blob: b8f7d7f69ccc6363018b70732823c5814994414e [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 Shafikb2ff5a62017-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 Shafikb2ff5a62017-05-02 15:54:39 -0400144 def receive_inter_adapter_message(self, msg):
145 log.info('receive_inter_adapter_message', msg=msg)
146
Steve Crooks3c2c7582017-01-10 15:02:26 -0600147
148class BroadcomOnuHandler(object):
149
150 def __init__(self, adapter, device_id):
151 self.adapter = adapter
152 self.adapter_agent = adapter.adapter_agent
153 self.device_id = device_id
154 self.log = structlog.get_logger(device_id=device_id)
155 self.incoming_messages = DeferredQueue()
156 self.proxy_address = None
157 self.tx_id = 0
158
159 def receive_message(self, msg):
160 self.incoming_messages.put(msg)
161
162 def activate(self, device):
163 self.log.info('activating')
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800164
165 # first we verify that we got parent reference and proxy info
166 assert device.parent_id
167 assert device.proxy_address.device_id
Steve Crooks8abe8c22017-03-31 10:48:29 -0500168 #assert device.proxy_address.channel_id # c-vid
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800169
Steve Crooks3c2c7582017-01-10 15:02:26 -0600170 # register for proxied messages right away
171 self.proxy_address = device.proxy_address
172 self.adapter_agent.register_for_proxied_messages(device.proxy_address)
173
Peter Shafikb2ff5a62017-05-02 15:54:39 -0400174
Steve Crooks3c2c7582017-01-10 15:02:26 -0600175 # populate device info
176 device.root = True
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800177 device.vendor = 'Broadcom'
Steve Crooks9e85ce82017-03-20 12:00:53 -0400178 device.model = 'n/a'
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800179 device.hardware_version = 'to be filled'
180 device.firmware_version = 'to be filled'
181 device.software_version = 'to be filled'
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800182 device.connect_status = ConnectStatus.REACHABLE
183 self.adapter_agent.update_device(device)
184
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800185 self.adapter_agent.add_port(device.id, Port(
Steve Crooks8abe8c22017-03-31 10:48:29 -0500186 port_no=100,
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800187 label='PON port',
188 type=Port.PON_ONU,
189 admin_state=AdminState.ENABLED,
190 oper_status=OperStatus.ACTIVE,
191 peers=[
192 Port.PeerPort(
193 device_id=device.parent_id,
194 port_no=device.parent_port_no
195 )
196 ]
197 ))
198
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800199 parent_device = self.adapter_agent.get_device(device.parent_id)
200 logical_device_id = parent_device.parent_id
201 assert logical_device_id
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800202
Steve Crooks8abe8c22017-03-31 10:48:29 -0500203 # query ONU for number of supported uni ports
204 # temporarily set number of ports to 1 - port #2
205 uni_ports = (2,)
206
207 for uni in uni_ports:
208 # register physical ports
209 uni_port = Port(
210 port_no=uni,
211 label='UNI facing Ethernet port '+str(uni),
212 type=Port.ETHERNET_UNI,
213 admin_state=AdminState.ENABLED,
214 oper_status=OperStatus.ACTIVE
215 )
216 self.adapter_agent.add_port(device.id, uni_port)
217
218 # add uni port to logical device
219 port_no = device.proxy_address.channel_id + uni
220 cap = OFPPF_1GB_FD | OFPPF_FIBER
221 self.adapter_agent.add_logical_port(logical_device_id, LogicalPort(
222 id='uni-{}'.format(port_no),
223 ofp_port=ofp_port(
224 port_no=port_no,
225 hw_addr=mac_str_to_tuple('00:00:00:%02x:%02x:%02x' %
226 (device.proxy_address.onu_id & 0xff,
227 (port_no >> 8) & 0xff,
228 port_no & 0xff)),
229 name='uni-{}'.format(port_no),
230 config=0,
231 state=OFPPS_LIVE,
232 curr=cap,
233 advertised=cap,
234 peer=cap,
235 curr_speed=OFPPF_1GB_FD,
236 max_speed=OFPPF_1GB_FD
237 ),
238 device_id=device.id,
239 device_port_no=uni_port.port_no
240 ))
241
242 reactor.callLater(10,
243 self.message_exchange,
244 self.proxy_address.onu_id,
245 self.proxy_address.onu_session_id,
246 port_no)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800247
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800248 device = self.adapter_agent.get_device(device.id)
249 device.oper_status = OperStatus.ACTIVE
250 self.adapter_agent.update_device(device)
251
Steve Crooks3c2c7582017-01-10 15:02:26 -0600252 @inlineCallbacks
Steve Crooksf248e182017-02-07 10:50:24 -0500253 def update_flow_table(self, device, flows):
254 #
255 # We need to proxy through the OLT to get to the ONU
256 # Configuration from here should be using OMCI
257 #
258 self.log.info('bulk-flow-update', device_id=device.id, flows=flows)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800259
Steve Crooksf248e182017-02-07 10:50:24 -0500260 def is_downstream(port):
Steve Crooks8abe8c22017-03-31 10:48:29 -0500261 return port == 100 # Need a better way
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800262
Steve Crooksf248e182017-02-07 10:50:24 -0500263 def is_upstream(port):
264 return not is_downstream(port)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800265
Steve Crooksf248e182017-02-07 10:50:24 -0500266 for flow in flows:
Steve Crooks8abe8c22017-03-31 10:48:29 -0500267 _type = None
268 _port = None
269 _vlan_vid = None
270 _udp_dst = None
271 _udp_src = None
272 _ipv4_dst = None
273 _ipv4_src = None
274 _metadata = None
275 _output = None
276 _push_tpid = None
277 _field = None
278 _set_vlan_vid = None
Steve Crooksf248e182017-02-07 10:50:24 -0500279 try:
280 _in_port = fd.get_in_port(flow)
281 assert _in_port is not None
Steve Crooks3c2c7582017-01-10 15:02:26 -0600282
Steve Crooksf248e182017-02-07 10:50:24 -0500283 if is_downstream(_in_port):
284 self.log.info('downstream-flow')
285 elif is_upstream(_in_port):
286 self.log.info('upstream-flow')
287 else:
288 raise Exception('port should be 1 or 2 by our convention')
289
290 _out_port = fd.get_out_port(flow) # may be None
291 self.log.info('out-port', out_port=_out_port)
292
293 for field in fd.get_ofb_fields(flow):
294 if field.type == fd.ETH_TYPE:
295 _type = field.eth_type
296 self.log.info('field-type-eth-type',
297 eth_type=_type)
298
299 elif field.type == fd.IP_PROTO:
300 _proto = field.ip_proto
301 self.log.info('field-type-ip-proto',
302 ip_proto=_proto)
303
304 elif field.type == fd.IN_PORT:
305 _port = field.port
306 self.log.info('field-type-in-port',
307 in_port=_port)
308
309 elif field.type == fd.VLAN_VID:
310 _vlan_vid = field.vlan_vid & 0xfff
311 self.log.info('field-type-vlan-vid',
312 vlan=_vlan_vid)
313
314 elif field.type == fd.VLAN_PCP:
315 _vlan_pcp = field.vlan_pcp
316 self.log.info('field-type-vlan-pcp',
317 pcp=_vlan_pcp)
318
319 elif field.type == fd.UDP_DST:
320 _udp_dst = field.udp_dst
321 self.log.info('field-type-udp-dst',
322 udp_dst=_udp_dst)
323
324 elif field.type == fd.UDP_SRC:
325 _udp_src = field.udp_src
326 self.log.info('field-type-udp-src',
327 udp_src=_udp_src)
328
329 elif field.type == fd.IPV4_DST:
330 _ipv4_dst = field.ipv4_dst
331 self.log.info('field-type-ipv4-dst',
332 ipv4_dst=_ipv4_dst)
333
334 elif field.type == fd.IPV4_SRC:
335 _ipv4_src = field.ipv4_src
336 self.log.info('field-type-ipv4-src',
337 ipv4_dst=_ipv4_src)
338
339 elif field.type == fd.METADATA:
Steve Crooks8abe8c22017-03-31 10:48:29 -0500340 _metadata = field.table_metadata
Steve Crooksf248e182017-02-07 10:50:24 -0500341 self.log.info('field-type-metadata',
342 metadata=_metadata)
343
344 else:
345 raise NotImplementedError('field.type={}'.format(
346 field.type))
347
348 for action in fd.get_actions(flow):
349
350 if action.type == fd.OUTPUT:
351 _output = action.output.port
352 self.log.info('action-type-output',
353 output=_output, in_port=_in_port)
354
355 elif action.type == fd.POP_VLAN:
356 self.log.info('action-type-pop-vlan',
357 in_port=_in_port)
358
359 elif action.type == fd.PUSH_VLAN:
360 _push_tpid = action.push.ethertype
361 log.info('action-type-push-vlan',
362 push_tpid=_push_tpid, in_port=_in_port)
363 if action.push.ethertype != 0x8100:
364 self.log.error('unhandled-tpid',
365 ethertype=action.push.ethertype)
366
367 elif action.type == fd.SET_FIELD:
368 _field = action.set_field.field.ofb_field
369 assert (action.set_field.field.oxm_class ==
370 OFPXMC_OPENFLOW_BASIC)
371 self.log.info('action-type-set-field',
372 field=_field, in_port=_in_port)
373 if _field.type == fd.VLAN_VID:
Steve Crooks8abe8c22017-03-31 10:48:29 -0500374 _set_vlan_vid = _field.vlan_vid & 0xfff
375 self.log.info('set-field-type-valn-vid', _set_vlan_vid)
Steve Crooksf248e182017-02-07 10:50:24 -0500376 else:
377 self.log.error('unsupported-action-set-field-type',
378 field_type=_field.type)
379 else:
380 log.error('unsupported-action-type',
381 action_type=action.type, in_port=_in_port)
382
383 #
384 # All flows created from ONU adapter should be OMCI based
385 #
Steve Crooks8abe8c22017-03-31 10:48:29 -0500386 if _vlan_vid == 0:
387 # allow priority tagged packets
388 # Set AR - ExtendedVlanTaggingOperationConfigData
389 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
390 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0,
391 1, 8, _in_port)
392 yield self.wait_for_response()
393
394 # Set AR - ExtendedVlanTaggingOperationConfigData
395 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
396 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0,
397 1, 8, _in_port)
398 yield self.wait_for_response()
Steve Crooksf248e182017-02-07 10:50:24 -0500399
400 except Exception as e:
401 log.exception('failed-to-install-flow', e=e, flow=flow)
402
Steve Crooks3c2c7582017-01-10 15:02:26 -0600403 def get_tx_id(self):
404 self.tx_id += 1
405 return self.tx_id
406
407 def send_omci_message(self, frame):
408 _frame = hexify(str(frame))
409 self.log.info('send-omci-message-%s' % _frame)
410 device = self.adapter_agent.get_device(self.device_id)
411 try:
412 self.adapter_agent.send_proxied_message(device.proxy_address, _frame)
413 except Exception as e:
414 self.log.info('send-omci-message-exception', exc=str(e))
415
416 def send_get_circuit_pack(self, entity_id=0):
417 frame = OmciFrame(
418 transaction_id=self.get_tx_id(),
419 message_type=OmciGet.message_id,
420 omci_message=OmciGet(
421 entity_class=CircuitPack.class_id,
422 entity_id=entity_id,
423 attributes_mask=CircuitPack.mask_for('vendor_id')
424 )
425 )
426 self.send_omci_message(frame)
427
428 def send_mib_reset(self, entity_id=0):
429 frame = OmciFrame(
430 transaction_id=self.get_tx_id(),
431 message_type=OmciMibReset.message_id,
432 omci_message=OmciMibReset(
433 entity_class=OntData.class_id,
434 entity_id=entity_id
435 )
436 )
437 self.send_omci_message(frame)
438
Steve Crooks9e85ce82017-03-20 12:00:53 -0400439 def send_create_gal_ethernet_profile(self,
440 entity_id,
441 max_gem_payload_size):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600442 frame = OmciFrame(
443 transaction_id=self.get_tx_id(),
444 message_type=OmciCreate.message_id,
445 omci_message=OmciCreate(
446 entity_class=GalEthernetProfile.class_id,
447 entity_id=entity_id,
448 data=dict(
449 max_gem_payload_size=max_gem_payload_size
450 )
451 )
452 )
453 self.send_omci_message(frame)
454
Steve Crooks9e85ce82017-03-20 12:00:53 -0400455 def send_set_tcont(self,
456 entity_id,
457 alloc_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600458 data = dict(
459 alloc_id=alloc_id
460 )
461 frame = OmciFrame(
462 transaction_id=self.get_tx_id(),
463 message_type=OmciSet.message_id,
464 omci_message=OmciSet(
465 entity_class=Tcont.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400466 entity_id=entity_id,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600467 attributes_mask=Tcont.mask_for(*data.keys()),
468 data=data
469 )
470 )
471 self.send_omci_message(frame)
472
Steve Crooks9e85ce82017-03-20 12:00:53 -0400473 def send_create_8021p_mapper_service_profile(self,
474 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600475 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400476 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600477 message_type=OmciCreate.message_id,
478 omci_message=OmciCreate(
479 entity_class=Ieee8021pMapperServiceProfile.class_id,
480 entity_id=entity_id,
481 data=dict(
482 tp_pointer=OmciNullPointer,
483 interwork_tp_pointer_for_p_bit_priority_0=OmciNullPointer,
Steve Crooks8abe8c22017-03-31 10:48:29 -0500484 interwork_tp_pointer_for_p_bit_priority_1=OmciNullPointer,
485 interwork_tp_pointer_for_p_bit_priority_2=OmciNullPointer,
486 interwork_tp_pointer_for_p_bit_priority_3=OmciNullPointer,
487 interwork_tp_pointer_for_p_bit_priority_4=OmciNullPointer,
488 interwork_tp_pointer_for_p_bit_priority_5=OmciNullPointer,
489 interwork_tp_pointer_for_p_bit_priority_6=OmciNullPointer,
490 interwork_tp_pointer_for_p_bit_priority_7=OmciNullPointer
Steve Crooks3c2c7582017-01-10 15:02:26 -0600491 )
492 )
493 )
494 self.send_omci_message(frame)
495
Steve Crooks9e85ce82017-03-20 12:00:53 -0400496 def send_create_mac_bridge_service_profile(self,
497 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600498 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400499 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600500 message_type=OmciCreate.message_id,
501 omci_message=OmciCreate(
502 entity_class=MacBridgeServiceProfile.class_id,
503 entity_id=entity_id,
504 data=dict(
505 spanning_tree_ind=False,
506 learning_ind=True,
507 priority=0x8000,
508 max_age=20 * 256,
509 hello_time=2 * 256,
510 forward_delay=15 * 256,
511 unknown_mac_address_discard=True
512 )
513 )
514 )
515 self.send_omci_message(frame)
516
Steve Crooks9e85ce82017-03-20 12:00:53 -0400517 def send_create_gem_port_network_ctp(self,
518 entity_id,
519 port_id,
520 tcont_id,
521 direction,
522 tm):
523 _directions = {"upstream": 1, "downstream": 2, "bi-directional": 3}
524 if _directions.has_key(direction):
525 _direction = _directions[direction]
526 else:
527 self.log.error('invalid-gem-port-direction', direction=direction)
528 raise ValueError('Invalid GEM port direction: {_dir}'.format(_dir=direction))
529
Steve Crooks3c2c7582017-01-10 15:02:26 -0600530 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400531 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600532 message_type=OmciCreate.message_id,
533 omci_message=OmciCreate(
534 entity_class=GemPortNetworkCtp.class_id,
535 entity_id=entity_id,
536 data=dict(
537 port_id=port_id,
538 tcont_pointer=tcont_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400539 direction=_direction,
540 traffic_management_pointer_upstream=tm
Steve Crooks3c2c7582017-01-10 15:02:26 -0600541 )
542 )
543 )
544 self.send_omci_message(frame)
545
Steve Crooks9e85ce82017-03-20 12:00:53 -0400546 def send_create_multicast_gem_interworking_tp(self,
547 entity_id,
548 gem_port_net_ctp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600549 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400550 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600551 message_type=OmciCreate.message_id,
552 omci_message=OmciCreate(
553 entity_class=MulticastGemInterworkingTp.class_id,
554 entity_id=entity_id,
555 data=dict(
556 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
557 interworking_option=0,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400558 service_profile_pointer=0x1
Steve Crooks3c2c7582017-01-10 15:02:26 -0600559 )
560 )
561 )
562 self.send_omci_message(frame)
563
Steve Crooks9e85ce82017-03-20 12:00:53 -0400564 def send_create_gem_inteworking_tp(self,
565 entity_id,
566 gem_port_net_ctp_id,
567 service_profile_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600568 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400569 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600570 message_type=OmciCreate.message_id,
571 omci_message=OmciCreate(
572 entity_class=GemInterworkingTp.class_id,
573 entity_id=entity_id,
574 data=dict(
575 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
576 interworking_option=5,
577 service_profile_pointer=service_profile_id,
578 interworking_tp_pointer=0x0,
579 gal_profile_pointer=0x1
580 )
581 )
582 )
583 self.send_omci_message(frame)
584
Steve Crooks9e85ce82017-03-20 12:00:53 -0400585 def send_set_8021p_mapper_service_profile(self,
586 entity_id,
587 interwork_tp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600588 data = dict(
Steve Crooks8abe8c22017-03-31 10:48:29 -0500589 interwork_tp_pointer_for_p_bit_priority_0=interwork_tp_id,
590 interwork_tp_pointer_for_p_bit_priority_1=interwork_tp_id,
591 interwork_tp_pointer_for_p_bit_priority_2=interwork_tp_id,
592 interwork_tp_pointer_for_p_bit_priority_3=interwork_tp_id,
593 interwork_tp_pointer_for_p_bit_priority_4=interwork_tp_id,
594 interwork_tp_pointer_for_p_bit_priority_5=interwork_tp_id,
595 interwork_tp_pointer_for_p_bit_priority_6=interwork_tp_id,
596 interwork_tp_pointer_for_p_bit_priority_7=interwork_tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600597 )
598 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400599 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600600 message_type=OmciSet.message_id,
601 omci_message=OmciSet(
602 entity_class=Ieee8021pMapperServiceProfile.class_id,
603 entity_id=entity_id,
604 attributes_mask=Ieee8021pMapperServiceProfile.mask_for(
605 *data.keys()),
606 data=data
607 )
608 )
609 self.send_omci_message(frame)
610
611 def send_create_mac_bridge_port_configuration_data(self,
612 entity_id,
613 bridge_id,
614 port_id,
615 tp_type,
616 tp_id):
617 frame = OmciFrame(
618 transaction_id=self.get_tx_id(),
619 message_type=OmciCreate.message_id,
620 omci_message=OmciCreate(
621 entity_class=MacBridgePortConfigurationData.class_id,
622 entity_id=entity_id,
623 data=dict(
624 bridge_id_pointer = bridge_id,
625 port_num=port_id,
626 tp_type=tp_type,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400627 tp_pointer=tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600628 )
629 )
630 )
631 self.send_omci_message(frame)
632
Steve Crooks9e85ce82017-03-20 12:00:53 -0400633 def send_create_vlan_tagging_filter_data(self,
634 entity_id,
635 vlan_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600636 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400637 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600638 message_type=OmciCreate.message_id,
639 omci_message=OmciCreate(
640 entity_class=VlanTaggingFilterData.class_id,
641 entity_id=entity_id,
642 data=dict(
643 vlan_filter_0=vlan_id,
644 forward_operation=0x10,
645 number_of_entries=1
646 )
647 )
648 )
649 self.send_omci_message(frame)
650
Steve Crooks46d64302017-03-10 15:11:06 -0500651 def send_create_extended_vlan_tagging_operation_configuration_data(self,
652 entity_id,
653 assoc_type,
654 assoc_me):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600655 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400656 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600657 message_type=OmciCreate.message_id,
658 omci_message=OmciCreate(
659 entity_class=
660 ExtendedVlanTaggingOperationConfigurationData.class_id,
661 entity_id=entity_id,
662 data=dict(
Steve Crooks46d64302017-03-10 15:11:06 -0500663 association_type=assoc_type,
664 associated_me_pointer=assoc_me
Steve Crooks3c2c7582017-01-10 15:02:26 -0600665 )
666 )
667 )
668 self.send_omci_message(frame)
669
Steve Crooks9e85ce82017-03-20 12:00:53 -0400670 def send_set_extended_vlan_tagging_operation_tpid_configuration_data(self,
671 entity_id,
672 input_tpid,
673 output_tpid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600674 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400675 input_tpid=input_tpid,
676 output_tpid=output_tpid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600677 downstream_mode=0, # inverse of upstream
678 )
679 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400680 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600681 message_type=OmciSet.message_id,
682 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400683 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600684 ExtendedVlanTaggingOperationConfigurationData.class_id,
685 entity_id=entity_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400686 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600687 ExtendedVlanTaggingOperationConfigurationData.mask_for(
688 *data.keys()),
689 data=data
690 )
691 )
692 self.send_omci_message(frame)
693
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400694 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(self,
695 entity_id,
696 filter_inner_vid,
697 treatment_inner_vid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600698 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400699 received_frame_vlan_tagging_operation_table=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600700 VlanTaggingOperation(
701 filter_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500702 filter_outer_vid=4096,
703 filter_outer_tpid_de=0,
704
705 filter_inner_priority=15,
706 filter_inner_vid=filter_inner_vid,
707 filter_inner_tpid_de=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600708 filter_ether_type=0,
Steve Crooks46d64302017-03-10 15:11:06 -0500709
710 treatment_tags_to_remove=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600711 treatment_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500712 treatment_outer_vid=0,
713 treatment_outer_tpid_de=0,
714
715 treatment_inner_priority=0,
716 treatment_inner_vid=treatment_inner_vid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600717 treatment_inner_tpid_de=4
718 )
719 )
720 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400721 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600722 message_type=OmciSet.message_id,
723 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400724 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600725 ExtendedVlanTaggingOperationConfigurationData.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400726 entity_id=entity_id,
727 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600728 ExtendedVlanTaggingOperationConfigurationData.mask_for(
729 *data.keys()),
730 data=data
731 )
732 )
733 self.send_omci_message(frame)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800734
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400735 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(self,
736 entity_id,
737 filter_inner_priority,
738 filter_inner_vid,
739 filter_inner_tpid_de,
740 treatment_tags_to_remove,
741 treatment_inner_priority,
742 treatment_inner_vid):
743 data = dict(
744 received_frame_vlan_tagging_operation_table=
745 VlanTaggingOperation(
746 filter_outer_priority=15,
747 filter_outer_vid=4096,
748 filter_outer_tpid_de=0,
749
750 filter_inner_priority=filter_inner_priority,
751 filter_inner_vid=filter_inner_vid,
752 filter_inner_tpid_de=filter_inner_tpid_de,
753 filter_ether_type=0,
754
755 treatment_tags_to_remove=treatment_tags_to_remove,
756 treatment_outer_priority=15,
757 treatment_outer_vid=0,
758 treatment_outer_tpid_de=0,
759
760 treatment_inner_priority=treatment_inner_priority,
761 treatment_inner_vid=treatment_inner_vid,
762 treatment_inner_tpid_de=4
763 )
764 )
765 frame = OmciFrame(
766 transaction_id=self.get_tx_id(),
767 message_type=OmciSet.message_id,
768 omci_message=OmciSet(
769 entity_class=
770 ExtendedVlanTaggingOperationConfigurationData.class_id,
771 entity_id=entity_id,
772 attributes_mask=
773 ExtendedVlanTaggingOperationConfigurationData.mask_for(
774 *data.keys()),
775 data=data
776 )
777 )
778 self.send_omci_message(frame)
779
Steve Crooks9e85ce82017-03-20 12:00:53 -0400780 def send_create_multicast_operations_profile(self,
781 entity_id,
782 igmp_ver):
783 frame = OmciFrame(
784 transaction_id=self.get_tx_id(),
785 message_type=OmciCreate.message_id,
786 omci_message=OmciCreate(
787 entity_class=
788 MulticastOperationsProfile.class_id,
789 entity_id=entity_id,
790 data=dict(
791 igmp_version=igmp_ver,
792 igmp_function=0,
793 immediate_leave=0
794 )
795 )
796 )
797 self.send_omci_message(frame)
798
799 def send_set_multicast_operations_profile_acl_row0(self,
800 entity_id,
801 acl_table,
802 row_key,
803 gem_port,
804 vlan,
805 src_ip,
806 dst_ip_start,
807 dst_ip_end):
808 row0 = AccessControlRow0(
809 set_ctrl=1,
810 row_part_id=0,
811 test=0,
812 row_key=row_key,
813 gem_port_id=gem_port,
814 vlan_id=vlan,
815 src_ip=src_ip,
816 dst_ip_start=dst_ip_start,
817 dst_ip_end=dst_ip_end,
818 ipm_group_bw=0
819 )
820
821 if acl_table == 'dynamic':
822 data = dict(
823 dynamic_access_control_list_table=row0
824 )
825 else:
826 data = dict(
827 static_access_control_list_table=row0
828 )
829
830 frame = OmciFrame(
831 transaction_id=self.get_tx_id(),
832 message_type=OmciSet.message_id,
833 omci_message=OmciSet(
834 entity_class=MulticastOperationsProfile.class_id,
835 entity_id=entity_id,
836 attributes_mask=MulticastOperationsProfile.mask_for(
837 *data.keys()),
838 data=data
839 )
840 )
841 self.send_omci_message(frame)
842
843 def send_set_multicast_operations_profile_ds_igmp_mcast_tci(self,
844 entity_id,
845 ctrl_type,
846 tci):
847 data = dict(
848 ds_igmp_mcast_tci=
849 DownstreamIgmpMulticastTci(
850 ctrl_type=ctrl_type,
851 tci=tci
852 )
853 )
854 frame = OmciFrame(
855 transaction_id=self.get_tx_id(),
856 message_type=OmciSet.message_id,
857 omci_message=OmciSet(
858 entity_class=MulticastOperationsProfile.class_id,
859 entity_id=entity_id,
860 attributes_mask=MulticastOperationsProfile.mask_for(
861 *data.keys()),
862 data=data
863 )
864 )
865 self.send_omci_message(frame)
866
867 def send_create_multicast_subscriber_config_info(self,
868 entity_id,
869 me_type,
870 mcast_oper_profile):
871 frame = OmciFrame(
872 transaction_id=self.get_tx_id(),
873 message_type=OmciCreate.message_id,
874 omci_message=OmciCreate(
875 entity_class=
876 MulticastSubscriberConfigInfo.class_id,
877 entity_id=entity_id,
878 data=dict(
879 me_type=me_type,
880 mcast_operations_profile_pointer=mcast_oper_profile
881 )
882 )
883 )
884 self.send_omci_message(frame)
885
886 def send_set_multicast_subscriber_config_info(self,
887 entity_id,
888 max_groups=0,
889 max_mcast_bw=0,
890 bw_enforcement=0):
891 data = dict(
892 max_simultaneous_groups=max_groups,
893 max_multicast_bandwidth=max_mcast_bw,
894 bandwidth_enforcement=bw_enforcement
895 )
896 frame = OmciFrame(
897 transaction_id=self.get_tx_id(),
898 message_type=OmciSet.message_id,
899 omci_message=OmciSet(
900 entity_class=MulticastSubscriberConfigInfo.class_id,
901 entity_id=entity_id,
902 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
903 *data.keys()),
904 data=data
905 )
906 )
907 self.send_omci_message(frame)
908
909 def send_set_multicast_service_package(self,
910 entity_id,
911 row_key,
912 vid_uni,
913 max_groups,
914 max_mcast_bw,
915 mcast_oper_profile):
916 data = dict(
917 multicast_service_package_table=
918 MulticastServicePackage(
919 set_ctrl=1,
920 row_key=row_key,
921
922 vid_uni=vid_uni,
923 max_simultaneous_groups=max_groups,
924 max_multicast_bw=max_mcast_bw,
925 mcast_operations_profile_pointer=mcast_oper_profile
926 )
927 )
928 frame = OmciFrame(
929 transaction_id=self.get_tx_id(),
930 message_type=OmciSet.message_id,
931 omci_message=OmciSet(
932 entity_class=MulticastSubscriberConfigInfo.class_id,
933 entity_id=entity_id,
934 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
935 *data.keys()),
936 data=data
937 )
938 )
939 self.send_omci_message(frame)
940
941 def send_set_multicast_allowed_preview_groups_row0(self,
942 entity_id,
943 row_key,
944 src_ip,
945 vlan_id_ani,
946 vlan_id_uni):
947 data = dict(
948 allowed_preview_groups_table=
949 AllowedPreviewGroupsRow0(
950 set_ctrl=1,
951 row_part_id=0,
952 row_key=row_key,
953
954 src_ip=src_ip,
955 vlan_id_ani=vlan_id_ani,
956 vlan_id_uni=vlan_id_uni
957 )
958 )
959 frame = OmciFrame(
960 transaction_id=self.get_tx_id(),
961 message_type=OmciSet.message_id,
962 omci_message=OmciSet(
963 entity_class=MulticastSubscriberConfigInfo.class_id,
964 entity_id=entity_id,
965 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
966 *data.keys()),
967 data=data
968 )
969 )
970 self.send_omci_message(frame)
971
972 def send_set_multicast_allowed_preview_groups_row1(self,
973 entity_id,
974 row_key,
975 dst_ip,
976 duration,
977 time_left):
978 data = dict(
979 allowed_preview_groups_table=
980 AllowedPreviewGroupsRow1(
981 set_ctrl=1,
982 row_part_id=1,
983 row_key=row_key,
984
985 dst_ip=dst_ip,
986 duration=duration,
987 time_left=time_left
988 )
989 )
990 frame = OmciFrame(
991 transaction_id=self.get_tx_id(),
992 message_type=OmciSet.message_id,
993 omci_message=OmciSet(
994 entity_class=MulticastSubscriberConfigInfo.class_id,
995 entity_id=entity_id,
996 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
997 *data.keys()),
998 data=data
999 )
1000 )
1001 self.send_omci_message(frame)
1002
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001003 @inlineCallbacks
Steve Crooks3c2c7582017-01-10 15:02:26 -06001004 def wait_for_response(self):
1005 log.info('wait-for-response')
1006 try:
1007 response = yield self.incoming_messages.get()
Steve Crooks9e85ce82017-03-20 12:00:53 -04001008 log.info('got-response')
1009 # resp = OmciFrame(response)
1010 # resp.show()
Steve Crooks3c2c7582017-01-10 15:02:26 -06001011 except Exception as e:
1012 self.log.info('wait-for-response-exception', exc=str(e))
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001013
Steve Crooks3c2c7582017-01-10 15:02:26 -06001014 @inlineCallbacks
Steve Crooks8abe8c22017-03-31 10:48:29 -05001015 def message_exchange(self, onu, gem, cvid):
1016 log.info('message_exchange', onu=onu, gem=gem, cvid=cvid)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001017 # reset incoming message queue
1018 while self.incoming_messages.pending:
1019 _ = yield self.incoming_messages.get()
1020
Steve Crooks8abe8c22017-03-31 10:48:29 -05001021 tcont = gem
1022
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001023 # construct message
Steve Crooks3c2c7582017-01-10 15:02:26 -06001024 # MIB Reset - OntData - 0
1025 self.send_mib_reset()
1026 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001027
Steve Crooks3c2c7582017-01-10 15:02:26 -06001028 # Create AR - GalEthernetProfile - 1
1029 self.send_create_gal_ethernet_profile(1, 48)
1030 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001031
Steve Crooks8abe8c22017-03-31 10:48:29 -05001032 # TCONT config
1033 # Set AR - TCont - 32769 - (1025 or 1026)
1034 self.send_set_tcont(0x8001, tcont)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001035 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001036
Steve Crooks8abe8c22017-03-31 10:48:29 -05001037 # Mapper Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001038 # Create AR - 802.1pMapperServiceProfile - 32769
1039 self.send_create_8021p_mapper_service_profile(0x8001)
1040 yield self.wait_for_response()
1041
Steve Crooks8abe8c22017-03-31 10:48:29 -05001042 # MAC Bridge Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001043 # Create AR - MacBridgeServiceProfile - 513
1044 self.send_create_mac_bridge_service_profile(0x201)
1045 yield self.wait_for_response()
1046
Steve Crooks8abe8c22017-03-31 10:48:29 -05001047 # GEM Port Network CTP config
1048 # Create AR - GemPortNetworkCtp - 257 - <gem> - 32769
1049 self.send_create_gem_port_network_ctp(0x101, gem, 0x8001, "bi-directional", 0x100)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001050 yield self.wait_for_response()
1051
1052 # Create AR - GemPortNetworkCtp - 260 - 4000 - 0
1053 self.send_create_gem_port_network_ctp(0x104, 0x0FA0, 0, "downstream", 0)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001054 yield self.wait_for_response()
1055
Steve Crooks8abe8c22017-03-31 10:48:29 -05001056 # Multicast GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001057 # Create AR - MulticastGemInterworkingTp - 6 - 260
1058 self.send_create_multicast_gem_interworking_tp(0x6, 0x104)
1059 yield self.wait_for_response()
1060
Steve Crooks8abe8c22017-03-31 10:48:29 -05001061 # GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001062 # Create AR - GemInterworkingTp - 32770 - 257 -32769 - 1
1063 self.send_create_gem_inteworking_tp(0x8002, 0x101, 0x8001)
1064 yield self.wait_for_response()
1065
Steve Crooks8abe8c22017-03-31 10:48:29 -05001066 # Mapper Service Profile config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001067 # Set AR - 802.1pMapperServiceProfile - 32769 - 32770
1068 self.send_set_8021p_mapper_service_profile(0x8001, 0x8002)
1069 yield self.wait_for_response()
1070
Steve Crooks8abe8c22017-03-31 10:48:29 -05001071 # MAC Bridge Port config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001072 # Create AR - MacBridgePortConfigData - 8450 - 513 - 3 - 3 - 32769
1073 self.send_create_mac_bridge_port_configuration_data(0x2102, 0x201, 3, 3, 0x8001)
1074 yield self.wait_for_response()
1075
Steve Crooks3c2c7582017-01-10 15:02:26 -06001076 # Create AR - MacBridgePortConfigData - 9000 - 513 - 6 - 6 - 6
1077 self.send_create_mac_bridge_port_configuration_data(0x2328, 0x201, 6, 6, 6)
1078 yield self.wait_for_response()
1079
Steve Crooks8abe8c22017-03-31 10:48:29 -05001080 # VLAN Tagging Filter config
1081 # Create AR - VlanTaggingFilterData - 8450 - c-vid
1082 self.send_create_vlan_tagging_filter_data(0x2102, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001083 yield self.wait_for_response()
1084
Steve Crooks8abe8c22017-03-31 10:48:29 -05001085 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001086 # Create AR - MulticastOperationsProfile
1087 self.send_create_multicast_operations_profile(0x201, 3)
1088 yield self.wait_for_response()
1089
1090 # Set AR - MulticastOperationsProfile - Dynamic Access Control List table
1091 self.send_set_multicast_operations_profile_acl_row0(0x201,
1092 'dynamic',
1093 0,
1094 0x0fa0,
1095 0x0fa0,
1096 '0.0.0.0',
1097 '224.0.0.0',
1098 '239.255.255.255')
1099 yield self.wait_for_response()
1100
Steve Crooks8abe8c22017-03-31 10:48:29 -05001101 # Multicast Subscriber config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001102 # Create AR - MulticastSubscriberConfigInfo
1103 self.send_create_multicast_subscriber_config_info(0x201, 0, 0x201)
1104 yield self.wait_for_response()
1105
Steve Crooks8abe8c22017-03-31 10:48:29 -05001106 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001107 # Set AR - MulticastOperationsProfile - Downstream IGMP Multicast TCI
Steve Crooks8abe8c22017-03-31 10:48:29 -05001108 self.send_set_multicast_operations_profile_ds_igmp_mcast_tci(0x201, 4, cvid)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001109 yield self.wait_for_response()
1110
Steve Crooks8abe8c22017-03-31 10:48:29 -05001111 # Port 2
1112 # Extended VLAN Tagging Operation config
1113 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1114 # TODO: add entry here for additional UNI interfaces
Steve Crooks9e85ce82017-03-20 12:00:53 -04001115 self.send_create_extended_vlan_tagging_operation_configuration_data(0x202, 2, 0x102)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001116 yield self.wait_for_response()
1117
1118 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
Steve Crooks46d64302017-03-10 15:11:06 -05001119 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x202, 0x8100, 0x8100)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001120 yield self.wait_for_response()
1121
Steve Crooks46d64302017-03-10 15:11:06 -05001122 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks8abe8c22017-03-31 10:48:29 -05001123 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1124 #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 -04001125 #yield self.wait_for_response()
1126
1127 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks8abe8c22017-03-31 10:48:29 -05001128 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1129 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x202, 0x1000, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001130 yield self.wait_for_response()
1131
Steve Crooks8abe8c22017-03-31 10:48:29 -05001132 # MAC Bridge Port config
1133 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1134 # TODO: add more entries here for other UNI ports
1135 self.send_create_mac_bridge_port_configuration_data(0x201, 0x201, 2, 1, 0x102)
1136 yield self.wait_for_response()
1137
1138 # Port 5
1139 # Extended VLAN Tagging Operation config
1140 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1141 # TODO: add entry here for additional UNI interfaces
1142 self.send_create_extended_vlan_tagging_operation_configuration_data(0x205, 2, 0x105)
1143 yield self.wait_for_response()
1144
1145 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
1146 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x205, 0x8100, 0x8100)
1147 yield self.wait_for_response()
1148
1149 # Set AR - ExtendedVlanTaggingOperationConfigData
1150 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1151 #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0, 1, 8, cvid)
1152 #yield self.wait_for_response()
1153
1154 # Set AR - ExtendedVlanTaggingOperationConfigData
1155 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1156 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x205, 0x1000, cvid)
1157 yield self.wait_for_response()
1158
1159 # MAC Bridge Port config
1160 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1161 # TODO: add more entries here for other UNI ports
1162 self.send_create_mac_bridge_port_configuration_data(0x205, 0x201, 5, 1, 0x105)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001163 yield self.wait_for_response()