@@ 1185-1213 (lines=29) @@ | ||
1182 | with self._links_lock: |
|
1183 | self.handle_interruption_end(event) |
|
1184 | ||
1185 | def handle_interruption_end(self, event: KytosEvent): |
|
1186 | """Deals with the end of service interruption.""" |
|
1187 | interrupt_type = event.content['type'] |
|
1188 | switches = event.content.get('switches', []) |
|
1189 | interfaces = event.content.get('interfaces', []) |
|
1190 | links = event.content.get('links', []) |
|
1191 | log.info( |
|
1192 | 'Received interruption end of type \'%s\' ' |
|
1193 | 'affecting switches %s, interfaces %s, links %s', |
|
1194 | interrupt_type, |
|
1195 | switches, |
|
1196 | interfaces, |
|
1197 | links |
|
1198 | ) |
|
1199 | # for switch_id in switches: |
|
1200 | # pass |
|
1201 | # for interface_id in interfaces: |
|
1202 | # pass |
|
1203 | for link_id in links: |
|
1204 | link = self.links.get(link_id) |
|
1205 | if link is None: |
|
1206 | log.error( |
|
1207 | "Invalid link id '%s' for interruption of type '%s;", |
|
1208 | link_id, |
|
1209 | interrupt_type |
|
1210 | ) |
|
1211 | else: |
|
1212 | self.notify_link_status_change(link, interrupt_type) |
|
1213 | self.notify_topology_update() |
|
1214 | ||
@@ 1149-1177 (lines=29) @@ | ||
1146 | with self._links_lock: |
|
1147 | self.handle_interruption_start(event) |
|
1148 | ||
1149 | def handle_interruption_start(self, event: KytosEvent): |
|
1150 | """Deals with the start of service interruption.""" |
|
1151 | interrupt_type = event.content['type'] |
|
1152 | switches = event.content.get('switches', []) |
|
1153 | interfaces = event.content.get('interfaces', []) |
|
1154 | links = event.content.get('links', []) |
|
1155 | log.info( |
|
1156 | 'Received interruption start of type \'%s\' ' |
|
1157 | 'affecting switches %s, interfaces %s, links %s', |
|
1158 | interrupt_type, |
|
1159 | switches, |
|
1160 | interfaces, |
|
1161 | links |
|
1162 | ) |
|
1163 | # for switch_id in switches: |
|
1164 | # pass |
|
1165 | # for interface_id in interfaces: |
|
1166 | # pass |
|
1167 | for link_id in links: |
|
1168 | link = self.links.get(link_id) |
|
1169 | if link is None: |
|
1170 | log.error( |
|
1171 | "Invalid link id '%s' for interruption of type '%s;", |
|
1172 | link_id, |
|
1173 | interrupt_type |
|
1174 | ) |
|
1175 | else: |
|
1176 | self.notify_link_status_change(link, interrupt_type) |
|
1177 | self.notify_topology_update() |
|
1178 | ||
1179 | @listen_to('topology.interruption.end') |
|
1180 | def on_interruption_end(self, event: KytosEvent): |