Use bgvpn-delete and create instead of update 47/50847/3
authortomsou <soth@intracom-telecom.com>
Fri, 19 Jan 2018 14:15:33 +0000 (16:15 +0200)
committerPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
Thu, 15 Feb 2018 12:54:57 +0000 (13:54 +0100)
Testcases 1 and 4 fail because of netvirt bug [1]

The same functionality is now achieved by using
bgvpn-delete and bgpvpn-create cli commands instead
of bgpvpn-update

[1] https://jira.opendaylight.org/browse/NETVIRT-1067

Change-Id: Iaba6e06d0f39e356bf364b0640c707b0a83470d7
Signed-off-by: tomsou <soth@intracom-telecom.com>
Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
sdnvpn/test/functest/testcase_1.py
sdnvpn/test/functest/testcase_4.py

index 89011cd..b60a3c3 100644 (file)
@@ -10,6 +10,7 @@
 
 import logging
 import sys
+import time
 
 from functest.utils import openstack_utils as os_utils
 from random import randint
@@ -192,11 +193,46 @@ def main():
         results.add_to_summary(0, "-")
         results.record_action(msg)
         results.add_to_summary(0, "-")
-        kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
-                  "export_targets": TESTCASE_CONFIG.targets1,
-                  "name": vpn_name}
-        bgpvpn = test_utils.update_bgpvpn(neutron_client,
-                                          bgpvpn_id, **kwargs)
+
+        # use bgpvpn-create instead of update till NETVIRT-1067 bug is fixed
+        # kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
+        #           "export_targets": TESTCASE_CONFIG.targets1,
+        #           "name": vpn_name}
+        # bgpvpn = test_utils.update_bgpvpn(neutron_client,
+        #                                   bgpvpn_id, **kwargs)
+
+        test_utils.delete_bgpvpn(neutron_client, bgpvpn_id)
+        bgpvpn_ids.remove(bgpvpn_id)
+        kwargs = {
+            "import_targets": TESTCASE_CONFIG.targets1,
+            "export_targets": TESTCASE_CONFIG.targets1,
+            "route_distinguishers": TESTCASE_CONFIG.route_distinguishers,
+            "name": vpn_name
+        }
+
+        test_utils.wait_before_subtest()
+
+        bgpvpn = test_utils.create_bgpvpn(neutron_client, **kwargs)
+        bgpvpn_id = bgpvpn['bgpvpn']['id']
+        logger.debug("VPN re-created details: %s" % bgpvpn)
+        bgpvpn_ids.append(bgpvpn_id)
+
+        msg = ("Associate network '%s' to the VPN." %
+               TESTCASE_CONFIG.net_1_name)
+        results.record_action(msg)
+        results.add_to_summary(0, "-")
+
+        test_utils.create_network_association(
+            neutron_client, bgpvpn_id, network_1_id)
+
+        test_utils.create_network_association(
+            neutron_client, bgpvpn_id, network_2_id)
+
+        test_utils.wait_for_bgp_net_assocs(neutron_client,
+                                           bgpvpn_id,
+                                           network_1_id,
+                                           network_2_id)
+        # The above code has to be removed after re-enabling bgpvpn-update
 
         logger.info("Waiting for the VMs to connect to each other using the"
                     " updated network configuration")
index cc429c3..042fb59 100644 (file)
@@ -10,6 +10,7 @@
 
 import logging
 import sys
+import time
 
 from functest.utils import openstack_utils as os_utils
 from random import randint
@@ -199,11 +200,48 @@ def main():
         results.add_to_summary(0, "-")
         results.record_action(msg)
         results.add_to_summary(0, "-")
-        kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
-                  "export_targets": TESTCASE_CONFIG.targets1,
-                  "name": vpn_name}
-        bgpvpn = test_utils.update_bgpvpn(neutron_client,
-                                          bgpvpn_id, **kwargs)
+
+        # use bgpvpn-create instead of update till NETVIRT-1067 bug is fixed
+        # kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
+        #           "export_targets": TESTCASE_CONFIG.targets1,
+        #           "name": vpn_name}
+        # bgpvpn = test_utils.update_bgpvpn(neutron_client,
+        #                                   bgpvpn_id, **kwargs)
+
+        test_utils.delete_bgpvpn(neutron_client, bgpvpn_id)
+        bgpvpn_ids.remove(bgpvpn_id)
+        kwargs = {
+            "import_targets": TESTCASE_CONFIG.targets1,
+            "export_targets": TESTCASE_CONFIG.targets1,
+            "route_distinguishers": TESTCASE_CONFIG.route_distinguishers,
+            "name": vpn_name
+        }
+
+        test_utils.wait_before_subtest()
+
+        bgpvpn = test_utils.create_bgpvpn(neutron_client, **kwargs)
+        bgpvpn_id = bgpvpn['bgpvpn']['id']
+        logger.debug("VPN re-created details: %s" % bgpvpn)
+        bgpvpn_ids.append(bgpvpn_id)
+
+        msg = ("Associate again network '%s' and router '%s 'to the VPN."
+               % (TESTCASE_CONFIG.net_2_name,
+                  TESTCASE_CONFIG.router_1_name))
+        results.add_to_summary(0, "-")
+        results.record_action(msg)
+        results.add_to_summary(0, "-")
+
+        test_utils.create_router_association(
+            neutron_client, bgpvpn_id, router_1_id)
+
+        test_utils.create_network_association(
+            neutron_client, bgpvpn_id, network_2_id)
+
+        test_utils.wait_for_bgp_router_assoc(
+            neutron_client, bgpvpn_id, router_1_id)
+        test_utils.wait_for_bgp_net_assoc(
+            neutron_client, bgpvpn_id, network_2_id)
+        # The above code has to be removed after re-enabling bgpvpn-update
 
         logger.info("Waiting for the VMs to connect to each other using the"
                     " updated network configuration")