fix netconf testtool portmapping
[transportpce.git] / tests / transportpce_tests / test_portmapping.py
index a880ea80dca42a086ee450c178d99d50179843ca..2a0b81734ade9d0a0a8486568b1803879df707a9 100644 (file)
@@ -25,24 +25,24 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
     testtools_process1 = None
     testtools_process2 = None
     odl_process = None
-    restconf_baseurl = "http://127.0.0.1:8181/restconf"
+    restconf_baseurl = "http://localhost:8181/restconf"
 
     @classmethod
     def __start_testtools(cls):
         executable = ("./netconf/netconf/tools/netconf-testtool/target/"
-                      "netconf-testtool-1.3.1-executable.jar")
+                      "netconf-testtool-1.5.0-SNAPSHOT-executable.jar")
         if os.path.isfile(executable):
             with open('testtools1.log', 'w') as outfile:
                 cls.testtools_process1 = subprocess.Popen(
                     ["java", "-jar", executable, "--schemas-dir", "schemas",
                      "--initial-config-xml", "sample_configs/ord_1.2.1/sample-config-ROADM.xml",
-                     "--starting-port","17830"],
+                     "--starting-port", "17830"],
                     stdout=outfile)
             with open('testtools2.log', 'w') as outfile:
                 cls.testtools_process2 = subprocess.Popen(
                     ["java", "-jar", executable, "--schemas-dir", "schemas",
                      "--initial-config-xml", "sample_configs/ord_1.2.1/sample-config-XPDR.xml",
-                     "--starting-port","17831"],
+                     "--starting-port", "17831"],
                     stdout=outfile)
 
     @classmethod
@@ -50,7 +50,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         executable = "../karaf/target/assembly/bin/karaf"
         with open('odl.log', 'w') as outfile:
             cls.odl_process = subprocess.Popen(
-                ["bash", executable], stdout=outfile,
+                ["bash", executable, "server"], stdout=outfile,
                 stdin=open(os.devnull))
 
     @classmethod
@@ -75,15 +75,15 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         print ("execution of {}".format(self.id().split(".")[-1]))
         time.sleep(10)
 
-    def test_01_restconfAPI(self):
-        url = ("{}/operational/network-topology:network-topology/topology/"
-        "topology-netconf/node/controller-config".format(self.restconf_baseurl))
-        headers = {'content-type': 'application/json'}
-        response = requests.request("GET", url, headers=headers, auth=('admin', 'admin'))
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertEqual(res['node'] [0] ['netconf-node-topology:connection-status'],
-                         'connected')
+#    def test_01_restconfAPI(self):
+#        url = ("{}/operational/network-topology:network-topology/topology/"
+#        "topology-netconf/node/controller-config".format(self.restconf_baseurl))
+#        headers = {'content-type': 'application/json'}
+#        response = requests.request("GET", url, headers=headers, auth=('admin', 'admin'))
+#        self.assertEqual(response.status_code, requests.codes.ok)
+#        res = response.json()
+#        self.assertEqual(res['node'] [0] ['netconf-node-topology:connection-status'],
+#                         'connected')
 
     def test_02_restconfAPI(self):
         url = ("{}/config/portmapping:network/nodes/controller-config"
@@ -94,7 +94,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.not_found)
         res = response.json()
         self.assertIn(
-            {"error-type":"application","error-tag":"data-missing",
+            {"error-type":"application", "error-tag":"data-missing",
              "error-message":"Request could not be completed because the relevant data model content does not exist "},
             res['errors']['error'])
 
@@ -208,7 +208,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     def test_10_xpdr_portmapping_NETWORK1(self):
         url = ("{}/config/portmapping:network/"
-               "nodes/XPDRA/mapping/XPDR-LINE1"
+               "nodes/XPDRA/mapping/XPDR1-NETWORK1"
                .format(self.restconf_baseurl))
         headers = {'content-type': 'application/json'}
         response = requests.request(
@@ -217,12 +217,12 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         res = response.json()
         self.assertIn(
             {'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
-             'logical-connection-point': 'XPDR-LINE1'},
+             'logical-connection-point': 'XPDR1-NETWORK1'},
             res['mapping'])
 
     def test_11_xpdr_portmapping_CLIENT1(self):
         url = ("{}/config/portmapping:network/"
-               "nodes/XPDRA/mapping/XPDR-CLNT1"
+               "nodes/XPDRA/mapping/XPDR1-CLIENT1"
                .format(self.restconf_baseurl))
         headers = {'content-type': 'application/json'}
         response = requests.request(
@@ -232,7 +232,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         self.assertIn(
             {'supporting-port': '1',
              'supporting-circuit-pack-name': '1/0/2-PLUG-CLIENT',
-             'logical-connection-point': 'XPDR-CLNT1'},
+             'logical-connection-point': 'XPDR1-CLIENT1'},
             res['mapping'])
 
     def test_12_xpdr_device_disconnected(self):
@@ -255,7 +255,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.not_found)
         res = response.json()
         self.assertIn(
-            {"error-type":"application","error-tag":"data-missing",
+            {"error-type":"application", "error-tag":"data-missing",
              "error-message":"Request could not be completed because the relevant data model content does not exist "},
             res['errors']['error'])
 
@@ -269,7 +269,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.not_found)
         res = response.json()
         self.assertIn(
-            {"error-type":"application","error-tag":"data-missing",
+            {"error-type":"application", "error-tag":"data-missing",
              "error-message":"Request could not be completed because the relevant data model content does not exist "},
             res['errors']['error'])
 
@@ -293,7 +293,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.not_found)
         res = response.json()
         self.assertIn(
-            {"error-type":"application","error-tag":"data-missing",
+            {"error-type":"application", "error-tag":"data-missing",
              "error-message":"Request could not be completed because the relevant data model content does not exist "},
             res['errors']['error'])
 
@@ -306,7 +306,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.not_found)
         res = response.json()
         self.assertIn(
-            {"error-type":"application","error-tag":"data-missing",
+            {"error-type":"application", "error-tag":"data-missing",
              "error-message":"Request could not be completed because the relevant data model content does not exist "},
             res['errors']['error'])