| @@ 1292-1320 (lines=29) @@ | ||
| 1289 | with self._links_lock: |
|
| 1290 | self.handle_interruption_end(event) |
|
| 1291 | ||
| 1292 | def handle_interruption_end(self, event: KytosEvent): |
|
| 1293 | """Deals with the end of service interruption.""" |
|
| 1294 | interrupt_type = event.content['type'] |
|
| 1295 | switches = event.content.get('switches', []) |
|
| 1296 | interfaces = event.content.get('interfaces', []) |
|
| 1297 | links = event.content.get('links', []) |
|
| 1298 | log.info( |
|
| 1299 | 'Received interruption end of type \'%s\' ' |
|
| 1300 | 'affecting switches %s, interfaces %s, links %s', |
|
| 1301 | interrupt_type, |
|
| 1302 | switches, |
|
| 1303 | interfaces, |
|
| 1304 | links |
|
| 1305 | ) |
|
| 1306 | # for switch_id in switches: |
|
| 1307 | # pass |
|
| 1308 | # for interface_id in interfaces: |
|
| 1309 | # pass |
|
| 1310 | for link_id in links: |
|
| 1311 | link = self.links.get(link_id) |
|
| 1312 | if link is None: |
|
| 1313 | log.error( |
|
| 1314 | "Invalid link id '%s' for interruption of type '%s;", |
|
| 1315 | link_id, |
|
| 1316 | interrupt_type |
|
| 1317 | ) |
|
| 1318 | else: |
|
| 1319 | self.notify_link_status_change(link, interrupt_type) |
|
| 1320 | self.notify_topology_update() |
|
| 1321 | ||
| @@ 1256-1284 (lines=29) @@ | ||
| 1253 | with self._links_lock: |
|
| 1254 | self.handle_interruption_start(event) |
|
| 1255 | ||
| 1256 | def handle_interruption_start(self, event: KytosEvent): |
|
| 1257 | """Deals with the start of service interruption.""" |
|
| 1258 | interrupt_type = event.content['type'] |
|
| 1259 | switches = event.content.get('switches', []) |
|
| 1260 | interfaces = event.content.get('interfaces', []) |
|
| 1261 | links = event.content.get('links', []) |
|
| 1262 | log.info( |
|
| 1263 | 'Received interruption start of type \'%s\' ' |
|
| 1264 | 'affecting switches %s, interfaces %s, links %s', |
|
| 1265 | interrupt_type, |
|
| 1266 | switches, |
|
| 1267 | interfaces, |
|
| 1268 | links |
|
| 1269 | ) |
|
| 1270 | # for switch_id in switches: |
|
| 1271 | # pass |
|
| 1272 | # for interface_id in interfaces: |
|
| 1273 | # pass |
|
| 1274 | for link_id in links: |
|
| 1275 | link = self.links.get(link_id) |
|
| 1276 | if link is None: |
|
| 1277 | log.error( |
|
| 1278 | "Invalid link id '%s' for interruption of type '%s;", |
|
| 1279 | link_id, |
|
| 1280 | interrupt_type |
|
| 1281 | ) |
|
| 1282 | else: |
|
| 1283 | self.notify_link_status_change(link, interrupt_type) |
|
| 1284 | self.notify_topology_update() |
|
| 1285 | ||
| 1286 | @listen_to('topology.interruption.end') |
|
| 1287 | def on_interruption_end(self, event: KytosEvent): |
|