| @@ 1440-1468 (lines=29) @@ | ||
| 1437 | with self._links_lock: |
|
| 1438 | self.handle_interruption_end(event) |
|
| 1439 | ||
| 1440 | def handle_interruption_end(self, event: KytosEvent): |
|
| 1441 | """Deals with the end of service interruption.""" |
|
| 1442 | interrupt_type = event.content['type'] |
|
| 1443 | switches = event.content.get('switches', []) |
|
| 1444 | interfaces = event.content.get('interfaces', []) |
|
| 1445 | links = event.content.get('links', []) |
|
| 1446 | log.info( |
|
| 1447 | 'Received interruption end of type \'%s\' ' |
|
| 1448 | 'affecting switches %s, interfaces %s, links %s', |
|
| 1449 | interrupt_type, |
|
| 1450 | switches, |
|
| 1451 | interfaces, |
|
| 1452 | links |
|
| 1453 | ) |
|
| 1454 | # for switch_id in switches: |
|
| 1455 | # pass |
|
| 1456 | # for interface_id in interfaces: |
|
| 1457 | # pass |
|
| 1458 | for link_id in links: |
|
| 1459 | link = self.links.get(link_id) |
|
| 1460 | if link is None: |
|
| 1461 | log.error( |
|
| 1462 | "Invalid link id '%s' for interruption of type '%s;", |
|
| 1463 | link_id, |
|
| 1464 | interrupt_type |
|
| 1465 | ) |
|
| 1466 | else: |
|
| 1467 | self.notify_link_status_change(link, interrupt_type) |
|
| 1468 | self.notify_topology_update() |
|
| 1469 | ||
| @@ 1404-1432 (lines=29) @@ | ||
| 1401 | with self._links_lock: |
|
| 1402 | self.handle_interruption_start(event) |
|
| 1403 | ||
| 1404 | def handle_interruption_start(self, event: KytosEvent): |
|
| 1405 | """Deals with the start of service interruption.""" |
|
| 1406 | interrupt_type = event.content['type'] |
|
| 1407 | switches = event.content.get('switches', []) |
|
| 1408 | interfaces = event.content.get('interfaces', []) |
|
| 1409 | links = event.content.get('links', []) |
|
| 1410 | log.info( |
|
| 1411 | 'Received interruption start of type \'%s\' ' |
|
| 1412 | 'affecting switches %s, interfaces %s, links %s', |
|
| 1413 | interrupt_type, |
|
| 1414 | switches, |
|
| 1415 | interfaces, |
|
| 1416 | links |
|
| 1417 | ) |
|
| 1418 | # for switch_id in switches: |
|
| 1419 | # pass |
|
| 1420 | # for interface_id in interfaces: |
|
| 1421 | # pass |
|
| 1422 | for link_id in links: |
|
| 1423 | link = self.links.get(link_id) |
|
| 1424 | if link is None: |
|
| 1425 | log.error( |
|
| 1426 | "Invalid link id '%s' for interruption of type '%s;", |
|
| 1427 | link_id, |
|
| 1428 | interrupt_type |
|
| 1429 | ) |
|
| 1430 | else: |
|
| 1431 | self.notify_link_status_change(link, interrupt_type) |
|
| 1432 | self.notify_topology_update() |
|
| 1433 | ||
| 1434 | @listen_to('topology.interruption.end') |
|
| 1435 | def on_interruption_end(self, event: KytosEvent): |
|