Code Duplication    Length = 21-21 lines in 2 locations

main.py 2 locations

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