diff options
-rw-r--r-- | test/functest/config.yaml | 1 | ||||
-rw-r--r-- | test/functest/testcase_1.py | 29 | ||||
-rw-r--r-- | test/functest/utils.py | 28 |
3 files changed, 48 insertions, 10 deletions
diff --git a/test/functest/config.yaml b/test/functest/config.yaml index 93f3552..076989a 100644 --- a/test/functest/config.yaml +++ b/test/functest/config.yaml @@ -31,6 +31,7 @@ testcases: sdnvpn_sg_descr: Security group for SDNVPN test cases targets1: '88:88' targets2: '55:55' + route_distinguishers: '11:11' testcase_2: enabled: true diff --git a/test/functest/testcase_1.py b/test/functest/testcase_1.py index 1356518..fe4298b 100644 --- a/test/functest/testcase_1.py +++ b/test/functest/testcase_1.py @@ -50,6 +50,9 @@ FLAVOR = ft_utils.get_parameter_from_yaml( "testcases.testcase_1.flavor", config_file) IMAGE_NAME = ft_utils.get_parameter_from_yaml( "testcases.testcase_1.image_name", config_file) +ROUTE_DISTINGUISHERS = ft_utils.get_parameter_from_yaml( + "testcases.testcase_1.route_distinguishers", config_file) + IMAGE_FILENAME = ft_utils.get_functest_config( "general.openstack.image_file_name") IMAGE_FORMAT = ft_utils.get_functest_config( @@ -188,16 +191,21 @@ def main(): disk=IMAGE_FORMAT, container="bare", public=True) - network_1_id, _, _ = test_utils.create_network(neutron_client, - NET_1_NAME, - SUBNET_1_NAME, - SUBNET_1_CIDR, - ROUTER_1_NAME) - network_2_id, _, _ = test_utils.create_network(neutron_client, - NET_2_NAME, - SUBNET_2_NAME, - SUBNET_2_CIDR, - ROUTER_2_NAME) + network_1_id = test_utils.create_net(neutron_client, + NET_1_NAME) + test_utils.create_subnet(neutron_client, + SUBNET_1_NAME, + SUBNET_1_CIDR, + network_1_id) + + network_2_id = test_utils.create_net(neutron_client, + NET_2_NAME) + + test_utils.create_subnet(neutron_client, + SUBNET_2_NAME, + SUBNET_2_CIDR, + network_2_id) + sg_id = os_utils.create_security_group_full(neutron_client, SECGROUP_NAME, SECGROUP_DESCR) @@ -289,6 +297,7 @@ def main(): vpn_name = "sdnvpn-" + str(randint(100000, 999999)) kwargs = {"import_targets": TARGETS_1, "export_targets": TARGETS_2, + "route_distinguishers": ROUTE_DISTINGUISHERS, "name": vpn_name} bgpvpn = os_utils.create_bgpvpn(neutron_client, **kwargs) bgpvpn_id = bgpvpn['bgpvpn']['id'] diff --git a/test/functest/utils.py b/test/functest/utils.py index 4d921c8..97f58c7 100644 --- a/test/functest/utils.py +++ b/test/functest/utils.py @@ -16,8 +16,36 @@ import functest.utils.openstack_utils as os_utils logger = ft_logger.Logger("sndvpn_test_utils").getLogger() +def create_net(neutron_client, name): + logger.debug("Creating network %s", name) + net_id = os_utils.create_neutron_net(neutron_client, name) + if not net_id: + logger.error( + "There has been a problem when creating the neutron network") + sys.exit(-1) + return net_id + + +def create_subnet(neutron_client, name, cidr, net_id): + logger.debug("Creating subnet %s in network %s with cidr %s", + name, net_id, cidr) + subnet_id = os_utils.create_neutron_subnet(neutron_client, + name, + cidr, + net_id) + if not subnet_id: + logger.error( + "There has been a problem when creating the neutron subnet") + sys.exit(-1) + return subnet_id + + def create_network(neutron_client, net, subnet1, cidr1, router, subnet2=None, cidr2=None): + """Network assoc will not work for networks/subnets created by this function. + + It is an ODL limitation due to it handling routers as vpns. + See https://bugs.opendaylight.org/show_bug.cgi?id=6962""" network_dic = os_utils.create_network_full(neutron_client, net, subnet1, |