test topoPortMapping adapted to Honeynode 72/82272/1
authorguillaume.lambert <guillaume.lambert@orange.com>
Tue, 28 May 2019 09:46:56 +0000 (11:46 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Tue, 28 May 2019 09:48:09 +0000 (11:48 +0200)
Change-Id: I8cf63c7389383d630638e192fd6304a5b067f70b
JIRA: TRNSPRTPCE-68
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
tests/transportpce_tests/test_topoPortMapping.py
tox.ini

index 2c3f164ad6efc474bcac6b6e9d7c503d8727aa1a..415ef9bb28f9d7b2e2fd3a25f58df331ddef0363 100644 (file)
@@ -22,32 +22,41 @@ import logging
 
 class TransportPCEtesting(unittest.TestCase):
 
-    testtools_process1 = None
-    testtools_process2 = None
+    honeynode_process1 = None
+    honeynode_process2 = None
     odl_process = None
     restconf_baseurl = "http://localhost:8181/restconf"
 
 #START_IGNORE_XTESTING
 
     @classmethod
-    def __start_testtools(cls):
-        executable = ("./netconf/netconf/tools/netconf-testtool/target/"
-                      "netconf-testtool-1.5.0-executable.jar")
-        if os.path.isfile(executable):
-            if not os.path.exists("transportpce_tests/log"):
+    def __init_logfile(cls):
+        if not os.path.exists("transportpce_tests/log"):
                 os.makedirs("transportpce_tests/log")
-            if os.path.isfile("./transportpce_tests/log/topoPortMap.log"):
-                os.remove("transportpce_tests/log/topoPortMap.log")
-            with open('transportpce_tests/log/testtools_ROADMA.log', 'w') as outfile1:
-                cls.testtools_process1 = subprocess.Popen(
-                    ["java", "-jar", executable, "--schemas-dir", "schemas",
-                     "--initial-config-xml", "sample_configs/openroadm/1.2.1/sample-config-ROADMA.xml","--starting-port","17831"],
-                    stdout=outfile1)
-            with open('transportpce_tests/log/testtools_XPDRA.log', 'w') as outfile2:
-                cls.testtools_process2 = subprocess.Popen(
-                    ["java", "-jar", executable, "--schemas-dir", "schemas",
-                     "--initial-config-xml", "sample_configs/openroadm/1.2.1/sample-config-XPDRA.xml","--starting-port","17830"],
-                    stdout=outfile2)
+        if os.path.isfile("./transportpce_tests/log/topoPortMap.log"):
+            os.remove("transportpce_tests/log/topoPortMap.log")
+
+    @classmethod
+    def __start_honeynode1(cls):
+        executable = ("./honeynode/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, "17830", "sample_configs/openroadm/2.1/oper-XPDRA.xml"],
+                    stdout=outfile)
+
+
+    @classmethod
+    def __start_honeynode2(cls):
+        executable = ("./honeynode/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, "17831", "sample_configs/openroadm/2.1/oper-ROADMA.xml"],
+                    stdout=outfile)
+
 
     @classmethod
     def __start_odl(cls):
@@ -59,21 +68,32 @@ class TransportPCEtesting(unittest.TestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.__start_testtools()
+        cls.__init_logfile()
+        time.sleep(2)
+        cls.__start_honeynode1()
+        time.sleep(20)
+        cls.__start_honeynode2()
+        time.sleep(20)
         cls.__start_odl()
-        time.sleep(40)
+        time.sleep(60)
 
     @classmethod
     def tearDownClass(cls):
-        cls.testtools_process1.send_signal(signal.SIGINT)
-        cls.testtools_process1.wait()
-        cls.testtools_process2.send_signal(signal.SIGINT)
-        cls.testtools_process2.wait()
         for child in psutil.Process(cls.odl_process.pid).children():
             child.send_signal(signal.SIGINT)
             child.wait()
         cls.odl_process.send_signal(signal.SIGINT)
         cls.odl_process.wait()
+        for child in psutil.Process(cls.honeynode_process1.pid).children():
+            child.send_signal(signal.SIGINT)
+            child.wait()
+        cls.honeynode_process1.send_signal(signal.SIGINT)
+        cls.honeynode_process1.wait()
+        for child in psutil.Process(cls.honeynode_process2.pid).children():
+            child.send_signal(signal.SIGINT)
+            child.wait()
+        cls.honeynode_process2.send_signal(signal.SIGINT)
+        cls.honeynode_process2.wait()
 
     def setUp(self):
         time.sleep(10)
diff --git a/tox.ini b/tox.ini
index 4481214610f35d494c0d75e4de0553b03577c020..b0704282d2e2a5b28c646a935c25aa6f4dfb8062 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -17,8 +17,8 @@ changedir={toxinidir}/tests
 commands =
   {py27,portmapping,topoPortMapping,rspn,topology,pce,olm,end2end}: - bash -c "if [ ! `which mvn` ]; then ./installMavenCentOS.sh  ; fi"
   {py27,portmapping,topoPortMapping,rspn,topology,pce,olm,end2end}: - bash -c "(cd .. && mvn clean install -s tests/odl_settings.xml -DskipTests -Dmaven.javadoc.skip=true)"
-  {py27,topoPortMapping}: - ./buildTesttool.sh
-  {py27,portmapping,rspn,topology,olm,end2end}: - ./buildHoneynode.sh
+#  {py27,topoPortMapping}: - ./buildTesttool.sh
+  {py27,portmapping,topoPortMapping,rspn,topology,olm,end2end}: - ./buildHoneynode.sh
   #py27: nosetests --with-xunit transportpce_tests/
   {py27,portmapping}: - nosetests --with-xunit transportpce_tests/test_portmapping.py
   {py27,topoPortMapping}: - nosetests --with-xunit transportpce_tests/test_topoPortMapping.py