fix deprecated openroadm interfaces/objects
[transportpce.git] / tests / transportpce_tests / 2.2.1 / test_end2end.py
index 46d09d71e1be3d620f991eabde34b7dacdac5f16..10d66d0de0511e904b31fd96bca53ad4f2d786a8 100644 (file)
@@ -18,6 +18,7 @@ import shutil
 import subprocess
 import time
 import unittest
+import test_utils
 
 
 class TransportPCEFulltesting(unittest.TestCase):
@@ -33,70 +34,28 @@ class TransportPCEFulltesting(unittest.TestCase):
 #START_IGNORE_XTESTING
 
     @classmethod
-    def __start_honeynode1(cls):
-        executable = ("./honeynode/2.2.1/honeynode-distribution/target/honeynode-distribution-1.18.01-hc"
-                      "/honeynode-distribution-1.18.01/honeycomb-tpce")
-        if os.path.isfile(executable):
-            with open('honeynode1.log', 'w') as outfile:
-                cls.honeynode_process1 = subprocess.Popen(
-                    [executable, "17840", "sample_configs/openroadm/2.2.1/oper-XPDRA.xml"],
-                    stdout=outfile)
-
-    @classmethod
-    def __start_honeynode2(cls):
-        executable = ("./honeynode/2.2.1/honeynode-distribution/target/honeynode-distribution-1.18.01-hc"
-                      "/honeynode-distribution-1.18.01/honeycomb-tpce")
-        if os.path.isfile(executable):
-            with open('honeynode2.log', 'w') as outfile:
-                cls.honeynode_process2 = subprocess.Popen(
-                    [executable, "17841", "sample_configs/openroadm/2.2.1/oper-ROADMA.xml"],
-                    stdout=outfile)
+    def setUpClass(cls):
+        print ("starting honeynode1...")
+        cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+        time.sleep(20)
 
-    @classmethod
-    def __start_honeynode3(cls):
-        executable = ("./honeynode/2.2.1/honeynode-distribution/target/honeynode-distribution-1.18.01-hc"
-                      "/honeynode-distribution-1.18.01/honeycomb-tpce")
-        if os.path.isfile(executable):
-            with open('honeynode3.log', 'w') as outfile:
-                cls.honeynode_process3 = subprocess.Popen(
-                    [executable, "17843", "sample_configs/openroadm/2.2.1/oper-ROADMC.xml"],
-                    stdout=outfile)
+        print ("starting honeynode2...")
+        cls.honeynode_process2 = test_utils.start_roadma_honeynode()
+        time.sleep(20)
 
-    @classmethod
-    def __start_honeynode4(cls):
-        executable = ("./honeynode/2.2.1/honeynode-distribution/target/honeynode-distribution-1.18.01-hc"
-                      "/honeynode-distribution-1.18.01/honeycomb-tpce")
-        if os.path.isfile(executable):
-            with open('honeynode4.log', 'w') as outfile:
-                cls.honeynode_process4 = subprocess.Popen(
-                    [executable, "17844", "sample_configs/openroadm/2.2.1/oper-XPDRC.xml"],
-                    stdout=outfile)
+        print ("starting honeynode3...")
+        cls.honeynode_process3 = test_utils.start_roadmc_honeynode()
+        time.sleep(20)
 
-    @classmethod
-    def __start_odl(cls):
-        executable = "../karaf/target/assembly/bin/karaf"
-        with open('odl.log', 'w') as outfile:
-            cls.odl_process = subprocess.Popen(
-                ["bash", executable, "server"], stdout=outfile,
-                stdin=open(os.devnull))
+        print ("starting honeynode4...")
+        cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()
+        time.sleep(20)
+        print ("all honeynodes started")
 
-    @classmethod
-    def setUpClass(cls):
-        print ("starting honeynode1")
-        cls.__start_honeynode1()
-        time.sleep(40)
-        print ("starting honeynode2")
-        cls.__start_honeynode2()
-        time.sleep(40)
-        print ("starting honeynode3")
-        cls.__start_honeynode3()
-        time.sleep(40)
-        print ("starting honeynode4")
-        cls.__start_honeynode4()
-        time.sleep(40)
-        print ("starting opendaylight")
-        cls.__start_odl()
+        print ("starting opendaylight...")
+        cls.odl_process = test_utils.start_tpce()
         time.sleep(80)
+        print ("opendaylight started")
 
     @classmethod
     def tearDownClass(cls):
@@ -1092,9 +1051,9 @@ class TransportPCEFulltesting(unittest.TestCase):
         res = response.json()
         liste_tp = res['node'][0]['ietf-network-topology:termination-point']
         for ele in liste_tp:
-            if ele[u'org-openroadm-network-topology:tp-type'] == 'XPONDER-CLIENT':
+            if ele[u'org-openroadm-common-network:tp-type'] == 'XPONDER-CLIENT':
                 self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes']))
-            elif ele[u'org-openroadm-network-topology:tp-type'] == 'XPONDER-NETWORK':
+            elif ele[u'org-openroadm-common-network:tp-type'] == 'XPONDER-NETWORK':
                 self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-network-attributes']))
         time.sleep(10)
 
@@ -1538,7 +1497,7 @@ class TransportPCEFulltesting(unittest.TestCase):
         self.test_34_check_topo_ROADMA_SRG1()
         self.test_35_check_topo_ROADMA_DEG2()
 
-    @unittest.expectedFailure
+#    @unittest.expectedFailure
     def test_49_loop_create_eth_service(self):
         for i in range(1,6):
             print ("trial number {}".format(i))
@@ -1551,7 +1510,7 @@ class TransportPCEFulltesting(unittest.TestCase):
             print ("eth service deletion\n")
             self.test_30_delete_eth_service1()
 
-    @unittest.expectedFailure
+#    @unittest.expectedFailure
     def test_50_loop_create_oc_service(self):
         url = ("{}/operational/org-openroadm-service:service-list/services/service1"
                .format(self.restconf_baseurl))