3 #############################################################################
4 # Copyright (c) 2017 Orange, Inc. and others. All rights reserved.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #############################################################################
21 from unittest.result import failfast
22 from common import test_utils
25 class TransportOlmTesting(unittest.TestCase):
31 cls.processes = test_utils.start_tpce()
32 cls.processes = test_utils.start_sims(['xpdra', 'roadma-full', 'roadmc-full', 'xpdrc'])
35 def tearDownClass(cls):
36 for process in cls.processes:
37 test_utils.shutdown_process(process)
38 print("all processes killed")
41 print("execution of {}".format(self.id().split(".")[-1]))
44 def test_01_xpdrA_device_connected(self):
45 response = test_utils.mount_device("XPDRA01", 'xpdra')
46 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
48 def test_02_xpdrC_device_connected(self):
49 response = test_utils.mount_device("XPDRC01", 'xpdrc')
50 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
52 def test_03_rdmA_device_connected(self):
53 response = test_utils.mount_device("ROADMA01", 'roadma-full')
54 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
56 def test_04_rdmC_device_connected(self):
57 response = test_utils.mount_device("ROADMC01", 'roadmc-full')
58 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
60 def test_05_connect_xprdA_to_roadmA(self):
61 url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(test_utils.RESTCONF_BASE_URL)
63 "networkutils:input": {
64 "networkutils:links-input": {
65 "networkutils:xpdr-node": "XPDRA01",
66 "networkutils:xpdr-num": "1",
67 "networkutils:network-num": "1",
68 "networkutils:rdm-node": "ROADMA01",
69 "networkutils:srg-num": "1",
70 "networkutils:termination-point-num": "SRG1-PP1-TXRX"
74 response = requests.request(
75 "POST", url, data=json.dumps(data),
76 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
77 self.assertEqual(response.status_code, requests.codes.ok)
79 self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"])
81 def test_06_connect_roadmA_to_xpdrA(self):
82 url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(test_utils.RESTCONF_BASE_URL)
84 "networkutils:input": {
85 "networkutils:links-input": {
86 "networkutils:xpdr-node": "XPDRA01",
87 "networkutils:xpdr-num": "1",
88 "networkutils:network-num": "1",
89 "networkutils:rdm-node": "ROADMA01",
90 "networkutils:srg-num": "1",
91 "networkutils:termination-point-num": "SRG1-PP1-TXRX"
95 response = requests.request(
96 "POST", url, data=json.dumps(data),
97 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
98 self.assertEqual(response.status_code, requests.codes.ok)
100 self.assertIn('Roadm Xponder links created successfully', res["output"]["result"])
102 def test_07_connect_xprdC_to_roadmC(self):
103 url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(test_utils.RESTCONF_BASE_URL)
105 "networkutils:input": {
106 "networkutils:links-input": {
107 "networkutils:xpdr-node": "XPDRC01",
108 "networkutils:xpdr-num": "1",
109 "networkutils:network-num": "1",
110 "networkutils:rdm-node": "ROADMC01",
111 "networkutils:srg-num": "1",
112 "networkutils:termination-point-num": "SRG1-PP1-TXRX"
116 response = requests.request(
117 "POST", url, data=json.dumps(data),
118 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
119 self.assertEqual(response.status_code, requests.codes.ok)
120 res = response.json()
121 self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"])
123 def test_08_connect_roadmC_to_xpdrC(self):
124 url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(test_utils.RESTCONF_BASE_URL)
126 "networkutils:input": {
127 "networkutils:links-input": {
128 "networkutils:xpdr-node": "XPDRC01",
129 "networkutils:xpdr-num": "1",
130 "networkutils:network-num": "1",
131 "networkutils:rdm-node": "ROADMC01",
132 "networkutils:srg-num": "1",
133 "networkutils:termination-point-num": "SRG1-PP1-TXRX"
137 response = requests.request(
138 "POST", url, data=json.dumps(data),
139 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
140 self.assertEqual(response.status_code, requests.codes.ok)
141 res = response.json()
142 self.assertIn('Roadm Xponder links created successfully', res["output"]["result"])
144 def test_09_create_OTS_ROADMA(self):
145 url = "{}/operations/transportpce-device-renderer:create-ots-oms".format(test_utils.RESTCONF_BASE_URL)
148 "node-id": "ROADMA01",
149 "logical-connection-point": "DEG1-TTP-TXRX"
152 response = requests.request(
153 "POST", url, data=json.dumps(data),
154 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
155 self.assertEqual(response.status_code, requests.codes.ok)
156 res = response.json()
157 self.assertIn('Interfaces OTS-DEG1-TTP-TXRX - OMS-DEG1-TTP-TXRX successfully created on node ROADMA01',
158 res["output"]["result"])
160 def test_10_create_OTS_ROADMC(self):
161 url = "{}/operations/transportpce-device-renderer:create-ots-oms".format(test_utils.RESTCONF_BASE_URL)
164 "node-id": "ROADMC01",
165 "logical-connection-point": "DEG2-TTP-TXRX"
168 response = requests.request(
169 "POST", url, data=json.dumps(data),
170 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
171 self.assertEqual(response.status_code, requests.codes.ok)
172 res = response.json()
173 self.assertIn('Interfaces OTS-DEG2-TTP-TXRX - OMS-DEG2-TTP-TXRX successfully created on node ROADMC01',
174 res["output"]["result"])
176 def test_11_get_PM_ROADMA(self):
177 url = "{}/operations/transportpce-olm:get-pm".format(test_utils.RESTCONF_BASE_URL)
180 "node-id": "ROADMA01",
181 "resource-type": "interface",
182 "granularity": "15min",
183 "resource-identifier": {
184 "resource-name": "OTS-DEG1-TTP-TXRX"
188 response = requests.request(
189 "POST", url, data=json.dumps(data),
190 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
191 self.assertEqual(response.status_code, requests.codes.ok)
192 res = response.json()
194 "pmparameter-name": "OpticalPowerOutput",
195 "pmparameter-value": "2.5"
196 }, res["output"]["measurements"])
198 "pmparameter-name": "OpticalReturnLoss",
199 "pmparameter-value": "49.9"
200 }, res["output"]["measurements"])
202 "pmparameter-name": "OpticalPowerInput",
203 "pmparameter-value": "3"
204 }, res["output"]["measurements"])
206 def test_12_get_PM_ROADMC(self):
207 url = "{}/operations/transportpce-olm:get-pm".format(test_utils.RESTCONF_BASE_URL)
210 "node-id": "ROADMC01",
211 "resource-type": "interface",
212 "granularity": "15min",
213 "resource-identifier": {
214 "resource-name": "OTS-DEG2-TTP-TXRX"
218 response = requests.request(
219 "POST", url, data=json.dumps(data),
220 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
221 self.assertEqual(response.status_code, requests.codes.ok)
222 res = response.json()
224 "pmparameter-name": "OpticalPowerOutput",
225 "pmparameter-value": "18.1"
226 }, res["output"]["measurements"])
228 "pmparameter-name": "OpticalReturnLoss",
229 "pmparameter-value": "48.8"
230 }, res["output"]["measurements"])
232 "pmparameter-name": "OpticalPowerInput",
233 "pmparameter-value": "-3.2"
234 }, res["output"]["measurements"])
236 def test_13_calculate_span_loss_base_ROADMA_ROADMC(self):
237 url = "{}/operations/transportpce-olm:calculate-spanloss-base".format(test_utils.RESTCONF_BASE_URL)
241 "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX"
244 response = requests.request(
245 "POST", url, data=json.dumps(data),
246 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
247 self.assertEqual(response.status_code, requests.codes.ok)
248 res = response.json()
249 self.assertIn('Success',
250 res["output"]["result"])
253 "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX"
254 }, res["output"]["spans"])
257 def test_14_calculate_span_loss_base_all(self):
258 url = "{}/operations/transportpce-olm:calculate-spanloss-base".format(test_utils.RESTCONF_BASE_URL)
264 response = requests.request(
265 "POST", url, data=json.dumps(data),
266 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
267 self.assertEqual(response.status_code, requests.codes.ok)
268 res = response.json()
269 self.assertIn('Success',
270 res["output"]["result"])
273 "link-id": "ROADMC01-DEG2-DEG2-TTP-TXRXtoROADMA01-DEG1-DEG1-TTP-TXRX"
274 }, res["output"]["spans"])
277 "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX"
278 }, res["output"]["spans"])
281 def test_15_get_OTS_DEG1_TTP_TXRX_ROADMA(self):
282 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/"
283 "node/ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface/OTS-DEG1-TTP-TXRX/"
284 "org-openroadm-optical-transport-interfaces:ots".format(test_utils.RESTCONF_BASE_URL))
285 response = requests.request(
286 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
287 self.assertEqual(response.status_code, requests.codes.ok)
288 res = response.json()
289 self.assertEqual(5.7, res['org-openroadm-optical-transport-interfaces:ots']['span-loss-transmit'])
290 self.assertEqual(15.1, res['org-openroadm-optical-transport-interfaces:ots']['span-loss-receive'])
292 def test_16_get_OTS_DEG2_TTP_TXRX_ROADMC(self):
293 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/"
294 "node/ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface/OTS-DEG2-TTP-TXRX/"
295 "org-openroadm-optical-transport-interfaces:ots".format(test_utils.RESTCONF_BASE_URL))
296 response = requests.request(
297 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
298 self.assertEqual(response.status_code, requests.codes.ok)
299 res = response.json()
300 self.assertEqual(15.1, res['org-openroadm-optical-transport-interfaces:ots']['span-loss-transmit'])
301 self.assertEqual(5.7, res['org-openroadm-optical-transport-interfaces:ots']['span-loss-receive'])
303 def test_17_servicePath_create_AToZ(self):
304 url = "{}/operations/transportpce-device-renderer:service-path".format(test_utils.RESTCONF_BASE_URL)
307 "service-name": "test",
309 "modulation-format": "qpsk",
310 "operation": "create",
313 "dest-tp": "XPDR1-NETWORK1",
314 "src-tp": "XPDR1-CLIENT1",
318 "dest-tp": "DEG1-TTP-TXRX",
319 "src-tp": "SRG1-PP1-TXRX",
320 "node-id": "ROADMA01"
323 "dest-tp": "SRG1-PP1-TXRX",
324 "src-tp": "DEG2-TTP-TXRX",
325 "node-id": "ROADMC01"
328 "dest-tp": "XPDR1-CLIENT1",
329 "src-tp": "XPDR1-NETWORK1",
335 response = requests.request(
336 "POST", url, data=json.dumps(data),
337 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
338 self.assertEqual(response.status_code, requests.codes.ok)
339 res = response.json()
340 self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
344 def test_18_servicePath_create_ZToA(self):
345 url = "{}/operations/transportpce-device-renderer:service-path".format(test_utils.RESTCONF_BASE_URL)
348 "service-name": "test",
350 "modulation-format": "qpsk",
351 "operation": "create",
354 "dest-tp": "XPDR1-NETWORK1",
355 "src-tp": "XPDR1-CLIENT1",
359 "dest-tp": "DEG2-TTP-TXRX",
360 "src-tp": "SRG1-PP1-TXRX",
361 "node-id": "ROADMC01"
364 "src-tp": "DEG1-TTP-TXRX",
365 "dest-tp": "SRG1-PP1-TXRX",
366 "node-id": "ROADMA01"
369 "src-tp": "XPDR1-NETWORK1",
370 "dest-tp": "XPDR1-CLIENT1",
376 response = requests.request(
377 "POST", url, data=json.dumps(data),
378 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
379 self.assertEqual(response.status_code, requests.codes.ok)
380 res = response.json()
381 self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
385 def test_19_service_power_setup_XPDRA_XPDRC(self):
386 url = "{}/operations/transportpce-olm:service-power-setup".format(test_utils.RESTCONF_BASE_URL)
389 "service-name": "test",
393 "dest-tp": "XPDR1-NETWORK1",
394 "src-tp": "XPDR1-CLIENT1",
398 "dest-tp": "DEG1-TTP-TXRX",
399 "src-tp": "SRG1-PP1-TXRX",
400 "node-id": "ROADMA01"
403 "dest-tp": "SRG1-PP1-TXRX",
404 "src-tp": "DEG2-TTP-TXRX",
405 "node-id": "ROADMC01"
408 "dest-tp": "XPDR1-CLIENT1",
409 "src-tp": "XPDR1-NETWORK1",
415 response = requests.request(
416 "POST", url, data=json.dumps(data),
417 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
418 self.assertEqual(response.status_code, requests.codes.ok)
419 res = response.json()
420 self.assertIn('Success', res["output"]["result"])
422 def test_20_get_interface_XPDRA_XPDR1_NETWORK1(self):
423 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA01/yang-ext:mount/"
424 "org-openroadm-device:org-openroadm-device/interface/XPDR1-NETWORK1-1/"
425 "org-openroadm-optical-channel-interfaces:och".format(test_utils.RESTCONF_BASE_URL))
426 response = requests.request(
427 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
428 self.assertEqual(response.status_code, requests.codes.ok)
429 res = response.json()
430 self.assertEqual(0, res['org-openroadm-optical-channel-interfaces:och']['transmit-power'])
431 self.assertEqual(1, res['org-openroadm-optical-channel-interfaces:och']['wavelength-number'])
433 def test_21_get_roadmconnection_ROADMA(self):
434 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA01/yang-ext:mount/"
435 "org-openroadm-device:org-openroadm-device/roadm-connections/"
436 "SRG1-PP1-TXRX-DEG1-TTP-TXRX-1".format(test_utils.RESTCONF_BASE_URL))
437 response = requests.request(
438 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
439 self.assertEqual(response.status_code, requests.codes.ok)
440 res = response.json()
441 self.assertEqual("gainLoss", res['roadm-connections'][0]['opticalControlMode'])
442 self.assertEqual(-3.3, res['roadm-connections'][0]['target-output-power'])
444 def test_22_get_roadmconnection_ROADMC(self):
445 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADMC01/yang-ext:mount/"
446 "org-openroadm-device:org-openroadm-device/roadm-connections/"
447 "DEG2-TTP-TXRX-SRG1-PP1-TXRX-1".format(test_utils.RESTCONF_BASE_URL))
448 response = requests.request(
449 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
450 self.assertEqual(response.status_code, requests.codes.ok)
451 res = response.json()
452 self.assertEqual("power", res['roadm-connections'][0]['opticalControlMode'])
454 def test_23_service_power_setup_XPDRC_XPDRA(self):
455 url = "{}/operations/transportpce-olm:service-power-setup".format(test_utils.RESTCONF_BASE_URL)
458 "service-name": "test",
462 "dest-tp": "XPDR1-NETWORK1",
463 "src-tp": "XPDR1-CLIENT1",
467 "dest-tp": "DEG2-TTP-TXRX",
468 "src-tp": "SRG1-PP1-TXRX",
469 "node-id": "ROADMC01"
472 "src-tp": "DEG1-TTP-TXRX",
473 "dest-tp": "SRG1-PP1-TXRX",
474 "node-id": "ROADMA01"
477 "src-tp": "XPDR1-NETWORK1",
478 "dest-tp": "XPDR1-CLIENT1",
484 response = requests.request(
485 "POST", url, data=json.dumps(data),
486 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
487 self.assertEqual(response.status_code, requests.codes.ok)
488 res = response.json()
489 self.assertIn('Success', res["output"]["result"])
491 def test_24_get_interface_XPDRC_XPDR1_NETWORK1(self):
492 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/XPDRC01/yang-ext:mount/"
493 "org-openroadm-device:org-openroadm-device/interface/XPDR1-NETWORK1-1/"
494 "org-openroadm-optical-channel-interfaces:och".format(test_utils.RESTCONF_BASE_URL))
495 response = requests.request(
496 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
497 self.assertEqual(response.status_code, requests.codes.ok)
498 res = response.json()
499 self.assertEqual(0, res['org-openroadm-optical-channel-interfaces:och']['transmit-power'])
500 self.assertEqual(1, res['org-openroadm-optical-channel-interfaces:och']['wavelength-number'])
502 def test_25_get_roadmconnection_ROADMC(self):
503 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADMC01/yang-ext:mount/"
504 "org-openroadm-device:org-openroadm-device/roadm-connections/"
505 "SRG1-PP1-TXRX-DEG2-TTP-TXRX-1".format(test_utils.RESTCONF_BASE_URL))
506 response = requests.request(
507 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
508 self.assertEqual(response.status_code, requests.codes.ok)
509 res = response.json()
510 self.assertEqual("gainLoss", res['roadm-connections'][0]['opticalControlMode'])
511 self.assertEqual(2, res['roadm-connections'][0]['target-output-power'])
513 def test_26_service_power_turndown_XPDRA_XPDRC(self):
514 url = "{}/operations/transportpce-olm:service-power-turndown".format(test_utils.RESTCONF_BASE_URL)
517 "service-name": "test",
521 "dest-tp": "XPDR1-NETWORK1",
522 "src-tp": "XPDR1-CLIENT1",
526 "dest-tp": "DEG1-TTP-TXRX",
527 "src-tp": "SRG1-PP1-TXRX",
528 "node-id": "ROADMA01"
531 "dest-tp": "SRG1-PP1-TXRX",
532 "src-tp": "DEG2-TTP-TXRX",
533 "node-id": "ROADMC01"
536 "dest-tp": "XPDR1-CLIENT1",
537 "src-tp": "XPDR1-NETWORK1",
543 response = requests.request(
544 "POST", url, data=json.dumps(data),
545 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
546 self.assertEqual(response.status_code, requests.codes.ok)
547 res = response.json()
548 self.assertIn('Success', res["output"]["result"])
550 def test_27_get_roadmconnection_ROADMA(self):
551 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA01/yang-ext:mount/"
552 "org-openroadm-device:org-openroadm-device/roadm-connections/"
553 "SRG1-PP1-TXRX-DEG1-TTP-TXRX-1".format(test_utils.RESTCONF_BASE_URL))
554 response = requests.request(
555 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
556 self.assertEqual(response.status_code, requests.codes.ok)
557 res = response.json()
558 self.assertEqual("off", res['roadm-connections'][0]['opticalControlMode'])
559 self.assertEqual(-60, res['roadm-connections'][0]['target-output-power'])
561 def test_28_get_roadmconnection_ROADMC(self):
562 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADMC01/yang-ext:mount/"
563 "org-openroadm-device:org-openroadm-device/roadm-connections/"
564 "DEG2-TTP-TXRX-SRG1-PP1-TXRX-1".format(test_utils.RESTCONF_BASE_URL))
565 response = requests.request(
566 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
567 self.assertEqual(response.status_code, requests.codes.ok)
568 res = response.json()
569 self.assertEqual("off", res['roadm-connections'][0]['opticalControlMode'])
571 def test_29_servicePath_delete_AToZ(self):
572 url = "{}/operations/transportpce-device-renderer:service-path".format(test_utils.RESTCONF_BASE_URL)
575 "service-name": "test",
577 "modulation-format": "qpsk",
578 "operation": "delete",
581 "dest-tp": "XPDR1-NETWORK1",
582 "src-tp": "XPDR1-CLIENT1",
586 "dest-tp": "DEG1-TTP-TXRX",
587 "src-tp": "SRG1-PP1-TXRX",
588 "node-id": "ROADMA01"
591 "dest-tp": "SRG1-PP1-TXRX",
592 "src-tp": "DEG2-TTP-TXRX",
593 "node-id": "ROADMC01"
596 "dest-tp": "XPDR1-CLIENT1",
597 "src-tp": "XPDR1-NETWORK1",
603 response = requests.request(
604 "POST", url, data=json.dumps(data),
605 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
606 self.assertEqual(response.status_code, requests.codes.ok)
607 res = response.json()
608 self.assertIn('Request processed', res["output"]["result"])
611 def test_30_servicePath_delete_ZToA(self):
612 url = "{}/operations/transportpce-device-renderer:service-path".format(test_utils.RESTCONF_BASE_URL)
615 "service-name": "test",
617 "modulation-format": "qpsk",
618 "operation": "delete",
621 "dest-tp": "XPDR1-NETWORK1",
622 "src-tp": "XPDR1-CLIENT1",
626 "dest-tp": "DEG2-TTP-TXRX",
627 "src-tp": "SRG1-PP1-TXRX",
628 "node-id": "ROADMC01"
631 "src-tp": "DEG1-TTP-TXRX",
632 "dest-tp": "SRG1-PP1-TXRX",
633 "node-id": "ROADMA01"
636 "src-tp": "XPDR1-NETWORK1",
637 "dest-tp": "XPDR1-CLIENT1",
643 response = requests.request(
644 "POST", url, data=json.dumps(data),
645 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
646 self.assertEqual(response.status_code, requests.codes.ok)
647 res = response.json()
648 self.assertIn('Request processed', res["output"]["result"])
651 """to test case where SRG where the xpdr is connected to has no optical range data"""
653 def test_31_connect_xprdA_to_roadmA(self):
654 url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(test_utils.RESTCONF_BASE_URL)
656 "networkutils:input": {
657 "networkutils:links-input": {
658 "networkutils:xpdr-node": "XPDRA01",
659 "networkutils:xpdr-num": "1",
660 "networkutils:network-num": "2",
661 "networkutils:rdm-node": "ROADMA01",
662 "networkutils:srg-num": "1",
663 "networkutils:termination-point-num": "SRG1-PP2-TXRX"
667 response = requests.request(
668 "POST", url, data=json.dumps(data),
669 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
670 self.assertEqual(response.status_code, requests.codes.ok)
671 res = response.json()
672 self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"])
674 def test_32_connect_roadmA_to_xpdrA(self):
675 url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(test_utils.RESTCONF_BASE_URL)
677 "networkutils:input": {
678 "networkutils:links-input": {
679 "networkutils:xpdr-node": "XPDRA01",
680 "networkutils:xpdr-num": "1",
681 "networkutils:network-num": "2",
682 "networkutils:rdm-node": "ROADMA01",
683 "networkutils:srg-num": "1",
684 "networkutils:termination-point-num": "SRG1-PP2-TXRX"
688 response = requests.request(
689 "POST", url, data=json.dumps(data),
690 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
691 self.assertEqual(response.status_code, requests.codes.ok)
692 res = response.json()
693 self.assertIn('Roadm Xponder links created successfully', res["output"]["result"])
695 def test_33_servicePath_create_AToZ(self):
696 url = "{}/operations/transportpce-device-renderer:service-path".format(test_utils.RESTCONF_BASE_URL)
699 "service-name": "test2",
701 "modulation-format": "qpsk",
702 "operation": "create",
705 "dest-tp": "XPDR1-NETWORK2",
706 "src-tp": "XPDR1-CLIENT2",
710 "dest-tp": "DEG1-TTP-TXRX",
711 "src-tp": "SRG1-PP2-TXRX",
712 "node-id": "ROADMA01"
717 response = requests.request(
718 "POST", url, data=json.dumps(data),
719 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
720 self.assertEqual(response.status_code, requests.codes.ok)
721 res = response.json()
722 self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
726 def test_34_get_interface_XPDRA_XPDR1_NETWORK2(self):
727 url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA01/yang-ext:mount/"
728 "org-openroadm-device:org-openroadm-device/interface/XPDR1-NETWORK2-2/"
729 "org-openroadm-optical-channel-interfaces:och".format(test_utils.RESTCONF_BASE_URL))
730 response = requests.request(
731 "GET", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
732 self.assertEqual(response.status_code, requests.codes.ok)
733 res = response.json()
734 self.assertEqual(-5, res['org-openroadm-optical-channel-interfaces:och']['transmit-power'])
735 self.assertEqual(2, res['org-openroadm-optical-channel-interfaces:och']['wavelength-number'])
737 def test_35_servicePath_delete_AToZ(self):
738 url = "{}/operations/transportpce-device-renderer:service-path".format(test_utils.RESTCONF_BASE_URL)
741 "service-name": "test",
743 "modulation-format": "qpsk",
744 "operation": "delete",
747 "dest-tp": "XPDR1-NETWORK2",
748 "src-tp": "XPDR1-CLIENT2",
752 "dest-tp": "DEG1-TTP-TXRX",
753 "src-tp": "SRG1-PP2-TXRX",
754 "node-id": "ROADMA01"
759 response = requests.request(
760 "POST", url, data=json.dumps(data),
761 headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
762 self.assertEqual(response.status_code, requests.codes.ok)
763 res = response.json()
764 self.assertIn('Request processed', res["output"]["result"])
767 def test_36_xpdrA_device_disconnected(self):
768 response = test_utils.unmount_device("XPDRA01")
769 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
771 def test_37_xpdrC_device_disconnected(self):
772 response = test_utils.unmount_device("XPDRC01")
773 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
775 def test_38_calculate_span_loss_current(self):
776 url = "{}/operations/transportpce-olm:calculate-spanloss-current".format(test_utils.RESTCONF_BASE_URL)
777 response = requests.request(
778 "POST", url, headers=test_utils.TYPE_APPLICATION_JSON, auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
779 self.assertEqual(response.status_code, requests.codes.ok)
780 res = response.json()
781 self.assertIn('Success',
782 res["output"]["result"])
785 def test_39_rdmA_device_disconnected(self):
786 response = test_utils.unmount_device("ROADMA01")
787 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
789 def test_40_rdmC_device_disconnected(self):
790 response = test_utils.unmount_device("ROADMC01")
791 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
794 if __name__ == "__main__":
795 unittest.main(verbosity=2)