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