Code Duplication    Length = 21-21 lines in 2 locations

main.py 2 locations

@@ 1201-1221 (lines=21) @@
1198
        with self._links_lock:
1199
            self.handle_interruption_end(event)
1200
1201
    def handle_interruption_end(self, event: KytosEvent):
1202
        """Deals with the end of service interruption."""
1203
        interrupt_type = event.content['type']
1204
        # switches = event.content.get('switches', [])
1205
        # interfaces = event.content.get('interfaces', [])
1206
        links = event.content.get('links', [])
1207
        # for switch_id in switches:
1208
        #     pass
1209
        # for interface_id in interfaces:
1210
        #     pass
1211
        for link_id in links:
1212
            link = self.links.get(link_id)
1213
            if link is None:
1214
                log.error(
1215
                    "Invalid link id '%s' for interruption of type '%s;",
1216
                    link_id,
1217
                    interrupt_type
1218
                )
1219
            else:
1220
                self.notify_link_status_change(link, interrupt_type)
1221
        self.notify_topology_update()
1222
@@ 1173-1193 (lines=21) @@
1170
        with self._links_lock:
1171
            self.handle_interruption_start(event)
1172
1173
    def handle_interruption_start(self, event: KytosEvent):
1174
        """Deals with the start of service interruption."""
1175
        interrupt_type = event.content['type']
1176
        # switches = event.content.get('switches', [])
1177
        # interfaces = event.content.get('interfaces', [])
1178
        links = event.content.get('links', [])
1179
        # for switch_id in switches:
1180
        #     pass
1181
        # for interface_id in interfaces:
1182
        #     pass
1183
        for link_id in links:
1184
            link = self.links.get(link_id)
1185
            if link is None:
1186
                log.error(
1187
                    "Invalid link id '%s' for interruption of type '%s;",
1188
                    link_id,
1189
                    interrupt_type
1190
                )
1191
            else:
1192
                self.notify_link_status_change(link, interrupt_type)
1193
        self.notify_topology_update()
1194
1195
    @listen_to('topology.interruption.end')
1196
    def on_interruption_end(self, event: KytosEvent):