14 class TransportPCEtesting(unittest.TestCase):
16 testtools_process = None
20 def __start_testtools(cls):
21 executable = ("./netconf/netconf/tools/netconf-testtool/target/"
22 "netconf-testtool-1.3.0-SNAPSHOT-executable.jar")
23 if os.path.isfile(executable):
24 with open('testtools.log', 'w') as outfile:
25 cls.testtools_process = subprocess.Popen(
26 ["java", "-jar", executable, "--schemas-dir", "schemas",
27 "--initial-config-xml", "sample-config-ROADM.xml"],
32 zfile = "../karaf/target/transportpce-karaf-0.2.0-SNAPSHOT.zip"
33 executable = "transportpce-karaf-0.2.0-SNAPSHOT/bin/karaf"
34 if os.path.isfile(zfile):
36 shutil.rmtree("transportpce-karaf-0.2.0-SNAPSHOT")
39 zipobj = zipfile.ZipFile(zfile)
41 with open('odl.log', 'w') as outfile:
42 cls.odl_process = subprocess.Popen(
43 ["bash", executable], stdout=outfile)
47 cls.__start_testtools()
52 def tearDownClass(cls):
53 cls.testtools_process.kill()
54 for child in psutil.Process(cls.odl_process.pid).children():
56 cls.odl_process.kill()
61 def test_connect_device(self):
62 url = ("http://127.0.0.1:8181/restconf/config/network-topology:"
63 "network-topology/topology/topology-netconf/node/ROADMA")
66 "netconf-node-topology:username": "admin",
67 "netconf-node-topology:password": "admin",
68 "netconf-node-topology:host": "127.0.0.1",
69 "netconf-node-topology:port": "17830",
70 "netconf-node-topology:tcp-only": "false",
71 "netconf-node-topology:pass-through": {}}]}
72 headers = {'content-type': 'application/json'}
73 response = requests.request(
74 "PUT", url, data=json.dumps(data), headers=headers,
75 auth=('admin', 'admin'))
76 self.assertEqual(response.status_code, requests.codes.created)
79 def test_device_connected(self):
80 url = ("http://127.0.0.1:8181/restconf/operational/network-topology:"
81 "network-topology/topology/topology-netconf/node/ROADMA")
82 headers = {'content-type': 'application/json'}
83 response = requests.request(
84 "GET", url, headers=headers, auth=('admin', 'admin'))
85 self.assertEqual(response.status_code, requests.codes.ok)
88 res['node'][0]['netconf-node-topology:connection-status'],
92 def test_portmapping_SRG1_PP3_TXRX(self):
93 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
94 "nodes/ROADMA/mapping/SRG1-PP3-TXRX")
95 headers = {'content-type': 'application/json'}
96 response = requests.request(
97 "GET", url, headers=headers, auth=('admin', 'admin'))
98 self.assertEqual(response.status_code, requests.codes.ok)
101 {'supporting-port': 'C3', 'supporting-circuit-pack-name': '4/0',
102 'logical-connection-point': 'SRG1-PP3-TXRX'},
105 def test_portmapping_SRG1_PP6_TXRX(self):
106 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
107 "nodes/ROADMA/mapping/SRG1-PP6-TXRX")
108 headers = {'content-type': 'application/json'}
109 response = requests.request(
110 "GET", url, headers=headers, auth=('admin', 'admin'))
111 self.assertEqual(response.status_code, requests.codes.ok)
112 res = response.json()
114 {'supporting-port': 'C6', 'supporting-circuit-pack-name': '4/0',
115 'logical-connection-point': 'SRG1-PP6-TXRX'},
118 def test_portmapping_DEG1_TTP_TXRX(self):
119 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
120 "nodes/ROADMA/mapping/DEG1-TTP-TXRX")
121 headers = {'content-type': 'application/json'}
122 response = requests.request(
123 "GET", url, headers=headers, auth=('admin', 'admin'))
124 self.assertEqual(response.status_code, requests.codes.ok)
125 res = response.json()
127 {'supporting-port': 'L1', 'supporting-circuit-pack-name': '2/0',
128 'logical-connection-point': 'DEG1-TTP-TXRX'},
131 def test_portmapping_SRG1_PP9_TXRX(self):
132 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
133 "nodes/ROADMA/mapping/SRG1-PP9-TXRX")
134 headers = {'content-type': 'application/json'}
135 response = requests.request(
136 "GET", url, headers=headers, auth=('admin', 'admin'))
137 self.assertEqual(response.status_code, requests.codes.ok)
138 res = response.json()
140 {'supporting-port': 'C9', 'supporting-circuit-pack-name': '4/0',
141 'logical-connection-point': 'SRG1-PP9-TXRX'},
144 def test_portmapping_SRG1_PP16_TXRX(self):
145 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
146 "nodes/ROADMA/mapping/SRG1-PP16-TXRX")
147 headers = {'content-type': 'application/json'}
148 response = requests.request(
149 "GET", url, headers=headers, auth=('admin', 'admin'))
150 self.assertEqual(response.status_code, requests.codes.ok)
151 res = response.json()
153 {'supporting-port': 'C16', 'supporting-circuit-pack-name': '4/0',
154 'logical-connection-point': 'SRG1-PP16-TXRX'},
157 def test_portmapping_SRG1_PP4_TXRX(self):
158 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
159 "nodes/ROADMA/mapping/SRG1-PP4-TXRX")
160 headers = {'content-type': 'application/json'}
161 response = requests.request(
162 "GET", url, headers=headers, auth=('admin', 'admin'))
163 self.assertEqual(response.status_code, requests.codes.ok)
164 res = response.json()
166 {'supporting-port': 'C4', 'supporting-circuit-pack-name': '4/0',
167 'logical-connection-point': 'SRG1-PP4-TXRX'},
170 def test_portmapping_SRG1_PP2_TXRX(self):
171 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
172 "nodes/ROADMA/mapping/SRG1-PP2-TXRX")
173 headers = {'content-type': 'application/json'}
174 response = requests.request(
175 "GET", url, headers=headers, auth=('admin', 'admin'))
176 self.assertEqual(response.status_code, requests.codes.ok)
177 res = response.json()
179 {'supporting-port': 'C2', 'supporting-circuit-pack-name': '4/0',
180 'logical-connection-point': 'SRG1-PP2-TXRX'},
183 def test_portmapping_SRG1_PP14_TXRX(self):
184 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
185 "nodes/ROADMA/mapping/SRG1-PP14-TXRX")
186 headers = {'content-type': 'application/json'}
187 response = requests.request(
188 "GET", url, headers=headers, auth=('admin', 'admin'))
189 self.assertEqual(response.status_code, requests.codes.ok)
190 res = response.json()
192 {'supporting-port': 'C14', 'supporting-circuit-pack-name': '4/0',
193 'logical-connection-point': 'SRG1-PP14-TXRX'},
196 def test_portmapping_SRG1_PP11_TXRX(self):
197 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
198 "nodes/ROADMA/mapping/SRG1-PP11-TXRX")
199 headers = {'content-type': 'application/json'}
200 response = requests.request(
201 "GET", url, headers=headers, auth=('admin', 'admin'))
202 self.assertEqual(response.status_code, requests.codes.ok)
203 res = response.json()
205 {'supporting-port': 'C11', 'supporting-circuit-pack-name': '4/0',
206 'logical-connection-point': 'SRG1-PP11-TXRX'},
209 def test_portmapping_SRG1_PP7_TXRX(self):
210 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
211 "nodes/ROADMA/mapping/SRG1-PP7-TXRX")
212 headers = {'content-type': 'application/json'}
213 response = requests.request(
214 "GET", url, headers=headers, auth=('admin', 'admin'))
215 self.assertEqual(response.status_code, requests.codes.ok)
216 res = response.json()
218 {'supporting-port': 'C7', 'supporting-circuit-pack-name': '4/0',
219 'logical-connection-point': 'SRG1-PP7-TXRX'},
222 def test_portmapping_DEG2_TTP_TXRX(self):
223 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
224 "nodes/ROADMA/mapping/DEG2-TTP-TXRX")
225 headers = {'content-type': 'application/json'}
226 response = requests.request(
227 "GET", url, headers=headers, auth=('admin', 'admin'))
228 self.assertEqual(response.status_code, requests.codes.ok)
229 res = response.json()
231 {'supporting-port': 'L1', 'supporting-circuit-pack-name': '3/0',
232 'logical-connection-point': 'DEG2-TTP-TXRX'},
235 def test_portmapping_DEG2_TTP_TXRX(self):
236 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
237 "nodes/ROADMA/mapping/DEG2-TTP-TXRX")
238 headers = {'content-type': 'application/json'}
239 response = requests.request(
240 "GET", url, headers=headers, auth=('admin', 'admin'))
241 self.assertEqual(response.status_code, requests.codes.ok)
242 res = response.json()
244 {'supporting-port': 'L1', 'supporting-circuit-pack-name': '3/0',
245 'logical-connection-point': 'DEG2-TTP-TXRX'},
248 def test_portmapping_SRG1_PP12_TXRX(self):
249 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
250 "nodes/ROADMA/mapping/SRG1-PP12-TXRX")
251 headers = {'content-type': 'application/json'}
252 response = requests.request(
253 "GET", url, headers=headers, auth=('admin', 'admin'))
254 self.assertEqual(response.status_code, requests.codes.ok)
255 res = response.json()
257 {'supporting-port': 'C12', 'supporting-circuit-pack-name': '4/0',
258 'logical-connection-point': 'SRG1-PP12-TXRX'},
261 def test_portmapping_SRG1_PP8_TXRX(self):
262 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
263 "nodes/ROADMA/mapping/SRG1-PP8-TXRX")
264 headers = {'content-type': 'application/json'}
265 response = requests.request(
266 "GET", url, headers=headers, auth=('admin', 'admin'))
267 self.assertEqual(response.status_code, requests.codes.ok)
268 res = response.json()
270 {'supporting-port': 'C8', 'supporting-circuit-pack-name': '4/0',
271 'logical-connection-point': 'SRG1-PP8-TXRX'},
274 def test_portmapping_SRG1_PP5_TXRX(self):
275 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
276 "nodes/ROADMA/mapping/SRG1-PP5-TXRX")
277 headers = {'content-type': 'application/json'}
278 response = requests.request(
279 "GET", url, headers=headers, auth=('admin', 'admin'))
280 self.assertEqual(response.status_code, requests.codes.ok)
281 res = response.json()
283 {'supporting-port': 'C5', 'supporting-circuit-pack-name': '4/0',
284 'logical-connection-point': 'SRG1-PP5-TXRX'},
287 def test_portmapping_SRG1_PP13_TXRX(self):
288 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
289 "nodes/ROADMA/mapping/SRG1-PP13-TXRX")
290 headers = {'content-type': 'application/json'}
291 response = requests.request(
292 "GET", url, headers=headers, auth=('admin', 'admin'))
293 self.assertEqual(response.status_code, requests.codes.ok)
294 res = response.json()
296 {'supporting-port': 'C13', 'supporting-circuit-pack-name': '4/0',
297 'logical-connection-point': 'SRG1-PP13-TXRX'},
300 def test_portmapping_SRG1_PP15_TXRX(self):
301 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
302 "nodes/ROADMA/mapping/SRG1-PP15-TXRX")
303 headers = {'content-type': 'application/json'}
304 response = requests.request(
305 "GET", url, headers=headers, auth=('admin', 'admin'))
306 self.assertEqual(response.status_code, requests.codes.ok)
307 res = response.json()
309 {'supporting-port': 'C15', 'supporting-circuit-pack-name': '4/0',
310 'logical-connection-point': 'SRG1-PP15-TXRX'},
313 def test_portmapping_SRG1_PP10_TXRX(self):
314 url = ("http://127.0.0.1:8181/restconf/config/portmapping:network/"
315 "nodes/ROADMA/mapping/SRG1-PP10-TXRX")
316 headers = {'content-type': 'application/json'}
317 response = requests.request(
318 "GET", url, headers=headers, auth=('admin', 'admin'))
319 self.assertEqual(response.status_code, requests.codes.ok)
320 res = response.json()
322 {'supporting-port': 'C10', 'supporting-circuit-pack-name': '4/0',
323 'logical-connection-point': 'SRG1-PP10-TXRX'},
328 suite = unittest.TestSuite()
329 suite.addTest(TransportPCEtesting('test_connect_device'))
330 suite.addTest(TransportPCEtesting('test_device_connected'))
331 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP3_TXRX'))
332 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP6_TXRX'))
333 suite.addTest(TransportPCEtesting('test_portmapping_DEG1_TTP_TXRX'))
334 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP9_TXRX'))
335 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP16_TXRX'))
336 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP4_TXRX'))
337 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP2_TXRX'))
338 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP14_TXRX'))
339 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP11_TXRX'))
340 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP7_TXRX'))
341 suite.addTest(TransportPCEtesting('test_portmapping_DEG2_TTP_TXRX'))
342 suite.addTest(TransportPCEtesting('test_portmapping_DEG2_TTP_TXRX'))
343 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP12_TXRX'))
344 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP8_TXRX'))
345 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP5_TXRX'))
346 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP13_TXRX'))
347 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP15_TXRX'))
348 suite.addTest(TransportPCEtesting('test_portmapping_SRG1_PP10_TXRX'))
351 if __name__ == "__main__":
352 RUNNER = unittest.TextTestRunner(verbosity=2)
353 RUNNER.run(test_suite())