blob: be75f2e99093ebb7ce914c15bf33cfbfcbc8019e [file] [log] [blame]
Chip Boling27275992017-09-22 15:17:04 -05001# Copyright 2017-present Adtran, Inc.
Chip Boling3e3b1a92017-05-16 11:51:18 -05002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
Chip Boling252c7772017-08-16 10:13:17 -05007# http://www.apache.org/licenses/LICENSE-2.0
Chip Boling3e3b1a92017-05-16 11:51:18 -05008#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Chip Boling3e3b1a92017-05-16 11:51:18 -050014
15"""
16Adtran 1-U OLT adapter.
17"""
18import structlog
19from twisted.internet import reactor
20from zope.interface import implementer
21
22from adtran_olt_handler import AdtranOltHandler
23from voltha.adapters.interface import IAdapterInterface
24from voltha.protos import third_party
25from voltha.protos.adapter_pb2 import Adapter
26from voltha.protos.adapter_pb2 import AdapterConfig
27from voltha.protos.common_pb2 import LogLevel
28from voltha.protos.device_pb2 import DeviceType, DeviceTypes
29from voltha.protos.health_pb2 import HealthStatus
30from voltha.registry import registry
31
32_ = third_party
33log = structlog.get_logger()
34
35
36@implementer(IAdapterInterface)
37class AdtranOltAdapter(object):
38 name = 'adtran_olt'
39
40 supported_device_types = [
41 DeviceType(
42 id=name,
43 adapter=name,
44 accepts_bulk_flow_update=True
45 )
46 ]
47
48 def __init__(self, adapter_agent, config):
49 self.adapter_agent = adapter_agent
50 self.config = config
51 self.descriptor = Adapter(
52 id=self.name,
Chip Bolingae298012017-08-28 08:55:17 -050053 vendor='Adtran, Inc.',
Chip Boling61a12792017-10-02 13:23:27 -050054 version='0.7',
Chip Boling3e3b1a92017-05-16 11:51:18 -050055 config=AdapterConfig(log_level=LogLevel.INFO)
56 )
57 log.debug('adtran_olt.__init__', adapter_agent=adapter_agent)
58 self.devices_handlers = dict() # device_id -> AdtranOltHandler()
59 self.interface = registry('main').get_args().interface
Chip Boling252c7772017-08-16 10:13:17 -050060 self.logical_device_id_to_root_device_id = dict()
Chip Boling3e3b1a92017-05-16 11:51:18 -050061
62 def start(self):
63 """
64 Called once after adapter instance is loaded. Can be used to async
65 initialization.
66
67 :return: (None or Deferred)
68 """
Chip Boling3e3b1a92017-05-16 11:51:18 -050069 log.info('started', interface=self.interface)
70
71 def stop(self):
72 """
73 Called once before adapter is unloaded. It can be used to perform
74 any cleanup after the adapter.
75
76 :return: (None or Deferred)
77 """
Chip Boling3e3b1a92017-05-16 11:51:18 -050078 log.info('stopped', interface=self.interface)
79
80 def adapter_descriptor(self):
81 """
82 Return the adapter descriptor object for this adapter.
83
84 :return: voltha.Adapter grpc object (see voltha/protos/adapter.proto),
85 with adapter-specific information and config extensions.
86 """
87 log.debug('get descriptor', interface=self.interface)
88 return self.descriptor
89
90 def device_types(self):
91 """
92 Return list of device types supported by the adapter.
93
94 :return: voltha.DeviceTypes protobuf object, with optional type
95 specific extensions.
96 """
97 log.debug('get device_types', interface=self.interface, items=self.supported_device_types)
98 return DeviceTypes(items=self.supported_device_types)
99
100 def health(self):
101 """
102 Return a 3-state health status using the voltha.HealthStatus message.
103
104 :return: Deferred or direct return with voltha.HealthStatus message
105 """
106 log.debug('get health', interface=self.interface)
107 return HealthStatus(state=HealthStatus.HealthState.HEALTHY)
108
109 def change_master_state(self, master):
110 """
111 Called to indicate if plugin shall assume or lose master role. The
112 master role can be used to perform functions that must be performed
113 from a single point in the cluster. In single-node deployments of
114 Voltha, the plugins are always in master role.
115
116 :param master: (bool) True to indicate the mastership needs to be
117 assumed; False to indicate that mastership needs to be abandoned.
118 :return: (Deferred) which is fired by the adapter when mastership is
119 assumed/dropped, respectively.
120 """
121 log.debug('change_master_state', interface=self.interface, master=master)
122 raise NotImplementedError()
123
124 def adopt_device(self, device):
125 """
126 Make sure the adapter looks after given device. Called when a device
127 is provisioned top-down and needs to be activated by the adapter.
128
129 :param device: A voltha.Device object, with possible device-type
130 specific extensions. Such extensions shall be described as part of
131 the device type specification returned by device_types().
132 :return: (Deferred) Shall be fired to acknowledge device ownership.
133 """
134 log.info('adopt-device', device=device)
135 self.devices_handlers[device.id] = AdtranOltHandler(self, device.id)
136 reactor.callLater(0, self.devices_handlers[device.id].activate, device)
137 return device
138
khenaidooce681042017-06-12 11:25:34 -0400139 def reconcile_device(self, device):
140 """
Chip Boling7294b252017-06-15 16:16:55 -0500141 Make sure the adapter looks after given device. Called when this device has
142 changed ownership from another Voltha instance to this one (typically, this
143 occurs when the previous voltha instance went down).
khenaidooce681042017-06-12 11:25:34 -0400144
Chip Boling7294b252017-06-15 16:16:55 -0500145 :param device: A voltha.Device object, with possible device-type specific
146 extensions. Such extensions shall be described as part of
147 the device type specification returned by device_types().
148 :return: (Deferred) Shall be fired to acknowledge device ownership.
149 """
150 log.info('reconcile-device', device=device)
151 self.devices_handlers[device.id] = AdtranOltHandler(self, device.id)
152 reactor.callLater(0, self.devices_handlers[device.id].activate, device, reconciling=True)
153 return device
khenaidooce681042017-06-12 11:25:34 -0400154
Chip Boling3e3b1a92017-05-16 11:51:18 -0500155 def abandon_device(self, device):
156 """
157 Make sure the adapter no longer looks after device. This is called
158 if device ownership is taken over by another Voltha instance.
159
160 :param device: A Voltha.Device object.
161 :return: (Deferred) Shall be fired to acknowledge abandonment.
162 """
163 log.info('abandon-device', device=device)
Chip Boling7294b252017-06-15 16:16:55 -0500164 raise NotImplementedError()
Chip Boling3e3b1a92017-05-16 11:51:18 -0500165
166 def disable_device(self, device):
167 """
168 This is called when a previously enabled device needs to be disabled
169 based on a NBI call.
170
171 :param device: A Voltha.Device object.
172 :return: (Deferred) Shall be fired to acknowledge disabling the device.
173 """
Chip Boling69fba862017-08-18 15:11:32 -0500174 log.info('disable-device', device=device)
Chip Boling7294b252017-06-15 16:16:55 -0500175 reactor.callLater(0, self.devices_handlers[device.id].disable)
176 return device
Chip Boling3e3b1a92017-05-16 11:51:18 -0500177
178 def reenable_device(self, device):
179 """
180 This is called when a previously disabled device needs to be enabled
181 based on a NBI call.
182
183 :param device: A Voltha.Device object.
184 :return: (Deferred) Shall be fired to acknowledge re-enabling the device.
185 """
Chip Boling69fba862017-08-18 15:11:32 -0500186 log.info('reenable-device', device=device)
Chip Boling7294b252017-06-15 16:16:55 -0500187 reactor.callLater(0, self.devices_handlers[device.id].reenable)
188 return device
Chip Boling3e3b1a92017-05-16 11:51:18 -0500189
190 def reboot_device(self, device):
191 """
192 This is called to reboot a device based on a NBI call. The admin
193 state of the device will not change after the reboot
194
195 :param device: A Voltha.Device object.
196 :return: (Deferred) Shall be fired to acknowledge the reboot.
197 """
198 log.info('reboot_device', device=device)
Chip Boling7294b252017-06-15 16:16:55 -0500199 reactor.callLater(0, self.devices_handlers[device.id].reboot)
200 return device
Chip Boling3e3b1a92017-05-16 11:51:18 -0500201
Lydia Fang01f2e852017-06-28 17:24:58 -0700202 def download_image(self, device, request):
Chip Bolingae298012017-08-28 08:55:17 -0500203 """
204 This is called to request downloading a specified image into
205 the standby partition of a device based on a NBI call.
206 This call is expected to be non-blocking.
207 :param device: A Voltha.Device object.
208 A Voltha.ImageDownload object.
209 :return: (Deferred) Shall be fired to acknowledge the download.
210 """
Lydia Fang01f2e852017-06-28 17:24:58 -0700211 log.info('image_download', device=device, request=request)
212 raise NotImplementedError()
213
214 def get_image_download_status(self, device, request):
Chip Bolingae298012017-08-28 08:55:17 -0500215 """
216 This is called to inquire about a requested image download
217 status based on a NBI call.
218 The adapter is expected to update the DownloadImage DB object
219 with the query result
220 :param device: A Voltha.Device object.
221 A Voltha.ImageDownload object.
222 :return: (Deferred) Shall be fired to acknowledge
223 """
Lydia Fang01f2e852017-06-28 17:24:58 -0700224 log.info('get_image_download', device=device, request=request)
225 raise NotImplementedError()
226
227 def cancel_image_download(self, device, request):
Chip Bolingae298012017-08-28 08:55:17 -0500228 """
229 This is called to cancel a requested image download
230 based on a NBI call. The admin state of the device will not
231 change after the download.
232 :param device: A Voltha.Device object.
233 A Voltha.ImageDownload object.
234 :return: (Deferred) Shall be fired to acknowledge
235 """
Lydia Fang01f2e852017-06-28 17:24:58 -0700236 log.info('cancel_image_download', device=device)
237 raise NotImplementedError()
238
239 def activate_image_update(self, device, request):
Chip Bolingae298012017-08-28 08:55:17 -0500240 """
241 This is called to activate a downloaded image from
242 a standby partition into active partition.
243 Depending on the device implementation, this call
244 may or may not cause device reboot.
245 If no reboot, then a reboot is required to make the
246 activated image running on device
247 This call is expected to be non-blocking.
248 :param device: A Voltha.Device object.
249 A Voltha.ImageDownload object.
250 :return: (Deferred) OperationResponse object.
251 """
252 log.info('activate_image_update', device=device, request=request)
Lydia Fang01f2e852017-06-28 17:24:58 -0700253 raise NotImplementedError()
254
255 def revert_image_update(self, device, request):
Chip Bolingae298012017-08-28 08:55:17 -0500256 """
257 This is called to deactivate the specified image at
258 active partition, and revert to previous image at
259 standby partition.
260 Depending on the device implementation, this call
261 may or may not cause device reboot.
262 If no reboot, then a reboot is required to make the
263 previous image running on device
264 This call is expected to be non-blocking.
265 :param device: A Voltha.Device object.
266 A Voltha.ImageDownload object.
267 :return: (Deferred) OperationResponse object.
268 """
269 log.info('revert_image_update', device=device, request=request)
Lydia Fang01f2e852017-06-28 17:24:58 -0700270 raise NotImplementedError()
271
sathishg5ae86222017-06-28 15:16:29 +0530272 def self_test_device(self, device):
273 """
274 This is called to Self a device based on a NBI call.
275 :param device: A Voltha.Device object.
276 :return: Will return result of self test
277 """
Chip Boling5561d552017-07-07 15:11:26 -0500278 from voltha.protos.voltha_pb2 import SelfTestResponse
sathishg5ae86222017-06-28 15:16:29 +0530279 log.info('self-test-device', device=device.id)
Chip Boling5561d552017-07-07 15:11:26 -0500280
281 # TODO: Support self test?
282 return SelfTestResponse(result=SelfTestResponse.NOT_SUPPORTED)
sathishg5ae86222017-06-28 15:16:29 +0530283
Chip Boling3e3b1a92017-05-16 11:51:18 -0500284 def delete_device(self, device):
285 """
286 This is called to delete a device from the PON based on a NBI call.
287 If the device is an OLT then the whole PON will be deleted.
288
289 :param device: A Voltha.Device object.
290 :return: (Deferred) Shall be fired to acknowledge the deletion.
291 """
Chip Boling69fba862017-08-18 15:11:32 -0500292 log.info('delete-device', device=device)
Chip Boling7294b252017-06-15 16:16:55 -0500293 reactor.callLater(0, self.devices_handlers[device.id].delete)
294 return device
Chip Boling3e3b1a92017-05-16 11:51:18 -0500295
296 def get_device_details(self, device):
297 """
298 This is called to get additional device details based on a NBI call.
299
300 :param device: A Voltha.Device object.
301 :return: (Deferred) Shall be fired to acknowledge the retrieval of
302 additional details.
303 """
304 log.debug('get_device_details', device=device)
305 raise NotImplementedError()
306
307 def update_flows_bulk(self, device, flows, groups):
308 """
309 Called after any flow table change, but only if the device supports
310 bulk mode, which is expressed by the 'accepts_bulk_flow_update'
311 capability attribute of the device type.
312
313 :param device: A Voltha.Device object.
314 :param flows: An openflow_v13.Flows object
315 :param groups: An openflow_v13.Flows object
316 :return: (Deferred or None)
317 """
318 log.info('bulk-flow-update', device_id=device.id, flows=flows,
Chip Boling69fba862017-08-18 15:11:32 -0500319 groups=groups, num_flows=len(flows.items))
Chip Boling3e3b1a92017-05-16 11:51:18 -0500320 assert len(groups.items) == 0, "Cannot yet deal with groups"
Chip Boling7294b252017-06-15 16:16:55 -0500321
Chip Boling3e3b1a92017-05-16 11:51:18 -0500322 handler = self.devices_handlers[device.id]
323 return handler.update_flow_table(flows.items, device)
324
325 def update_flows_incrementally(self, device, flow_changes, group_changes):
326 """
327 [This mode is not supported yet.]
328
329 :param device: A Voltha.Device object.
330 :param flow_changes:
331 :param group_changes:
332 :return:
333 """
334 log.debug('update_flows_incrementally', device=device, flow_changes=flow_changes,
335 group_changes=group_changes)
336 raise NotImplementedError()
337
338 def update_pm_config(self, device, pm_configs):
339 """
340 Called every time a request is made to change pm collection behavior
341 :param device: A Voltha.Device object
342 :param pm_configs: A Pms
343 """
344 log.debug('update_pm_config', device=device, pm_configs=pm_configs)
Chip Boling5561d552017-07-07 15:11:26 -0500345 handler = self.devices_handlers[device.id]
346 handler.update_pm_config(device, pm_configs)
Chip Boling3e3b1a92017-05-16 11:51:18 -0500347
348 def send_proxied_message(self, proxy_address, msg):
349 """
350 Forward a msg to a child device of device, addressed by the given
351 proxy_address=Device.ProxyAddress().
352
353 :param proxy_address: Address info for the parent device
354 to route the message to the child device. This was given to the
355 child device by the parent device at the creation of the child
356 device.
357 :param msg: (str) The actual message to send.
358 :return: (Deferred(None) or None) The return of this method should
359 indicate that the message was successfully *sent*.
360 """
Chip Boling69fba862017-08-18 15:11:32 -0500361 log.debug('send-proxied-message', proxy_address=proxy_address, msg=msg)
Chip Boling3e3b1a92017-05-16 11:51:18 -0500362 handler = self.devices_handlers[proxy_address.device_id]
363 handler.send_proxied_message(proxy_address, msg)
364
365 def receive_proxied_message(self, proxy_address, msg):
366 """
367 Pass an async message (arrived via a proxy) to this device.
368
369 :param proxy_address: Address info for the parent device
370 to route the message to the child device. This was given to the
371 child device by the parent device at the creation of the child
372 device. Note this is the proxy_address with which the adapter
373 had to register prior to receiving proxied messages.
374 :param msg: (str) The actual message received.
375 :return: None
376 """
377 log.debug('receive_proxied_message', proxy_address=proxy_address, msg=msg)
378 raise NotImplementedError()
379
380 def receive_packet_out(self, logical_device_id, egress_port_no, msg):
381 """
382 Pass a packet_out message content to adapter so that it can forward it
383 out to the device. This is only called on root devices.
384
385 :param logical_device_id:
386 :param egress_port_no: egress logical port number
387 :param msg: actual message
388 :return: None
389 """
Chip Boling69fba862017-08-18 15:11:32 -0500390 log.debug('packet-out', logical_device_id=logical_device_id,
391 egress_port_no=egress_port_no, msg_len=len(msg))
Chip Boling5561d552017-07-07 15:11:26 -0500392
393 def ldi_to_di(ldi):
394 di = self.logical_device_id_to_root_device_id.get(ldi)
395 if di is None:
396 logical_device = self.adapter_agent.get_logical_device(ldi)
397 di = logical_device.root_device_id
398 self.logical_device_id_to_root_device_id[ldi] = di
399 return di
400
401 device_id = ldi_to_di(logical_device_id)
402 handler = self.devices_handlers[device_id]
403 handler.packet_out(egress_port_no, msg)
Chip Boling3e3b1a92017-05-16 11:51:18 -0500404
405 def receive_inter_adapter_message(self, msg):
406 """
Chip Boling252c7772017-08-16 10:13:17 -0500407 Called when the adapter receives a message that was sent to it directly
Chip Boling3e3b1a92017-05-16 11:51:18 -0500408 from another adapter. An adapter may register for these messages by calling
409 the register_for_inter_adapter_messages() method in the adapter agent.
410 Note that it is the responsibility of the sending and receiving
411 adapters to properly encode and decode the message.
412 :param msg: The message contents.
413 :return: None
414 """
415 log.info('rx_inter_adapter_msg')
416 raise NotImplementedError()
Chip Boling99004882017-05-19 15:36:19 -0500417
418 def suppress_alarm(self, filter):
Chip Boling5561d552017-07-07 15:11:26 -0500419 """
420 Inform an adapter that all incoming alarms should be suppressed
421 :param filter: A Voltha.AlarmFilter object.
422 :return: (Deferred) Shall be fired to acknowledge the suppression.
423 """
Chip Boling99004882017-05-19 15:36:19 -0500424 log.info('suppress_alarm', filter=filter)
425 raise NotImplementedError()
426
427 def unsuppress_alarm(self, filter):
Chip Boling5561d552017-07-07 15:11:26 -0500428 """
429 Inform an adapter that all incoming alarms should resume
430 :param filter: A Voltha.AlarmFilter object.
431 :return: (Deferred) Shall be fired to acknowledge the unsuppression.
432 """
Chip Boling99004882017-05-19 15:36:19 -0500433 log.info('unsuppress_alarm', filter=filter)
434 raise NotImplementedError()
Nikolay Titov89004ec2017-06-19 18:22:42 -0400435
Chip Boling5561d552017-07-07 15:11:26 -0500436 # PON Mgnt APIs #
Nikolay Titov89004ec2017-06-19 18:22:42 -0400437 def create_interface(self, device, data):
Chip Boling5561d552017-07-07 15:11:26 -0500438 """
439 API to create various interfaces (only some PON interfaces as of now)
440 in the devices
441 """
Chip Boling69fba862017-08-18 15:11:32 -0500442 log.info('create-interface', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500443 if device.id in self.devices_handlers:
444 handler = self.devices_handlers[device.id]
445 if handler is not None:
446 handler.create_interface(data)
Nikolay Titov89004ec2017-06-19 18:22:42 -0400447
448 def update_interface(self, device, data):
Chip Boling5561d552017-07-07 15:11:26 -0500449 """
450 API to update various interfaces (only some PON interfaces as of now)
451 in the devices
452 """
Chip Boling69fba862017-08-18 15:11:32 -0500453 log.info('update-interface', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500454 if device.id in self.devices_handlers:
455 handler = self.devices_handlers[device.id]
456 if handler is not None:
457 handler.update_interface(data)
Nikolay Titov89004ec2017-06-19 18:22:42 -0400458
459 def remove_interface(self, device, data):
Chip Boling5561d552017-07-07 15:11:26 -0500460 """
461 API to delete various interfaces (only some PON interfaces as of now)
462 in the devices
463 """
Chip Boling69fba862017-08-18 15:11:32 -0500464 log.info('remove-interface', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500465 if device.id in self.devices_handlers:
466 handler = self.devices_handlers[device.id]
467 if handler is not None:
468 handler.remove_interface(data)
Nikolay Titov89004ec2017-06-19 18:22:42 -0400469
Chip Bolingae298012017-08-28 08:55:17 -0500470 def receive_onu_detect_state(self, proxy_address, state):
Chip Boling5561d552017-07-07 15:11:26 -0500471 """
472 Receive onu detect state in ONU adapter
473 :param proxy_address: ONU device address
474 :param state: ONU detect state (bool)
475 :return: None
476 """
Nikolay Titov89004ec2017-06-19 18:22:42 -0400477 raise NotImplementedError()
Nikolay Titov176f1db2017-08-10 12:38:43 -0400478
479 def create_tcont(self, device, tcont_data, traffic_descriptor_data):
Chip Bolingae298012017-08-28 08:55:17 -0500480 """
481 API to create tcont object in the devices
482 :param device: device id
483 :tcont_data: tcont data object
484 :traffic_descriptor_data: traffic descriptor data object
485 :return: None
486 """
Chip Boling69fba862017-08-18 15:11:32 -0500487 log.info('create-tcont', tcont_data=tcont_data,
488 traffic_descriptor_data=traffic_descriptor_data)
Chip Boling27275992017-09-22 15:17:04 -0500489 if device.id in self.devices_handlers:
490 handler = self.devices_handlers[device.id]
491 if handler is not None:
492 handler.create_tcont(tcont_data, traffic_descriptor_data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400493
494 def update_tcont(self, device, tcont_data, traffic_descriptor_data):
Chip Bolingae298012017-08-28 08:55:17 -0500495 """
496 API to update tcont object in the devices
497 :param device: device id
498 :tcont_data: tcont data object
499 :traffic_descriptor_data: traffic descriptor data object
500 :return: None
501 """
Chip Boling69fba862017-08-18 15:11:32 -0500502 log.info('update-tcont', tcont_data=tcont_data,
503 traffic_descriptor_data=traffic_descriptor_data)
Chip Boling27275992017-09-22 15:17:04 -0500504 if device.id in self.devices_handlers:
505 handler = self.devices_handlers[device.id]
506 if handler is not None:
507 handler.update_tcont(tcont_data, traffic_descriptor_data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400508
509 def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
Chip Bolingae298012017-08-28 08:55:17 -0500510 """
511 API to delete tcont object in the devices
512 :param device: device id
513 :tcont_data: tcont data object
514 :traffic_descriptor_data: traffic descriptor data object
515 :return: None
516 """
Chip Boling69fba862017-08-18 15:11:32 -0500517 log.info('remove-tcont', tcont_data=tcont_data,
518 traffic_descriptor_data=traffic_descriptor_data)
Chip Boling27275992017-09-22 15:17:04 -0500519 if device.id in self.devices_handlers:
520 handler = self.devices_handlers[device.id]
521 if handler is not None:
522 handler.remove_tcont(tcont_data, traffic_descriptor_data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400523
524 def create_gemport(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500525 """
526 API to create gemport object in the devices
527 :param device: device id
528 :data: gemport data object
529 :return: None
530 """
Chip Boling69fba862017-08-18 15:11:32 -0500531 log.info('create-gemport', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500532 if device.id in self.devices_handlers:
533 handler = self.devices_handlers[device.id]
534 if handler is not None:
535 handler.create_gemport(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400536
537 def update_gemport(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500538 """
539 API to update gemport object in the devices
540 :param device: device id
541 :data: gemport data object
542 :return: None
543 """
Chip Boling69fba862017-08-18 15:11:32 -0500544 log.info('update-gemport', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500545 if device.id in self.devices_handlers:
546 handler = self.devices_handlers[device.id]
547 if handler is not None:
548 handler.update_gemport(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400549
550 def remove_gemport(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500551 """
552 API to delete gemport object in the devices
553 :param device: device id
554 :data: gemport data object
555 :return: None
556 """
Chip Boling69fba862017-08-18 15:11:32 -0500557 log.info('remove-gemport', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500558 if device.id in self.devices_handlers:
559 handler = self.devices_handlers[device.id]
560 if handler is not None:
561 handler.remove_gemport(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400562
563 def create_multicast_gemport(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500564 """
565 API to create multicast gemport object in the devices
566 :param device: device id
567 :data: multicast gemport data object
568 :return: None
569 """
Chip Boling69fba862017-08-18 15:11:32 -0500570 log.info('create-mcast-gemport', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500571 if device.id in self.devices_handlers:
572 handler = self.devices_handlers[device.id]
573 if handler is not None:
574 handler.create_multicast_gemport(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400575
576 def update_multicast_gemport(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500577 """
578 API to update multicast gemport object in the devices
579 :param device: device id
580 :data: multicast gemport data object
581 :return: None
582 """
Chip Boling69fba862017-08-18 15:11:32 -0500583 log.info('update-mcast-gemport', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500584 if device.id in self.devices_handlers:
585 handler = self.devices_handlers[device.id]
586 if handler is not None:
587 handler.update_multicast_gemport(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400588
589 def remove_multicast_gemport(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500590 """
591 API to delete multicast gemport object in the devices
592 :param device: device id
593 :data: multicast gemport data object
594 :return: None
595 """
Chip Boling69fba862017-08-18 15:11:32 -0500596 log.info('remove-mcast-gemport', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500597 if device.id in self.devices_handlers:
598 handler = self.devices_handlers[device.id]
599 if handler is not None:
600 handler.remove_multicast_gemport(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400601
602 def create_multicast_distribution_set(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500603 """
604 API to create multicast distribution rule to specify
605 the multicast VLANs that ride on the multicast gemport
606 :param device: device id
607 :data: multicast distribution data object
608 :return: None
609 """
Chip Boling69fba862017-08-18 15:11:32 -0500610 log.info('create-mcast-distribution-set', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500611 if device.id in self.devices_handlers:
612 handler = self.devices_handlers[device.id]
613 if handler is not None:
614 handler.create_multicast_distribution_set(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400615
616 def update_multicast_distribution_set(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500617 """
618 API to update multicast distribution rule to specify
619 the multicast VLANs that ride on the multicast gemport
620 :param device: device id
621 :data: multicast distribution data object
622 :return: None
623 """
Chip Boling69fba862017-08-18 15:11:32 -0500624 log.info('update-mcast-distribution-set', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500625 if device.id in self.devices_handlers:
626 handler = self.devices_handlers[device.id]
627 if handler is not None:
628 handler.create_multicast_distribution_set(data)
Nikolay Titov176f1db2017-08-10 12:38:43 -0400629
630 def remove_multicast_distribution_set(self, device, data):
Chip Bolingae298012017-08-28 08:55:17 -0500631 """
632 API to delete multicast distribution rule to specify
633 the multicast VLANs that ride on the multicast gemport
634 :param device: device id
635 :data: multicast distribution data object
636 :return: None
637 """
Chip Boling69fba862017-08-18 15:11:32 -0500638 log.info('remove-mcast-distribution-set', data=data)
Chip Boling27275992017-09-22 15:17:04 -0500639 if device.id in self.devices_handlers:
640 handler = self.devices_handlers[device.id]
641 if handler is not None:
642 handler.create_multicast_distribution_set(data)