blob: e02c9edf970a285ef264f9d604f4b842b880f90e [file] [log] [blame]
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001#
Zsolt Haraszti3eb27a52017-01-03 21:56:48 -08002# Copyright 2017 the original author or authors.
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08003#
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"""
Steve Crooks3c2c7582017-01-10 15:02:26 -060018Broadcom OLT/ONU adapter.
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080019"""
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080020
Steve Crooks3c2c7582017-01-10 15:02:26 -060021from uuid import uuid4
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080022import structlog
23from twisted.internet import reactor
Steve Crooks3c2c7582017-01-10 15:02:26 -060024from twisted.internet.defer import DeferredQueue, inlineCallbacks
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080025from zope.interface import implementer
26
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080027from voltha.adapters.interface import IAdapterInterface
28from voltha.core.logical_device_agent import mac_str_to_tuple
Steve Crooksf248e182017-02-07 10:50:24 -050029import voltha.core.flow_decomposer as fd
Steve Crooks3c2c7582017-01-10 15:02:26 -060030from voltha.protos import third_party
31from voltha.protos.adapter_pb2 import Adapter
32from voltha.protos.adapter_pb2 import AdapterConfig
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080033from voltha.protos.common_pb2 import LogLevel, OperStatus, ConnectStatus, \
34 AdminState
Steve Crooks3c2c7582017-01-10 15:02:26 -060035from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Port
36from voltha.protos.health_pb2 import HealthStatus
37from voltha.protos.logical_device_pb2 import LogicalPort
38from voltha.protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, OFPPF_1GB_FD
Steve Crooksf248e182017-02-07 10:50:24 -050039from voltha.protos.openflow_13_pb2 import OFPXMC_OPENFLOW_BASIC, ofp_port
Steve Crooks3c2c7582017-01-10 15:02:26 -060040from common.frameio.frameio import hexify
41from voltha.extensions.omci.omci import *
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080042
Steve Crooks3c2c7582017-01-10 15:02:26 -060043_ = third_party
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080044log = structlog.get_logger()
45
46
47@implementer(IAdapterInterface)
48class BroadcomOnuAdapter(object):
49
50 name = 'broadcom_onu'
51
52 supported_device_types = [
53 DeviceType(
Steve Crooks3c2c7582017-01-10 15:02:26 -060054 id=name,
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080055 adapter=name,
56 accepts_bulk_flow_update=True
57 )
58 ]
59
60 def __init__(self, adapter_agent, config):
61 self.adapter_agent = adapter_agent
62 self.config = config
63 self.descriptor = Adapter(
64 id=self.name,
65 vendor='Voltha project',
Steve Crooks3c2c7582017-01-10 15:02:26 -060066 version='0.4',
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080067 config=AdapterConfig(log_level=LogLevel.INFO)
68 )
Steve Crooks3c2c7582017-01-10 15:02:26 -060069 self.devices_handlers = dict() # device_id -> BroadcomOnuHandler()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080070
Peter Shafik9107f2e2017-05-02 15:54:39 -040071 # register for adapter messages
72 self.adapter_agent.register_for_inter_adapter_messages()
73
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080074 def start(self):
75 log.debug('starting')
76 log.info('started')
77
78 def stop(self):
79 log.debug('stopping')
80 log.info('stopped')
81
82 def adapter_descriptor(self):
83 return self.descriptor
84
85 def device_types(self):
86 return DeviceTypes(items=self.supported_device_types)
87
88 def health(self):
89 return HealthStatus(state=HealthStatus.HealthState.HEALTHY)
90
91 def change_master_state(self, master):
92 raise NotImplementedError()
93
94 def adopt_device(self, device):
Steve Crooks3c2c7582017-01-10 15:02:26 -060095 log.info('adopt_device', device_id=device.id)
96 self.devices_handlers[device.proxy_address.channel_id] = BroadcomOnuHandler(self, device.id)
97 reactor.callLater(0, self.devices_handlers[device.proxy_address.channel_id].activate, device)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -080098 return device
99
100 def abandon_device(self, device):
101 raise NotImplementedError()
102
Khen Nursimulud068d812017-03-06 11:44:18 -0500103 def disable_device(self, device):
104 raise NotImplementedError()
105
106 def reenable_device(self, device):
107 raise NotImplementedError()
108
109 def reboot_device(self, device):
110 raise NotImplementedError()
111
112 def delete_device(self, device):
113 raise NotImplementedError()
114
115 def get_device_details(self, device):
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800116 raise NotImplementedError()
117
Sergio Slobodrianec864c62017-03-09 11:41:43 -0500118 def update_pm_config(self, device, pm_configs):
119 raise NotImplementedError()
120
Steve Crooks3c2c7582017-01-10 15:02:26 -0600121 def update_flows_bulk(self, device, flows, groups):
122 log.info('bulk-flow-update', device_id=device.id,
123 flows=flows, groups=groups)
124 assert len(groups.items) == 0
125 handler = self.devices_handlers[device.proxy_address.channel_id]
Steve Crooksf248e182017-02-07 10:50:24 -0500126 return handler.update_flow_table(device, flows.items)
Steve Crooks3c2c7582017-01-10 15:02:26 -0600127
128 def update_flows_incrementally(self, device, flow_changes, group_changes):
129 raise NotImplementedError()
130
131 def send_proxied_message(self, proxy_address, msg):
132 log.info('send-proxied-message', proxy_address=proxy_address, msg=msg)
133
134 def receive_proxied_message(self, proxy_address, msg):
135 log.info('receive-proxied-message', proxy_address=proxy_address,
136 device_id=proxy_address.device_id, msg=hexify(msg))
137 handler = self.devices_handlers[proxy_address.channel_id]
138 handler.receive_message(msg)
139
140 def receive_packet_out(self, logical_device_id, egress_port_no, msg):
141 log.info('packet-out', logical_device_id=logical_device_id,
142 egress_port_no=egress_port_no, msg_len=len(msg))
143
Peter Shafik9107f2e2017-05-02 15:54:39 -0400144 def receive_inter_adapter_message(self, msg):
145 log.info('receive_inter_adapter_message', msg=msg)
146
Stephane Barbarie980a0912017-05-11 11:27:06 -0400147 def suppress_alarm(self, filter):
148 raise NotImplementedError()
149
150 def unsuppress_alarm(self, filter):
151 raise NotImplementedError()
Steve Crooks3c2c7582017-01-10 15:02:26 -0600152
153class BroadcomOnuHandler(object):
154
155 def __init__(self, adapter, device_id):
156 self.adapter = adapter
157 self.adapter_agent = adapter.adapter_agent
158 self.device_id = device_id
159 self.log = structlog.get_logger(device_id=device_id)
160 self.incoming_messages = DeferredQueue()
161 self.proxy_address = None
162 self.tx_id = 0
163
164 def receive_message(self, msg):
165 self.incoming_messages.put(msg)
166
167 def activate(self, device):
168 self.log.info('activating')
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800169
170 # first we verify that we got parent reference and proxy info
171 assert device.parent_id
172 assert device.proxy_address.device_id
Steve Crooks9b160d72017-03-31 10:48:29 -0500173 #assert device.proxy_address.channel_id # c-vid
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800174
Steve Crooks3c2c7582017-01-10 15:02:26 -0600175 # register for proxied messages right away
176 self.proxy_address = device.proxy_address
177 self.adapter_agent.register_for_proxied_messages(device.proxy_address)
178
Peter Shafik9107f2e2017-05-02 15:54:39 -0400179
Steve Crooks3c2c7582017-01-10 15:02:26 -0600180 # populate device info
181 device.root = True
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800182 device.vendor = 'Broadcom'
Steve Crooks9e85ce82017-03-20 12:00:53 -0400183 device.model = 'n/a'
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800184 device.hardware_version = 'to be filled'
185 device.firmware_version = 'to be filled'
186 device.software_version = 'to be filled'
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800187 device.connect_status = ConnectStatus.REACHABLE
188 self.adapter_agent.update_device(device)
189
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800190 self.adapter_agent.add_port(device.id, Port(
Steve Crooks9b160d72017-03-31 10:48:29 -0500191 port_no=100,
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800192 label='PON port',
193 type=Port.PON_ONU,
194 admin_state=AdminState.ENABLED,
195 oper_status=OperStatus.ACTIVE,
196 peers=[
197 Port.PeerPort(
198 device_id=device.parent_id,
199 port_no=device.parent_port_no
200 )
201 ]
202 ))
203
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800204 parent_device = self.adapter_agent.get_device(device.parent_id)
205 logical_device_id = parent_device.parent_id
206 assert logical_device_id
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800207
Steve Crooks9b160d72017-03-31 10:48:29 -0500208 # query ONU for number of supported uni ports
209 # temporarily set number of ports to 1 - port #2
210 uni_ports = (2,)
211
212 for uni in uni_ports:
213 # register physical ports
214 uni_port = Port(
215 port_no=uni,
216 label='UNI facing Ethernet port '+str(uni),
217 type=Port.ETHERNET_UNI,
218 admin_state=AdminState.ENABLED,
219 oper_status=OperStatus.ACTIVE
220 )
221 self.adapter_agent.add_port(device.id, uni_port)
222
223 # add uni port to logical device
224 port_no = device.proxy_address.channel_id + uni
225 cap = OFPPF_1GB_FD | OFPPF_FIBER
226 self.adapter_agent.add_logical_port(logical_device_id, LogicalPort(
227 id='uni-{}'.format(port_no),
228 ofp_port=ofp_port(
229 port_no=port_no,
230 hw_addr=mac_str_to_tuple('00:00:00:%02x:%02x:%02x' %
231 (device.proxy_address.onu_id & 0xff,
232 (port_no >> 8) & 0xff,
233 port_no & 0xff)),
234 name='uni-{}'.format(port_no),
235 config=0,
236 state=OFPPS_LIVE,
237 curr=cap,
238 advertised=cap,
239 peer=cap,
240 curr_speed=OFPPF_1GB_FD,
241 max_speed=OFPPF_1GB_FD
242 ),
243 device_id=device.id,
244 device_port_no=uni_port.port_no
245 ))
246
247 reactor.callLater(10,
248 self.message_exchange,
249 self.proxy_address.onu_id,
250 self.proxy_address.onu_session_id,
251 port_no)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800252
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800253 device = self.adapter_agent.get_device(device.id)
254 device.oper_status = OperStatus.ACTIVE
255 self.adapter_agent.update_device(device)
256
Steve Crooks3c2c7582017-01-10 15:02:26 -0600257 @inlineCallbacks
Steve Crooksf248e182017-02-07 10:50:24 -0500258 def update_flow_table(self, device, flows):
259 #
260 # We need to proxy through the OLT to get to the ONU
261 # Configuration from here should be using OMCI
262 #
263 self.log.info('bulk-flow-update', device_id=device.id, flows=flows)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800264
Steve Crooksf248e182017-02-07 10:50:24 -0500265 def is_downstream(port):
Steve Crooks9b160d72017-03-31 10:48:29 -0500266 return port == 100 # Need a better way
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800267
Steve Crooksf248e182017-02-07 10:50:24 -0500268 def is_upstream(port):
269 return not is_downstream(port)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800270
Steve Crooksf248e182017-02-07 10:50:24 -0500271 for flow in flows:
Steve Crooks9b160d72017-03-31 10:48:29 -0500272 _type = None
273 _port = None
274 _vlan_vid = None
275 _udp_dst = None
276 _udp_src = None
277 _ipv4_dst = None
278 _ipv4_src = None
279 _metadata = None
280 _output = None
281 _push_tpid = None
282 _field = None
283 _set_vlan_vid = None
Steve Crooksf248e182017-02-07 10:50:24 -0500284 try:
285 _in_port = fd.get_in_port(flow)
286 assert _in_port is not None
Steve Crooks3c2c7582017-01-10 15:02:26 -0600287
Steve Crooksf248e182017-02-07 10:50:24 -0500288 if is_downstream(_in_port):
289 self.log.info('downstream-flow')
290 elif is_upstream(_in_port):
291 self.log.info('upstream-flow')
292 else:
293 raise Exception('port should be 1 or 2 by our convention')
294
295 _out_port = fd.get_out_port(flow) # may be None
296 self.log.info('out-port', out_port=_out_port)
297
298 for field in fd.get_ofb_fields(flow):
299 if field.type == fd.ETH_TYPE:
300 _type = field.eth_type
301 self.log.info('field-type-eth-type',
302 eth_type=_type)
303
304 elif field.type == fd.IP_PROTO:
305 _proto = field.ip_proto
306 self.log.info('field-type-ip-proto',
307 ip_proto=_proto)
308
309 elif field.type == fd.IN_PORT:
310 _port = field.port
311 self.log.info('field-type-in-port',
312 in_port=_port)
313
314 elif field.type == fd.VLAN_VID:
315 _vlan_vid = field.vlan_vid & 0xfff
316 self.log.info('field-type-vlan-vid',
317 vlan=_vlan_vid)
318
319 elif field.type == fd.VLAN_PCP:
320 _vlan_pcp = field.vlan_pcp
321 self.log.info('field-type-vlan-pcp',
322 pcp=_vlan_pcp)
323
324 elif field.type == fd.UDP_DST:
325 _udp_dst = field.udp_dst
326 self.log.info('field-type-udp-dst',
327 udp_dst=_udp_dst)
328
329 elif field.type == fd.UDP_SRC:
330 _udp_src = field.udp_src
331 self.log.info('field-type-udp-src',
332 udp_src=_udp_src)
333
334 elif field.type == fd.IPV4_DST:
335 _ipv4_dst = field.ipv4_dst
336 self.log.info('field-type-ipv4-dst',
337 ipv4_dst=_ipv4_dst)
338
339 elif field.type == fd.IPV4_SRC:
340 _ipv4_src = field.ipv4_src
341 self.log.info('field-type-ipv4-src',
342 ipv4_dst=_ipv4_src)
343
344 elif field.type == fd.METADATA:
Steve Crooks9b160d72017-03-31 10:48:29 -0500345 _metadata = field.table_metadata
Steve Crooksf248e182017-02-07 10:50:24 -0500346 self.log.info('field-type-metadata',
347 metadata=_metadata)
348
349 else:
350 raise NotImplementedError('field.type={}'.format(
351 field.type))
352
353 for action in fd.get_actions(flow):
354
355 if action.type == fd.OUTPUT:
356 _output = action.output.port
357 self.log.info('action-type-output',
358 output=_output, in_port=_in_port)
359
360 elif action.type == fd.POP_VLAN:
361 self.log.info('action-type-pop-vlan',
362 in_port=_in_port)
363
364 elif action.type == fd.PUSH_VLAN:
365 _push_tpid = action.push.ethertype
366 log.info('action-type-push-vlan',
367 push_tpid=_push_tpid, in_port=_in_port)
368 if action.push.ethertype != 0x8100:
369 self.log.error('unhandled-tpid',
370 ethertype=action.push.ethertype)
371
372 elif action.type == fd.SET_FIELD:
373 _field = action.set_field.field.ofb_field
374 assert (action.set_field.field.oxm_class ==
375 OFPXMC_OPENFLOW_BASIC)
376 self.log.info('action-type-set-field',
377 field=_field, in_port=_in_port)
378 if _field.type == fd.VLAN_VID:
Steve Crooks9b160d72017-03-31 10:48:29 -0500379 _set_vlan_vid = _field.vlan_vid & 0xfff
380 self.log.info('set-field-type-valn-vid', _set_vlan_vid)
Steve Crooksf248e182017-02-07 10:50:24 -0500381 else:
382 self.log.error('unsupported-action-set-field-type',
383 field_type=_field.type)
384 else:
385 log.error('unsupported-action-type',
386 action_type=action.type, in_port=_in_port)
387
388 #
389 # All flows created from ONU adapter should be OMCI based
390 #
Steve Crooks9b160d72017-03-31 10:48:29 -0500391 if _vlan_vid == 0:
392 # allow priority tagged packets
393 # Set AR - ExtendedVlanTaggingOperationConfigData
394 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
395 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0,
396 1, 8, _in_port)
397 yield self.wait_for_response()
398
399 # Set AR - ExtendedVlanTaggingOperationConfigData
400 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
401 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0,
402 1, 8, _in_port)
403 yield self.wait_for_response()
Steve Crooksf248e182017-02-07 10:50:24 -0500404
405 except Exception as e:
406 log.exception('failed-to-install-flow', e=e, flow=flow)
407
Steve Crooks3c2c7582017-01-10 15:02:26 -0600408 def get_tx_id(self):
409 self.tx_id += 1
410 return self.tx_id
411
412 def send_omci_message(self, frame):
413 _frame = hexify(str(frame))
414 self.log.info('send-omci-message-%s' % _frame)
415 device = self.adapter_agent.get_device(self.device_id)
416 try:
417 self.adapter_agent.send_proxied_message(device.proxy_address, _frame)
418 except Exception as e:
419 self.log.info('send-omci-message-exception', exc=str(e))
420
421 def send_get_circuit_pack(self, entity_id=0):
422 frame = OmciFrame(
423 transaction_id=self.get_tx_id(),
424 message_type=OmciGet.message_id,
425 omci_message=OmciGet(
426 entity_class=CircuitPack.class_id,
427 entity_id=entity_id,
428 attributes_mask=CircuitPack.mask_for('vendor_id')
429 )
430 )
431 self.send_omci_message(frame)
432
433 def send_mib_reset(self, entity_id=0):
434 frame = OmciFrame(
435 transaction_id=self.get_tx_id(),
436 message_type=OmciMibReset.message_id,
437 omci_message=OmciMibReset(
438 entity_class=OntData.class_id,
439 entity_id=entity_id
440 )
441 )
442 self.send_omci_message(frame)
443
Steve Crooks9e85ce82017-03-20 12:00:53 -0400444 def send_create_gal_ethernet_profile(self,
445 entity_id,
446 max_gem_payload_size):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600447 frame = OmciFrame(
448 transaction_id=self.get_tx_id(),
449 message_type=OmciCreate.message_id,
450 omci_message=OmciCreate(
451 entity_class=GalEthernetProfile.class_id,
452 entity_id=entity_id,
453 data=dict(
454 max_gem_payload_size=max_gem_payload_size
455 )
456 )
457 )
458 self.send_omci_message(frame)
459
Steve Crooks9e85ce82017-03-20 12:00:53 -0400460 def send_set_tcont(self,
461 entity_id,
462 alloc_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600463 data = dict(
464 alloc_id=alloc_id
465 )
466 frame = OmciFrame(
467 transaction_id=self.get_tx_id(),
468 message_type=OmciSet.message_id,
469 omci_message=OmciSet(
470 entity_class=Tcont.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400471 entity_id=entity_id,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600472 attributes_mask=Tcont.mask_for(*data.keys()),
473 data=data
474 )
475 )
476 self.send_omci_message(frame)
477
Steve Crooks9e85ce82017-03-20 12:00:53 -0400478 def send_create_8021p_mapper_service_profile(self,
479 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600480 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400481 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600482 message_type=OmciCreate.message_id,
483 omci_message=OmciCreate(
484 entity_class=Ieee8021pMapperServiceProfile.class_id,
485 entity_id=entity_id,
486 data=dict(
487 tp_pointer=OmciNullPointer,
488 interwork_tp_pointer_for_p_bit_priority_0=OmciNullPointer,
Steve Crooks9b160d72017-03-31 10:48:29 -0500489 interwork_tp_pointer_for_p_bit_priority_1=OmciNullPointer,
490 interwork_tp_pointer_for_p_bit_priority_2=OmciNullPointer,
491 interwork_tp_pointer_for_p_bit_priority_3=OmciNullPointer,
492 interwork_tp_pointer_for_p_bit_priority_4=OmciNullPointer,
493 interwork_tp_pointer_for_p_bit_priority_5=OmciNullPointer,
494 interwork_tp_pointer_for_p_bit_priority_6=OmciNullPointer,
495 interwork_tp_pointer_for_p_bit_priority_7=OmciNullPointer
Steve Crooks3c2c7582017-01-10 15:02:26 -0600496 )
497 )
498 )
499 self.send_omci_message(frame)
500
Steve Crooks9e85ce82017-03-20 12:00:53 -0400501 def send_create_mac_bridge_service_profile(self,
502 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600503 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400504 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600505 message_type=OmciCreate.message_id,
506 omci_message=OmciCreate(
507 entity_class=MacBridgeServiceProfile.class_id,
508 entity_id=entity_id,
509 data=dict(
510 spanning_tree_ind=False,
511 learning_ind=True,
512 priority=0x8000,
513 max_age=20 * 256,
514 hello_time=2 * 256,
515 forward_delay=15 * 256,
516 unknown_mac_address_discard=True
517 )
518 )
519 )
520 self.send_omci_message(frame)
521
Steve Crooks9e85ce82017-03-20 12:00:53 -0400522 def send_create_gem_port_network_ctp(self,
523 entity_id,
524 port_id,
525 tcont_id,
526 direction,
527 tm):
528 _directions = {"upstream": 1, "downstream": 2, "bi-directional": 3}
529 if _directions.has_key(direction):
530 _direction = _directions[direction]
531 else:
532 self.log.error('invalid-gem-port-direction', direction=direction)
533 raise ValueError('Invalid GEM port direction: {_dir}'.format(_dir=direction))
534
Steve Crooks3c2c7582017-01-10 15:02:26 -0600535 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400536 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600537 message_type=OmciCreate.message_id,
538 omci_message=OmciCreate(
539 entity_class=GemPortNetworkCtp.class_id,
540 entity_id=entity_id,
541 data=dict(
542 port_id=port_id,
543 tcont_pointer=tcont_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400544 direction=_direction,
545 traffic_management_pointer_upstream=tm
Steve Crooks3c2c7582017-01-10 15:02:26 -0600546 )
547 )
548 )
549 self.send_omci_message(frame)
550
Steve Crooks9e85ce82017-03-20 12:00:53 -0400551 def send_create_multicast_gem_interworking_tp(self,
552 entity_id,
553 gem_port_net_ctp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600554 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400555 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600556 message_type=OmciCreate.message_id,
557 omci_message=OmciCreate(
558 entity_class=MulticastGemInterworkingTp.class_id,
559 entity_id=entity_id,
560 data=dict(
561 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
562 interworking_option=0,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400563 service_profile_pointer=0x1
Steve Crooks3c2c7582017-01-10 15:02:26 -0600564 )
565 )
566 )
567 self.send_omci_message(frame)
568
Steve Crooks9e85ce82017-03-20 12:00:53 -0400569 def send_create_gem_inteworking_tp(self,
570 entity_id,
571 gem_port_net_ctp_id,
572 service_profile_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600573 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400574 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600575 message_type=OmciCreate.message_id,
576 omci_message=OmciCreate(
577 entity_class=GemInterworkingTp.class_id,
578 entity_id=entity_id,
579 data=dict(
580 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
581 interworking_option=5,
582 service_profile_pointer=service_profile_id,
583 interworking_tp_pointer=0x0,
584 gal_profile_pointer=0x1
585 )
586 )
587 )
588 self.send_omci_message(frame)
589
Steve Crooks9e85ce82017-03-20 12:00:53 -0400590 def send_set_8021p_mapper_service_profile(self,
591 entity_id,
592 interwork_tp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600593 data = dict(
Steve Crooks9b160d72017-03-31 10:48:29 -0500594 interwork_tp_pointer_for_p_bit_priority_0=interwork_tp_id,
595 interwork_tp_pointer_for_p_bit_priority_1=interwork_tp_id,
596 interwork_tp_pointer_for_p_bit_priority_2=interwork_tp_id,
597 interwork_tp_pointer_for_p_bit_priority_3=interwork_tp_id,
598 interwork_tp_pointer_for_p_bit_priority_4=interwork_tp_id,
599 interwork_tp_pointer_for_p_bit_priority_5=interwork_tp_id,
600 interwork_tp_pointer_for_p_bit_priority_6=interwork_tp_id,
601 interwork_tp_pointer_for_p_bit_priority_7=interwork_tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600602 )
603 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400604 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600605 message_type=OmciSet.message_id,
606 omci_message=OmciSet(
607 entity_class=Ieee8021pMapperServiceProfile.class_id,
608 entity_id=entity_id,
609 attributes_mask=Ieee8021pMapperServiceProfile.mask_for(
610 *data.keys()),
611 data=data
612 )
613 )
614 self.send_omci_message(frame)
615
616 def send_create_mac_bridge_port_configuration_data(self,
617 entity_id,
618 bridge_id,
619 port_id,
620 tp_type,
621 tp_id):
622 frame = OmciFrame(
623 transaction_id=self.get_tx_id(),
624 message_type=OmciCreate.message_id,
625 omci_message=OmciCreate(
626 entity_class=MacBridgePortConfigurationData.class_id,
627 entity_id=entity_id,
628 data=dict(
629 bridge_id_pointer = bridge_id,
630 port_num=port_id,
631 tp_type=tp_type,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400632 tp_pointer=tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600633 )
634 )
635 )
636 self.send_omci_message(frame)
637
Steve Crooks9e85ce82017-03-20 12:00:53 -0400638 def send_create_vlan_tagging_filter_data(self,
639 entity_id,
640 vlan_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600641 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400642 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600643 message_type=OmciCreate.message_id,
644 omci_message=OmciCreate(
645 entity_class=VlanTaggingFilterData.class_id,
646 entity_id=entity_id,
647 data=dict(
648 vlan_filter_0=vlan_id,
649 forward_operation=0x10,
650 number_of_entries=1
651 )
652 )
653 )
654 self.send_omci_message(frame)
655
Steve Crooks46d64302017-03-10 15:11:06 -0500656 def send_create_extended_vlan_tagging_operation_configuration_data(self,
657 entity_id,
658 assoc_type,
659 assoc_me):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600660 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400661 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600662 message_type=OmciCreate.message_id,
663 omci_message=OmciCreate(
664 entity_class=
665 ExtendedVlanTaggingOperationConfigurationData.class_id,
666 entity_id=entity_id,
667 data=dict(
Steve Crooks46d64302017-03-10 15:11:06 -0500668 association_type=assoc_type,
669 associated_me_pointer=assoc_me
Steve Crooks3c2c7582017-01-10 15:02:26 -0600670 )
671 )
672 )
673 self.send_omci_message(frame)
674
Steve Crooks9e85ce82017-03-20 12:00:53 -0400675 def send_set_extended_vlan_tagging_operation_tpid_configuration_data(self,
676 entity_id,
677 input_tpid,
678 output_tpid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600679 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400680 input_tpid=input_tpid,
681 output_tpid=output_tpid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600682 downstream_mode=0, # inverse of upstream
683 )
684 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400685 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600686 message_type=OmciSet.message_id,
687 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400688 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600689 ExtendedVlanTaggingOperationConfigurationData.class_id,
690 entity_id=entity_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400691 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600692 ExtendedVlanTaggingOperationConfigurationData.mask_for(
693 *data.keys()),
694 data=data
695 )
696 )
697 self.send_omci_message(frame)
698
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400699 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(self,
700 entity_id,
701 filter_inner_vid,
702 treatment_inner_vid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600703 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400704 received_frame_vlan_tagging_operation_table=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600705 VlanTaggingOperation(
706 filter_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500707 filter_outer_vid=4096,
708 filter_outer_tpid_de=0,
709
710 filter_inner_priority=15,
711 filter_inner_vid=filter_inner_vid,
712 filter_inner_tpid_de=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600713 filter_ether_type=0,
Steve Crooks46d64302017-03-10 15:11:06 -0500714
715 treatment_tags_to_remove=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600716 treatment_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500717 treatment_outer_vid=0,
718 treatment_outer_tpid_de=0,
719
720 treatment_inner_priority=0,
721 treatment_inner_vid=treatment_inner_vid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600722 treatment_inner_tpid_de=4
723 )
724 )
725 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400726 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600727 message_type=OmciSet.message_id,
728 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400729 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600730 ExtendedVlanTaggingOperationConfigurationData.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400731 entity_id=entity_id,
732 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600733 ExtendedVlanTaggingOperationConfigurationData.mask_for(
734 *data.keys()),
735 data=data
736 )
737 )
738 self.send_omci_message(frame)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800739
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400740 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(self,
741 entity_id,
742 filter_inner_priority,
743 filter_inner_vid,
744 filter_inner_tpid_de,
745 treatment_tags_to_remove,
746 treatment_inner_priority,
747 treatment_inner_vid):
748 data = dict(
749 received_frame_vlan_tagging_operation_table=
750 VlanTaggingOperation(
751 filter_outer_priority=15,
752 filter_outer_vid=4096,
753 filter_outer_tpid_de=0,
754
755 filter_inner_priority=filter_inner_priority,
756 filter_inner_vid=filter_inner_vid,
757 filter_inner_tpid_de=filter_inner_tpid_de,
758 filter_ether_type=0,
759
760 treatment_tags_to_remove=treatment_tags_to_remove,
761 treatment_outer_priority=15,
762 treatment_outer_vid=0,
763 treatment_outer_tpid_de=0,
764
765 treatment_inner_priority=treatment_inner_priority,
766 treatment_inner_vid=treatment_inner_vid,
767 treatment_inner_tpid_de=4
768 )
769 )
770 frame = OmciFrame(
771 transaction_id=self.get_tx_id(),
772 message_type=OmciSet.message_id,
773 omci_message=OmciSet(
774 entity_class=
775 ExtendedVlanTaggingOperationConfigurationData.class_id,
776 entity_id=entity_id,
777 attributes_mask=
778 ExtendedVlanTaggingOperationConfigurationData.mask_for(
779 *data.keys()),
780 data=data
781 )
782 )
783 self.send_omci_message(frame)
784
Steve Crooks9e85ce82017-03-20 12:00:53 -0400785 def send_create_multicast_operations_profile(self,
786 entity_id,
787 igmp_ver):
788 frame = OmciFrame(
789 transaction_id=self.get_tx_id(),
790 message_type=OmciCreate.message_id,
791 omci_message=OmciCreate(
792 entity_class=
793 MulticastOperationsProfile.class_id,
794 entity_id=entity_id,
795 data=dict(
796 igmp_version=igmp_ver,
797 igmp_function=0,
798 immediate_leave=0
799 )
800 )
801 )
802 self.send_omci_message(frame)
803
804 def send_set_multicast_operations_profile_acl_row0(self,
805 entity_id,
806 acl_table,
807 row_key,
808 gem_port,
809 vlan,
810 src_ip,
811 dst_ip_start,
812 dst_ip_end):
813 row0 = AccessControlRow0(
814 set_ctrl=1,
815 row_part_id=0,
816 test=0,
817 row_key=row_key,
818 gem_port_id=gem_port,
819 vlan_id=vlan,
820 src_ip=src_ip,
821 dst_ip_start=dst_ip_start,
822 dst_ip_end=dst_ip_end,
823 ipm_group_bw=0
824 )
825
826 if acl_table == 'dynamic':
827 data = dict(
828 dynamic_access_control_list_table=row0
829 )
830 else:
831 data = dict(
832 static_access_control_list_table=row0
833 )
834
835 frame = OmciFrame(
836 transaction_id=self.get_tx_id(),
837 message_type=OmciSet.message_id,
838 omci_message=OmciSet(
839 entity_class=MulticastOperationsProfile.class_id,
840 entity_id=entity_id,
841 attributes_mask=MulticastOperationsProfile.mask_for(
842 *data.keys()),
843 data=data
844 )
845 )
846 self.send_omci_message(frame)
847
848 def send_set_multicast_operations_profile_ds_igmp_mcast_tci(self,
849 entity_id,
850 ctrl_type,
851 tci):
852 data = dict(
853 ds_igmp_mcast_tci=
854 DownstreamIgmpMulticastTci(
855 ctrl_type=ctrl_type,
856 tci=tci
857 )
858 )
859 frame = OmciFrame(
860 transaction_id=self.get_tx_id(),
861 message_type=OmciSet.message_id,
862 omci_message=OmciSet(
863 entity_class=MulticastOperationsProfile.class_id,
864 entity_id=entity_id,
865 attributes_mask=MulticastOperationsProfile.mask_for(
866 *data.keys()),
867 data=data
868 )
869 )
870 self.send_omci_message(frame)
871
872 def send_create_multicast_subscriber_config_info(self,
873 entity_id,
874 me_type,
875 mcast_oper_profile):
876 frame = OmciFrame(
877 transaction_id=self.get_tx_id(),
878 message_type=OmciCreate.message_id,
879 omci_message=OmciCreate(
880 entity_class=
881 MulticastSubscriberConfigInfo.class_id,
882 entity_id=entity_id,
883 data=dict(
884 me_type=me_type,
885 mcast_operations_profile_pointer=mcast_oper_profile
886 )
887 )
888 )
889 self.send_omci_message(frame)
890
891 def send_set_multicast_subscriber_config_info(self,
892 entity_id,
893 max_groups=0,
894 max_mcast_bw=0,
895 bw_enforcement=0):
896 data = dict(
897 max_simultaneous_groups=max_groups,
898 max_multicast_bandwidth=max_mcast_bw,
899 bandwidth_enforcement=bw_enforcement
900 )
901 frame = OmciFrame(
902 transaction_id=self.get_tx_id(),
903 message_type=OmciSet.message_id,
904 omci_message=OmciSet(
905 entity_class=MulticastSubscriberConfigInfo.class_id,
906 entity_id=entity_id,
907 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
908 *data.keys()),
909 data=data
910 )
911 )
912 self.send_omci_message(frame)
913
914 def send_set_multicast_service_package(self,
915 entity_id,
916 row_key,
917 vid_uni,
918 max_groups,
919 max_mcast_bw,
920 mcast_oper_profile):
921 data = dict(
922 multicast_service_package_table=
923 MulticastServicePackage(
924 set_ctrl=1,
925 row_key=row_key,
926
927 vid_uni=vid_uni,
928 max_simultaneous_groups=max_groups,
929 max_multicast_bw=max_mcast_bw,
930 mcast_operations_profile_pointer=mcast_oper_profile
931 )
932 )
933 frame = OmciFrame(
934 transaction_id=self.get_tx_id(),
935 message_type=OmciSet.message_id,
936 omci_message=OmciSet(
937 entity_class=MulticastSubscriberConfigInfo.class_id,
938 entity_id=entity_id,
939 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
940 *data.keys()),
941 data=data
942 )
943 )
944 self.send_omci_message(frame)
945
946 def send_set_multicast_allowed_preview_groups_row0(self,
947 entity_id,
948 row_key,
949 src_ip,
950 vlan_id_ani,
951 vlan_id_uni):
952 data = dict(
953 allowed_preview_groups_table=
954 AllowedPreviewGroupsRow0(
955 set_ctrl=1,
956 row_part_id=0,
957 row_key=row_key,
958
959 src_ip=src_ip,
960 vlan_id_ani=vlan_id_ani,
961 vlan_id_uni=vlan_id_uni
962 )
963 )
964 frame = OmciFrame(
965 transaction_id=self.get_tx_id(),
966 message_type=OmciSet.message_id,
967 omci_message=OmciSet(
968 entity_class=MulticastSubscriberConfigInfo.class_id,
969 entity_id=entity_id,
970 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
971 *data.keys()),
972 data=data
973 )
974 )
975 self.send_omci_message(frame)
976
977 def send_set_multicast_allowed_preview_groups_row1(self,
978 entity_id,
979 row_key,
980 dst_ip,
981 duration,
982 time_left):
983 data = dict(
984 allowed_preview_groups_table=
985 AllowedPreviewGroupsRow1(
986 set_ctrl=1,
987 row_part_id=1,
988 row_key=row_key,
989
990 dst_ip=dst_ip,
991 duration=duration,
992 time_left=time_left
993 )
994 )
995 frame = OmciFrame(
996 transaction_id=self.get_tx_id(),
997 message_type=OmciSet.message_id,
998 omci_message=OmciSet(
999 entity_class=MulticastSubscriberConfigInfo.class_id,
1000 entity_id=entity_id,
1001 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1002 *data.keys()),
1003 data=data
1004 )
1005 )
1006 self.send_omci_message(frame)
1007
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001008 @inlineCallbacks
Steve Crooks3c2c7582017-01-10 15:02:26 -06001009 def wait_for_response(self):
1010 log.info('wait-for-response')
1011 try:
1012 response = yield self.incoming_messages.get()
Steve Crooks9e85ce82017-03-20 12:00:53 -04001013 log.info('got-response')
1014 # resp = OmciFrame(response)
1015 # resp.show()
Steve Crooks3c2c7582017-01-10 15:02:26 -06001016 except Exception as e:
1017 self.log.info('wait-for-response-exception', exc=str(e))
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001018
Steve Crooks3c2c7582017-01-10 15:02:26 -06001019 @inlineCallbacks
Steve Crooks9b160d72017-03-31 10:48:29 -05001020 def message_exchange(self, onu, gem, cvid):
1021 log.info('message_exchange', onu=onu, gem=gem, cvid=cvid)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001022 # reset incoming message queue
1023 while self.incoming_messages.pending:
1024 _ = yield self.incoming_messages.get()
1025
Steve Crooks9b160d72017-03-31 10:48:29 -05001026 tcont = gem
1027
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001028 # construct message
Steve Crooks3c2c7582017-01-10 15:02:26 -06001029 # MIB Reset - OntData - 0
1030 self.send_mib_reset()
1031 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001032
Steve Crooks3c2c7582017-01-10 15:02:26 -06001033 # Create AR - GalEthernetProfile - 1
1034 self.send_create_gal_ethernet_profile(1, 48)
1035 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001036
Steve Crooks9b160d72017-03-31 10:48:29 -05001037 # TCONT config
1038 # Set AR - TCont - 32769 - (1025 or 1026)
1039 self.send_set_tcont(0x8001, tcont)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001040 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001041
Steve Crooks9b160d72017-03-31 10:48:29 -05001042 # Mapper Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001043 # Create AR - 802.1pMapperServiceProfile - 32769
1044 self.send_create_8021p_mapper_service_profile(0x8001)
1045 yield self.wait_for_response()
1046
Steve Crooks9b160d72017-03-31 10:48:29 -05001047 # MAC Bridge Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001048 # Create AR - MacBridgeServiceProfile - 513
1049 self.send_create_mac_bridge_service_profile(0x201)
1050 yield self.wait_for_response()
1051
Steve Crooks9b160d72017-03-31 10:48:29 -05001052 # GEM Port Network CTP config
1053 # Create AR - GemPortNetworkCtp - 257 - <gem> - 32769
1054 self.send_create_gem_port_network_ctp(0x101, gem, 0x8001, "bi-directional", 0x100)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001055 yield self.wait_for_response()
1056
1057 # Create AR - GemPortNetworkCtp - 260 - 4000 - 0
1058 self.send_create_gem_port_network_ctp(0x104, 0x0FA0, 0, "downstream", 0)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001059 yield self.wait_for_response()
1060
Steve Crooks9b160d72017-03-31 10:48:29 -05001061 # Multicast GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001062 # Create AR - MulticastGemInterworkingTp - 6 - 260
1063 self.send_create_multicast_gem_interworking_tp(0x6, 0x104)
1064 yield self.wait_for_response()
1065
Steve Crooks9b160d72017-03-31 10:48:29 -05001066 # GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001067 # Create AR - GemInterworkingTp - 32770 - 257 -32769 - 1
1068 self.send_create_gem_inteworking_tp(0x8002, 0x101, 0x8001)
1069 yield self.wait_for_response()
1070
Steve Crooks9b160d72017-03-31 10:48:29 -05001071 # Mapper Service Profile config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001072 # Set AR - 802.1pMapperServiceProfile - 32769 - 32770
1073 self.send_set_8021p_mapper_service_profile(0x8001, 0x8002)
1074 yield self.wait_for_response()
1075
Steve Crooks9b160d72017-03-31 10:48:29 -05001076 # MAC Bridge Port config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001077 # Create AR - MacBridgePortConfigData - 8450 - 513 - 3 - 3 - 32769
1078 self.send_create_mac_bridge_port_configuration_data(0x2102, 0x201, 3, 3, 0x8001)
1079 yield self.wait_for_response()
1080
Steve Crooks3c2c7582017-01-10 15:02:26 -06001081 # Create AR - MacBridgePortConfigData - 9000 - 513 - 6 - 6 - 6
1082 self.send_create_mac_bridge_port_configuration_data(0x2328, 0x201, 6, 6, 6)
1083 yield self.wait_for_response()
1084
Steve Crooks9b160d72017-03-31 10:48:29 -05001085 # VLAN Tagging Filter config
1086 # Create AR - VlanTaggingFilterData - 8450 - c-vid
1087 self.send_create_vlan_tagging_filter_data(0x2102, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001088 yield self.wait_for_response()
1089
Steve Crooks9b160d72017-03-31 10:48:29 -05001090 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001091 # Create AR - MulticastOperationsProfile
1092 self.send_create_multicast_operations_profile(0x201, 3)
1093 yield self.wait_for_response()
1094
1095 # Set AR - MulticastOperationsProfile - Dynamic Access Control List table
1096 self.send_set_multicast_operations_profile_acl_row0(0x201,
1097 'dynamic',
1098 0,
1099 0x0fa0,
1100 0x0fa0,
1101 '0.0.0.0',
1102 '224.0.0.0',
1103 '239.255.255.255')
1104 yield self.wait_for_response()
1105
Steve Crooks9b160d72017-03-31 10:48:29 -05001106 # Multicast Subscriber config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001107 # Create AR - MulticastSubscriberConfigInfo
1108 self.send_create_multicast_subscriber_config_info(0x201, 0, 0x201)
1109 yield self.wait_for_response()
1110
Steve Crooks9b160d72017-03-31 10:48:29 -05001111 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001112 # Set AR - MulticastOperationsProfile - Downstream IGMP Multicast TCI
Steve Crooks9b160d72017-03-31 10:48:29 -05001113 self.send_set_multicast_operations_profile_ds_igmp_mcast_tci(0x201, 4, cvid)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001114 yield self.wait_for_response()
1115
Steve Crooks9b160d72017-03-31 10:48:29 -05001116 # Port 2
1117 # Extended VLAN Tagging Operation config
1118 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1119 # TODO: add entry here for additional UNI interfaces
Steve Crooks9e85ce82017-03-20 12:00:53 -04001120 self.send_create_extended_vlan_tagging_operation_configuration_data(0x202, 2, 0x102)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001121 yield self.wait_for_response()
1122
1123 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
Steve Crooks46d64302017-03-10 15:11:06 -05001124 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x202, 0x8100, 0x8100)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001125 yield self.wait_for_response()
1126
Steve Crooks46d64302017-03-10 15:11:06 -05001127 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001128 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1129 #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0, 1, 8, cvid)
Steve Crooksa9d0a7c2017-03-28 22:40:01 -04001130 #yield self.wait_for_response()
1131
1132 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001133 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1134 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x202, 0x1000, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001135 yield self.wait_for_response()
1136
Steve Crooks9b160d72017-03-31 10:48:29 -05001137 # MAC Bridge Port config
1138 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1139 # TODO: add more entries here for other UNI ports
1140 self.send_create_mac_bridge_port_configuration_data(0x201, 0x201, 2, 1, 0x102)
1141 yield self.wait_for_response()
1142
1143 # Port 5
1144 # Extended VLAN Tagging Operation config
1145 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1146 # TODO: add entry here for additional UNI interfaces
1147 self.send_create_extended_vlan_tagging_operation_configuration_data(0x205, 2, 0x105)
1148 yield self.wait_for_response()
1149
1150 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
1151 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x205, 0x8100, 0x8100)
1152 yield self.wait_for_response()
1153
1154 # Set AR - ExtendedVlanTaggingOperationConfigData
1155 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1156 #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0, 1, 8, cvid)
1157 #yield self.wait_for_response()
1158
1159 # Set AR - ExtendedVlanTaggingOperationConfigData
1160 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1161 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x205, 0x1000, cvid)
1162 yield self.wait_for_response()
1163
1164 # MAC Bridge Port config
1165 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1166 # TODO: add more entries here for other UNI ports
1167 self.send_create_mac_bridge_port_configuration_data(0x205, 0x201, 5, 1, 0x105)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001168 yield self.wait_for_response()