Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2018 the original author or authors. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | """ |
| 18 | Openolt adapter. |
| 19 | """ |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 20 | from zope.interface import implementer |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 21 | import structlog |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 22 | |
| 23 | from openolt_device import OpenoltDevice |
| 24 | from voltha.adapters.interface import IAdapterInterface |
| 25 | from voltha.protos import third_party |
| 26 | from voltha.protos.adapter_pb2 import Adapter |
| 27 | from voltha.protos.adapter_pb2 import AdapterConfig |
| 28 | from voltha.protos.common_pb2 import LogLevel |
Scott Baker | d319095 | 2018-09-04 15:47:28 -0700 | [diff] [blame] | 29 | from voltha.protos.common_pb2 import OperationResp |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 30 | from voltha.protos.device_pb2 import DeviceType, DeviceTypes |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 31 | from voltha.registry import registry |
| 32 | |
| 33 | _ = third_party |
| 34 | log = structlog.get_logger() |
| 35 | |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 36 | |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 37 | @implementer(IAdapterInterface) |
| 38 | class OpenoltAdapter(object): |
| 39 | name = 'openolt' |
| 40 | |
| 41 | supported_device_types = [ |
| 42 | DeviceType( |
| 43 | id=name, |
| 44 | adapter=name, |
Nicolas Palpacuer | 0c7c316 | 2018-08-08 11:27:57 -0400 | [diff] [blame] | 45 | accepts_bulk_flow_update=True, |
| 46 | accepts_direct_logical_flows_update=True |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 47 | ) |
| 48 | ] |
| 49 | |
| 50 | def __init__(self, adapter_agent, config): |
| 51 | self.adapter_agent = adapter_agent |
| 52 | self.config = config |
| 53 | self.descriptor = Adapter( |
| 54 | id=self.name, |
| 55 | vendor='OLT white box vendor', |
| 56 | version='0.1', |
| 57 | config=AdapterConfig(log_level=LogLevel.INFO) |
| 58 | ) |
| 59 | log.debug('openolt.__init__', adapter_agent=adapter_agent) |
| 60 | self.devices = dict() # device_id -> OpenoltDevice() |
| 61 | self.interface = registry('main').get_args().interface |
| 62 | self.logical_device_id_to_root_device_id = dict() |
Shad Ansari | 5dbc9c8 | 2018-05-10 03:29:31 +0000 | [diff] [blame] | 63 | self.num_devices = 0 |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 64 | |
| 65 | def start(self): |
| 66 | log.info('started', interface=self.interface) |
| 67 | |
| 68 | def stop(self): |
| 69 | log.info('stopped', interface=self.interface) |
| 70 | |
| 71 | def adapter_descriptor(self): |
| 72 | log.debug('get descriptor', interface=self.interface) |
| 73 | return self.descriptor |
| 74 | |
| 75 | def device_types(self): |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 76 | log.debug('get device_types', interface=self.interface, |
| 77 | items=self.supported_device_types) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 78 | return DeviceTypes(items=self.supported_device_types) |
| 79 | |
| 80 | def health(self): |
| 81 | log.debug('get health', interface=self.interface) |
| 82 | raise NotImplementedError() |
| 83 | |
| 84 | def change_master_state(self, master): |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 85 | log.debug('change_master_state', interface=self.interface, |
| 86 | master=master) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 87 | raise NotImplementedError() |
| 88 | |
| 89 | def adopt_device(self, device): |
| 90 | log.info('adopt-device', device=device) |
| 91 | kwargs = { |
| 92 | 'adapter_agent': self.adapter_agent, |
Shad Ansari | 5dbc9c8 | 2018-05-10 03:29:31 +0000 | [diff] [blame] | 93 | 'device': device, |
| 94 | 'device_num': self.num_devices + 1 |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 95 | } |
| 96 | try: |
| 97 | self.devices[device.id] = OpenoltDevice(**kwargs) |
| 98 | except Exception as e: |
| 99 | log.error('Failed to adopt OpenOLT device', error=e) |
| 100 | del self.devices[device.id] |
| 101 | raise |
Shad Ansari | 5dbc9c8 | 2018-05-10 03:29:31 +0000 | [diff] [blame] | 102 | else: |
| 103 | self.num_devices += 1 |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 104 | |
| 105 | def reconcile_device(self, device): |
| 106 | log.info('reconcile-device', device=device) |
Nicolas Palpacuer | 253461f | 2018-06-01 12:01:45 -0400 | [diff] [blame] | 107 | kwargs = { |
| 108 | 'adapter_agent': self.adapter_agent, |
| 109 | 'device': device, |
| 110 | 'device_num': self.num_devices + 1, |
| 111 | 'reconciliation': True |
| 112 | } |
| 113 | try: |
| 114 | reconciled_device = OpenoltDevice(**kwargs) |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 115 | log.debug('reconciled-device-recreated', |
| 116 | device_id=reconciled_device.device_id) |
Nicolas Palpacuer | 253461f | 2018-06-01 12:01:45 -0400 | [diff] [blame] | 117 | self.devices[device.id] = reconciled_device |
| 118 | except Exception as e: |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 119 | log.error('Failed to reconcile OpenOLT device', error=e, |
| 120 | exception_type=type(e).__name__) |
Nicolas Palpacuer | 253461f | 2018-06-01 12:01:45 -0400 | [diff] [blame] | 121 | del self.devices[device.id] |
| 122 | raise |
| 123 | else: |
| 124 | self.num_devices += 1 |
| 125 | # Invoke the children reconciliation which would setup the |
| 126 | # basic children data structures |
| 127 | self.adapter_agent.reconcile_child_devices(device.id) |
| 128 | return device |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 129 | |
| 130 | def abandon_device(self, device): |
| 131 | log.info('abandon-device', device=device) |
| 132 | raise NotImplementedError() |
| 133 | |
| 134 | def disable_device(self, device): |
| 135 | log.info('disable-device', device=device) |
Jonathan Davis | 0f917a2 | 2018-05-30 14:39:45 -0400 | [diff] [blame] | 136 | handler = self.devices[device.id] |
| 137 | handler.disable() |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 138 | |
| 139 | def reenable_device(self, device): |
| 140 | log.info('reenable-device', device=device) |
Jonathan Davis | 0f917a2 | 2018-05-30 14:39:45 -0400 | [diff] [blame] | 141 | handler = self.devices[device.id] |
| 142 | handler.reenable() |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 143 | |
| 144 | def reboot_device(self, device): |
| 145 | log.info('reboot_device', device=device) |
Nicolas Palpacuer | fd365ac | 2018-08-02 11:37:37 -0400 | [diff] [blame] | 146 | handler = self.devices[device.id] |
| 147 | handler.reboot() |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 148 | |
| 149 | def download_image(self, device, request): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 150 | log.info('image_download - Not implemented yet', device=device, |
| 151 | request=request) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 152 | raise NotImplementedError() |
| 153 | |
| 154 | def get_image_download_status(self, device, request): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 155 | log.info('get_image_download - Not implemented yet', device=device, |
| 156 | request=request) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 157 | raise NotImplementedError() |
| 158 | |
| 159 | def cancel_image_download(self, device, request): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 160 | log.info('cancel_image_download - Not implemented yet', device=device) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 161 | raise NotImplementedError() |
| 162 | |
| 163 | def activate_image_update(self, device, request): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 164 | log.info('activate_image_update - Not implemented yet', |
| 165 | device=device, request=request) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 166 | raise NotImplementedError() |
| 167 | |
| 168 | def revert_image_update(self, device, request): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 169 | log.info('revert_image_update - Not implemented yet', |
| 170 | device=device, request=request) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 171 | raise NotImplementedError() |
| 172 | |
| 173 | def self_test_device(self, device): |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 174 | # from voltha.protos.voltha_pb2 import SelfTestResponse |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 175 | log.info('Not implemented yet') |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 176 | raise NotImplementedError() |
| 177 | |
| 178 | def delete_device(self, device): |
| 179 | log.info('delete-device', device=device) |
Jonathan Davis | 0f917a2 | 2018-05-30 14:39:45 -0400 | [diff] [blame] | 180 | handler = self.devices[device.id] |
| 181 | handler.delete() |
| 182 | del self.devices[device.id] |
Matteo Scandolo | a171b6e | 2018-09-14 16:48:24 -0700 | [diff] [blame^] | 183 | del self.logical_device_id_to_root_device_id[device.parent_id] |
Nicolas Palpacuer | 0d44e68 | 2018-08-06 10:30:26 -0400 | [diff] [blame] | 184 | return device |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 185 | |
| 186 | def get_device_details(self, device): |
| 187 | log.debug('get_device_details', device=device) |
| 188 | raise NotImplementedError() |
| 189 | |
| 190 | def update_flows_bulk(self, device, flows, groups): |
| 191 | log.info('bulk-flow-update', device_id=device.id, |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 192 | number_of_flows=len(flows.items), number_of_groups=len( |
| 193 | groups.items)) |
| 194 | log.debug('flows and grousp details', flows=flows, groups=groups) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 195 | assert len(groups.items) == 0, "Cannot yet deal with groups" |
| 196 | handler = self.devices[device.id] |
| 197 | return handler.update_flow_table(flows.items) |
| 198 | |
| 199 | def update_flows_incrementally(self, device, flow_changes, group_changes): |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 200 | log.debug('update_flows_incrementally', device=device, |
| 201 | flow_changes=flow_changes, group_changes=group_changes) |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 202 | log.info('This device does not allow this, therefore it is Not ' |
| 203 | 'implemented') |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 204 | raise NotImplementedError() |
| 205 | |
Nicolas Palpacuer | 0c7c316 | 2018-08-08 11:27:57 -0400 | [diff] [blame] | 206 | def update_logical_flows(self, device_id, flows_to_add, flows_to_remove, |
| 207 | groups, device_rules_map): |
| 208 | |
| 209 | log.info('logical-flows-update', flows_to_add=len(flows_to_add), |
| 210 | flows_to_remove = len(flows_to_remove)) |
| 211 | log.debug('logical-flows-details', flows_to_add=flows_to_add, |
| 212 | flows_to_remove=flows_to_remove) |
| 213 | assert len(groups) == 0, "Cannot yet deal with groups" |
| 214 | handler = self.devices[device_id] |
| 215 | handler.update_logical_flows(flows_to_add, flows_to_remove, |
| 216 | device_rules_map) |
| 217 | |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 218 | def update_pm_config(self, device, pm_configs): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 219 | log.info('update_pm_config - Not implemented yet', device=device, |
| 220 | pm_configs=pm_configs) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 221 | raise NotImplementedError() |
| 222 | |
| 223 | def send_proxied_message(self, proxy_address, msg): |
| 224 | log.debug('send-proxied-message', proxy_address=proxy_address, msg=msg) |
| 225 | handler = self.devices[proxy_address.device_id] |
| 226 | handler.send_proxied_message(proxy_address, msg) |
| 227 | |
| 228 | def receive_proxied_message(self, proxy_address, msg): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 229 | log.debug('receive_proxied_message - Not implemented', |
| 230 | proxy_address=proxy_address, |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 231 | msg=msg) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 232 | raise NotImplementedError() |
| 233 | |
| 234 | def receive_packet_out(self, logical_device_id, egress_port_no, msg): |
| 235 | log.debug('packet-out', logical_device_id=logical_device_id, |
| 236 | egress_port_no=egress_port_no, msg_len=len(msg)) |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 237 | |
Shad Ansari | 42db734 | 2018-04-25 21:39:46 +0000 | [diff] [blame] | 238 | def ldi_to_di(ldi): |
| 239 | di = self.logical_device_id_to_root_device_id.get(ldi) |
| 240 | if di is None: |
| 241 | logical_device = self.adapter_agent.get_logical_device(ldi) |
| 242 | di = logical_device.root_device_id |
| 243 | self.logical_device_id_to_root_device_id[ldi] = di |
| 244 | return di |
| 245 | |
Matteo Scandolo | a171b6e | 2018-09-14 16:48:24 -0700 | [diff] [blame^] | 246 | try: |
| 247 | device_id = ldi_to_di(logical_device_id) |
| 248 | handler = self.devices[device_id] |
| 249 | handler.packet_out(egress_port_no, msg) |
| 250 | except Exception as e: |
| 251 | log.error('packet-out:exception', e=e.message) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 252 | |
| 253 | def receive_inter_adapter_message(self, msg): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 254 | log.info('rx_inter_adapter_msg - Not implemented') |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 255 | raise NotImplementedError() |
| 256 | |
| 257 | def suppress_alarm(self, filter): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 258 | log.info('suppress_alarm - Not implemented yet', filter=filter) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 259 | raise NotImplementedError() |
| 260 | |
| 261 | def unsuppress_alarm(self, filter): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 262 | log.info('unsuppress_alarm - Not implemented yet', filter=filter) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 263 | raise NotImplementedError() |
| 264 | |
| 265 | # PON Mgnt APIs # |
| 266 | def create_interface(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 267 | log.debug('create-interface - Not implemented - We do not use this', |
| 268 | data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 269 | raise NotImplementedError() |
| 270 | |
| 271 | def update_interface(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 272 | log.debug('update-interface - Not implemented - We do not use this', |
| 273 | data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 274 | raise NotImplementedError() |
| 275 | |
| 276 | def remove_interface(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 277 | log.debug('remove-interface - Not implemented - We do not use this', |
| 278 | data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 279 | raise NotImplementedError() |
| 280 | |
| 281 | def receive_onu_detect_state(self, proxy_address, state): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 282 | log.debug('receive-onu-detect-state - Not implemented - We do not ' |
| 283 | 'use this', proxy_address=proxy_address, |
Shad Ansari | f9d2d10 | 2018-06-13 02:15:26 +0000 | [diff] [blame] | 284 | state=state) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 285 | raise NotImplementedError() |
| 286 | |
| 287 | def create_tcont(self, device, tcont_data, traffic_descriptor_data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 288 | log.info('create-tcont - Not implemented - We do not use this', |
| 289 | tcont_data=tcont_data, |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 290 | traffic_descriptor_data=traffic_descriptor_data) |
| 291 | raise NotImplementedError() |
| 292 | |
| 293 | def update_tcont(self, device, tcont_data, traffic_descriptor_data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 294 | log.info('update-tcont - Not implemented - We do not use this', |
| 295 | tcont_data=tcont_data, |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 296 | traffic_descriptor_data=traffic_descriptor_data) |
| 297 | raise NotImplementedError() |
| 298 | |
| 299 | def remove_tcont(self, device, tcont_data, traffic_descriptor_data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 300 | log.info('remove-tcont - Not implemented - We do not use this', |
| 301 | tcont_data=tcont_data, |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 302 | traffic_descriptor_data=traffic_descriptor_data) |
| 303 | raise NotImplementedError() |
| 304 | |
| 305 | def create_gemport(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 306 | log.info('create-gemport - Not implemented - We do not use this', |
| 307 | data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 308 | raise NotImplementedError() |
| 309 | |
| 310 | def update_gemport(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 311 | log.info('update-gemport - Not implemented - We do not use this', |
| 312 | data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 313 | raise NotImplementedError() |
| 314 | |
| 315 | def remove_gemport(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 316 | log.info('remove-gemport - Not implemented - We do not use this', |
| 317 | data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 318 | raise NotImplementedError() |
| 319 | |
| 320 | def create_multicast_gemport(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 321 | log.info('create-mcast-gemport - Not implemented - We do not use ' |
| 322 | 'this', data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 323 | raise NotImplementedError() |
| 324 | |
| 325 | def update_multicast_gemport(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 326 | log.info('update-mcast-gemport - Not implemented - We do not use ' |
| 327 | 'this', data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 328 | raise NotImplementedError() |
| 329 | |
| 330 | def remove_multicast_gemport(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 331 | log.info('remove-mcast-gemport - Not implemented - We do not use ' |
| 332 | 'this', data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 333 | raise NotImplementedError() |
| 334 | |
| 335 | def create_multicast_distribution_set(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 336 | log.info('create-mcast-distribution-set - Not implemented - We do ' |
| 337 | 'not use this', data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 338 | raise NotImplementedError() |
| 339 | |
| 340 | def update_multicast_distribution_set(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 341 | log.info('update-mcast-distribution-set - Not implemented - We do ' |
| 342 | 'not use this', data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 343 | raise NotImplementedError() |
| 344 | |
| 345 | def remove_multicast_distribution_set(self, device, data): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 346 | log.info('remove-mcast-distribution-set - Not implemented - We do ' |
| 347 | 'not use this', data=data) |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame] | 348 | raise NotImplementedError() |
Jonathan Davis | b45bb37 | 2018-07-19 15:05:15 -0400 | [diff] [blame] | 349 | |
Jonathan Davis | b45bb37 | 2018-07-19 15:05:15 -0400 | [diff] [blame] | 350 | def delete_child_device(self, parent_device_id, child_device): |
Nicolas Palpacuer | 324dcae | 2018-08-02 11:12:22 -0400 | [diff] [blame] | 351 | log.info('delete-child_device', parent_device_id=parent_device_id, |
| 352 | child_device=child_device) |
Jonathan Davis | b45bb37 | 2018-07-19 15:05:15 -0400 | [diff] [blame] | 353 | handler = self.devices[parent_device_id] |
Nicolas Palpacuer | 131790b | 2018-08-20 09:59:34 -0400 | [diff] [blame] | 354 | if handler is not None: |
| 355 | handler.delete_child_device(child_device) |
| 356 | else: |
| 357 | log.error('Could not find matching handler', |
| 358 | looking_for_device_id =parent_device_id, |
| 359 | available_handlers=self.devices.keys()) |
Nicolas Palpacuer | 30027f4 | 2018-09-06 15:55:54 -0400 | [diff] [blame] | 360 | |
| 361 | # This is currently not part of the Iadapter interface |
| 362 | def collect_stats(self, device_id): |
| 363 | log.info('collect_stats', device_id=device_id) |
| 364 | handler= self.devices[device_id] |
| 365 | if handler is not None: |
| 366 | handler.trigger_statistics_collection() |
| 367 | else: |
| 368 | log.error('Could not find matching handler', |
| 369 | looking_for_device_id=device_id, |
| 370 | available_handlers=self.devices.keys()) |
Scott Baker | d319095 | 2018-09-04 15:47:28 -0700 | [diff] [blame] | 371 | |
| 372 | def simulate_alarm(self, device, request): |
| 373 | log.info('simulate_alarm', device=device, request=request) |
| 374 | |
| 375 | if device.id not in self.devices: |
| 376 | log.error("Device does not exist", device_id=device.id) |
| 377 | return OperationResp(code=OperationResp.OPERATION_FAILURE, |
| 378 | additional_info="Device %s does not exist" % device.id) |
| 379 | |
| 380 | handler = self.devices[device.id] |
| 381 | |
| 382 | handler.simulate_alarm(request) |
| 383 | |
| 384 | return OperationResp(code=OperationResp.OPERATION_SUCCESS) |