Code Duplication    Length = 29-29 lines in 2 locations

main.py 2 locations

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