blob: 5531978aa52594293f65f36b6df4d61721730ec3 [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
Peter Shafikd7f33772017-05-17 13:56:34 -040023from twisted.internet import reactor, task
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
ggowdru236bd952017-06-20 20:32:55 -070035from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Port, Image
Steve Crooks3c2c7582017-01-10 15:02:26 -060036from 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
khenaidoo032d3302017-06-09 14:50:04 -0400100 def reconcile_device(self, device):
101 raise NotImplementedError()
102
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800103 def abandon_device(self, device):
104 raise NotImplementedError()
105
Khen Nursimulud068d812017-03-06 11:44:18 -0500106 def disable_device(self, device):
107 raise NotImplementedError()
108
109 def reenable_device(self, device):
110 raise NotImplementedError()
111
112 def reboot_device(self, device):
113 raise NotImplementedError()
114
115 def delete_device(self, device):
116 raise NotImplementedError()
117
118 def get_device_details(self, device):
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800119 raise NotImplementedError()
120
Sergio Slobodrianec864c62017-03-09 11:41:43 -0500121 def update_pm_config(self, device, pm_configs):
122 raise NotImplementedError()
123
Steve Crooks3c2c7582017-01-10 15:02:26 -0600124 def update_flows_bulk(self, device, flows, groups):
125 log.info('bulk-flow-update', device_id=device.id,
126 flows=flows, groups=groups)
127 assert len(groups.items) == 0
128 handler = self.devices_handlers[device.proxy_address.channel_id]
Steve Crooksf248e182017-02-07 10:50:24 -0500129 return handler.update_flow_table(device, flows.items)
Steve Crooks3c2c7582017-01-10 15:02:26 -0600130
131 def update_flows_incrementally(self, device, flow_changes, group_changes):
132 raise NotImplementedError()
133
134 def send_proxied_message(self, proxy_address, msg):
135 log.info('send-proxied-message', proxy_address=proxy_address, msg=msg)
136
137 def receive_proxied_message(self, proxy_address, msg):
138 log.info('receive-proxied-message', proxy_address=proxy_address,
139 device_id=proxy_address.device_id, msg=hexify(msg))
140 handler = self.devices_handlers[proxy_address.channel_id]
141 handler.receive_message(msg)
142
143 def receive_packet_out(self, logical_device_id, egress_port_no, msg):
144 log.info('packet-out', logical_device_id=logical_device_id,
145 egress_port_no=egress_port_no, msg_len=len(msg))
146
Peter Shafik9107f2e2017-05-02 15:54:39 -0400147 def receive_inter_adapter_message(self, msg):
148 log.info('receive_inter_adapter_message', msg=msg)
Peter Shafikd7f33772017-05-17 13:56:34 -0400149 proxy_address = msg['proxy_address']
150 assert proxy_address is not None
151
152 handler = self.devices_handlers[proxy_address.channel_id]
153 handler.event_messages.put(msg)
Peter Shafik9107f2e2017-05-02 15:54:39 -0400154
Stephane Barbarie980a0912017-05-11 11:27:06 -0400155 def suppress_alarm(self, filter):
156 raise NotImplementedError()
157
158 def unsuppress_alarm(self, filter):
159 raise NotImplementedError()
Steve Crooks3c2c7582017-01-10 15:02:26 -0600160
161class BroadcomOnuHandler(object):
162
163 def __init__(self, adapter, device_id):
164 self.adapter = adapter
165 self.adapter_agent = adapter.adapter_agent
166 self.device_id = device_id
167 self.log = structlog.get_logger(device_id=device_id)
168 self.incoming_messages = DeferredQueue()
Peter Shafikd7f33772017-05-17 13:56:34 -0400169 self.event_messages = DeferredQueue()
Steve Crooks3c2c7582017-01-10 15:02:26 -0600170 self.proxy_address = None
171 self.tx_id = 0
172
Peter Shafikd7f33772017-05-17 13:56:34 -0400173 # Need to query ONU for number of supported uni ports
174 # For now, temporarily set number of ports to 1 - port #2
175 self.uni_ports = (2,)
176
177 # Handle received ONU event messages
178 reactor.callLater(0, self.handle_onu_events)
179
Steve Crooks3c2c7582017-01-10 15:02:26 -0600180 def receive_message(self, msg):
181 self.incoming_messages.put(msg)
182
Peter Shafikd7f33772017-05-17 13:56:34 -0400183 @inlineCallbacks
184 def handle_onu_events(self):
185 event_msg = yield self.event_messages.get()
186
187 if event_msg['event'] == 'activation-completed':
188
189 if event_msg['event_data']['activation_successful'] == True:
190 for uni in self.uni_ports:
191 port_no = self.proxy_address.channel_id + uni
192 reactor.callLater(1,
193 self.message_exchange,
194 self.proxy_address.onu_id,
195 self.proxy_address.onu_session_id,
196 port_no)
197
198 device = self.adapter_agent.get_device(self.device_id)
199 device.oper_status = OperStatus.ACTIVE
200 self.adapter_agent.update_device(device)
201
202 else:
203 device = self.adapter_agent.get_device(self.device_id)
204 device.oper_status = OperStatus.FAILED
205 self.adapter_agent.update_device(device)
206
207 elif event_msg['event'] == 'deactivation-completed':
208 device = self.adapter_agent.get_device(self.device_id)
209 device.oper_status = OperStatus.DISCOVERED
210 self.adapter_agent.update_device(device)
211
212 elif event_msg['event'] == 'ranging-completed':
213
214 if event_msg['event_data']['ranging_successful'] == True:
215 device = self.adapter_agent.get_device(self.device_id)
216 device.oper_status = OperStatus.ACTIVATING
217 self.adapter_agent.update_device(device)
218
219 else:
220 device = self.adapter_agent.get_device(self.device_id)
221 device.oper_status = OperStatus.FAILED
222 self.adapter_agent.update_device(device)
223
224 # Handle next event
225 reactor.callLater(0, self.handle_onu_events)
226
227
Steve Crooks3c2c7582017-01-10 15:02:26 -0600228 def activate(self, device):
229 self.log.info('activating')
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800230
231 # first we verify that we got parent reference and proxy info
232 assert device.parent_id
233 assert device.proxy_address.device_id
Steve Crooks9b160d72017-03-31 10:48:29 -0500234 #assert device.proxy_address.channel_id # c-vid
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800235
Steve Crooks3c2c7582017-01-10 15:02:26 -0600236 # register for proxied messages right away
237 self.proxy_address = device.proxy_address
238 self.adapter_agent.register_for_proxied_messages(device.proxy_address)
239
Peter Shafik9107f2e2017-05-02 15:54:39 -0400240
Steve Crooks3c2c7582017-01-10 15:02:26 -0600241 # populate device info
242 device.root = True
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800243 device.vendor = 'Broadcom'
Steve Crooks9e85ce82017-03-20 12:00:53 -0400244 device.model = 'n/a'
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800245 device.hardware_version = 'to be filled'
246 device.firmware_version = 'to be filled'
ggowdru236bd952017-06-20 20:32:55 -0700247 device.images.image.extend([
248 Image(version="to be filled")
249 ])
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800250 device.connect_status = ConnectStatus.REACHABLE
251 self.adapter_agent.update_device(device)
252
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800253 self.adapter_agent.add_port(device.id, Port(
Steve Crooks9b160d72017-03-31 10:48:29 -0500254 port_no=100,
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800255 label='PON port',
256 type=Port.PON_ONU,
257 admin_state=AdminState.ENABLED,
258 oper_status=OperStatus.ACTIVE,
259 peers=[
260 Port.PeerPort(
261 device_id=device.parent_id,
262 port_no=device.parent_port_no
263 )
264 ]
265 ))
266
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800267 parent_device = self.adapter_agent.get_device(device.parent_id)
268 logical_device_id = parent_device.parent_id
269 assert logical_device_id
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800270
Peter Shafikd7f33772017-05-17 13:56:34 -0400271 for uni in self.uni_ports:
Steve Crooks9b160d72017-03-31 10:48:29 -0500272 # register physical ports
273 uni_port = Port(
274 port_no=uni,
275 label='UNI facing Ethernet port '+str(uni),
276 type=Port.ETHERNET_UNI,
277 admin_state=AdminState.ENABLED,
278 oper_status=OperStatus.ACTIVE
279 )
280 self.adapter_agent.add_port(device.id, uni_port)
281
282 # add uni port to logical device
283 port_no = device.proxy_address.channel_id + uni
284 cap = OFPPF_1GB_FD | OFPPF_FIBER
285 self.adapter_agent.add_logical_port(logical_device_id, LogicalPort(
286 id='uni-{}'.format(port_no),
287 ofp_port=ofp_port(
288 port_no=port_no,
289 hw_addr=mac_str_to_tuple('00:00:00:%02x:%02x:%02x' %
290 (device.proxy_address.onu_id & 0xff,
291 (port_no >> 8) & 0xff,
292 port_no & 0xff)),
293 name='uni-{}'.format(port_no),
294 config=0,
295 state=OFPPS_LIVE,
296 curr=cap,
297 advertised=cap,
298 peer=cap,
299 curr_speed=OFPPF_1GB_FD,
300 max_speed=OFPPF_1GB_FD
301 ),
302 device_id=device.id,
303 device_port_no=uni_port.port_no
304 ))
305
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800306 device = self.adapter_agent.get_device(device.id)
Peter Shafikd7f33772017-05-17 13:56:34 -0400307 device.oper_status = OperStatus.DISCOVERED
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800308 self.adapter_agent.update_device(device)
309
Steve Crooks3c2c7582017-01-10 15:02:26 -0600310 @inlineCallbacks
Steve Crooksf248e182017-02-07 10:50:24 -0500311 def update_flow_table(self, device, flows):
312 #
313 # We need to proxy through the OLT to get to the ONU
314 # Configuration from here should be using OMCI
315 #
316 self.log.info('bulk-flow-update', device_id=device.id, flows=flows)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800317
Steve Crooksf248e182017-02-07 10:50:24 -0500318 def is_downstream(port):
Steve Crooks9b160d72017-03-31 10:48:29 -0500319 return port == 100 # Need a better way
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800320
Steve Crooksf248e182017-02-07 10:50:24 -0500321 def is_upstream(port):
322 return not is_downstream(port)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800323
Steve Crooksf248e182017-02-07 10:50:24 -0500324 for flow in flows:
Steve Crooks9b160d72017-03-31 10:48:29 -0500325 _type = None
326 _port = None
327 _vlan_vid = None
328 _udp_dst = None
329 _udp_src = None
330 _ipv4_dst = None
331 _ipv4_src = None
332 _metadata = None
333 _output = None
334 _push_tpid = None
335 _field = None
336 _set_vlan_vid = None
Steve Crooksf248e182017-02-07 10:50:24 -0500337 try:
338 _in_port = fd.get_in_port(flow)
339 assert _in_port is not None
Steve Crooks3c2c7582017-01-10 15:02:26 -0600340
Steve Crooksf248e182017-02-07 10:50:24 -0500341 if is_downstream(_in_port):
342 self.log.info('downstream-flow')
343 elif is_upstream(_in_port):
344 self.log.info('upstream-flow')
345 else:
346 raise Exception('port should be 1 or 2 by our convention')
347
348 _out_port = fd.get_out_port(flow) # may be None
349 self.log.info('out-port', out_port=_out_port)
350
351 for field in fd.get_ofb_fields(flow):
352 if field.type == fd.ETH_TYPE:
353 _type = field.eth_type
354 self.log.info('field-type-eth-type',
355 eth_type=_type)
356
357 elif field.type == fd.IP_PROTO:
358 _proto = field.ip_proto
359 self.log.info('field-type-ip-proto',
360 ip_proto=_proto)
361
362 elif field.type == fd.IN_PORT:
363 _port = field.port
364 self.log.info('field-type-in-port',
365 in_port=_port)
366
367 elif field.type == fd.VLAN_VID:
368 _vlan_vid = field.vlan_vid & 0xfff
369 self.log.info('field-type-vlan-vid',
370 vlan=_vlan_vid)
371
372 elif field.type == fd.VLAN_PCP:
373 _vlan_pcp = field.vlan_pcp
374 self.log.info('field-type-vlan-pcp',
375 pcp=_vlan_pcp)
376
377 elif field.type == fd.UDP_DST:
378 _udp_dst = field.udp_dst
379 self.log.info('field-type-udp-dst',
380 udp_dst=_udp_dst)
381
382 elif field.type == fd.UDP_SRC:
383 _udp_src = field.udp_src
384 self.log.info('field-type-udp-src',
385 udp_src=_udp_src)
386
387 elif field.type == fd.IPV4_DST:
388 _ipv4_dst = field.ipv4_dst
389 self.log.info('field-type-ipv4-dst',
390 ipv4_dst=_ipv4_dst)
391
392 elif field.type == fd.IPV4_SRC:
393 _ipv4_src = field.ipv4_src
394 self.log.info('field-type-ipv4-src',
395 ipv4_dst=_ipv4_src)
396
397 elif field.type == fd.METADATA:
Steve Crooks9b160d72017-03-31 10:48:29 -0500398 _metadata = field.table_metadata
Steve Crooksf248e182017-02-07 10:50:24 -0500399 self.log.info('field-type-metadata',
400 metadata=_metadata)
401
402 else:
403 raise NotImplementedError('field.type={}'.format(
404 field.type))
405
406 for action in fd.get_actions(flow):
407
408 if action.type == fd.OUTPUT:
409 _output = action.output.port
410 self.log.info('action-type-output',
411 output=_output, in_port=_in_port)
412
413 elif action.type == fd.POP_VLAN:
414 self.log.info('action-type-pop-vlan',
415 in_port=_in_port)
416
417 elif action.type == fd.PUSH_VLAN:
418 _push_tpid = action.push.ethertype
419 log.info('action-type-push-vlan',
420 push_tpid=_push_tpid, in_port=_in_port)
421 if action.push.ethertype != 0x8100:
422 self.log.error('unhandled-tpid',
423 ethertype=action.push.ethertype)
424
425 elif action.type == fd.SET_FIELD:
426 _field = action.set_field.field.ofb_field
427 assert (action.set_field.field.oxm_class ==
428 OFPXMC_OPENFLOW_BASIC)
429 self.log.info('action-type-set-field',
430 field=_field, in_port=_in_port)
431 if _field.type == fd.VLAN_VID:
Steve Crooks9b160d72017-03-31 10:48:29 -0500432 _set_vlan_vid = _field.vlan_vid & 0xfff
433 self.log.info('set-field-type-valn-vid', _set_vlan_vid)
Steve Crooksf248e182017-02-07 10:50:24 -0500434 else:
435 self.log.error('unsupported-action-set-field-type',
436 field_type=_field.type)
437 else:
438 log.error('unsupported-action-type',
439 action_type=action.type, in_port=_in_port)
440
441 #
442 # All flows created from ONU adapter should be OMCI based
443 #
Steve Crooks9b160d72017-03-31 10:48:29 -0500444 if _vlan_vid == 0:
445 # allow priority tagged packets
446 # Set AR - ExtendedVlanTaggingOperationConfigData
447 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
448 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0,
449 1, 8, _in_port)
450 yield self.wait_for_response()
451
452 # Set AR - ExtendedVlanTaggingOperationConfigData
453 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
454 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0,
455 1, 8, _in_port)
456 yield self.wait_for_response()
Steve Crooksf248e182017-02-07 10:50:24 -0500457
458 except Exception as e:
459 log.exception('failed-to-install-flow', e=e, flow=flow)
460
Steve Crooks3c2c7582017-01-10 15:02:26 -0600461 def get_tx_id(self):
462 self.tx_id += 1
463 return self.tx_id
464
465 def send_omci_message(self, frame):
466 _frame = hexify(str(frame))
467 self.log.info('send-omci-message-%s' % _frame)
468 device = self.adapter_agent.get_device(self.device_id)
469 try:
470 self.adapter_agent.send_proxied_message(device.proxy_address, _frame)
471 except Exception as e:
472 self.log.info('send-omci-message-exception', exc=str(e))
473
474 def send_get_circuit_pack(self, entity_id=0):
475 frame = OmciFrame(
476 transaction_id=self.get_tx_id(),
477 message_type=OmciGet.message_id,
478 omci_message=OmciGet(
479 entity_class=CircuitPack.class_id,
480 entity_id=entity_id,
481 attributes_mask=CircuitPack.mask_for('vendor_id')
482 )
483 )
484 self.send_omci_message(frame)
485
486 def send_mib_reset(self, entity_id=0):
487 frame = OmciFrame(
488 transaction_id=self.get_tx_id(),
489 message_type=OmciMibReset.message_id,
490 omci_message=OmciMibReset(
491 entity_class=OntData.class_id,
492 entity_id=entity_id
493 )
494 )
495 self.send_omci_message(frame)
496
Steve Crooks9e85ce82017-03-20 12:00:53 -0400497 def send_create_gal_ethernet_profile(self,
498 entity_id,
499 max_gem_payload_size):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600500 frame = OmciFrame(
501 transaction_id=self.get_tx_id(),
502 message_type=OmciCreate.message_id,
503 omci_message=OmciCreate(
504 entity_class=GalEthernetProfile.class_id,
505 entity_id=entity_id,
506 data=dict(
507 max_gem_payload_size=max_gem_payload_size
508 )
509 )
510 )
511 self.send_omci_message(frame)
512
Steve Crooks9e85ce82017-03-20 12:00:53 -0400513 def send_set_tcont(self,
514 entity_id,
515 alloc_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600516 data = dict(
517 alloc_id=alloc_id
518 )
519 frame = OmciFrame(
520 transaction_id=self.get_tx_id(),
521 message_type=OmciSet.message_id,
522 omci_message=OmciSet(
523 entity_class=Tcont.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400524 entity_id=entity_id,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600525 attributes_mask=Tcont.mask_for(*data.keys()),
526 data=data
527 )
528 )
529 self.send_omci_message(frame)
530
Steve Crooks9e85ce82017-03-20 12:00:53 -0400531 def send_create_8021p_mapper_service_profile(self,
532 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600533 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400534 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600535 message_type=OmciCreate.message_id,
536 omci_message=OmciCreate(
537 entity_class=Ieee8021pMapperServiceProfile.class_id,
538 entity_id=entity_id,
539 data=dict(
540 tp_pointer=OmciNullPointer,
541 interwork_tp_pointer_for_p_bit_priority_0=OmciNullPointer,
Steve Crooks9b160d72017-03-31 10:48:29 -0500542 interwork_tp_pointer_for_p_bit_priority_1=OmciNullPointer,
543 interwork_tp_pointer_for_p_bit_priority_2=OmciNullPointer,
544 interwork_tp_pointer_for_p_bit_priority_3=OmciNullPointer,
545 interwork_tp_pointer_for_p_bit_priority_4=OmciNullPointer,
546 interwork_tp_pointer_for_p_bit_priority_5=OmciNullPointer,
547 interwork_tp_pointer_for_p_bit_priority_6=OmciNullPointer,
548 interwork_tp_pointer_for_p_bit_priority_7=OmciNullPointer
Steve Crooks3c2c7582017-01-10 15:02:26 -0600549 )
550 )
551 )
552 self.send_omci_message(frame)
553
Steve Crooks9e85ce82017-03-20 12:00:53 -0400554 def send_create_mac_bridge_service_profile(self,
555 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600556 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400557 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600558 message_type=OmciCreate.message_id,
559 omci_message=OmciCreate(
560 entity_class=MacBridgeServiceProfile.class_id,
561 entity_id=entity_id,
562 data=dict(
563 spanning_tree_ind=False,
564 learning_ind=True,
565 priority=0x8000,
566 max_age=20 * 256,
567 hello_time=2 * 256,
568 forward_delay=15 * 256,
569 unknown_mac_address_discard=True
570 )
571 )
572 )
573 self.send_omci_message(frame)
574
Steve Crooks9e85ce82017-03-20 12:00:53 -0400575 def send_create_gem_port_network_ctp(self,
576 entity_id,
577 port_id,
578 tcont_id,
579 direction,
580 tm):
581 _directions = {"upstream": 1, "downstream": 2, "bi-directional": 3}
582 if _directions.has_key(direction):
583 _direction = _directions[direction]
584 else:
585 self.log.error('invalid-gem-port-direction', direction=direction)
586 raise ValueError('Invalid GEM port direction: {_dir}'.format(_dir=direction))
587
Steve Crooks3c2c7582017-01-10 15:02:26 -0600588 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400589 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600590 message_type=OmciCreate.message_id,
591 omci_message=OmciCreate(
592 entity_class=GemPortNetworkCtp.class_id,
593 entity_id=entity_id,
594 data=dict(
595 port_id=port_id,
596 tcont_pointer=tcont_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400597 direction=_direction,
598 traffic_management_pointer_upstream=tm
Steve Crooks3c2c7582017-01-10 15:02:26 -0600599 )
600 )
601 )
602 self.send_omci_message(frame)
603
Steve Crooks9e85ce82017-03-20 12:00:53 -0400604 def send_create_multicast_gem_interworking_tp(self,
605 entity_id,
606 gem_port_net_ctp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600607 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400608 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600609 message_type=OmciCreate.message_id,
610 omci_message=OmciCreate(
611 entity_class=MulticastGemInterworkingTp.class_id,
612 entity_id=entity_id,
613 data=dict(
614 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
615 interworking_option=0,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400616 service_profile_pointer=0x1
Steve Crooks3c2c7582017-01-10 15:02:26 -0600617 )
618 )
619 )
620 self.send_omci_message(frame)
621
Steve Crooks9e85ce82017-03-20 12:00:53 -0400622 def send_create_gem_inteworking_tp(self,
623 entity_id,
624 gem_port_net_ctp_id,
625 service_profile_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600626 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400627 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600628 message_type=OmciCreate.message_id,
629 omci_message=OmciCreate(
630 entity_class=GemInterworkingTp.class_id,
631 entity_id=entity_id,
632 data=dict(
633 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
634 interworking_option=5,
635 service_profile_pointer=service_profile_id,
636 interworking_tp_pointer=0x0,
637 gal_profile_pointer=0x1
638 )
639 )
640 )
641 self.send_omci_message(frame)
642
Steve Crooks9e85ce82017-03-20 12:00:53 -0400643 def send_set_8021p_mapper_service_profile(self,
644 entity_id,
645 interwork_tp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600646 data = dict(
Steve Crooks9b160d72017-03-31 10:48:29 -0500647 interwork_tp_pointer_for_p_bit_priority_0=interwork_tp_id,
648 interwork_tp_pointer_for_p_bit_priority_1=interwork_tp_id,
649 interwork_tp_pointer_for_p_bit_priority_2=interwork_tp_id,
650 interwork_tp_pointer_for_p_bit_priority_3=interwork_tp_id,
651 interwork_tp_pointer_for_p_bit_priority_4=interwork_tp_id,
652 interwork_tp_pointer_for_p_bit_priority_5=interwork_tp_id,
653 interwork_tp_pointer_for_p_bit_priority_6=interwork_tp_id,
654 interwork_tp_pointer_for_p_bit_priority_7=interwork_tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600655 )
656 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400657 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600658 message_type=OmciSet.message_id,
659 omci_message=OmciSet(
660 entity_class=Ieee8021pMapperServiceProfile.class_id,
661 entity_id=entity_id,
662 attributes_mask=Ieee8021pMapperServiceProfile.mask_for(
663 *data.keys()),
664 data=data
665 )
666 )
667 self.send_omci_message(frame)
668
669 def send_create_mac_bridge_port_configuration_data(self,
670 entity_id,
671 bridge_id,
672 port_id,
673 tp_type,
674 tp_id):
675 frame = OmciFrame(
676 transaction_id=self.get_tx_id(),
677 message_type=OmciCreate.message_id,
678 omci_message=OmciCreate(
679 entity_class=MacBridgePortConfigurationData.class_id,
680 entity_id=entity_id,
681 data=dict(
682 bridge_id_pointer = bridge_id,
683 port_num=port_id,
684 tp_type=tp_type,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400685 tp_pointer=tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600686 )
687 )
688 )
689 self.send_omci_message(frame)
690
Steve Crooks9e85ce82017-03-20 12:00:53 -0400691 def send_create_vlan_tagging_filter_data(self,
692 entity_id,
693 vlan_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600694 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400695 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600696 message_type=OmciCreate.message_id,
697 omci_message=OmciCreate(
698 entity_class=VlanTaggingFilterData.class_id,
699 entity_id=entity_id,
700 data=dict(
701 vlan_filter_0=vlan_id,
702 forward_operation=0x10,
703 number_of_entries=1
704 )
705 )
706 )
707 self.send_omci_message(frame)
708
Steve Crooks46d64302017-03-10 15:11:06 -0500709 def send_create_extended_vlan_tagging_operation_configuration_data(self,
710 entity_id,
711 assoc_type,
712 assoc_me):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600713 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400714 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600715 message_type=OmciCreate.message_id,
716 omci_message=OmciCreate(
717 entity_class=
718 ExtendedVlanTaggingOperationConfigurationData.class_id,
719 entity_id=entity_id,
720 data=dict(
Steve Crooks46d64302017-03-10 15:11:06 -0500721 association_type=assoc_type,
722 associated_me_pointer=assoc_me
Steve Crooks3c2c7582017-01-10 15:02:26 -0600723 )
724 )
725 )
726 self.send_omci_message(frame)
727
Steve Crooks9e85ce82017-03-20 12:00:53 -0400728 def send_set_extended_vlan_tagging_operation_tpid_configuration_data(self,
729 entity_id,
730 input_tpid,
731 output_tpid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600732 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400733 input_tpid=input_tpid,
734 output_tpid=output_tpid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600735 downstream_mode=0, # inverse of upstream
736 )
737 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400738 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600739 message_type=OmciSet.message_id,
740 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400741 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600742 ExtendedVlanTaggingOperationConfigurationData.class_id,
743 entity_id=entity_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400744 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600745 ExtendedVlanTaggingOperationConfigurationData.mask_for(
746 *data.keys()),
747 data=data
748 )
749 )
750 self.send_omci_message(frame)
751
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400752 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(self,
753 entity_id,
754 filter_inner_vid,
755 treatment_inner_vid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600756 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400757 received_frame_vlan_tagging_operation_table=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600758 VlanTaggingOperation(
759 filter_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500760 filter_outer_vid=4096,
761 filter_outer_tpid_de=0,
762
763 filter_inner_priority=15,
764 filter_inner_vid=filter_inner_vid,
765 filter_inner_tpid_de=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600766 filter_ether_type=0,
Steve Crooks46d64302017-03-10 15:11:06 -0500767
768 treatment_tags_to_remove=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600769 treatment_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500770 treatment_outer_vid=0,
771 treatment_outer_tpid_de=0,
772
773 treatment_inner_priority=0,
774 treatment_inner_vid=treatment_inner_vid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600775 treatment_inner_tpid_de=4
776 )
777 )
778 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400779 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600780 message_type=OmciSet.message_id,
781 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400782 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600783 ExtendedVlanTaggingOperationConfigurationData.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400784 entity_id=entity_id,
785 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600786 ExtendedVlanTaggingOperationConfigurationData.mask_for(
787 *data.keys()),
788 data=data
789 )
790 )
791 self.send_omci_message(frame)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800792
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400793 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(self,
794 entity_id,
795 filter_inner_priority,
796 filter_inner_vid,
797 filter_inner_tpid_de,
798 treatment_tags_to_remove,
799 treatment_inner_priority,
800 treatment_inner_vid):
801 data = dict(
802 received_frame_vlan_tagging_operation_table=
803 VlanTaggingOperation(
804 filter_outer_priority=15,
805 filter_outer_vid=4096,
806 filter_outer_tpid_de=0,
807
808 filter_inner_priority=filter_inner_priority,
809 filter_inner_vid=filter_inner_vid,
810 filter_inner_tpid_de=filter_inner_tpid_de,
811 filter_ether_type=0,
812
813 treatment_tags_to_remove=treatment_tags_to_remove,
814 treatment_outer_priority=15,
815 treatment_outer_vid=0,
816 treatment_outer_tpid_de=0,
817
818 treatment_inner_priority=treatment_inner_priority,
819 treatment_inner_vid=treatment_inner_vid,
820 treatment_inner_tpid_de=4
821 )
822 )
823 frame = OmciFrame(
824 transaction_id=self.get_tx_id(),
825 message_type=OmciSet.message_id,
826 omci_message=OmciSet(
827 entity_class=
828 ExtendedVlanTaggingOperationConfigurationData.class_id,
829 entity_id=entity_id,
830 attributes_mask=
831 ExtendedVlanTaggingOperationConfigurationData.mask_for(
832 *data.keys()),
833 data=data
834 )
835 )
836 self.send_omci_message(frame)
837
Steve Crooks9e85ce82017-03-20 12:00:53 -0400838 def send_create_multicast_operations_profile(self,
839 entity_id,
840 igmp_ver):
841 frame = OmciFrame(
842 transaction_id=self.get_tx_id(),
843 message_type=OmciCreate.message_id,
844 omci_message=OmciCreate(
845 entity_class=
846 MulticastOperationsProfile.class_id,
847 entity_id=entity_id,
848 data=dict(
849 igmp_version=igmp_ver,
850 igmp_function=0,
851 immediate_leave=0
852 )
853 )
854 )
855 self.send_omci_message(frame)
856
857 def send_set_multicast_operations_profile_acl_row0(self,
858 entity_id,
859 acl_table,
860 row_key,
861 gem_port,
862 vlan,
863 src_ip,
864 dst_ip_start,
865 dst_ip_end):
866 row0 = AccessControlRow0(
867 set_ctrl=1,
868 row_part_id=0,
869 test=0,
870 row_key=row_key,
871 gem_port_id=gem_port,
872 vlan_id=vlan,
873 src_ip=src_ip,
874 dst_ip_start=dst_ip_start,
875 dst_ip_end=dst_ip_end,
876 ipm_group_bw=0
877 )
878
879 if acl_table == 'dynamic':
880 data = dict(
881 dynamic_access_control_list_table=row0
882 )
883 else:
884 data = dict(
885 static_access_control_list_table=row0
886 )
887
888 frame = OmciFrame(
889 transaction_id=self.get_tx_id(),
890 message_type=OmciSet.message_id,
891 omci_message=OmciSet(
892 entity_class=MulticastOperationsProfile.class_id,
893 entity_id=entity_id,
894 attributes_mask=MulticastOperationsProfile.mask_for(
895 *data.keys()),
896 data=data
897 )
898 )
899 self.send_omci_message(frame)
900
901 def send_set_multicast_operations_profile_ds_igmp_mcast_tci(self,
902 entity_id,
903 ctrl_type,
904 tci):
905 data = dict(
906 ds_igmp_mcast_tci=
907 DownstreamIgmpMulticastTci(
908 ctrl_type=ctrl_type,
909 tci=tci
910 )
911 )
912 frame = OmciFrame(
913 transaction_id=self.get_tx_id(),
914 message_type=OmciSet.message_id,
915 omci_message=OmciSet(
916 entity_class=MulticastOperationsProfile.class_id,
917 entity_id=entity_id,
918 attributes_mask=MulticastOperationsProfile.mask_for(
919 *data.keys()),
920 data=data
921 )
922 )
923 self.send_omci_message(frame)
924
925 def send_create_multicast_subscriber_config_info(self,
926 entity_id,
927 me_type,
928 mcast_oper_profile):
929 frame = OmciFrame(
930 transaction_id=self.get_tx_id(),
931 message_type=OmciCreate.message_id,
932 omci_message=OmciCreate(
933 entity_class=
934 MulticastSubscriberConfigInfo.class_id,
935 entity_id=entity_id,
936 data=dict(
937 me_type=me_type,
938 mcast_operations_profile_pointer=mcast_oper_profile
939 )
940 )
941 )
942 self.send_omci_message(frame)
943
944 def send_set_multicast_subscriber_config_info(self,
945 entity_id,
946 max_groups=0,
947 max_mcast_bw=0,
948 bw_enforcement=0):
949 data = dict(
950 max_simultaneous_groups=max_groups,
951 max_multicast_bandwidth=max_mcast_bw,
952 bandwidth_enforcement=bw_enforcement
953 )
954 frame = OmciFrame(
955 transaction_id=self.get_tx_id(),
956 message_type=OmciSet.message_id,
957 omci_message=OmciSet(
958 entity_class=MulticastSubscriberConfigInfo.class_id,
959 entity_id=entity_id,
960 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
961 *data.keys()),
962 data=data
963 )
964 )
965 self.send_omci_message(frame)
966
967 def send_set_multicast_service_package(self,
968 entity_id,
969 row_key,
970 vid_uni,
971 max_groups,
972 max_mcast_bw,
973 mcast_oper_profile):
974 data = dict(
975 multicast_service_package_table=
976 MulticastServicePackage(
977 set_ctrl=1,
978 row_key=row_key,
979
980 vid_uni=vid_uni,
981 max_simultaneous_groups=max_groups,
982 max_multicast_bw=max_mcast_bw,
983 mcast_operations_profile_pointer=mcast_oper_profile
984 )
985 )
986 frame = OmciFrame(
987 transaction_id=self.get_tx_id(),
988 message_type=OmciSet.message_id,
989 omci_message=OmciSet(
990 entity_class=MulticastSubscriberConfigInfo.class_id,
991 entity_id=entity_id,
992 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
993 *data.keys()),
994 data=data
995 )
996 )
997 self.send_omci_message(frame)
998
999 def send_set_multicast_allowed_preview_groups_row0(self,
1000 entity_id,
1001 row_key,
1002 src_ip,
1003 vlan_id_ani,
1004 vlan_id_uni):
1005 data = dict(
1006 allowed_preview_groups_table=
1007 AllowedPreviewGroupsRow0(
1008 set_ctrl=1,
1009 row_part_id=0,
1010 row_key=row_key,
1011
1012 src_ip=src_ip,
1013 vlan_id_ani=vlan_id_ani,
1014 vlan_id_uni=vlan_id_uni
1015 )
1016 )
1017 frame = OmciFrame(
1018 transaction_id=self.get_tx_id(),
1019 message_type=OmciSet.message_id,
1020 omci_message=OmciSet(
1021 entity_class=MulticastSubscriberConfigInfo.class_id,
1022 entity_id=entity_id,
1023 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1024 *data.keys()),
1025 data=data
1026 )
1027 )
1028 self.send_omci_message(frame)
1029
1030 def send_set_multicast_allowed_preview_groups_row1(self,
1031 entity_id,
1032 row_key,
1033 dst_ip,
1034 duration,
1035 time_left):
1036 data = dict(
1037 allowed_preview_groups_table=
1038 AllowedPreviewGroupsRow1(
1039 set_ctrl=1,
1040 row_part_id=1,
1041 row_key=row_key,
1042
1043 dst_ip=dst_ip,
1044 duration=duration,
1045 time_left=time_left
1046 )
1047 )
1048 frame = OmciFrame(
1049 transaction_id=self.get_tx_id(),
1050 message_type=OmciSet.message_id,
1051 omci_message=OmciSet(
1052 entity_class=MulticastSubscriberConfigInfo.class_id,
1053 entity_id=entity_id,
1054 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1055 *data.keys()),
1056 data=data
1057 )
1058 )
1059 self.send_omci_message(frame)
1060
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001061 @inlineCallbacks
Steve Crooks3c2c7582017-01-10 15:02:26 -06001062 def wait_for_response(self):
1063 log.info('wait-for-response')
1064 try:
1065 response = yield self.incoming_messages.get()
Steve Crooks9e85ce82017-03-20 12:00:53 -04001066 log.info('got-response')
1067 # resp = OmciFrame(response)
1068 # resp.show()
Steve Crooks3c2c7582017-01-10 15:02:26 -06001069 except Exception as e:
1070 self.log.info('wait-for-response-exception', exc=str(e))
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001071
Steve Crooks3c2c7582017-01-10 15:02:26 -06001072 @inlineCallbacks
Steve Crooks9b160d72017-03-31 10:48:29 -05001073 def message_exchange(self, onu, gem, cvid):
1074 log.info('message_exchange', onu=onu, gem=gem, cvid=cvid)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001075 # reset incoming message queue
1076 while self.incoming_messages.pending:
1077 _ = yield self.incoming_messages.get()
1078
Steve Crooks9b160d72017-03-31 10:48:29 -05001079 tcont = gem
1080
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001081 # construct message
Steve Crooks3c2c7582017-01-10 15:02:26 -06001082 # MIB Reset - OntData - 0
1083 self.send_mib_reset()
1084 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001085
Steve Crooks3c2c7582017-01-10 15:02:26 -06001086 # Create AR - GalEthernetProfile - 1
1087 self.send_create_gal_ethernet_profile(1, 48)
1088 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001089
Steve Crooks9b160d72017-03-31 10:48:29 -05001090 # TCONT config
1091 # Set AR - TCont - 32769 - (1025 or 1026)
1092 self.send_set_tcont(0x8001, tcont)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001093 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001094
Steve Crooks9b160d72017-03-31 10:48:29 -05001095 # Mapper Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001096 # Create AR - 802.1pMapperServiceProfile - 32769
1097 self.send_create_8021p_mapper_service_profile(0x8001)
1098 yield self.wait_for_response()
1099
Steve Crooks9b160d72017-03-31 10:48:29 -05001100 # MAC Bridge Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001101 # Create AR - MacBridgeServiceProfile - 513
1102 self.send_create_mac_bridge_service_profile(0x201)
1103 yield self.wait_for_response()
1104
Steve Crooks9b160d72017-03-31 10:48:29 -05001105 # GEM Port Network CTP config
1106 # Create AR - GemPortNetworkCtp - 257 - <gem> - 32769
1107 self.send_create_gem_port_network_ctp(0x101, gem, 0x8001, "bi-directional", 0x100)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001108 yield self.wait_for_response()
1109
1110 # Create AR - GemPortNetworkCtp - 260 - 4000 - 0
1111 self.send_create_gem_port_network_ctp(0x104, 0x0FA0, 0, "downstream", 0)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001112 yield self.wait_for_response()
1113
Steve Crooks9b160d72017-03-31 10:48:29 -05001114 # Multicast GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001115 # Create AR - MulticastGemInterworkingTp - 6 - 260
1116 self.send_create_multicast_gem_interworking_tp(0x6, 0x104)
1117 yield self.wait_for_response()
1118
Steve Crooks9b160d72017-03-31 10:48:29 -05001119 # GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001120 # Create AR - GemInterworkingTp - 32770 - 257 -32769 - 1
1121 self.send_create_gem_inteworking_tp(0x8002, 0x101, 0x8001)
1122 yield self.wait_for_response()
1123
Steve Crooks9b160d72017-03-31 10:48:29 -05001124 # Mapper Service Profile config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001125 # Set AR - 802.1pMapperServiceProfile - 32769 - 32770
1126 self.send_set_8021p_mapper_service_profile(0x8001, 0x8002)
1127 yield self.wait_for_response()
1128
Steve Crooks9b160d72017-03-31 10:48:29 -05001129 # MAC Bridge Port config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001130 # Create AR - MacBridgePortConfigData - 8450 - 513 - 3 - 3 - 32769
1131 self.send_create_mac_bridge_port_configuration_data(0x2102, 0x201, 3, 3, 0x8001)
1132 yield self.wait_for_response()
1133
Steve Crooks3c2c7582017-01-10 15:02:26 -06001134 # Create AR - MacBridgePortConfigData - 9000 - 513 - 6 - 6 - 6
1135 self.send_create_mac_bridge_port_configuration_data(0x2328, 0x201, 6, 6, 6)
1136 yield self.wait_for_response()
1137
Steve Crooks9b160d72017-03-31 10:48:29 -05001138 # VLAN Tagging Filter config
1139 # Create AR - VlanTaggingFilterData - 8450 - c-vid
1140 self.send_create_vlan_tagging_filter_data(0x2102, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001141 yield self.wait_for_response()
1142
Steve Crooks9b160d72017-03-31 10:48:29 -05001143 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001144 # Create AR - MulticastOperationsProfile
1145 self.send_create_multicast_operations_profile(0x201, 3)
1146 yield self.wait_for_response()
1147
1148 # Set AR - MulticastOperationsProfile - Dynamic Access Control List table
1149 self.send_set_multicast_operations_profile_acl_row0(0x201,
1150 'dynamic',
1151 0,
1152 0x0fa0,
1153 0x0fa0,
1154 '0.0.0.0',
1155 '224.0.0.0',
1156 '239.255.255.255')
1157 yield self.wait_for_response()
1158
Steve Crooks9b160d72017-03-31 10:48:29 -05001159 # Multicast Subscriber config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001160 # Create AR - MulticastSubscriberConfigInfo
1161 self.send_create_multicast_subscriber_config_info(0x201, 0, 0x201)
1162 yield self.wait_for_response()
1163
Steve Crooks9b160d72017-03-31 10:48:29 -05001164 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001165 # Set AR - MulticastOperationsProfile - Downstream IGMP Multicast TCI
Steve Crooks9b160d72017-03-31 10:48:29 -05001166 self.send_set_multicast_operations_profile_ds_igmp_mcast_tci(0x201, 4, cvid)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001167 yield self.wait_for_response()
1168
Steve Crooks9b160d72017-03-31 10:48:29 -05001169 # Port 2
1170 # Extended VLAN Tagging Operation config
1171 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1172 # TODO: add entry here for additional UNI interfaces
Steve Crooks9e85ce82017-03-20 12:00:53 -04001173 self.send_create_extended_vlan_tagging_operation_configuration_data(0x202, 2, 0x102)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001174 yield self.wait_for_response()
1175
1176 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
Steve Crooks46d64302017-03-10 15:11:06 -05001177 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x202, 0x8100, 0x8100)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001178 yield self.wait_for_response()
1179
Steve Crooks46d64302017-03-10 15:11:06 -05001180 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001181 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1182 #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 -04001183 #yield self.wait_for_response()
1184
1185 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001186 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1187 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x202, 0x1000, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001188 yield self.wait_for_response()
1189
Steve Crooks9b160d72017-03-31 10:48:29 -05001190 # MAC Bridge Port config
1191 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1192 # TODO: add more entries here for other UNI ports
1193 self.send_create_mac_bridge_port_configuration_data(0x201, 0x201, 2, 1, 0x102)
1194 yield self.wait_for_response()
1195
1196 # Port 5
1197 # Extended VLAN Tagging Operation config
1198 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1199 # TODO: add entry here for additional UNI interfaces
1200 self.send_create_extended_vlan_tagging_operation_configuration_data(0x205, 2, 0x105)
1201 yield self.wait_for_response()
1202
1203 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
1204 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x205, 0x8100, 0x8100)
1205 yield self.wait_for_response()
1206
1207 # Set AR - ExtendedVlanTaggingOperationConfigData
1208 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1209 #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0, 1, 8, cvid)
1210 #yield self.wait_for_response()
1211
1212 # Set AR - ExtendedVlanTaggingOperationConfigData
1213 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1214 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x205, 0x1000, cvid)
1215 yield self.wait_for_response()
1216
1217 # MAC Bridge Port config
1218 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1219 # TODO: add more entries here for other UNI ports
1220 self.send_create_mac_bridge_port_configuration_data(0x205, 0x201, 5, 1, 0x105)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001221 yield self.wait_for_response()