blob: 6af1a7377fe06baf6248ed8852d46481af47f186 [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 Jeanneret2e3cb8d2019-11-16 09:22:41 -050016from __future__ import absolute_import
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050017import structlog
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050018from twisted.internet import reactor
Matt Jeanneret2e3cb8d2019-11-16 09:22:41 -050019from twisted.internet.defer import inlineCallbacks, TimeoutError, failure
20from pyvoltha.adapters.extensions.omci.omci_me import Ont2G, OmciNullPointer, PriorityQueueFrame, \
Girish Gowdrae933cd32019-11-21 21:04:41 +053021 Ieee8021pMapperServiceProfileFrame, MacBridgePortConfigurationDataFrame
Matt Jeanneret72f96fc2019-02-11 10:53:05 -050022from pyvoltha.adapters.extensions.omci.tasks.task import Task
Matt Jeanneret2e3cb8d2019-11-16 09:22:41 -050023from pyvoltha.adapters.extensions.omci.omci_defs import EntityOperations, ReasonCodes
Girish Gowdrae933cd32019-11-21 21:04:41 +053024from pyvoltha.adapters.extensions.omci.omci_entities import OntG, Tcont, PriorityQueueG, Ieee8021pMapperServiceProfile
aishwaryarana0180594ce2019-07-26 15:31:14 -050025
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050026OP = EntityOperations
27RC = ReasonCodes
28
Girish Gowdrae933cd32019-11-21 21:04:41 +053029SETUP_TP_TASK_PRIORITY = 240
30
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050031
32class TechProfileDownloadFailure(Exception):
33 """
34 This error is raised by default when the download fails
35 """
36
37
38class TechProfileResourcesFailure(Exception):
39 """
40 This error is raised by when one or more resources required is not available
41 """
42
43
Girish Gowdrae933cd32019-11-21 21:04:41 +053044class BrcmTpSetupTask(Task):
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050045 """
46 OpenOMCI Tech-Profile Download Task
47
48 """
49
50 name = "Broadcom Tech-Profile Download Task"
51
Girish Gowdrae933cd32019-11-21 21:04:41 +053052 def __init__(self, omci_agent, handler, uni_id, tconts, gem_ports, tp_table_id):
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050053 """
54 Class initialization
55
56 :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
Matt Jeanneret810148b2019-09-29 12:44:01 -040057 :param handler: (BrcmOpenomciOnuHandler) ONU Device Handler Instance
58 :param uni_id: (int) numeric id of the uni port on the onu device, starts at 0
Girish Gowdrae933cd32019-11-21 21:04:41 +053059 :param tp_table_id: (int) Technology Profile Table-ID
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050060 """
61 log = structlog.get_logger(device_id=handler.device_id, uni_id=uni_id)
62 log.debug('function-entry')
63
Girish Gowdrae933cd32019-11-21 21:04:41 +053064 super(BrcmTpSetupTask, self).__init__(BrcmTpSetupTask.name,
65 omci_agent,
66 handler.device_id,
67 priority=SETUP_TP_TASK_PRIORITY,
68 exclusive=True)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050069
70 self.log = log
71
72 self._onu_device = omci_agent.get_device(handler.device_id)
73 self._local_deferred = None
74
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050075 self._uni_port = handler.uni_ports[uni_id]
76 assert self._uni_port.uni_id == uni_id
77
Girish Gowdrae933cd32019-11-21 21:04:41 +053078 # Tech Profile Table ID
79 self._tp_table_id = tp_table_id
80
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050081 # Entity IDs. IDs with values can probably be most anything for most ONUs,
82 # IDs set to None are discovered/set
83
84 self._mac_bridge_service_profile_entity_id = \
85 handler.mac_bridge_service_profile_entity_id
86 self._ieee_mapper_service_profile_entity_id = \
87 handler.pon_port.ieee_mapper_service_profile_entity_id
88 self._mac_bridge_port_ani_entity_id = \
89 handler.pon_port.mac_bridge_port_ani_entity_id
90 self._gal_enet_profile_entity_id = \
91 handler.gal_enet_profile_entity_id
92
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050093 self._tconts = []
Girish Gowdrae933cd32019-11-21 21:04:41 +053094 for t in tconts:
95 self._tconts.append(t)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -050096
97 self._gem_ports = []
Girish Gowdrae933cd32019-11-21 21:04:41 +053098 for g in gem_ports:
99 self._gem_ports.append(g)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500100
101 self.tcont_me_to_queue_map = dict()
102 self.uni_port_to_queue_map = dict()
103
104 def cancel_deferred(self):
105 self.log.debug('function-entry')
Girish Gowdrae933cd32019-11-21 21:04:41 +0530106 super(BrcmTpSetupTask, self).cancel_deferred()
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500107
108 d, self._local_deferred = self._local_deferred, None
109 try:
110 if d is not None and not d.called:
111 d.cancel()
112 except:
113 pass
114
115 def start(self):
116 """
117 Start the Tech-Profile Download
118 """
119 self.log.debug('function-entry')
Girish Gowdrae933cd32019-11-21 21:04:41 +0530120 super(BrcmTpSetupTask, self).start()
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500121 self._local_deferred = reactor.callLater(0, self.perform_service_specific_steps)
122
123 def stop(self):
124 """
125 Shutdown Tech-Profile download tasks
126 """
127 self.log.debug('function-entry')
128 self.log.debug('stopping')
129
130 self.cancel_deferred()
Girish Gowdrae933cd32019-11-21 21:04:41 +0530131 super(BrcmTpSetupTask, self).stop()
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500132
133 def check_status_and_state(self, results, operation=''):
134 """
135 Check the results of an OMCI response. An exception is thrown
136 if the task was cancelled or an error was detected.
137
138 :param results: (OmciFrame) OMCI Response frame
139 :param operation: (str) what operation was being performed
140 :return: True if successful, False if the entity existed (already created)
141 """
142 self.log.debug('function-entry')
143
144 omci_msg = results.fields['omci_message'].fields
145 status = omci_msg['success_code']
146 error_mask = omci_msg.get('parameter_error_attributes_mask', 'n/a')
147 failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
148 unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
149
Matt Jeannerete8fc53e2019-04-13 15:58:33 -0400150 self.log.debug("OMCI Result", operation=operation, omci_msg=omci_msg, status=status, error_mask=error_mask,
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500151 failed_mask=failed_mask, unsupported_mask=unsupported_mask)
152
153 if status == RC.Success:
154 self.strobe_watchdog()
155 return True
156
157 elif status == RC.InstanceExists:
158 return False
159
160 raise TechProfileDownloadFailure(
Girish Gowdrae933cd32019-11-21 21:04:41 +0530161 '{} failed with a status of {}, error_mask: {}, failed_mask: {}, '
162 'unsupported_mask: {}'.format(operation, status, error_mask, failed_mask, unsupported_mask))
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500163
164 @inlineCallbacks
165 def perform_service_specific_steps(self):
166 self.log.debug('function-entry')
167
168 omci_cc = self._onu_device.omci_cc
aishwaryarana0180594ce2019-07-26 15:31:14 -0500169 gem_pq_associativity = dict()
170 pq_to_related_port = dict()
171 is_related_ports_configurable = False
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500172
173 try:
174 ################################################################################
175 # TCONTS
176 #
177 # EntityID will be referenced by:
178 # - GemPortNetworkCtp
179 # References:
180 # - ONU created TCONT (created on ONU startup)
181
Girish Gowdrae933cd32019-11-21 21:04:41 +0530182 # Setup 8021p mapper and ani mac bridge port, if it does not exist
183 # Querying just 8021p mapper ME should be enough since we create and
184 # delete 8021pMapper and ANI Mac Bridge Port together.
185 ieee_8021p_mapper_exists = False
186 ieee_8021p_mapper = self._onu_device.query_mib(Ieee8021pMapperServiceProfile.class_id)
187 for k, v in ieee_8021p_mapper.items():
188 if not isinstance(v, dict):
189 continue
190 if k == (self._ieee_mapper_service_profile_entity_id +
191 self._uni_port.mac_bridge_port_num + self._tp_table_id):
192 ieee_8021p_mapper_exists = True
193
194 if ieee_8021p_mapper_exists is False:
195 self.log.info("setting-up-8021pmapper-ani-mac-bridge-port")
196 yield self._setup__8021p_mapper__ani_mac_bridge_port()
197
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500198 tcont_idents = self._onu_device.query_mib(Tcont.class_id)
199 self.log.debug('tcont-idents', tcont_idents=tcont_idents)
200
201 for tcont in self._tconts:
202 self.log.debug('tcont-loop', tcont=tcont)
203
204 if tcont.entity_id is None:
205 free_entity_id = None
206 for k, v in tcont_idents.items():
Matt Jeanneret2e3cb8d2019-11-16 09:22:41 -0500207 if not isinstance(v, dict):
208 continue
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500209 alloc_check = v.get('attributes', {}).get('alloc_id', 0)
210 # Some onu report both to indicate an available tcont
211 if alloc_check == 0xFF or alloc_check == 0xFFFF:
212 free_entity_id = k
213 break
214
215 self.log.debug('tcont-loop-free', free_entity_id=free_entity_id, alloc_id=tcont.alloc_id)
216
217 if free_entity_id is None:
218 self.log.error('no-available-tconts')
219 break
220
221 # Also assign entity id within tcont object
222 results = yield tcont.add_to_hardware(omci_cc, free_entity_id)
223 self.check_status_and_state(results, 'new-tcont-added')
224 else:
225 # likely already added given entity_id is set, but no harm in doing it again
226 results = yield tcont.add_to_hardware(omci_cc, tcont.entity_id)
227 self.check_status_and_state(results, 'existing-tcont-added')
228
229 ################################################################################
230 # GEMS (GemPortNetworkCtp and GemInterworkingTp)
231 #
232 # For both of these MEs, the entity_id is the GEM Port ID. The entity id of the
233 # GemInterworkingTp ME could be different since it has an attribute to specify
234 # the GemPortNetworkCtp entity id.
235 #
236 # for the GemPortNetworkCtp ME
237 #
238 # GemPortNetworkCtp
239 # EntityID will be referenced by:
240 # - GemInterworkingTp
241 # References:
242 # - TCONT
243 # - Hardcoded upstream TM Entity ID
244 # - (Possibly in Future) Upstream Traffic descriptor profile pointer
245 #
246 # GemInterworkingTp
247 # EntityID will be referenced by:
248 # - Ieee8021pMapperServiceProfile
249 # References:
250 # - GemPortNetworkCtp
251 # - Ieee8021pMapperServiceProfile
252 # - GalEthernetProfile
253 #
254
255 onu_g = self._onu_device.query_mib(OntG.class_id)
256 # If the traffic management option attribute in the ONU-G ME is 0
257 # (priority controlled) or 2 (priority and rate controlled), this
258 # pointer specifies the priority queue ME serving this GEM port
259 # network CTP. If the traffic management option attribute is 1
260 # (rate controlled), this attribute redundantly points to the
261 # T-CONT serving this GEM port network CTP.
262 traffic_mgmt_opt = \
263 onu_g.get('attributes', {}).get('traffic_management_options', 0)
264 self.log.debug("traffic-mgmt-option", traffic_mgmt_opt=traffic_mgmt_opt)
265
266 prior_q = self._onu_device.query_mib(PriorityQueueG.class_id)
267 for k, v in prior_q.items():
268 self.log.debug("prior-q", k=k, v=v)
269
270 try:
271 _ = iter(v)
272 except TypeError:
273 continue
274
275 if 'instance_id' in v:
276 related_port = v['attributes']['related_port']
aishwaryarana0180594ce2019-07-26 15:31:14 -0500277 pq_to_related_port[k] = related_port
278
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500279 if v['instance_id'] & 0b1000000000000000:
280 tcont_me = (related_port & 0xffff0000) >> 16
281 if tcont_me not in self.tcont_me_to_queue_map:
282 self.log.debug("prior-q-related-port-and-tcont-me",
Girish Gowdrae933cd32019-11-21 21:04:41 +0530283 related_port=related_port,
284 tcont_me=tcont_me)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500285 self.tcont_me_to_queue_map[tcont_me] = list()
286
287 self.tcont_me_to_queue_map[tcont_me].append(k)
288 else:
289 uni_port = (related_port & 0xffff0000) >> 16
Girish Gowdrae933cd32019-11-21 21:04:41 +0530290 if uni_port == self._uni_port.entity_id:
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500291 if uni_port not in self.uni_port_to_queue_map:
292 self.log.debug("prior-q-related-port-and-uni-port-me",
Girish Gowdrae933cd32019-11-21 21:04:41 +0530293 related_port=related_port,
294 uni_port_me=uni_port)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500295 self.uni_port_to_queue_map[uni_port] = list()
296
297 self.uni_port_to_queue_map[uni_port].append(k)
298
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500299 self.log.debug("ul-prior-q", ul_prior_q=self.tcont_me_to_queue_map)
300 self.log.debug("dl-prior-q", dl_prior_q=self.uni_port_to_queue_map)
301
302 for gem_port in self._gem_ports:
303 # TODO: Traffic descriptor will be available after meter bands are available
304 tcont = gem_port.tcont
305 if tcont is None:
306 self.log.error('unknown-tcont-reference', gem_id=gem_port.gem_id)
307 continue
308
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500309 if gem_port.direction == "upstream" or \
310 gem_port.direction == "bi-directional":
311
312 # Sort the priority queue list in order of priority.
313 # 0 is highest priority and 0x0fff is lowest.
314 self.tcont_me_to_queue_map[tcont.entity_id].sort()
315 self.uni_port_to_queue_map[self._uni_port.entity_id].sort()
aishwaryarana0180594ce2019-07-26 15:31:14 -0500316 # Get the priority queue by indexing the priority value of the gemport.
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500317 # The self.tcont_me_to_queue_map and self.uni_port_to_queue_map
318 # have priority queue entities ordered in descending order
319 # of priority
aishwaryarana0180594ce2019-07-26 15:31:14 -0500320
321 ul_prior_q_entity_id = \
322 self.tcont_me_to_queue_map[tcont.entity_id][gem_port.priority_q]
323 dl_prior_q_entity_id = \
324 self.uni_port_to_queue_map[self._uni_port.entity_id][gem_port.priority_q]
325
326 pq_attributes = dict()
327 pq_attributes["pq_entity_id"] = ul_prior_q_entity_id
328 pq_attributes["weight"] = gem_port.weight
329 pq_attributes["scheduling_policy"] = gem_port.scheduling_policy
330 pq_attributes["priority_q"] = gem_port.priority_q
331 gem_pq_associativity[gem_port.entity_id] = pq_attributes
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500332
333 assert ul_prior_q_entity_id is not None and \
334 dl_prior_q_entity_id is not None
335
336 # TODO: Need to restore on failure. Need to check status/results
337 results = yield gem_port.add_to_hardware(omci_cc,
Girish Gowdrae933cd32019-11-21 21:04:41 +0530338 tcont.entity_id,
339 self._ieee_mapper_service_profile_entity_id +
340 self._uni_port.mac_bridge_port_num +
341 self._tp_table_id,
342 self._gal_enet_profile_entity_id,
343 ul_prior_q_entity_id, dl_prior_q_entity_id)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500344 self.check_status_and_state(results, 'assign-gem-port')
345 elif gem_port.direction == "downstream":
346 # Downstream is inverse of upstream
347 # TODO: could also be a case of multicast. Not supported for now
348 self.log.debug("skipping-downstream-gem", gem_port=gem_port)
349 pass
350
351 ################################################################################
aishwaryarana0180594ce2019-07-26 15:31:14 -0500352 # Update the PriorityQeue Attributes for the PQ Associated with Gemport
353 #
354 # Entityt ID was created prior to this call. This is a set
355 #
356 #
357
358 ont2g = self._onu_device.query_mib(Ont2G.class_id)
Girish Gowdrae933cd32019-11-21 21:04:41 +0530359 qos_config_flexibility_ie = ont2g.get(0, {}).get('attributes', {}). \
360 get('qos_configuration_flexibility', None)
aishwaryarana0180594ce2019-07-26 15:31:14 -0500361 self.log.debug("qos_config_flexibility",
Girish Gowdrae933cd32019-11-21 21:04:41 +0530362 qos_config_flexibility=qos_config_flexibility_ie)
aishwaryarana0180594ce2019-07-26 15:31:14 -0500363
364 if qos_config_flexibility_ie & 0b100000:
365 is_related_ports_configurable = True
366
367 for k, v in gem_pq_associativity.items():
368 if v["scheduling_policy"] == "WRR":
369 self.log.debug("updating-pq-weight")
370 msg = PriorityQueueFrame(v["pq_entity_id"], weight=v["weight"])
371 frame = msg.set()
372 results = yield omci_cc.send(frame)
373 self.check_status_and_state(results, 'set-priority-queues-weight')
374 elif v["scheduling_policy"] == "StrictPriority" and \
375 is_related_ports_configurable:
376 self.log.debug("updating-pq-priority")
377 related_port = pq_to_related_port[v["pq_entity_id"]]
378 related_port = related_port & 0xffff0000
Girish Gowdrae933cd32019-11-21 21:04:41 +0530379 related_port = related_port | v['priority_q'] # Set priority
aishwaryarana0180594ce2019-07-26 15:31:14 -0500380 msg = PriorityQueueFrame(v["pq_entity_id"], related_port=related_port)
381 frame = msg.set()
382 results = yield omci_cc.send(frame)
383 self.check_status_and_state(results, 'set-priority-queues-priority')
384
aishwaryarana0180594ce2019-07-26 15:31:14 -0500385 ################################################################################
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500386 # Update the IEEE 802.1p Mapper Service Profile config
387 #
388 # EntityID was created prior to this call. This is a set
389 #
390 # References:
391 # - Gem Interwork TPs are set here
392 #
393
394 gem_entity_ids = [OmciNullPointer] * 8
Girish Gowdrae933cd32019-11-21 21:04:41 +0530395 # If IEEE8021pMapper ME existed already, then we need to re-build the
396 # inter-working-tp-pointers for different gem-entity-ids.
397 if ieee_8021p_mapper_exists:
398 self.log.debug("rebuilding-interworking-tp-pointers")
399 for k, v in ieee_8021p_mapper.items():
400 if not isinstance(v, dict):
401 continue
402 # Check the entity-id of the instance matches what we expect
403 # for this Uni/TechProfileId
404 if k == (self._ieee_mapper_service_profile_entity_id +
405 self._uni_port.mac_bridge_port_num + self._tp_table_id):
406 for i in range(len(gem_entity_ids)):
407 gem_entity_ids[i] = v.get('attributes', {}). \
408 get('interwork_tp_pointer_for_p_bit_priority_' + str(i), OmciNullPointer)
409 self.log.debug("interworking-tp-pointers-rebuilt-after-query-from-onu",
410 i_w_tp_ptr=gem_entity_ids)
411
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500412 for gem_port in self._gem_ports:
413 self.log.debug("tp-gem-port", entity_id=gem_port.entity_id, uni_id=gem_port.uni_id)
414
415 if gem_port.direction == "upstream" or \
416 gem_port.direction == "bi-directional":
417 for i, p in enumerate(reversed(gem_port.pbit_map)):
418 if p == '1':
419 gem_entity_ids[i] = gem_port.entity_id
420 elif gem_port.direction == "downstream":
421 # Downstream gem port p-bit mapper is inverse of upstream
422 # TODO: Could also be a case of multicast. Not supported for now
423 pass
424
425 msg = Ieee8021pMapperServiceProfileFrame(
Girish Gowdrae933cd32019-11-21 21:04:41 +0530426 (self._ieee_mapper_service_profile_entity_id +
427 self._uni_port.mac_bridge_port_num + self._tp_table_id),
428 # 802.1p mapper Service Mapper Profile ID
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500429 interwork_tp_pointers=gem_entity_ids # Interworking TP IDs
430 )
431 frame = msg.set()
432 self.log.debug('openomci-msg', omci_msg=msg)
433 results = yield omci_cc.send(frame)
434 self.check_status_and_state(results, 'set-8021p-mapper-service-profile-ul')
435
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500436 self.deferred.callback("tech-profile-download-success")
437
438 except TimeoutError as e:
Matt Jeanneret810148b2019-09-29 12:44:01 -0400439 self.log.warn('rx-timeout-tech-profile', e=e)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500440 self.deferred.errback(failure.Failure(e))
441
442 except Exception as e:
Matt Jeanneret810148b2019-09-29 12:44:01 -0400443 self.log.exception('omci-setup-tech-profile', e=e)
Matt Jeanneretf1e9c5d2019-02-08 07:41:29 -0500444 self.deferred.errback(failure.Failure(e))
Girish Gowdrae933cd32019-11-21 21:04:41 +0530445
446 @inlineCallbacks
447 def _setup__8021p_mapper__ani_mac_bridge_port(self):
448
449 omci_cc = self._onu_device.omci_cc
450
451 try:
452 ################################################################################
453 # PON Specific #
454 ################################################################################
455 # IEEE 802.1 Mapper Service config - One per tech-profile per UNI
456 #
457 # EntityID will be referenced by:
458 # - MAC Bridge Port Configuration Data for the PON port and TP ID
459 # References:
460 # - Nothing at this point. When a GEM port is created, this entity will
461 # be updated to reference the GEM Interworking TP
462
463 msg = Ieee8021pMapperServiceProfileFrame(
464 self._ieee_mapper_service_profile_entity_id +
465 self._uni_port.mac_bridge_port_num +
466 self._tp_table_id
467 )
468 frame = msg.create()
469 self.log.debug('openomci-msg', omci_msg=msg)
470 results = yield omci_cc.send(frame)
471 self.check_status_and_state(results, 'create-8021p-mapper-service-profile')
472
473 ################################################################################
474 # Create MAC Bridge Port Configuration Data for the PON port via IEEE 802.1
475 # mapper service and this per TechProfile. Upon receipt by the ONU, the ONU will create an instance
476 # of the following before returning the response.
477 #
478 # - MAC bridge port designation data
479 # - MAC bridge port filter table data
480 # - MAC bridge port bridge table data
481 #
482 # EntityID will be referenced by:
483 # - Implicitly by the VLAN tagging filter data
484 # References:
485 # - MAC Bridge Service Profile (the bridge)
486 # - IEEE 802.1p mapper service profile for PON port
487
488 # TODO: magic. make a static variable for tp_type
489 msg = MacBridgePortConfigurationDataFrame(
Matt Jeanneret2e5c6f12019-12-13 07:06:06 -0500490 self._mac_bridge_port_ani_entity_id + self._uni_port.entity_id + self._tp_table_id, # Entity ID
Girish Gowdrae933cd32019-11-21 21:04:41 +0530491 bridge_id_pointer=(
492 self._mac_bridge_service_profile_entity_id +
493 self._uni_port.mac_bridge_port_num),
494 # Bridge Entity ID
495 port_num=0xff, # Port ID - unique number within the bridge
496 tp_type=3, # TP Type (IEEE 802.1p mapper service)
497 tp_pointer=(
498 self._ieee_mapper_service_profile_entity_id +
499 self._uni_port.mac_bridge_port_num +
500 self._tp_table_id
501 )
502 # TP ID, 8021p mapper ID
503 )
504 frame = msg.create()
505 self.log.debug('openomci-msg', omci_msg=msg)
506 results = yield omci_cc.send(frame)
507 self.check_status_and_state(results, 'create-mac-bridge-port-configuration-data-8021p-mapper')
508
509 except TimeoutError as e:
510 self.log.warn('rx-timeout-8021p-ani-port-setup', e=e)
511 raise
512
513 except Exception as e:
514 self.log.exception('omci-setup-8021p-ani-port-setup', e=e)
515 raise