Code Duplication    Length = 21-21 lines in 2 locations

main.py 2 locations

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