| @@ 1323-1351 (lines=29) @@ | ||
| 1320 | with self._links_lock: |
|
| 1321 | self.handle_interruption_end(event) |
|
| 1322 | ||
| 1323 | def handle_interruption_end(self, event: KytosEvent): |
|
| 1324 | """Deals with the end 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 end 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 | ||
| @@ 1287-1315 (lines=29) @@ | ||
| 1284 | with self._links_lock: |
|
| 1285 | self.handle_interruption_start(event) |
|
| 1286 | ||
| 1287 | def handle_interruption_start(self, event: KytosEvent): |
|
| 1288 | """Deals with the start of service interruption.""" |
|
| 1289 | interrupt_type = event.content['type'] |
|
| 1290 | switches = event.content.get('switches', []) |
|
| 1291 | interfaces = event.content.get('interfaces', []) |
|
| 1292 | links = event.content.get('links', []) |
|
| 1293 | log.info( |
|
| 1294 | 'Received interruption start of type \'%s\' ' |
|
| 1295 | 'affecting switches %s, interfaces %s, links %s', |
|
| 1296 | interrupt_type, |
|
| 1297 | switches, |
|
| 1298 | interfaces, |
|
| 1299 | links |
|
| 1300 | ) |
|
| 1301 | # for switch_id in switches: |
|
| 1302 | # pass |
|
| 1303 | # for interface_id in interfaces: |
|
| 1304 | # pass |
|
| 1305 | for link_id in links: |
|
| 1306 | link = self.links.get(link_id) |
|
| 1307 | if link is None: |
|
| 1308 | log.error( |
|
| 1309 | "Invalid link id '%s' for interruption of type '%s;", |
|
| 1310 | link_id, |
|
| 1311 | interrupt_type |
|
| 1312 | ) |
|
| 1313 | else: |
|
| 1314 | self.notify_link_status_change(link, interrupt_type) |
|
| 1315 | self.notify_topology_update() |
|
| 1316 | ||
| 1317 | @listen_to('topology.interruption.end') |
|
| 1318 | def on_interruption_end(self, event: KytosEvent): |
|