@@ 1247-1275 (lines=29) @@ | ||
1244 | with self._links_lock: |
|
1245 | self.handle_interruption_end(event) |
|
1246 | ||
1247 | def handle_interruption_end(self, event: KytosEvent): |
|
1248 | """Deals with the end of service interruption.""" |
|
1249 | interrupt_type = event.content['type'] |
|
1250 | switches = event.content.get('switches', []) |
|
1251 | interfaces = event.content.get('interfaces', []) |
|
1252 | links = event.content.get('links', []) |
|
1253 | log.info( |
|
1254 | 'Received interruption end of type \'%s\' ' |
|
1255 | 'affecting switches %s, interfaces %s, links %s', |
|
1256 | interrupt_type, |
|
1257 | switches, |
|
1258 | interfaces, |
|
1259 | links |
|
1260 | ) |
|
1261 | # for switch_id in switches: |
|
1262 | # pass |
|
1263 | # for interface_id in interfaces: |
|
1264 | # pass |
|
1265 | for link_id in links: |
|
1266 | link = self.links.get(link_id) |
|
1267 | if link is None: |
|
1268 | log.error( |
|
1269 | "Invalid link id '%s' for interruption of type '%s;", |
|
1270 | link_id, |
|
1271 | interrupt_type |
|
1272 | ) |
|
1273 | else: |
|
1274 | self.notify_link_status_change(link, interrupt_type) |
|
1275 | self.notify_topology_update() |
|
1276 | ||
@@ 1211-1239 (lines=29) @@ | ||
1208 | with self._links_lock: |
|
1209 | self.handle_interruption_start(event) |
|
1210 | ||
1211 | def handle_interruption_start(self, event: KytosEvent): |
|
1212 | """Deals with the start of service interruption.""" |
|
1213 | interrupt_type = event.content['type'] |
|
1214 | switches = event.content.get('switches', []) |
|
1215 | interfaces = event.content.get('interfaces', []) |
|
1216 | links = event.content.get('links', []) |
|
1217 | log.info( |
|
1218 | 'Received interruption start of type \'%s\' ' |
|
1219 | 'affecting switches %s, interfaces %s, links %s', |
|
1220 | interrupt_type, |
|
1221 | switches, |
|
1222 | interfaces, |
|
1223 | links |
|
1224 | ) |
|
1225 | # for switch_id in switches: |
|
1226 | # pass |
|
1227 | # for interface_id in interfaces: |
|
1228 | # pass |
|
1229 | for link_id in links: |
|
1230 | link = self.links.get(link_id) |
|
1231 | if link is None: |
|
1232 | log.error( |
|
1233 | "Invalid link id '%s' for interruption of type '%s;", |
|
1234 | link_id, |
|
1235 | interrupt_type |
|
1236 | ) |
|
1237 | else: |
|
1238 | self.notify_link_status_change(link, interrupt_type) |
|
1239 | self.notify_topology_update() |
|
1240 | ||
1241 | @listen_to('topology.interruption.end') |
|
1242 | def on_interruption_end(self, event: KytosEvent): |