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