@@ 1359-1387 (lines=29) @@ | ||
1356 | with self._links_lock: |
|
1357 | self.handle_interruption_end(event) |
|
1358 | ||
1359 | def handle_interruption_end(self, event: KytosEvent): |
|
1360 | """Deals with the end of service interruption.""" |
|
1361 | interrupt_type = event.content['type'] |
|
1362 | switches = event.content.get('switches', []) |
|
1363 | interfaces = event.content.get('interfaces', []) |
|
1364 | links = event.content.get('links', []) |
|
1365 | log.info( |
|
1366 | 'Received interruption end of type \'%s\' ' |
|
1367 | 'affecting switches %s, interfaces %s, links %s', |
|
1368 | interrupt_type, |
|
1369 | switches, |
|
1370 | interfaces, |
|
1371 | links |
|
1372 | ) |
|
1373 | # for switch_id in switches: |
|
1374 | # pass |
|
1375 | # for interface_id in interfaces: |
|
1376 | # pass |
|
1377 | for link_id in links: |
|
1378 | link = self.links.get(link_id) |
|
1379 | if link is None: |
|
1380 | log.error( |
|
1381 | "Invalid link id '%s' for interruption of type '%s;", |
|
1382 | link_id, |
|
1383 | interrupt_type |
|
1384 | ) |
|
1385 | else: |
|
1386 | self.notify_link_status_change(link, interrupt_type) |
|
1387 | self.notify_topology_update() |
|
1388 | ||
@@ 1323-1351 (lines=29) @@ | ||
1320 | with self._links_lock: |
|
1321 | self.handle_interruption_start(event) |
|
1322 | ||
1323 | def handle_interruption_start(self, event: KytosEvent): |
|
1324 | """Deals with the start of service interruption.""" |
|
1325 | interrupt_type = event.content['type'] |
|
1326 | switches = event.content.get('switches', []) |
|
1327 | interfaces = event.content.get('interfaces', []) |
|
1328 | links = event.content.get('links', []) |
|
1329 | log.info( |
|
1330 | 'Received interruption start of type \'%s\' ' |
|
1331 | 'affecting switches %s, interfaces %s, links %s', |
|
1332 | interrupt_type, |
|
1333 | switches, |
|
1334 | interfaces, |
|
1335 | links |
|
1336 | ) |
|
1337 | # for switch_id in switches: |
|
1338 | # pass |
|
1339 | # for interface_id in interfaces: |
|
1340 | # pass |
|
1341 | for link_id in links: |
|
1342 | link = self.links.get(link_id) |
|
1343 | if link is None: |
|
1344 | log.error( |
|
1345 | "Invalid link id '%s' for interruption of type '%s;", |
|
1346 | link_id, |
|
1347 | interrupt_type |
|
1348 | ) |
|
1349 | else: |
|
1350 | self.notify_link_status_change(link, interrupt_type) |
|
1351 | self.notify_topology_update() |
|
1352 | ||
1353 | @listen_to('topology.interruption.end') |
|
1354 | def on_interruption_end(self, event: KytosEvent): |