response['nodes'][0]['mapping'])
def test_05_service_path_create(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_service_path_request(
+ {'input': {
'service-name': 'service_test',
'wave-number': '7',
'modulation-format': 'dp-qpsk',
'max-freq': 195.825,
'lower-spectral-slot-number': 713,
'higher-spectral-slot-number': 720
- }
- }
- response = test_utils_rfc8040.device_renderer_service_path_request(data)
- self.assertEqual(response.status_code, requests.codes.ok)
+ }})
+ self.assertEqual(response['status_code'], requests.codes.ok)
+ self.assertIn('Interfaces created successfully for nodes: ROADMA01', response['output']['result'])
def test_06_service_path_create_rdm_check(self):
response = test_utils_rfc8040.check_node_attribute_request("ROADMA01", "interface", "DEG1-TTP-TXRX-713:720")
self.assertIn('not-reserved-inuse', response['circuit-packs'][0]["equipment-state"])
def test_14_service_path_delete(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_service_path_request(
+ {'input': {
'service-name': 'service_test',
'wave-number': '7',
'modulation-format': 'dp-qpsk',
'max-freq': 195.825,
'lower-spectral-slot-number': 713,
'higher-spectral-slot-number': 720
- }
- }
- response = test_utils_rfc8040.device_renderer_service_path_request(data)
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertIn(response.json(),
- ({'output': {'result': 'Request processed', 'success': True}},
- {'transportpce-device-renderer:output': {'result': 'Request processed', 'success': True}}))
+ }})
+ self.assertEqual(response['status_code'], requests.codes.ok)
+ self.assertDictEqual(response['output'], {'result': 'Request processed', 'success': True})
def test_15_service_path_delete_rdm_check(self):
response = test_utils_rfc8040.check_node_attribute_request("ROADMA01", "interface", "DEG1-TTP-TXRX-713:720")
# Renderer interface creations
def test_07_device_renderer(self):
- data = {
- "input": {
- "modulation-format": "dp-qpsk",
- "operation": "create",
- "service-name": "testNMC-MC",
- "wave-number": "0",
- "center-freq": "196.05",
- "nmc-width": "80",
- "nodes": [
+ response = test_utils_rfc8040.device_renderer_service_path_request(
+ {'input': {
+ 'modulation-format': 'dp-qpsk',
+ 'operation': 'create',
+ 'service-name': 'testNMC-MC',
+ 'wave-number': '0',
+ 'center-freq': '196.05',
+ 'nmc-width': '80',
+ 'nodes': [
{
- "node-id": "ROADM-D1",
- "src-tp": "SRG1-PP1-TXRX",
- "dest-tp": "DEG1-TTP-TXRX"
+ 'node-id': 'ROADM-D1',
+ 'src-tp': 'SRG1-PP1-TXRX',
+ 'dest-tp': 'DEG1-TTP-TXRX'
}
],
- "min-freq": 196.00625,
- "max-freq": 196.09375,
- "lower-spectral-slot-number": 749,
- "higher-spectral-slot-number": 763
- }
- }
- response = test_utils_rfc8040.device_renderer_service_path_request(data)
- self.assertEqual(response.status_code, requests.codes.ok)
+ 'min-freq': 196.00625,
+ 'max-freq': 196.09375,
+ 'lower-spectral-slot-number': 749,
+ 'higher-spectral-slot-number': 763
+ }})
+ self.assertEqual(response['status_code'], requests.codes.ok)
+ self.assertIn('Interfaces created successfully for nodes: ', response['output']['result'])
time.sleep(10)
# Get Degree MC interface and check
response['nodes'][0]['mapping'])
def test_05_service_path_create(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_service_path_request(
+ {'input': {
'service-name': 'service_test',
'wave-number': '7',
'modulation-format': 'dp-qpsk',
'max-freq': 195.825,
'lower-spectral-slot-number': 713,
'higher-spectral-slot-number': 720
- }
- }
- response = test_utils_rfc8040.device_renderer_service_path_request(data)
- self.assertEqual(response.status_code, requests.codes.ok)
+ }})
+ self.assertEqual(response['status_code'], requests.codes.ok)
+ self.assertIn('Interfaces created successfully for nodes: ROADM-A1', response['output']['result'])
def test_06_service_path_create_rdm_check(self):
response = test_utils_rfc8040.check_node_attribute_request("ROADM-A1", "interface", "DEG1-TTP-TXRX-nmc-713:720")
# FIXME: https://jira.opendaylight.org/browse/TRNSPRTPCE-591
def test_17_service_path_delete(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_service_path_request(
+ {'input': {
'service-name': 'service_test',
'wave-number': '7',
'modulation-format': 'dp-qpsk',
'max-freq': 195.825,
'lower-spectral-slot-number': 713,
'higher-spectral-slot-number': 720
- }
- }
- response = test_utils_rfc8040.device_renderer_service_path_request(data)
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertIn(response.json(),
- ({'output': {'result': 'Request processed', 'success': True}},
- {'transportpce-device-renderer:output': {'result': 'Request processed', 'success': True}}))
+ }})
+ self.assertEqual(response['status_code'], requests.codes.ok)
+ self.assertDictEqual(response['output'], {'result': 'Request processed', 'success': True})
def test_18_service_path_delete_rdm_check(self):
response = test_utils_rfc8040.check_node_attribute_request("ROADM-A1", "interface", "DEG1-TTP-TXRX-mc-713:720")
response['mapping'])
def test_04_service_path_create_OCH_OTU4(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_service_path_request(
+ {'input': {
'service-name': 'service_test',
'wave-number': '7',
'modulation-format': 'dp-qpsk',
'max-freq': 196.125,
'lower-spectral-slot-number': 761,
'higher-spectral-slot-number': 768
- }
- }
- response = test_utils_rfc8040.device_renderer_service_path_request(data)
- self.assertEqual(response.status_code, requests.codes.ok)
+ }})
+ self.assertEqual(response['status_code'], requests.codes.ok)
+ self.assertIn('Interfaces created successfully for nodes: ', response['output']['result'])
+ self.assertTrue(response['output']['success'])
+ self.assertIn(
+ {'node-id': 'SPDR-SA1',
+ 'otu-interface-id': ['XPDR1-NETWORK1-OTU'],
+ 'och-interface-id': ['XPDR1-NETWORK1-761:768']}, response['output']['node-interface'])
def test_05_get_portmapping_NETWORK1(self):
response = test_utils_rfc8040.portmapping_request("SPDR-SA1", "XPDR1-NETWORK1")
response['interface'][0]['org-openroadm-otn-otu-interfaces:otu'])
def test_08_otn_service_path_create_ODU4(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_otn_service_path_request(
+ {'input': {
'service-name': 'service_ODU4',
'operation': 'create',
'service-rate': '100',
'service-format': 'ODU',
'nodes': [{'node-id': 'SPDR-SA1', 'network-tp': 'XPDR1-NETWORK1'}]
- }
- }
- response = test_utils_rfc8040.device_renderer_otn_service_path_request(data)
+ }})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Otn Service path was set up successfully for node :SPDR-SA1', response['output']['result'])
self.assertTrue(response['output']['success'])
response['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
def test_11_otn_service_path_create_10GE(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_otn_service_path_request(
+ {'input': {
'service-name': 'service1',
'operation': 'create',
'service-rate': '10',
'ethernet-encoding': 'eth encode',
'trib-slot': ['1'],
'trib-port-number': '1'
- }
- }
- response = test_utils_rfc8040.device_renderer_otn_service_path_request(data)
+ }})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Otn Service path was set up successfully for node :SPDR-SA1', response['output']['result'])
self.assertTrue(response['output']['success'])
response['odu-connection'][0]['source'])
def test_16_otn_service_path_delete_10GE(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_otn_service_path_request(
+ {'input': {
'service-name': 'service1',
'operation': 'delete',
'service-rate': '10',
'ethernet-encoding': 'eth encode',
'trib-slot': ['1'],
'trib-port-number': '1'
- }
- }
- response = test_utils_rfc8040.device_renderer_otn_service_path_request(data)
+ }})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
self.assertTrue(response['output']['success'])
self.assertEqual(response['status_code'], requests.codes.conflict)
def test_21_otn_service_path_delete_ODU4(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_otn_service_path_request(
+ {'input': {
'service-name': 'service_ODU4',
'operation': 'delete',
'service-rate': '100',
'service-format': 'ODU',
'nodes': [{'node-id': 'SPDR-SA1', 'network-tp': 'XPDR1-NETWORK1'}]
- }
- }
- response = test_utils_rfc8040.device_renderer_otn_service_path_request(data)
+ }})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
self.assertTrue(response['output']['success'])
self.assertEqual(response['status_code'], requests.codes.conflict)
def test_23_service_path_delete_OCH_OTU4(self):
- data = {
- 'input': {
+ response = test_utils_rfc8040.device_renderer_service_path_request(
+ {'input': {
'service-name': 'service_test',
'wave-number': '7',
'modulation-format': 'dp-qpsk',
'max-freq': 196.125,
'lower-spectral-slot-number': 761,
'higher-spectral-slot-number': 768
- }
- }
- response = test_utils_rfc8040.device_renderer_service_path_request(data)
- self.assertEqual(response.status_code, requests.codes.ok)
+ }})
+ self.assertEqual(response['status_code'], requests.codes.ok)
+ self.assertIn('Request processed', response['output']['result'])
+ self.assertTrue(response['output']['success'])
def test_24_check_no_interface_OTU4(self):
response = test_utils_rfc8040.check_node_attribute_request("SPDR-SA1", "interface", "XPDR1-NETWORK1-OTU")
data = prepend_dict_keys(payload, 'transportpce-device-renderer:')
else:
data = payload
- return post_request(url, data)
+ response = post_request(url, data)
+ res = response.json()
+ return_key = {'rfc8040': 'transportpce-device-renderer:output',
+ 'draft-bierman02': 'output'}
+ return_output = res[return_key[RESTCONF_VERSION]]
+ return {'status_code': response.status_code,
+ 'output': return_output}
def device_renderer_otn_service_path_request(payload: dict):