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