diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-08-25 11:20:17 +0800 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2016-08-26 08:45:19 +0000 |
commit | 22ff0e22d78a72e5190ac2acd5aa4da76adc4bce (patch) | |
tree | 2e060b693956ab112ce1dff28e489377c1057387 /utils/openstack_utils.py | |
parent | f3da85065e34b3058cace165443f6f919f959a0b (diff) |
refactor create shared network process to eliminate reduplicate
Some places shared network is created through create_network_full first,
then update it to shared, abstract a uniformed method to eliminate reduplicate
JIRA: FUNCTEST-437
Change-Id: I13c20ab061323188c5eb3b8c861674df38083c62
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
(cherry picked from commit 007868e4810aaf9a2664b030281fe7c818fc3494)
Diffstat (limited to 'utils/openstack_utils.py')
-rwxr-xr-x | utils/openstack_utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py index a7bc899ab..bc718bb2b 100755 --- a/utils/openstack_utils.py +++ b/utils/openstack_utils.py @@ -671,6 +671,28 @@ def create_network_full(neutron_client, return network_dic +def create_shared_network_full(net_name, subnt_name, router_name, subnet_cidr): + neutron_client = get_neutron_client() + + network_dic = create_network_full(neutron_client, + net_name, + subnt_name, + router_name, + subnet_cidr) + if network_dic: + if not update_neutron_net(neutron_client, + network_dic['net_id'], + shared=True): + logger.error("Failed to update network %s..." % net_name) + return None + else: + logger.debug("Network '%s' is available..." % net_name) + else: + logger.error("Network %s creation failed" % net_name) + return None + return network_dic + + def create_bgpvpn(neutron_client, **kwargs): # route_distinguishers # route_targets |