% (bgpvpn_id, net_id))
while tries > 0 and net_id not in nets:
- nets = os_utils.get_bgpvpn_networks(neutron_client, bgpvpn_id)
+ nets = get_bgpvpn_networks(neutron_client, bgpvpn_id)
time.sleep(sleep_time)
tries -= 1
if net_id not in nets:
logger.debug("Waiting for router %s to associate with BGPVPN %s "
% (bgpvpn_id, router_id))
while tries > 0 and router_id not in routers:
- routers = os_utils.get_bgpvpn_routers(neutron_client, bgpvpn_id)
+ routers = get_bgpvpn_routers(neutron_client, bgpvpn_id)
time.sleep(sleep_time)
tries -= 1
if router_id not in routers:
if len(bgpvpn_ids) != 0:
for bgpvpn_id in bgpvpn_ids:
- os_utils.delete_bgpvpn(neutron_client, bgpvpn_id)
+ delete_bgpvpn(neutron_client, bgpvpn_id)
if len(interfaces) != 0:
for router_id, subnet_id in interfaces:
format(image_id))
return False
return True
+
+
+def create_bgpvpn(neutron_client, **kwargs):
+ # route_distinguishers
+ # route_targets
+ json_body = {"bgpvpn": kwargs}
+ return neutron_client.create_bgpvpn(json_body)
+
+
+def update_bgpvpn(neutron_client, bgpvpn_id, **kwargs):
+ json_body = {"bgpvpn": kwargs}
+ return neutron_client.update_bgpvpn(bgpvpn_id, json_body)
+
+
+def delete_bgpvpn(neutron_client, bgpvpn_id):
+ return neutron_client.delete_bgpvpn(bgpvpn_id)
+
+
+def get_bgpvpn(neutron_client, bgpvpn_id):
+ return neutron_client.show_bgpvpn(bgpvpn_id)
+
+
+def get_bgpvpn_routers(neutron_client, bgpvpn_id):
+ return get_bgpvpn(neutron_client, bgpvpn_id)['bgpvpn']['routers']
+
+
+def get_bgpvpn_networks(neutron_client, bgpvpn_id):
+ return get_bgpvpn(neutron_client, bgpvpn_id)['bgpvpn']['networks']
+
+
+def create_router_association(neutron_client, bgpvpn_id, router_id):
+ json_body = {"router_association": {"router_id": router_id}}
+ return neutron_client.create_router_association(bgpvpn_id, json_body)
+
+
+def create_network_association(neutron_client, bgpvpn_id, neutron_network_id):
+ json_body = {"network_association": {"network_id": neutron_network_id}}
+ return neutron_client.create_network_association(bgpvpn_id, json_body)
"route_distinguishers": TESTCASE_CONFIG.route_distinguishers,
"name": vpn_name
}
- bgpvpn = os_utils.create_bgpvpn(neutron_client, **kwargs)
+ bgpvpn = test_utils.create_bgpvpn(neutron_client, **kwargs)
bgpvpn_id = bgpvpn['bgpvpn']['id']
logger.debug("VPN created details: %s" % bgpvpn)
bgpvpn_ids.append(bgpvpn_id)
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn_id, network_1_id)
# Wait for VMs to get ips.
results.add_to_summary(0, "-")
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn_id, network_2_id)
test_utils.wait_for_bgp_net_assocs(neutron_client,
kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
"export_targets": TESTCASE_CONFIG.targets1,
"name": vpn_name}
- bgpvpn = os_utils.update_bgpvpn(neutron_client, bgpvpn_id, **kwargs)
+ bgpvpn = test_utils.update_bgpvpn(neutron_client, bgpvpn_id, **kwargs)
logger.info("Waiting for the VMs to connect to each other using the"
" updated network configuration")
"route_targets": TESTCASE_CONFIG.targets2,
"route_distinguishers": TESTCASE_CONFIG.route_distinguishers1,
"name": vpn1_name}
- bgpvpn1 = os_utils.create_bgpvpn(neutron_client, **kwargs)
+ bgpvpn1 = test_utils.create_bgpvpn(neutron_client, **kwargs)
bgpvpn1_id = bgpvpn1['bgpvpn']['id']
logger.debug("VPN1 created details: %s" % bgpvpn1)
bgpvpn_ids.append(bgpvpn1_id)
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn1_id, network_1_id)
# Wait for VMs to get ips.
"route_targets": TESTCASE_CONFIG.targets1,
"route_distinguishers": TESTCASE_CONFIG.route_distinguishers2,
"name": vpn2_name}
- bgpvpn2 = os_utils.create_bgpvpn(neutron_client, **kwargs)
+ bgpvpn2 = test_utils.create_bgpvpn(neutron_client, **kwargs)
bgpvpn2_id = bgpvpn2['bgpvpn']['id']
logger.debug("VPN created details: %s" % bgpvpn2)
bgpvpn_ids.append(bgpvpn2_id)
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn2_id, network_2_id)
test_utils.wait_for_bgp_net_assoc(neutron_client, bgpvpn1_id, network_1_id)
"export_targets": TESTCASE_CONFIG.targets2,
"route_distinguishers": TESTCASE_CONFIG.route_distinguishers,
"name": vpn_name}
- bgpvpn = os_utils.create_bgpvpn(neutron_client, **kwargs)
+ bgpvpn = test_utils.create_bgpvpn(neutron_client, **kwargs)
bgpvpn_id = bgpvpn['bgpvpn']['id']
logger.debug("VPN created details: %s" % bgpvpn)
bgpvpn_ids.append(bgpvpn_id)
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_router_association(
+ test_utils.create_router_association(
neutron_client, bgpvpn_id, router_1_id)
# Wait for VMs to get ips.
results.add_to_summary(0, "-")
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn_id, network_2_id)
test_utils.wait_for_bgp_router_assoc(
kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
"export_targets": TESTCASE_CONFIG.targets1,
"name": vpn_name}
- bgpvpn = os_utils.update_bgpvpn(neutron_client, bgpvpn_id, **kwargs)
+ bgpvpn = test_utils.update_bgpvpn(neutron_client, bgpvpn_id, **kwargs)
logger.info("Waiting for the VMs to connect to each other using the"
" updated network configuration")
"export_targets": TESTCASE_CONFIG.targets,
"route_distinguishers": TESTCASE_CONFIG.route_distinguishers,
"name": vpn_name}
- bgpvpn = os_utils.create_bgpvpn(neutron_client, **kwargs)
+ bgpvpn = test_utils.create_bgpvpn(neutron_client, **kwargs)
bgpvpn_id = bgpvpn['bgpvpn']['id']
logger.debug("VPN created details: %s" % bgpvpn)
bgpvpn_ids.append(bgpvpn_id)
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn_id, network_1_id)
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn_id, network_2_id)
test_utils.wait_for_bgp_net_assoc(
results.add_to_summary(0, '-')
fip = os_utils.create_floating_ip(neutron_client)
- fip_added = os_utils.add_floating_ip(nova_client, vm_2.id, fip['fip_addr'])
+ fip_added = os_utils.add_floating_ip(nova_client, vm_2.id,
+ fip['fip_addr'])
if fip_added:
results.add_success(msg)
else:
"export_targets": TESTCASE_CONFIG.targets,
"route_distinguishers": TESTCASE_CONFIG.route_distinguishers,
"name": vpn_name}
- bgpvpn = os_utils.create_bgpvpn(neutron_client, **kwargs)
+ bgpvpn = test_utils.create_bgpvpn(neutron_client, **kwargs)
bgpvpn_id = bgpvpn['bgpvpn']['id']
logger.debug("VPN created details: %s" % bgpvpn)
bgpvpn_ids.append(bgpvpn_id)
results.record_action(msg)
results.add_to_summary(0, "-")
- os_utils.create_router_association(
+ test_utils.create_router_association(
neutron_client, bgpvpn_id, router_1_id)
- os_utils.create_network_association(
+ test_utils.create_network_association(
neutron_client, bgpvpn_id, network_2_id)
test_utils.wait_for_bgp_router_assoc(