Code Duplication    Length = 29-29 lines in 2 locations

main.py 2 locations

@@ 1493-1521 (lines=29) @@
1490
                self.notify_link_status_change(link, interrupt_type)
1491
        self.notify_topology_update()
1492
1493
    def handle_interruption_end(self, event: KytosEvent):
1494
        """Deals with the end of service interruption."""
1495
        interrupt_type = event.content['type']
1496
        switches = event.content.get('switches', [])
1497
        interfaces = event.content.get('interfaces', [])
1498
        links = event.content.get('links', [])
1499
        log.info(
1500
            'Received interruption end of type \'%s\' '
1501
            'affecting switches %s, interfaces %s, links %s',
1502
            interrupt_type,
1503
            switches,
1504
            interfaces,
1505
            links
1506
        )
1507
        # for switch_id in switches:
1508
        #     pass
1509
        # for interface_id in interfaces:
1510
        #     pass
1511
        for link_id in links:
1512
            link = self.links.get(link_id)
1513
            if link is None:
1514
                log.error(
1515
                    "Invalid link id '%s' for interruption of type '%s;",
1516
                    link_id,
1517
                    interrupt_type
1518
                )
1519
            else:
1520
                self.notify_link_status_change(link, interrupt_type)
1521
        self.notify_topology_update()
1522
@@ 1463-1491 (lines=29) @@
1460
            elif interrupt_type == "end":
1461
                self.handle_interruption_end(event)
1462
1463
    def handle_interruption_start(self, event: KytosEvent):
1464
        """Deals with the start of service interruption."""
1465
        interrupt_type = event.content['type']
1466
        switches = event.content.get('switches', [])
1467
        interfaces = event.content.get('interfaces', [])
1468
        links = event.content.get('links', [])
1469
        log.info(
1470
            'Received interruption start of type \'%s\' '
1471
            'affecting switches %s, interfaces %s, links %s',
1472
            interrupt_type,
1473
            switches,
1474
            interfaces,
1475
            links
1476
        )
1477
        # for switch_id in switches:
1478
        #     pass
1479
        # for interface_id in interfaces:
1480
        #     pass
1481
        for link_id in links:
1482
            link = self.links.get(link_id)
1483
            if link is None:
1484
                log.error(
1485
                    "Invalid link id '%s' for interruption of type '%s;",
1486
                    link_id,
1487
                    interrupt_type
1488
                )
1489
            else:
1490
                self.notify_link_status_change(link, interrupt_type)
1491
        self.notify_topology_update()
1492
1493
    def handle_interruption_end(self, event: KytosEvent):
1494
        """Deals with the end of service interruption."""