blob: 83a517f9d74dde2b5efe2212299d58ff64fba74c [file] [log] [blame]
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -05001#
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#
Matt Jeanneret810148b2019-09-29 12:44:01 -040016
Matt Jeanneret2e3cb8d2019-11-16 09:22:41 -050017from __future__ import absolute_import
Matt Jeanneret810148b2019-09-29 12:44:01 -040018import structlog
Matt Jeanneret72f96fc2019-02-11 10:53:05 -050019from pyvoltha.adapters.extensions.omci.tasks.task import Task
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050020from twisted.internet import reactor
21from twisted.internet.defer import inlineCallbacks, failure, returnValue
Matt Jeanneret72f96fc2019-02-11 10:53:05 -050022from pyvoltha.adapters.extensions.omci.omci_defs import ReasonCodes, EntityOperations
Mahir Gunyel45610b42020-03-16 17:29:01 -070023from pyvoltha.adapters.extensions.omci.omci_entities import VlanTaggingFilterData
Matt Jeanneret810148b2019-09-29 12:44:01 -040024from pyvoltha.adapters.extensions.omci.omci_me import \
Mahir Gunyel45610b42020-03-16 17:29:01 -070025 VlanTaggingOperation, VlanTaggingFilterDataFrame, ExtendedVlanTaggingOperationConfigurationDataFrame, \
26 ExtendedVlanTaggingOperationConfigurationData
Matt Jeanneret2e3cb8d2019-11-16 09:22:41 -050027from uni_port import UniType
Andrea Campanellacf916ea2020-02-14 10:03:58 +010028from uni_port import RESERVED_TRANSPARENT_VLAN
Matt Jeanneret2e3cb8d2019-11-16 09:22:41 -050029from pon_port import DEFAULT_TPID
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050030
31RC = ReasonCodes
32OP = EntityOperations
33
34
35class BrcmVlanFilterException(Exception):
36 pass
37
38
39class BrcmVlanFilterTask(Task):
40 """
41 Apply Vlan Tagging Filter Data and Extended VLAN Tagging Operation Configuration on an ANI and UNI
42 """
43 task_priority = 200
Matt Jeanneret810148b2019-09-29 12:44:01 -040044 name = "Broadcom VLAN Filter/Tagging Task"
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050045
Mahir Gunyeld680cb62020-02-18 10:28:12 -080046 def __init__(self, omci_agent, handler, uni_port, set_vlan_id,
47 match_vlan=0, set_vlan_pcp=8, add_tag=True,
48 priority=task_priority, tp_id=0):
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050049 """
50 Class initialization
51
52 :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
Matt Jeanneret810148b2019-09-29 12:44:01 -040053 :param handler: (BrcmOpenomciOnuHandler) ONU Device Handler Instance
54 :param uni_port: (UniPort) Object instance representing the uni port and its settings
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050055 :param set_vlan_id: (int) VLAN to filter for and set
Mahir Gunyel45610b42020-03-16 17:29:01 -070056 :param add_tag: (bool) Flag to identify VLAN Tagging or Untagging
Girish Gowdraa73ee452019-12-20 18:52:17 +053057 :param tp_id: (int) TP ID for the flow
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050058 :param priority: (int) OpenOMCI Task priority (0..255) 255 is the highest
59 """
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050060 super(BrcmVlanFilterTask, self).__init__(BrcmVlanFilterTask.name,
61 omci_agent,
Matt Jeanneret810148b2019-09-29 12:44:01 -040062 handler.device_id,
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050063 priority=priority,
64 exclusive=True)
Matt Jeanneret08a8e862019-12-20 14:02:32 -050065
66 self.log = structlog.get_logger(device_id=handler.device_id,
67 name=BrcmVlanFilterTask.name,
68 task_id=self._task_id,
69 entity_id=uni_port.entity_id,
70 uni_id=uni_port.uni_id,
71 uni_port=uni_port.port_number,
72 set_vlan_id=set_vlan_id)
73
Mahir Gunyel45610b42020-03-16 17:29:01 -070074 self._onu_handler = handler
Matt Jeanneret810148b2019-09-29 12:44:01 -040075 self._device = omci_agent.get_device(handler.device_id)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050076 self._uni_port = uni_port
77 self._set_vlan_id = set_vlan_id
Mahir Gunyel45610b42020-03-16 17:29:01 -070078
79 # If not setting any pbit, copy the pbit from the received vlan tag
80 if set_vlan_pcp is None:
81 self._set_vlan_pcp = 8 # Copy from the inner priority of the received frame
82 else:
83 self._set_vlan_pcp = set_vlan_pcp
84
85 # If not matching on any vlan do not filter for vlan value. effectively match on untagged
86 if match_vlan is None:
87 self._match_vlan = RESERVED_TRANSPARENT_VLAN # Do not filter on the VID
88 else:
89 self._match_vlan = match_vlan
90
91 self._vlan_pcp = 8 # Do not filter on priority
92
93 # If the tag is not transparent then need to remove it.
94 self._treatment_tags_to_remove = 1
95 if self._match_vlan == RESERVED_TRANSPARENT_VLAN: # Do not filter on the VID
96 self._vlan_pcp = 15 # This entry is a no-tag rule; ignore all other VLAN tag filter fields
97 self._treatment_tags_to_remove = 0
98
99 # If matching on untagged and trying to copy pbit from non-existent received vlan, set pbit to zero
100 if self._match_vlan == RESERVED_TRANSPARENT_VLAN and self._set_vlan_pcp == 8:
101 self._set_vlan_pcp = 0
102
Mahir Gunyela982ec32020-02-25 12:30:37 -0800103 self._add_tag = add_tag
Girish Gowdraa73ee452019-12-20 18:52:17 +0530104 self._tp_id = tp_id
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500105 self._results = None
106 self._local_deferred = None
107 self._config = self._device.configuration
Matt Jeanneret810148b2019-09-29 12:44:01 -0400108 self._input_tpid = DEFAULT_TPID
109 self._output_tpid = DEFAULT_TPID
110
111 self._mac_bridge_service_profile_entity_id = \
112 handler.mac_bridge_service_profile_entity_id
113 self._ieee_mapper_service_profile_entity_id = \
114 handler.pon_port.ieee_mapper_service_profile_entity_id
115 self._mac_bridge_port_ani_entity_id = \
116 handler.pon_port.mac_bridge_port_ani_entity_id
117 self._gal_enet_profile_entity_id = \
118 handler.gal_enet_profile_entity_id
119
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500120 def cancel_deferred(self):
121 super(BrcmVlanFilterTask, self).cancel_deferred()
122
123 d, self._local_deferred = self._local_deferred, None
124 try:
125 if d is not None and not d.called:
126 d.cancel()
127 except:
128 pass
129
130 def start(self):
131 """
132 Start Vlan Tagging Task
133 """
134 super(BrcmVlanFilterTask, self).start()
135 self._local_deferred = reactor.callLater(0, self.perform_vlan_tagging)
136
137 @inlineCallbacks
138 def perform_vlan_tagging(self):
139 """
140 Perform the vlan tagging
141 """
Mahir Gunyel45610b42020-03-16 17:29:01 -0700142 self.log.debug('vlan-filter-tagging-task', uni_port=self._uni_port, set_vlan_id=self._set_vlan_id,
143 set_vlan_pcp=self._set_vlan_pcp, match_vlan=self._match_vlan, tp_id=self._tp_id,
144 add_tag=self._add_tag)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500145 try:
Mahir Gunyela982ec32020-02-25 12:30:37 -0800146 if self._add_tag:
Mahir Gunyel45610b42020-03-16 17:29:01 -0700147 if not self._onu_handler.args.accept_incremental_evto_update:
148 yield self._bulk_update_evto_and_vlan_tag_filter()
Mahir Gunyela982ec32020-02-25 12:30:37 -0800149 else:
Mahir Gunyel45610b42020-03-16 17:29:01 -0700150 yield self._incremental_update_evto_and_vlan_tag_filter()
151 else: # addTag = False
152 if self._onu_handler.args.accept_incremental_evto_update:
153 self.log.info('removing-vlan-tagging')
154 yield self._delete_service_flow()
155 yield self._delete_vlan_filter_entity()
156 else:
157 # Will be reset anyway on new vlan tagging operation
158 self.log.info("not-removing-vlan-tagging")
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500159 self.deferred.callback(self)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500160 except Exception as e:
161 self.log.exception('setting-vlan-tagging', e=e)
162 self.deferred.errback(failure.Failure(e))
163
164 def check_status_and_state(self, results, operation=''):
165 """
166 Check the results of an OMCI response. An exception is thrown
167 if the task was cancelled or an error was detected.
168
169 :param results: (OmciFrame) OMCI Response frame
170 :param operation: (str) what operation was being performed
171 :return: True if successful, False if the entity existed (already created)
172 """
173
174 omci_msg = results.fields['omci_message'].fields
175 status = omci_msg['success_code']
176 error_mask = omci_msg.get('parameter_error_attributes_mask', 'n/a')
177 failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
178 unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
179
Matt Jeannerete8fc53e2019-04-13 15:58:33 -0400180 self.log.debug("OMCI Result", operation=operation, omci_msg=omci_msg,
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500181 status=status, error_mask=error_mask,
182 failed_mask=failed_mask, unsupported_mask=unsupported_mask)
183
184 if status == RC.Success:
185 self.strobe_watchdog()
186 return True
187
188 elif status == RC.InstanceExists:
189 return False
Harsh Awasthib10a7082019-08-26 02:17:33 -0400190
Mahir Gunyel45610b42020-03-16 17:29:01 -0700191 @inlineCallbacks
192 def _delete_service_flow(self):
193 extended_vlan_tagging_entity_id = self._mac_bridge_service_profile_entity_id + \
194 self._uni_port.mac_bridge_port_num
195
196 # See G.988 regarding evto row deletes for "default" flows:
197 #
198 # As an exception to the rule on ordered processing, these default rules are always
199 # considered as a last resort for frames that do not match any other rule. Best
200 # practice dictates that these entries not be deleted by the OLT; however, they
201 # can be modified to produce the desired default behaviour.
202 #
203 # 15, 4096, x, 15, 4096, x, 0, (0, 15, x, x, 15, x, x) – no tags
204 # 15, 4096, x, 14, 4096, x, 0, (0, 15, x, x, 15, x, x) – 1 tag
205 # 14, 4096, x, 14, 4096, x, 0, (0, 15, x, x, 15, x, x) – 2 tags
206
207 # outer_prio is 15, outer vid is 4096 inner prio is 15, inner vid is 4096
208 # its a default rule... dont delete it.
209 if self._match_vlan == RESERVED_TRANSPARENT_VLAN and self._vlan_pcp == 15:
210 self.log.warn("should-not-delete-onu-builtin-no-tag-flow")
211 return
212
213 # outer_prio is 15, outer vid is 4096 inner prio is 14, inner vid is 4096
214 # its a default rule... dont delete it.
215 if self._match_vlan == RESERVED_TRANSPARENT_VLAN and self._vlan_pcp == 14:
216 self.log.warn("should-not-delete-onu-builtin-single-tag-flow")
217 return
218
219 entry = VlanTaggingOperation(
220 filter_outer_priority=15,
221 filter_outer_vid=4096,
222 filter_outer_tpid_de=0,
223
224 filter_inner_priority=self._vlan_pcp,
225 filter_inner_vid=self._match_vlan,
226 filter_inner_tpid_de=0,
227 filter_ether_type=0
228 )
229 # delete this entry using the filter rules as the key.
230 # this function automatically fills 0xFF in the last 8 treatment bytes
231 entry = entry.delete()
232 attributes = dict(received_frame_vlan_tagging_operation_table=entry)
233
234 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
235 extended_vlan_tagging_entity_id, # Bridge Entity ID
236 attributes=attributes # See above
237 )
238 frame = msg.set()
239 self.log.debug('openomci-msg', omci_msg=msg)
240 results = yield self._device.omci_cc.send(frame)
241 self.check_status_and_state(results, 'delete-service-flow')
242
243 @inlineCallbacks
244 def _delete_vlan_filter_entity(self):
245 vlan_tagging_entity_id = int(self._mac_bridge_port_ani_entity_id + self._uni_port.entity_id
246 + self._tp_id)
247 self.log.debug("Vlan tagging filter data frame will be deleted.",
248 expected_me_id=vlan_tagging_entity_id)
249 msg = VlanTaggingFilterDataFrame(vlan_tagging_entity_id)
250 frame = msg.delete()
251 self.log.debug('openomci-msg', omci_msg=msg)
252 results = yield self._device.omci_cc.send(frame)
253 self.check_status_and_state(results, 'flow-delete-vlan-tagging-filter-data')
254
255 @inlineCallbacks
256 def _create_vlan_filter_entity(self, vlan_tagging_entity_id):
257
258 self.log.debug("Vlan tagging filter data frame will be created.",
259 expected_me_id=vlan_tagging_entity_id)
260 vlan_tagging_me = self._device.query_mib(VlanTaggingFilterData.class_id,
261 instance_id=int(vlan_tagging_entity_id))
262 if len(vlan_tagging_me) == 0:
263 forward_operation = 0x10 # VID investigation
264 self.log.debug("vlan id isn't reserved")
265 self.log.debug("forward_operation", forward_operation=forward_operation)
266 self.log.debug("set_vlan_id", vlan_id=self._set_vlan_id)
267 # When the PUSH VLAN is RESERVED_VLAN (4095), let ONU be transparent
268 if self._set_vlan_id == RESERVED_TRANSPARENT_VLAN:
269 forward_operation = 0x00 # no investigation, ONU transparent
270
271 # Create bridge ani side vlan filter
272 msg = VlanTaggingFilterDataFrame(
273 int(vlan_tagging_entity_id), # Entity ID
274 vlan_tcis=[self._set_vlan_id], # VLAN IDs
275 forward_operation=forward_operation
276 )
277
278 self.log.debug("created vlan tagging data frame msg")
279 frame = msg.create()
280 self.log.debug('openomci-msg', omci_msg=msg)
281 results = yield self._device.omci_cc.send(frame)
282 self.check_status_and_state(results, 'create-vlan-tagging-filter-data')
283
284 @inlineCallbacks
285 def _reset_evto_and_vlan_tag_filter(self):
286 self.log.info("resetting-evto-and-vlan-tag-filter")
287 # Delete bridge ani side vlan filter
288 eid = self._mac_bridge_port_ani_entity_id + self._uni_port.entity_id + self._tp_id # Entity ID
289 msg = VlanTaggingFilterDataFrame(eid)
290 frame = msg.delete()
291 self.log.debug('openomci-msg', omci_msg=msg)
292 self.strobe_watchdog()
293 results = yield self._device.omci_cc.send(frame)
294 self.check_status_and_state(results, 'flow-delete-vlan-tagging-filter-data')
295
296 ################################################################################
297 # Create Extended VLAN Tagging Operation config (UNI-side)
298 #
299 # EntityID relates to the VLAN TCIS later used int vlan filter task. This only
300 # sets up the inital MIB entry as it relates to port config, it does not set vlan
301 # that is saved for the vlan filter task
302 #
303 # References:
304 # - PPTP Ethernet or VEIP UNI
305 #
306
307 # Delete uni side evto
308 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
309 self._mac_bridge_service_profile_entity_id + self._uni_port.mac_bridge_port_num,
310 )
311 frame = msg.delete()
312 self.log.debug('openomci-msg', omci_msg=msg)
313 results = yield self._device.omci_cc.send(frame)
314 self.check_status_and_state(results, 'delete-extended-vlan-tagging-operation-configuration-data')
315
316 # Re-Create uni side evto
317 # default to PPTP
318 association_type = 2
319 if self._uni_port.type.value == UniType.VEIP.value:
320 association_type = 10
321 elif self._uni_port.type.value == UniType.PPTP.value:
322 association_type = 2
323
324 attributes = dict(
325 association_type=association_type, # Assoc Type, PPTP/VEIP Ethernet UNI
326 associated_me_pointer=self._uni_port.entity_id, # Assoc ME, PPTP/VEIP Entity Id
327
328 # See VOL-1311 - Need to set table during create to avoid exception
329 # trying to read back table during post-create-read-missing-attributes
330 # But, because this is a R/W attribute. Some ONU may not accept the
331 # value during create. It is repeated again in a set below.
332 input_tpid=self._input_tpid, # input TPID
333 output_tpid=self._output_tpid, # output TPID
334 )
335
336 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
337 self._mac_bridge_service_profile_entity_id + self._uni_port.mac_bridge_port_num, # Bridge Entity ID
338 attributes=attributes
339 )
340
341 frame = msg.create()
342 self.log.debug('openomci-msg', omci_msg=msg)
343 results = yield self._device.omci_cc.send(frame)
344 self.check_status_and_state(results, 'create-extended-vlan-tagging-operation-configuration-data')
345
346 @inlineCallbacks
347 def _incremental_update_evto_and_vlan_tag_filter(self):
348 self.log.info("incremental-update-evto-and-vlan-tag-filter")
349 vlan_tagging_entity_id = int(self._mac_bridge_port_ani_entity_id + self._uni_port.entity_id
350 + self._tp_id)
351 extended_vlan_tagging_entity_id = self._mac_bridge_service_profile_entity_id + \
352 self._uni_port.mac_bridge_port_num
353 ################################################################################
354 # VLAN Tagging Filter config
355 #
356 # EntityID will be referenced by:
357 # - Nothing
358 # References:
359 # - MacBridgePortConfigurationData for the ANI/PON side
360 #
361
362 # TODO: check if its in our local mib first before blindly deleting
363 if self._tp_id != 0:
364 yield self._create_vlan_filter_entity(vlan_tagging_entity_id)
365
366 self.log.info('setting-vlan-tagging')
367 attributes = dict(
368 # Specifies the TPIDs in use and that operations in the downstream direction are
369 # inverse to the operations in the upstream direction
370 input_tpid=self._input_tpid, # input TPID
371 output_tpid=self._output_tpid, # output TPID
372 downstream_mode=0, # inverse of upstream
373 )
374
375 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
376 extended_vlan_tagging_entity_id, # Bridge Entity ID
377 attributes=attributes
378 )
379
380 frame = msg.set()
381 self.log.debug('openomci-msg', omci_msg=msg)
382 self.strobe_watchdog()
383 results = yield self._device.omci_cc.send(frame)
384 self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data')
385
386 # Onu-Transparent
387 if self._set_vlan_id == RESERVED_TRANSPARENT_VLAN:
388 # Transparently send any single tagged packet.
389 # As the onu is to be transparent, no need to create VlanTaggingFilterData ME.
390 # Any other specific rules will take priority over this, so not setting any other vlan specific rules
391 entry = VlanTaggingOperation(
392 filter_outer_priority=15, # not an outer tag rule, ignore all other outers
393 filter_outer_vid=4096, # ignore
394 filter_outer_tpid_de=0, # ignore
395 filter_inner_priority=14, # default single tagged rule
396 filter_inner_vid=4096, # do not match on vlan value
397 filter_inner_tpid_de=0, # do not match on tpid
398 filter_ether_type=0, # do not filter on untagged ethertype
399 treatment_tags_to_remove=0, # do not remove any tags
400 treatment_outer_priority=15, # do not add outer tag
401 treatment_outer_vid=0, # ignore
402 treatment_outer_tpid_de=0, # ignore
403 treatment_inner_priority=15, # do not add inner tag
404 treatment_inner_vid=0, # ignore
405 treatment_inner_tpid_de=4 # set TPID 0x8100
406 )
407
408 attributes = dict(received_frame_vlan_tagging_operation_table=entry)
409 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
410 extended_vlan_tagging_entity_id, # Bridge Entity ID
411 attributes=attributes
412 )
413
414 frame = msg.set()
415 self.log.debug('openomci-msg', omci_msg=msg)
416 self.strobe_watchdog()
417 results = yield self._device.omci_cc.send(frame)
418 self.check_status_and_state(results, 'set-evto-table-transparent-vlan')
419 else:
420 # Update uni side extended vlan filter
421 # filter for any set vlan - even its match tag is TRANSPARENT.
422 # For TRANSPARENT match_vlan tag case we modified vlan_pcp and treatment_tags_to_remove values during init.
423 entry = VlanTaggingOperation(
424 filter_outer_priority=15, # This entry is not a double-tag rule
425 filter_outer_vid=4096, # Do not filter on the outer VID value
426 filter_outer_tpid_de=0, # Do not filter on the outer TPID field
427
428 filter_inner_priority=self._vlan_pcp, # Filter on inner vlan
429 filter_inner_vid=self._match_vlan, # Look for match vlan
430 filter_inner_tpid_de=0, # Do not filter on inner TPID field
431 filter_ether_type=0, # Do not filter on EtherType
432
433 treatment_tags_to_remove=self._treatment_tags_to_remove,
434 treatment_outer_priority=15,
435 treatment_outer_vid=0,
436 treatment_outer_tpid_de=0,
437
438 treatment_inner_priority=self._set_vlan_pcp, # Add an inner priority
439 treatment_inner_vid=self._set_vlan_id, # use this value as the VID in the inner VLAN tag
440 treatment_inner_tpid_de=4, # set TPID
441 )
442
443 attributes = dict(received_frame_vlan_tagging_operation_table=entry)
444 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
445 extended_vlan_tagging_entity_id, # Bridge Entity ID
446 attributes=attributes # See above
447 )
448 frame = msg.set()
449 self.log.debug('openomci-msg', omci_msg=msg)
450 self.strobe_watchdog()
451 results = yield self._device.omci_cc.send(frame)
452 self.check_status_and_state(results, 'set-evto-table')
453
454 @inlineCallbacks
455 def _bulk_update_evto_and_vlan_tag_filter(self):
456 self.log.info("bulk-update-evto-and-vlan-tag-filter")
457 # First reset any existing config EVTO and vlan tag filter on the ONU
458 yield self._reset_evto_and_vlan_tag_filter()
459
460 vlan_tagging_entity_id = int(self._mac_bridge_port_ani_entity_id + self._uni_port.entity_id
461 + self._tp_id)
462 extended_vlan_tagging_entity_id = self._mac_bridge_service_profile_entity_id + \
463 self._uni_port.mac_bridge_port_num
464 attributes = dict(
465 # Specifies the TPIDs in use and that operations in the downstream direction are
466 # inverse to the operations in the upstream direction
467 input_tpid=self._input_tpid, # input TPID
468 output_tpid=self._output_tpid, # output TPID
469 downstream_mode=0, # inverse of upstream
470 )
471
472 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
473 extended_vlan_tagging_entity_id, # Bridge Entity ID
474 attributes=attributes
475 )
476
477 frame = msg.set()
478 self.log.debug('openomci-msg', omci_msg=msg)
479 self.strobe_watchdog()
480 results = yield self._device.omci_cc.send(frame)
481 self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data')
482
483 # Onu-Transparent
484 if self._set_vlan_id == RESERVED_TRANSPARENT_VLAN:
485 # Transparently send any single tagged packet.
486 # As the onu is to be transparent, no need to create VlanTaggingFilterData ME.
487 # Any other specific rules will take priority over this, so not setting any other vlan specific rules
488 attributes = dict(
489 received_frame_vlan_tagging_operation_table=
490 VlanTaggingOperation(
491 filter_outer_priority=15,
492 filter_outer_vid=4096,
493 filter_outer_tpid_de=0,
494 filter_inner_priority=14,
495 filter_inner_vid=4096,
496 filter_inner_tpid_de=0,
497 filter_ether_type=0,
498 treatment_tags_to_remove=0,
499 treatment_outer_priority=15,
500 treatment_outer_vid=0,
501 treatment_outer_tpid_de=0,
502 treatment_inner_priority=15,
503 treatment_inner_vid=0,
504 treatment_inner_tpid_de=4
505 )
506 )
507
508 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
509 extended_vlan_tagging_entity_id, # Bridge Entity ID
510 attributes=attributes
511 )
512
513 frame = msg.set()
514 self.log.debug('openomci-msg', omci_msg=msg)
515 self.strobe_watchdog()
516 results = yield self._device.omci_cc.send(frame)
517 self.check_status_and_state(results, 'set-evto-table-transparent-vlan')
518
519 else:
520 # Re-Create bridge ani side vlan filter
521 forward_operation = 0x10 # VID investigation
522
523 msg = VlanTaggingFilterDataFrame(
524 vlan_tagging_entity_id,
525 vlan_tcis=[self._set_vlan_id], # VLAN IDs
526 forward_operation=forward_operation
527 )
528 frame = msg.create()
529 self.log.debug('openomci-msg', omci_msg=msg)
530 self.strobe_watchdog()
531 results = yield self._device.omci_cc.send(frame)
532 self.check_status_and_state(results, 'flow-create-vlan-tagging-filter-data')
533 # Update uni side extended vlan filter
534 # filter for untagged
535 attributes = dict(
536 received_frame_vlan_tagging_operation_table=
537 VlanTaggingOperation(
538 filter_outer_priority=15,
539 filter_outer_vid=4096,
540 filter_outer_tpid_de=0,
541 filter_inner_priority=15,
542 filter_inner_vid=4096,
543 filter_inner_tpid_de=0,
544 filter_ether_type=0,
545 treatment_tags_to_remove=0,
546 treatment_outer_priority=15,
547 treatment_outer_vid=0,
548 treatment_outer_tpid_de=0,
549 treatment_inner_priority=0,
550 treatment_inner_vid=self._set_vlan_id,
551 treatment_inner_tpid_de=4
552 )
553 )
554
555 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
556 extended_vlan_tagging_entity_id, # Bridge Entity ID
557 attributes=attributes
558 )
559
560 frame = msg.set()
561 self.log.debug('openomci-msg', omci_msg=msg)
562 self.strobe_watchdog()
563 results = yield self._device.omci_cc.send(frame)
564 self.check_status_and_state(results, 'set-evto-table-untagged')
565
566 # Update uni side extended vlan filter
567 # filter for vlan 0
568 attributes = dict(
569 received_frame_vlan_tagging_operation_table=
570 VlanTaggingOperation(
571 filter_outer_priority=15, # This entry is not a double-tag rule
572 filter_outer_vid=4096, # Do not filter on the outer VID value
573 filter_outer_tpid_de=0, # Do not filter on the outer TPID field
574
575 filter_inner_priority=8, # Filter on inner vlan
576 filter_inner_vid=0x0, # Look for vlan 0
577 filter_inner_tpid_de=0, # Do not filter on inner TPID field
578 filter_ether_type=0, # Do not filter on EtherType
579
580 treatment_tags_to_remove=1,
581 treatment_outer_priority=15,
582 treatment_outer_vid=0,
583 treatment_outer_tpid_de=0,
584
585 treatment_inner_priority=8, # Add an inner tag and insert this value as the priority
586 treatment_inner_vid=self._set_vlan_id, # use this value as the VID in the inner VLAN tag
587 treatment_inner_tpid_de=4, # set TPID
588 )
589 )
590 msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
591 extended_vlan_tagging_entity_id, # Bridge Entity ID
592 attributes=attributes # See above
593 )
594 frame = msg.set()
595 self.log.debug('openomci-msg', omci_msg=msg)
596 self.strobe_watchdog()
597 results = yield self._device.omci_cc.send(frame)
598 self.check_status_and_state(results, 'set-evto-table-zero-tagged')