| @@ 1360-1388 (lines=29) @@ | ||
| 1357 | with self._links_lock: |
|
| 1358 | self.handle_interruption_end(event) |
|
| 1359 | ||
| 1360 | def handle_interruption_end(self, event: KytosEvent): |
|
| 1361 | """Deals with the end of service interruption.""" |
|
| 1362 | interrupt_type = event.content['type'] |
|
| 1363 | switches = event.content.get('switches', []) |
|
| 1364 | interfaces = event.content.get('interfaces', []) |
|
| 1365 | links = event.content.get('links', []) |
|
| 1366 | log.info( |
|
| 1367 | 'Received interruption end of type \'%s\' ' |
|
| 1368 | 'affecting switches %s, interfaces %s, links %s', |
|
| 1369 | interrupt_type, |
|
| 1370 | switches, |
|
| 1371 | interfaces, |
|
| 1372 | links |
|
| 1373 | ) |
|
| 1374 | # for switch_id in switches: |
|
| 1375 | # pass |
|
| 1376 | # for interface_id in interfaces: |
|
| 1377 | # pass |
|
| 1378 | for link_id in links: |
|
| 1379 | link = self.links.get(link_id) |
|
| 1380 | if link is None: |
|
| 1381 | log.error( |
|
| 1382 | "Invalid link id '%s' for interruption of type '%s;", |
|
| 1383 | link_id, |
|
| 1384 | interrupt_type |
|
| 1385 | ) |
|
| 1386 | else: |
|
| 1387 | self.notify_link_status_change(link, interrupt_type) |
|
| 1388 | self.notify_topology_update() |
|
| 1389 | ||
| @@ 1324-1352 (lines=29) @@ | ||
| 1321 | with self._links_lock: |
|
| 1322 | self.handle_interruption_start(event) |
|
| 1323 | ||
| 1324 | def handle_interruption_start(self, event: KytosEvent): |
|
| 1325 | """Deals with the start of service interruption.""" |
|
| 1326 | interrupt_type = event.content['type'] |
|
| 1327 | switches = event.content.get('switches', []) |
|
| 1328 | interfaces = event.content.get('interfaces', []) |
|
| 1329 | links = event.content.get('links', []) |
|
| 1330 | log.info( |
|
| 1331 | 'Received interruption start of type \'%s\' ' |
|
| 1332 | 'affecting switches %s, interfaces %s, links %s', |
|
| 1333 | interrupt_type, |
|
| 1334 | switches, |
|
| 1335 | interfaces, |
|
| 1336 | links |
|
| 1337 | ) |
|
| 1338 | # for switch_id in switches: |
|
| 1339 | # pass |
|
| 1340 | # for interface_id in interfaces: |
|
| 1341 | # pass |
|
| 1342 | for link_id in links: |
|
| 1343 | link = self.links.get(link_id) |
|
| 1344 | if link is None: |
|
| 1345 | log.error( |
|
| 1346 | "Invalid link id '%s' for interruption of type '%s;", |
|
| 1347 | link_id, |
|
| 1348 | interrupt_type |
|
| 1349 | ) |
|
| 1350 | else: |
|
| 1351 | self.notify_link_status_change(link, interrupt_type) |
|
| 1352 | self.notify_topology_update() |
|
| 1353 | ||
| 1354 | @listen_to('topology.interruption.end') |
|
| 1355 | def on_interruption_end(self, event: KytosEvent): |
|