class TransportPCERendererTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
- odl_process = None
+ processes = None
restconf_baseurl = "http://localhost:8181/restconf"
-# START_IGNORE_XTESTING
-
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
- time.sleep(20)
-
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
- time.sleep(20)
- print("all honeynodes started")
-
- print("starting opendaylight...")
- cls.odl_process = test_utils.start_tpce()
- time.sleep(60)
- print("opendaylight started")
+ cls.processes = test_utils.start_tpce()
+ cls.processes = test_utils.start_sims(['xpdra', 'roadma'])
@classmethod
def tearDownClass(cls):
- 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):
- print("execution of {}".format(self.id().split(".")[-1]))
- time.sleep(10)
-
-# END_IGNORE_XTESTING
+ for process in cls.processes:
+ test_utils.shutdown_process(process)
+ print("all processes killed")
def test_01_rdm_device_connected(self):
url = ("{}/config/network-topology:"
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17841",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
response = requests.request(
"PUT", url, data=json.dumps(data), headers=headers,
auth=('admin', 'admin'))
- self.assertEqual(response.status_code, requests.codes.created)
+ self.assertIn(response.status_code, [requests.codes.created,
+ requests.codes.ok])
+ # self.assertEqual(response.status_code, requests.codes.created)
time.sleep(20)
def test_02_xpdr_device_connected(self):
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17840",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
response = requests.request(
"PUT", url, data=json.dumps(data), headers=headers,
auth=('admin', 'admin'))
- self.assertEqual(response.status_code, requests.codes.created)
+ # self.assertEqual(response.status_code, requests.codes.created)
+ self.assertIn(response.status_code, [requests.codes.created,
+ requests.codes.ok])
time.sleep(20)
def test_03_rdm_portmapping(self):
{'supported-interface-capability': ['org-openroadm-port-types:if-OCH'],
'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
'logical-connection-point': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-network',
- 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1'},
+ 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1',
+ 'lcp-hash-val': '8e128ba57560403cfd4ffafae38cd941'},
res['nodes'][0]['mapping'])
self.assertIn(
{'supported-interface-capability': ['org-openroadm-port-types:if-100GE'],
'supporting-port': 'C1',
'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT',
'logical-connection-point': 'XPDR1-CLIENT1', 'port-direction': 'bidirectional',
- 'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client'},
+ 'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client',
+ 'lcp-hash-val': '3ed8ed1336784ac7c2f66c22f2f03d8'},
res['nodes'][0]['mapping'])
def test_05_service_path_create(self):
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset({'name': 'DEG1-TTP-TXRX-nmc-7', 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/0',
- 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint',
- 'supporting-port': 'L1'}, res['interface'][0])
+ # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'name': 'DEG1-TTP-TXRX-nmc-7',
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/0',
+ 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint',
+ 'supporting-port': 'L1'
+ }, **res['interface'][0]),
+ res['interface'][0]
+ )
self.assertDictEqual(
{u'frequency': 195.8, u'width': 40},
res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp'])
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset({'name': 'DEG1-TTP-TXRX-mc-7', 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/0',
- 'type': 'org-openroadm-interfaces:mediaChannelTrailTerminationPoint',
- 'supporting-port': 'L1'}, res['interface'][0])
+ # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'name': 'DEG1-TTP-TXRX-mc-7',
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/0',
+ 'type': 'org-openroadm-interfaces:mediaChannelTrailTerminationPoint',
+ 'supporting-port': 'L1'
+ }, **res['interface'][0]),
+ res['interface'][0]
+ )
self.assertDictEqual(
{u'min-freq': 195.775, u'max-freq': 195.825},
res['interface'][0]['org-openroadm-media-channel-interfaces:mc-ttp'])
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset({'name': 'SRG1-PP3-TXRX-nmc-7', 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '3/0',
- 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint',
- 'supporting-port': 'C3'}, res['interface'][0])
+ # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'name': 'SRG1-PP3-TXRX-nmc-7',
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '3/0',
+ 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint',
+ 'supporting-port': 'C3'
+ }, **res['interface'][0]),
+ res['interface'][0]
+ )
self.assertDictEqual(
{u'frequency': 195.8, u'width': 40},
res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp'])
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset(
- {'connection-name': 'SRG1-PP3-TXRX-DEG1-TTP-TXRX-7',
- 'opticalControlMode': 'off'},
- res['roadm-connections'][0])
+ # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'connection-name': 'SRG1-PP3-TXRX-DEG1-TTP-TXRX-7',
+ 'opticalControlMode': 'off'
+ }, **res['roadm-connections'][0]),
+ res['roadm-connections'][0]
+ )
self.assertDictEqual(
{'src-if': 'SRG1-PP3-TXRX-nmc-7'},
res['roadm-connections'][0]['source'])
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset(
- {'name': 'XPDR1-NETWORK1-7', 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
- 'type': 'org-openroadm-interfaces:opticalChannel',
- 'supporting-port': '1'},
- res['interface'][0])
+ # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'name': 'XPDR1-NETWORK1-7',
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
+ 'type': 'org-openroadm-interfaces:opticalChannel',
+ 'supporting-port': '1'
+ }, **res['interface'][0]),
+ res['interface'][0]
+ )
self.assertDictEqual(
{u'rate': u'org-openroadm-common-types:R100G',
u'transmit-power': -5,
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset(
- {'name': 'XPDR1-NETWORK1-OTU', 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
- 'type': 'org-openroadm-interfaces:otnOtu',
- 'supporting-port': '1',
- 'supporting-interface': 'XPDR1-NETWORK1-7'},
- res['interface'][0])
+ # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'name': 'XPDR1-NETWORK1-OTU',
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
+ 'type': 'org-openroadm-interfaces:otnOtu',
+ 'supporting-port': '1',
+ 'supporting-interface': 'XPDR1-NETWORK1-7'
+ }, **res['interface'][0]),
+ res['interface'][0]
+ )
self.assertDictEqual(
{u'rate': u'org-openroadm-otn-common-types:OTU4',
u'fec': u'scfec'},
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset(
- {'name': 'XPDR1-NETWORK1-ODU', 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
- 'type': 'org-openroadm-interfaces:otnOdu',
- 'supporting-port': '1',
- 'supporting-interface': 'XPDR1-NETWORK1-OTU'},
- res['interface'][0])
- self.assertDictContainsSubset(
- {'rate': 'org-openroadm-otn-common-types:ODU4',
- u'monitoring-mode': u'terminated'},
- res['interface'][0]['org-openroadm-otn-odu-interfaces:odu'])
+ # the 2 following statements replace self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'name': 'XPDR1-NETWORK1-ODU',
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
+ 'type': 'org-openroadm-interfaces:otnOdu',
+ 'supporting-port': '1',
+ 'supporting-interface': 'XPDR1-NETWORK1-OTU'
+ }, **res['interface'][0]),
+ res['interface'][0]
+ )
+ self.assertDictEqual(
+ dict({
+ 'rate': 'org-openroadm-otn-common-types:ODU4',
+ u'monitoring-mode': u'terminated'
+ }, **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']),
+ res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']
+ )
self.assertDictEqual({u'exp-payload-type': u'07', u'payload-type': u'07'},
res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
"GET", url, headers=headers, auth=('admin', 'admin'))
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertDictContainsSubset(
- {'name': 'XPDR1-CLIENT1-ETHERNET', 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT',
- 'type': 'org-openroadm-interfaces:ethernetCsmacd',
- 'supporting-port': 'C1'},
- res['interface'][0])
+ # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+ self.assertDictEqual(
+ dict({
+ 'name': 'XPDR1-CLIENT1-ETHERNET',
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT',
+ 'type': 'org-openroadm-interfaces:ethernetCsmacd',
+ 'supporting-port': 'C1'
+ }, **res['interface'][0]),
+ res['interface'][0]
+ )
self.assertDictEqual(
{u'fec': u'off', u'speed': 100000},
res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])