@@ 1121-1149 (lines=29) @@ | ||
1118 | with self._links_lock: |
|
1119 | self.handle_interruption_end(event) |
|
1120 | ||
1121 | def handle_interruption_end(self, event: KytosEvent): |
|
1122 | """Deals with the end of service interruption.""" |
|
1123 | interrupt_type = event.content['type'] |
|
1124 | switches = event.content.get('switches', []) |
|
1125 | interfaces = event.content.get('interfaces', []) |
|
1126 | links = event.content.get('links', []) |
|
1127 | log.info( |
|
1128 | 'Received interruption end of type \'%s\' ' |
|
1129 | 'affecting switches %s, interfaces %s, links %s', |
|
1130 | interrupt_type, |
|
1131 | switches, |
|
1132 | interfaces, |
|
1133 | links |
|
1134 | ) |
|
1135 | # for switch_id in switches: |
|
1136 | # pass |
|
1137 | # for interface_id in interfaces: |
|
1138 | # pass |
|
1139 | for link_id in links: |
|
1140 | link = self.links.get(link_id) |
|
1141 | if link is None: |
|
1142 | log.error( |
|
1143 | "Invalid link id '%s' for interruption of type '%s;", |
|
1144 | link_id, |
|
1145 | interrupt_type |
|
1146 | ) |
|
1147 | else: |
|
1148 | self.notify_link_status_change(link, interrupt_type) |
|
1149 | self.notify_topology_update() |
|
1150 | ||
@@ 1085-1113 (lines=29) @@ | ||
1082 | with self._links_lock: |
|
1083 | self.handle_interruption_start(event) |
|
1084 | ||
1085 | def handle_interruption_start(self, event: KytosEvent): |
|
1086 | """Deals with the start of service interruption.""" |
|
1087 | interrupt_type = event.content['type'] |
|
1088 | switches = event.content.get('switches', []) |
|
1089 | interfaces = event.content.get('interfaces', []) |
|
1090 | links = event.content.get('links', []) |
|
1091 | log.info( |
|
1092 | 'Received interruption start of type \'%s\' ' |
|
1093 | 'affecting switches %s, interfaces %s, links %s', |
|
1094 | interrupt_type, |
|
1095 | switches, |
|
1096 | interfaces, |
|
1097 | links |
|
1098 | ) |
|
1099 | # for switch_id in switches: |
|
1100 | # pass |
|
1101 | # for interface_id in interfaces: |
|
1102 | # pass |
|
1103 | for link_id in links: |
|
1104 | link = self.links.get(link_id) |
|
1105 | if link is None: |
|
1106 | log.error( |
|
1107 | "Invalid link id '%s' for interruption of type '%s;", |
|
1108 | link_id, |
|
1109 | interrupt_type |
|
1110 | ) |
|
1111 | else: |
|
1112 | self.notify_link_status_change(link, interrupt_type) |
|
1113 | self.notify_topology_update() |
|
1114 | ||
1115 | @listen_to('topology.interruption.end') |
|
1116 | def on_interruption_end(self, event: KytosEvent): |