##############################################################################
import json
-import os
-import psutil
-import requests
import signal
-import shutil
-import subprocess
-import time
import unittest
+import time
+import requests
+import psutil
import test_utils
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
-#START_IGNORE_XTESTING
+# START_IGNORE_XTESTING
@classmethod
def setUpClass(cls):
- print ("starting honeynode1...")
+ print("starting honeynode1...")
cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
time.sleep(20)
- print ("starting honeynode2...")
+ print("starting honeynode2...")
cls.honeynode_process2 = test_utils.start_roadma_honeynode()
time.sleep(20)
- print ("starting opendaylight...")
+ print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
- print ("opendaylight started")
+ print("opendaylight started")
@classmethod
def tearDownClass(cls):
cls.honeynode_process2.wait()
def setUp(self):
- print ("execution of {}".format(self.id().split(".")[-1]))
+ print("execution of {}".format(self.id().split(".")[-1]))
time.sleep(10)
-#END_IGNORE_XTESTING
+# END_IGNORE_XTESTING
# def test_01_restconfAPI(self):
# url = ("{}/operational/network-topology:network-topology/topology/"
# res = response.json()
# self.assertIn(
# {"error-type":"application", "error-tag":"data-missing",
-# "error-message":"Request could not be completed because the relevant data model content does not exist "},
+# "error-message":"Request could not be completed because the relevant data model content does not exist "},
# res['errors']['error'])
def test_01_rdm_device_connected(self):
url = ("{}/config/network-topology:"
"network-topology/topology/topology-netconf/node/ROADMA01"
- .format(self.restconf_baseurl))
+ .format(self.restconf_baseurl))
data = {"node": [{
"node-id": "ROADMA01",
"netconf-node-topology:username": "admin",
res = response.json()
self.assertEqual(
{u'node-info': {u'node-type': u'rdm',
- u'node-ip-address': u'127.0.0.12',
- u'node-clli': u'NodeA',
- u'openroadm-version': u'1.2.1', u'node-vendor': u'vendorA',
- u'node-model': u'2'}},
+ u'node-ip-address': u'127.0.0.12',
+ u'node-clli': u'NodeA',
+ u'openroadm-version': u'1.2.1', u'node-vendor': u'vendorA',
+ u'node-model': u'2'}},
res)
time.sleep(3)
def test_07_xpdr_device_connected(self):
url = ("{}/config/network-topology:"
"network-topology/topology/topology-netconf/node/XPDRA01"
- .format(self.restconf_baseurl))
+ .format(self.restconf_baseurl))
data = {"node": [{
"node-id": "XPDRA01",
"netconf-node-topology:username": "admin",
res = response.json()
self.assertEqual(
{u'node-info': {u'node-type': u'xpdr',
- u'node-ip-address': u'127.0.0.10',
- u'node-clli': u'NodeA',
- u'openroadm-version': u'1.2.1', u'node-vendor': u'vendorA',
- u'node-model': u'1'}},
+ u'node-ip-address': u'127.0.0.10',
+ u'node-clli': u'NodeA',
+ u'openroadm-version': u'1.2.1', u'node-vendor': u'vendorA',
+ u'node-model': u'1'}},
res)
time.sleep(3)
def test_16_xpdr_device_disconnected(self):
url = ("{}/config/network-topology:"
- "network-topology/topology/topology-netconf/node/XPDRA01"
+ "network-topology/topology/topology-netconf/node/XPDRA01"
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json'}
response = requests.request(
- "DELETE", url, headers=headers,
- auth=('admin', 'admin'))
+ "DELETE", url, headers=headers,
+ auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
time.sleep(20)
self.assertEqual(response.status_code, requests.codes.not_found)
res = response.json()
self.assertIn(
- {"error-type":"application", "error-tag":"data-missing",
- "error-message":"Request could not be completed because the relevant data model content does not exist"},
+ {"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'])
def test_18_xpdr_device_disconnected(self):
self.assertEqual(response.status_code, requests.codes.not_found)
res = response.json()
self.assertIn(
- {"error-type":"application", "error-tag":"data-missing",
- "error-message":"Request could not be completed because the relevant data model content does not exist"},
+ {"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'])
def test_19_rdm_device_disconnected(self):
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json'}
response = requests.request(
- "DELETE", url, headers=headers,
- auth=('admin', 'admin'))
+ "DELETE", url, headers=headers,
+ auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
time.sleep(20)
self.assertEqual(response.status_code, requests.codes.not_found)
res = response.json()
self.assertIn(
- {"error-type":"application", "error-tag":"data-missing",
- "error-message":"Request could not be completed because the relevant data model content does not exist"},
+ {"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'])
def test_21_rdm_device_disconnected(self):
self.assertEqual(response.status_code, requests.codes.not_found)
res = response.json()
self.assertIn(
- {"error-type":"application", "error-tag":"data-missing",
- "error-message":"Request could not be completed because the relevant data model content does not exist"},
+ {"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'])