blob: f852220e22de081d64f6c867da1eb6f906c0dd40 [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
sathishg5ae86222017-06-28 15:16:29 +0530115 def self_test_device(self, device):
116 """
117 This is called to Self a device based on a NBI call.
118 :param device: A Voltha.Device object.
119 :return: Will return result of self test
120 """
121 log.info('self-test-device', device=device.id)
122 raise NotImplementedError()
123
Khen Nursimulud068d812017-03-06 11:44:18 -0500124 def delete_device(self, device):
125 raise NotImplementedError()
126
127 def get_device_details(self, device):
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800128 raise NotImplementedError()
129
Sergio Slobodrianec864c62017-03-09 11:41:43 -0500130 def update_pm_config(self, device, pm_configs):
131 raise NotImplementedError()
132
Steve Crooks3c2c7582017-01-10 15:02:26 -0600133 def update_flows_bulk(self, device, flows, groups):
134 log.info('bulk-flow-update', device_id=device.id,
135 flows=flows, groups=groups)
136 assert len(groups.items) == 0
137 handler = self.devices_handlers[device.proxy_address.channel_id]
Steve Crooksf248e182017-02-07 10:50:24 -0500138 return handler.update_flow_table(device, flows.items)
Steve Crooks3c2c7582017-01-10 15:02:26 -0600139
140 def update_flows_incrementally(self, device, flow_changes, group_changes):
141 raise NotImplementedError()
142
143 def send_proxied_message(self, proxy_address, msg):
144 log.info('send-proxied-message', proxy_address=proxy_address, msg=msg)
145
146 def receive_proxied_message(self, proxy_address, msg):
147 log.info('receive-proxied-message', proxy_address=proxy_address,
148 device_id=proxy_address.device_id, msg=hexify(msg))
149 handler = self.devices_handlers[proxy_address.channel_id]
150 handler.receive_message(msg)
151
152 def receive_packet_out(self, logical_device_id, egress_port_no, msg):
153 log.info('packet-out', logical_device_id=logical_device_id,
154 egress_port_no=egress_port_no, msg_len=len(msg))
155
Peter Shafik9107f2e2017-05-02 15:54:39 -0400156 def receive_inter_adapter_message(self, msg):
157 log.info('receive_inter_adapter_message', msg=msg)
Peter Shafikd7f33772017-05-17 13:56:34 -0400158 proxy_address = msg['proxy_address']
159 assert proxy_address is not None
160
161 handler = self.devices_handlers[proxy_address.channel_id]
162 handler.event_messages.put(msg)
Peter Shafik9107f2e2017-05-02 15:54:39 -0400163
Stephane Barbarie980a0912017-05-11 11:27:06 -0400164 def suppress_alarm(self, filter):
165 raise NotImplementedError()
166
167 def unsuppress_alarm(self, filter):
168 raise NotImplementedError()
Steve Crooks3c2c7582017-01-10 15:02:26 -0600169
170class BroadcomOnuHandler(object):
171
172 def __init__(self, adapter, device_id):
173 self.adapter = adapter
174 self.adapter_agent = adapter.adapter_agent
175 self.device_id = device_id
176 self.log = structlog.get_logger(device_id=device_id)
177 self.incoming_messages = DeferredQueue()
Peter Shafikd7f33772017-05-17 13:56:34 -0400178 self.event_messages = DeferredQueue()
Steve Crooks3c2c7582017-01-10 15:02:26 -0600179 self.proxy_address = None
180 self.tx_id = 0
181
Peter Shafikd7f33772017-05-17 13:56:34 -0400182 # Need to query ONU for number of supported uni ports
183 # For now, temporarily set number of ports to 1 - port #2
184 self.uni_ports = (2,)
185
186 # Handle received ONU event messages
187 reactor.callLater(0, self.handle_onu_events)
188
Steve Crooks3c2c7582017-01-10 15:02:26 -0600189 def receive_message(self, msg):
190 self.incoming_messages.put(msg)
191
Peter Shafikd7f33772017-05-17 13:56:34 -0400192 @inlineCallbacks
193 def handle_onu_events(self):
194 event_msg = yield self.event_messages.get()
195
196 if event_msg['event'] == 'activation-completed':
197
198 if event_msg['event_data']['activation_successful'] == True:
199 for uni in self.uni_ports:
200 port_no = self.proxy_address.channel_id + uni
201 reactor.callLater(1,
202 self.message_exchange,
203 self.proxy_address.onu_id,
204 self.proxy_address.onu_session_id,
205 port_no)
206
207 device = self.adapter_agent.get_device(self.device_id)
208 device.oper_status = OperStatus.ACTIVE
209 self.adapter_agent.update_device(device)
210
211 else:
212 device = self.adapter_agent.get_device(self.device_id)
213 device.oper_status = OperStatus.FAILED
214 self.adapter_agent.update_device(device)
215
216 elif event_msg['event'] == 'deactivation-completed':
217 device = self.adapter_agent.get_device(self.device_id)
218 device.oper_status = OperStatus.DISCOVERED
219 self.adapter_agent.update_device(device)
220
221 elif event_msg['event'] == 'ranging-completed':
222
223 if event_msg['event_data']['ranging_successful'] == True:
224 device = self.adapter_agent.get_device(self.device_id)
225 device.oper_status = OperStatus.ACTIVATING
226 self.adapter_agent.update_device(device)
227
228 else:
229 device = self.adapter_agent.get_device(self.device_id)
230 device.oper_status = OperStatus.FAILED
231 self.adapter_agent.update_device(device)
232
233 # Handle next event
234 reactor.callLater(0, self.handle_onu_events)
235
236
Steve Crooks3c2c7582017-01-10 15:02:26 -0600237 def activate(self, device):
238 self.log.info('activating')
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800239
240 # first we verify that we got parent reference and proxy info
241 assert device.parent_id
242 assert device.proxy_address.device_id
Steve Crooks9b160d72017-03-31 10:48:29 -0500243 #assert device.proxy_address.channel_id # c-vid
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800244
Steve Crooks3c2c7582017-01-10 15:02:26 -0600245 # register for proxied messages right away
246 self.proxy_address = device.proxy_address
247 self.adapter_agent.register_for_proxied_messages(device.proxy_address)
248
Peter Shafik9107f2e2017-05-02 15:54:39 -0400249
Steve Crooks3c2c7582017-01-10 15:02:26 -0600250 # populate device info
251 device.root = True
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800252 device.vendor = 'Broadcom'
Steve Crooks9e85ce82017-03-20 12:00:53 -0400253 device.model = 'n/a'
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800254 device.hardware_version = 'to be filled'
255 device.firmware_version = 'to be filled'
ggowdru236bd952017-06-20 20:32:55 -0700256 device.images.image.extend([
257 Image(version="to be filled")
258 ])
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800259 device.connect_status = ConnectStatus.REACHABLE
260 self.adapter_agent.update_device(device)
261
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800262 self.adapter_agent.add_port(device.id, Port(
Steve Crooks9b160d72017-03-31 10:48:29 -0500263 port_no=100,
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800264 label='PON port',
265 type=Port.PON_ONU,
266 admin_state=AdminState.ENABLED,
267 oper_status=OperStatus.ACTIVE,
268 peers=[
269 Port.PeerPort(
270 device_id=device.parent_id,
271 port_no=device.parent_port_no
272 )
273 ]
274 ))
275
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800276 parent_device = self.adapter_agent.get_device(device.parent_id)
277 logical_device_id = parent_device.parent_id
278 assert logical_device_id
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800279
Peter Shafikd7f33772017-05-17 13:56:34 -0400280 for uni in self.uni_ports:
Steve Crooks9b160d72017-03-31 10:48:29 -0500281 # register physical ports
282 uni_port = Port(
283 port_no=uni,
284 label='UNI facing Ethernet port '+str(uni),
285 type=Port.ETHERNET_UNI,
286 admin_state=AdminState.ENABLED,
287 oper_status=OperStatus.ACTIVE
288 )
289 self.adapter_agent.add_port(device.id, uni_port)
290
291 # add uni port to logical device
292 port_no = device.proxy_address.channel_id + uni
293 cap = OFPPF_1GB_FD | OFPPF_FIBER
294 self.adapter_agent.add_logical_port(logical_device_id, LogicalPort(
295 id='uni-{}'.format(port_no),
296 ofp_port=ofp_port(
297 port_no=port_no,
298 hw_addr=mac_str_to_tuple('00:00:00:%02x:%02x:%02x' %
299 (device.proxy_address.onu_id & 0xff,
300 (port_no >> 8) & 0xff,
301 port_no & 0xff)),
302 name='uni-{}'.format(port_no),
303 config=0,
304 state=OFPPS_LIVE,
305 curr=cap,
306 advertised=cap,
307 peer=cap,
308 curr_speed=OFPPF_1GB_FD,
309 max_speed=OFPPF_1GB_FD
310 ),
311 device_id=device.id,
312 device_port_no=uni_port.port_no
313 ))
314
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800315 device = self.adapter_agent.get_device(device.id)
Peter Shafikd7f33772017-05-17 13:56:34 -0400316 device.oper_status = OperStatus.DISCOVERED
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800317 self.adapter_agent.update_device(device)
318
Steve Crooks3c2c7582017-01-10 15:02:26 -0600319 @inlineCallbacks
Steve Crooksf248e182017-02-07 10:50:24 -0500320 def update_flow_table(self, device, flows):
321 #
322 # We need to proxy through the OLT to get to the ONU
323 # Configuration from here should be using OMCI
324 #
325 self.log.info('bulk-flow-update', device_id=device.id, flows=flows)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800326
Steve Crooksf248e182017-02-07 10:50:24 -0500327 def is_downstream(port):
Steve Crooks9b160d72017-03-31 10:48:29 -0500328 return port == 100 # Need a better way
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800329
Steve Crooksf248e182017-02-07 10:50:24 -0500330 def is_upstream(port):
331 return not is_downstream(port)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800332
Steve Crooksf248e182017-02-07 10:50:24 -0500333 for flow in flows:
Steve Crooks9b160d72017-03-31 10:48:29 -0500334 _type = None
335 _port = None
336 _vlan_vid = None
337 _udp_dst = None
338 _udp_src = None
339 _ipv4_dst = None
340 _ipv4_src = None
341 _metadata = None
342 _output = None
343 _push_tpid = None
344 _field = None
345 _set_vlan_vid = None
Steve Crooksf248e182017-02-07 10:50:24 -0500346 try:
347 _in_port = fd.get_in_port(flow)
348 assert _in_port is not None
Steve Crooks3c2c7582017-01-10 15:02:26 -0600349
Steve Crooksf248e182017-02-07 10:50:24 -0500350 if is_downstream(_in_port):
351 self.log.info('downstream-flow')
352 elif is_upstream(_in_port):
353 self.log.info('upstream-flow')
354 else:
355 raise Exception('port should be 1 or 2 by our convention')
356
357 _out_port = fd.get_out_port(flow) # may be None
358 self.log.info('out-port', out_port=_out_port)
359
360 for field in fd.get_ofb_fields(flow):
361 if field.type == fd.ETH_TYPE:
362 _type = field.eth_type
363 self.log.info('field-type-eth-type',
364 eth_type=_type)
365
366 elif field.type == fd.IP_PROTO:
367 _proto = field.ip_proto
368 self.log.info('field-type-ip-proto',
369 ip_proto=_proto)
370
371 elif field.type == fd.IN_PORT:
372 _port = field.port
373 self.log.info('field-type-in-port',
374 in_port=_port)
375
376 elif field.type == fd.VLAN_VID:
377 _vlan_vid = field.vlan_vid & 0xfff
378 self.log.info('field-type-vlan-vid',
379 vlan=_vlan_vid)
380
381 elif field.type == fd.VLAN_PCP:
382 _vlan_pcp = field.vlan_pcp
383 self.log.info('field-type-vlan-pcp',
384 pcp=_vlan_pcp)
385
386 elif field.type == fd.UDP_DST:
387 _udp_dst = field.udp_dst
388 self.log.info('field-type-udp-dst',
389 udp_dst=_udp_dst)
390
391 elif field.type == fd.UDP_SRC:
392 _udp_src = field.udp_src
393 self.log.info('field-type-udp-src',
394 udp_src=_udp_src)
395
396 elif field.type == fd.IPV4_DST:
397 _ipv4_dst = field.ipv4_dst
398 self.log.info('field-type-ipv4-dst',
399 ipv4_dst=_ipv4_dst)
400
401 elif field.type == fd.IPV4_SRC:
402 _ipv4_src = field.ipv4_src
403 self.log.info('field-type-ipv4-src',
404 ipv4_dst=_ipv4_src)
405
406 elif field.type == fd.METADATA:
Steve Crooks9b160d72017-03-31 10:48:29 -0500407 _metadata = field.table_metadata
Steve Crooksf248e182017-02-07 10:50:24 -0500408 self.log.info('field-type-metadata',
409 metadata=_metadata)
410
411 else:
412 raise NotImplementedError('field.type={}'.format(
413 field.type))
414
415 for action in fd.get_actions(flow):
416
417 if action.type == fd.OUTPUT:
418 _output = action.output.port
419 self.log.info('action-type-output',
420 output=_output, in_port=_in_port)
421
422 elif action.type == fd.POP_VLAN:
423 self.log.info('action-type-pop-vlan',
424 in_port=_in_port)
425
426 elif action.type == fd.PUSH_VLAN:
427 _push_tpid = action.push.ethertype
428 log.info('action-type-push-vlan',
429 push_tpid=_push_tpid, in_port=_in_port)
430 if action.push.ethertype != 0x8100:
431 self.log.error('unhandled-tpid',
432 ethertype=action.push.ethertype)
433
434 elif action.type == fd.SET_FIELD:
435 _field = action.set_field.field.ofb_field
436 assert (action.set_field.field.oxm_class ==
437 OFPXMC_OPENFLOW_BASIC)
438 self.log.info('action-type-set-field',
439 field=_field, in_port=_in_port)
440 if _field.type == fd.VLAN_VID:
Steve Crooks9b160d72017-03-31 10:48:29 -0500441 _set_vlan_vid = _field.vlan_vid & 0xfff
442 self.log.info('set-field-type-valn-vid', _set_vlan_vid)
Steve Crooksf248e182017-02-07 10:50:24 -0500443 else:
444 self.log.error('unsupported-action-set-field-type',
445 field_type=_field.type)
446 else:
447 log.error('unsupported-action-type',
448 action_type=action.type, in_port=_in_port)
449
450 #
451 # All flows created from ONU adapter should be OMCI based
452 #
Steve Crooks9b160d72017-03-31 10:48:29 -0500453 if _vlan_vid == 0:
454 # allow priority tagged packets
455 # Set AR - ExtendedVlanTaggingOperationConfigData
456 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
457 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0,
458 1, 8, _in_port)
459 yield self.wait_for_response()
460
461 # Set AR - ExtendedVlanTaggingOperationConfigData
462 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
463 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0,
464 1, 8, _in_port)
465 yield self.wait_for_response()
Steve Crooksf248e182017-02-07 10:50:24 -0500466
467 except Exception as e:
468 log.exception('failed-to-install-flow', e=e, flow=flow)
469
Steve Crooks3c2c7582017-01-10 15:02:26 -0600470 def get_tx_id(self):
471 self.tx_id += 1
472 return self.tx_id
473
474 def send_omci_message(self, frame):
475 _frame = hexify(str(frame))
476 self.log.info('send-omci-message-%s' % _frame)
477 device = self.adapter_agent.get_device(self.device_id)
478 try:
479 self.adapter_agent.send_proxied_message(device.proxy_address, _frame)
480 except Exception as e:
481 self.log.info('send-omci-message-exception', exc=str(e))
482
483 def send_get_circuit_pack(self, entity_id=0):
484 frame = OmciFrame(
485 transaction_id=self.get_tx_id(),
486 message_type=OmciGet.message_id,
487 omci_message=OmciGet(
488 entity_class=CircuitPack.class_id,
489 entity_id=entity_id,
490 attributes_mask=CircuitPack.mask_for('vendor_id')
491 )
492 )
493 self.send_omci_message(frame)
494
495 def send_mib_reset(self, entity_id=0):
496 frame = OmciFrame(
497 transaction_id=self.get_tx_id(),
498 message_type=OmciMibReset.message_id,
499 omci_message=OmciMibReset(
500 entity_class=OntData.class_id,
501 entity_id=entity_id
502 )
503 )
504 self.send_omci_message(frame)
505
Steve Crooks9e85ce82017-03-20 12:00:53 -0400506 def send_create_gal_ethernet_profile(self,
507 entity_id,
508 max_gem_payload_size):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600509 frame = OmciFrame(
510 transaction_id=self.get_tx_id(),
511 message_type=OmciCreate.message_id,
512 omci_message=OmciCreate(
513 entity_class=GalEthernetProfile.class_id,
514 entity_id=entity_id,
515 data=dict(
516 max_gem_payload_size=max_gem_payload_size
517 )
518 )
519 )
520 self.send_omci_message(frame)
521
Steve Crooks9e85ce82017-03-20 12:00:53 -0400522 def send_set_tcont(self,
523 entity_id,
524 alloc_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600525 data = dict(
526 alloc_id=alloc_id
527 )
528 frame = OmciFrame(
529 transaction_id=self.get_tx_id(),
530 message_type=OmciSet.message_id,
531 omci_message=OmciSet(
532 entity_class=Tcont.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400533 entity_id=entity_id,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600534 attributes_mask=Tcont.mask_for(*data.keys()),
535 data=data
536 )
537 )
538 self.send_omci_message(frame)
539
Steve Crooks9e85ce82017-03-20 12:00:53 -0400540 def send_create_8021p_mapper_service_profile(self,
541 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600542 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400543 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600544 message_type=OmciCreate.message_id,
545 omci_message=OmciCreate(
546 entity_class=Ieee8021pMapperServiceProfile.class_id,
547 entity_id=entity_id,
548 data=dict(
549 tp_pointer=OmciNullPointer,
550 interwork_tp_pointer_for_p_bit_priority_0=OmciNullPointer,
Steve Crooks9b160d72017-03-31 10:48:29 -0500551 interwork_tp_pointer_for_p_bit_priority_1=OmciNullPointer,
552 interwork_tp_pointer_for_p_bit_priority_2=OmciNullPointer,
553 interwork_tp_pointer_for_p_bit_priority_3=OmciNullPointer,
554 interwork_tp_pointer_for_p_bit_priority_4=OmciNullPointer,
555 interwork_tp_pointer_for_p_bit_priority_5=OmciNullPointer,
556 interwork_tp_pointer_for_p_bit_priority_6=OmciNullPointer,
557 interwork_tp_pointer_for_p_bit_priority_7=OmciNullPointer
Steve Crooks3c2c7582017-01-10 15:02:26 -0600558 )
559 )
560 )
561 self.send_omci_message(frame)
562
Steve Crooks9e85ce82017-03-20 12:00:53 -0400563 def send_create_mac_bridge_service_profile(self,
564 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600565 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400566 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600567 message_type=OmciCreate.message_id,
568 omci_message=OmciCreate(
569 entity_class=MacBridgeServiceProfile.class_id,
570 entity_id=entity_id,
571 data=dict(
572 spanning_tree_ind=False,
573 learning_ind=True,
574 priority=0x8000,
575 max_age=20 * 256,
576 hello_time=2 * 256,
577 forward_delay=15 * 256,
578 unknown_mac_address_discard=True
579 )
580 )
581 )
582 self.send_omci_message(frame)
583
Steve Crooks9e85ce82017-03-20 12:00:53 -0400584 def send_create_gem_port_network_ctp(self,
585 entity_id,
586 port_id,
587 tcont_id,
588 direction,
589 tm):
590 _directions = {"upstream": 1, "downstream": 2, "bi-directional": 3}
591 if _directions.has_key(direction):
592 _direction = _directions[direction]
593 else:
594 self.log.error('invalid-gem-port-direction', direction=direction)
595 raise ValueError('Invalid GEM port direction: {_dir}'.format(_dir=direction))
596
Steve Crooks3c2c7582017-01-10 15:02:26 -0600597 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400598 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600599 message_type=OmciCreate.message_id,
600 omci_message=OmciCreate(
601 entity_class=GemPortNetworkCtp.class_id,
602 entity_id=entity_id,
603 data=dict(
604 port_id=port_id,
605 tcont_pointer=tcont_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400606 direction=_direction,
607 traffic_management_pointer_upstream=tm
Steve Crooks3c2c7582017-01-10 15:02:26 -0600608 )
609 )
610 )
611 self.send_omci_message(frame)
612
Steve Crooks9e85ce82017-03-20 12:00:53 -0400613 def send_create_multicast_gem_interworking_tp(self,
614 entity_id,
615 gem_port_net_ctp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600616 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400617 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600618 message_type=OmciCreate.message_id,
619 omci_message=OmciCreate(
620 entity_class=MulticastGemInterworkingTp.class_id,
621 entity_id=entity_id,
622 data=dict(
623 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
624 interworking_option=0,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400625 service_profile_pointer=0x1
Steve Crooks3c2c7582017-01-10 15:02:26 -0600626 )
627 )
628 )
629 self.send_omci_message(frame)
630
Steve Crooks9e85ce82017-03-20 12:00:53 -0400631 def send_create_gem_inteworking_tp(self,
632 entity_id,
633 gem_port_net_ctp_id,
634 service_profile_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600635 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400636 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600637 message_type=OmciCreate.message_id,
638 omci_message=OmciCreate(
639 entity_class=GemInterworkingTp.class_id,
640 entity_id=entity_id,
641 data=dict(
642 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
643 interworking_option=5,
644 service_profile_pointer=service_profile_id,
645 interworking_tp_pointer=0x0,
646 gal_profile_pointer=0x1
647 )
648 )
649 )
650 self.send_omci_message(frame)
651
Steve Crooks9e85ce82017-03-20 12:00:53 -0400652 def send_set_8021p_mapper_service_profile(self,
653 entity_id,
654 interwork_tp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600655 data = dict(
Steve Crooks9b160d72017-03-31 10:48:29 -0500656 interwork_tp_pointer_for_p_bit_priority_0=interwork_tp_id,
657 interwork_tp_pointer_for_p_bit_priority_1=interwork_tp_id,
658 interwork_tp_pointer_for_p_bit_priority_2=interwork_tp_id,
659 interwork_tp_pointer_for_p_bit_priority_3=interwork_tp_id,
660 interwork_tp_pointer_for_p_bit_priority_4=interwork_tp_id,
661 interwork_tp_pointer_for_p_bit_priority_5=interwork_tp_id,
662 interwork_tp_pointer_for_p_bit_priority_6=interwork_tp_id,
663 interwork_tp_pointer_for_p_bit_priority_7=interwork_tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600664 )
665 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400666 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600667 message_type=OmciSet.message_id,
668 omci_message=OmciSet(
669 entity_class=Ieee8021pMapperServiceProfile.class_id,
670 entity_id=entity_id,
671 attributes_mask=Ieee8021pMapperServiceProfile.mask_for(
672 *data.keys()),
673 data=data
674 )
675 )
676 self.send_omci_message(frame)
677
678 def send_create_mac_bridge_port_configuration_data(self,
679 entity_id,
680 bridge_id,
681 port_id,
682 tp_type,
683 tp_id):
684 frame = OmciFrame(
685 transaction_id=self.get_tx_id(),
686 message_type=OmciCreate.message_id,
687 omci_message=OmciCreate(
688 entity_class=MacBridgePortConfigurationData.class_id,
689 entity_id=entity_id,
690 data=dict(
691 bridge_id_pointer = bridge_id,
692 port_num=port_id,
693 tp_type=tp_type,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400694 tp_pointer=tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600695 )
696 )
697 )
698 self.send_omci_message(frame)
699
Steve Crooks9e85ce82017-03-20 12:00:53 -0400700 def send_create_vlan_tagging_filter_data(self,
701 entity_id,
702 vlan_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600703 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400704 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600705 message_type=OmciCreate.message_id,
706 omci_message=OmciCreate(
707 entity_class=VlanTaggingFilterData.class_id,
708 entity_id=entity_id,
709 data=dict(
710 vlan_filter_0=vlan_id,
711 forward_operation=0x10,
712 number_of_entries=1
713 )
714 )
715 )
716 self.send_omci_message(frame)
717
Steve Crooks46d64302017-03-10 15:11:06 -0500718 def send_create_extended_vlan_tagging_operation_configuration_data(self,
719 entity_id,
720 assoc_type,
721 assoc_me):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600722 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400723 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600724 message_type=OmciCreate.message_id,
725 omci_message=OmciCreate(
726 entity_class=
727 ExtendedVlanTaggingOperationConfigurationData.class_id,
728 entity_id=entity_id,
729 data=dict(
Steve Crooks46d64302017-03-10 15:11:06 -0500730 association_type=assoc_type,
731 associated_me_pointer=assoc_me
Steve Crooks3c2c7582017-01-10 15:02:26 -0600732 )
733 )
734 )
735 self.send_omci_message(frame)
736
Steve Crooks9e85ce82017-03-20 12:00:53 -0400737 def send_set_extended_vlan_tagging_operation_tpid_configuration_data(self,
738 entity_id,
739 input_tpid,
740 output_tpid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600741 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400742 input_tpid=input_tpid,
743 output_tpid=output_tpid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600744 downstream_mode=0, # inverse of upstream
745 )
746 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400747 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600748 message_type=OmciSet.message_id,
749 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400750 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600751 ExtendedVlanTaggingOperationConfigurationData.class_id,
752 entity_id=entity_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400753 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600754 ExtendedVlanTaggingOperationConfigurationData.mask_for(
755 *data.keys()),
756 data=data
757 )
758 )
759 self.send_omci_message(frame)
760
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400761 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(self,
762 entity_id,
763 filter_inner_vid,
764 treatment_inner_vid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600765 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400766 received_frame_vlan_tagging_operation_table=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600767 VlanTaggingOperation(
768 filter_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500769 filter_outer_vid=4096,
770 filter_outer_tpid_de=0,
771
772 filter_inner_priority=15,
773 filter_inner_vid=filter_inner_vid,
774 filter_inner_tpid_de=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600775 filter_ether_type=0,
Steve Crooks46d64302017-03-10 15:11:06 -0500776
777 treatment_tags_to_remove=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600778 treatment_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500779 treatment_outer_vid=0,
780 treatment_outer_tpid_de=0,
781
782 treatment_inner_priority=0,
783 treatment_inner_vid=treatment_inner_vid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600784 treatment_inner_tpid_de=4
785 )
786 )
787 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400788 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600789 message_type=OmciSet.message_id,
790 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400791 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600792 ExtendedVlanTaggingOperationConfigurationData.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400793 entity_id=entity_id,
794 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600795 ExtendedVlanTaggingOperationConfigurationData.mask_for(
796 *data.keys()),
797 data=data
798 )
799 )
800 self.send_omci_message(frame)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800801
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400802 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(self,
803 entity_id,
804 filter_inner_priority,
805 filter_inner_vid,
806 filter_inner_tpid_de,
807 treatment_tags_to_remove,
808 treatment_inner_priority,
809 treatment_inner_vid):
810 data = dict(
811 received_frame_vlan_tagging_operation_table=
812 VlanTaggingOperation(
813 filter_outer_priority=15,
814 filter_outer_vid=4096,
815 filter_outer_tpid_de=0,
816
817 filter_inner_priority=filter_inner_priority,
818 filter_inner_vid=filter_inner_vid,
819 filter_inner_tpid_de=filter_inner_tpid_de,
820 filter_ether_type=0,
821
822 treatment_tags_to_remove=treatment_tags_to_remove,
823 treatment_outer_priority=15,
824 treatment_outer_vid=0,
825 treatment_outer_tpid_de=0,
826
827 treatment_inner_priority=treatment_inner_priority,
828 treatment_inner_vid=treatment_inner_vid,
829 treatment_inner_tpid_de=4
830 )
831 )
832 frame = OmciFrame(
833 transaction_id=self.get_tx_id(),
834 message_type=OmciSet.message_id,
835 omci_message=OmciSet(
836 entity_class=
837 ExtendedVlanTaggingOperationConfigurationData.class_id,
838 entity_id=entity_id,
839 attributes_mask=
840 ExtendedVlanTaggingOperationConfigurationData.mask_for(
841 *data.keys()),
842 data=data
843 )
844 )
845 self.send_omci_message(frame)
846
Steve Crooks9e85ce82017-03-20 12:00:53 -0400847 def send_create_multicast_operations_profile(self,
848 entity_id,
849 igmp_ver):
850 frame = OmciFrame(
851 transaction_id=self.get_tx_id(),
852 message_type=OmciCreate.message_id,
853 omci_message=OmciCreate(
854 entity_class=
855 MulticastOperationsProfile.class_id,
856 entity_id=entity_id,
857 data=dict(
858 igmp_version=igmp_ver,
859 igmp_function=0,
860 immediate_leave=0
861 )
862 )
863 )
864 self.send_omci_message(frame)
865
866 def send_set_multicast_operations_profile_acl_row0(self,
867 entity_id,
868 acl_table,
869 row_key,
870 gem_port,
871 vlan,
872 src_ip,
873 dst_ip_start,
874 dst_ip_end):
875 row0 = AccessControlRow0(
876 set_ctrl=1,
877 row_part_id=0,
878 test=0,
879 row_key=row_key,
880 gem_port_id=gem_port,
881 vlan_id=vlan,
882 src_ip=src_ip,
883 dst_ip_start=dst_ip_start,
884 dst_ip_end=dst_ip_end,
885 ipm_group_bw=0
886 )
887
888 if acl_table == 'dynamic':
889 data = dict(
890 dynamic_access_control_list_table=row0
891 )
892 else:
893 data = dict(
894 static_access_control_list_table=row0
895 )
896
897 frame = OmciFrame(
898 transaction_id=self.get_tx_id(),
899 message_type=OmciSet.message_id,
900 omci_message=OmciSet(
901 entity_class=MulticastOperationsProfile.class_id,
902 entity_id=entity_id,
903 attributes_mask=MulticastOperationsProfile.mask_for(
904 *data.keys()),
905 data=data
906 )
907 )
908 self.send_omci_message(frame)
909
910 def send_set_multicast_operations_profile_ds_igmp_mcast_tci(self,
911 entity_id,
912 ctrl_type,
913 tci):
914 data = dict(
915 ds_igmp_mcast_tci=
916 DownstreamIgmpMulticastTci(
917 ctrl_type=ctrl_type,
918 tci=tci
919 )
920 )
921 frame = OmciFrame(
922 transaction_id=self.get_tx_id(),
923 message_type=OmciSet.message_id,
924 omci_message=OmciSet(
925 entity_class=MulticastOperationsProfile.class_id,
926 entity_id=entity_id,
927 attributes_mask=MulticastOperationsProfile.mask_for(
928 *data.keys()),
929 data=data
930 )
931 )
932 self.send_omci_message(frame)
933
934 def send_create_multicast_subscriber_config_info(self,
935 entity_id,
936 me_type,
937 mcast_oper_profile):
938 frame = OmciFrame(
939 transaction_id=self.get_tx_id(),
940 message_type=OmciCreate.message_id,
941 omci_message=OmciCreate(
942 entity_class=
943 MulticastSubscriberConfigInfo.class_id,
944 entity_id=entity_id,
945 data=dict(
946 me_type=me_type,
947 mcast_operations_profile_pointer=mcast_oper_profile
948 )
949 )
950 )
951 self.send_omci_message(frame)
952
953 def send_set_multicast_subscriber_config_info(self,
954 entity_id,
955 max_groups=0,
956 max_mcast_bw=0,
957 bw_enforcement=0):
958 data = dict(
959 max_simultaneous_groups=max_groups,
960 max_multicast_bandwidth=max_mcast_bw,
961 bandwidth_enforcement=bw_enforcement
962 )
963 frame = OmciFrame(
964 transaction_id=self.get_tx_id(),
965 message_type=OmciSet.message_id,
966 omci_message=OmciSet(
967 entity_class=MulticastSubscriberConfigInfo.class_id,
968 entity_id=entity_id,
969 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
970 *data.keys()),
971 data=data
972 )
973 )
974 self.send_omci_message(frame)
975
976 def send_set_multicast_service_package(self,
977 entity_id,
978 row_key,
979 vid_uni,
980 max_groups,
981 max_mcast_bw,
982 mcast_oper_profile):
983 data = dict(
984 multicast_service_package_table=
985 MulticastServicePackage(
986 set_ctrl=1,
987 row_key=row_key,
988
989 vid_uni=vid_uni,
990 max_simultaneous_groups=max_groups,
991 max_multicast_bw=max_mcast_bw,
992 mcast_operations_profile_pointer=mcast_oper_profile
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
1008 def send_set_multicast_allowed_preview_groups_row0(self,
1009 entity_id,
1010 row_key,
1011 src_ip,
1012 vlan_id_ani,
1013 vlan_id_uni):
1014 data = dict(
1015 allowed_preview_groups_table=
1016 AllowedPreviewGroupsRow0(
1017 set_ctrl=1,
1018 row_part_id=0,
1019 row_key=row_key,
1020
1021 src_ip=src_ip,
1022 vlan_id_ani=vlan_id_ani,
1023 vlan_id_uni=vlan_id_uni
1024 )
1025 )
1026 frame = OmciFrame(
1027 transaction_id=self.get_tx_id(),
1028 message_type=OmciSet.message_id,
1029 omci_message=OmciSet(
1030 entity_class=MulticastSubscriberConfigInfo.class_id,
1031 entity_id=entity_id,
1032 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1033 *data.keys()),
1034 data=data
1035 )
1036 )
1037 self.send_omci_message(frame)
1038
1039 def send_set_multicast_allowed_preview_groups_row1(self,
1040 entity_id,
1041 row_key,
1042 dst_ip,
1043 duration,
1044 time_left):
1045 data = dict(
1046 allowed_preview_groups_table=
1047 AllowedPreviewGroupsRow1(
1048 set_ctrl=1,
1049 row_part_id=1,
1050 row_key=row_key,
1051
1052 dst_ip=dst_ip,
1053 duration=duration,
1054 time_left=time_left
1055 )
1056 )
1057 frame = OmciFrame(
1058 transaction_id=self.get_tx_id(),
1059 message_type=OmciSet.message_id,
1060 omci_message=OmciSet(
1061 entity_class=MulticastSubscriberConfigInfo.class_id,
1062 entity_id=entity_id,
1063 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1064 *data.keys()),
1065 data=data
1066 )
1067 )
1068 self.send_omci_message(frame)
1069
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001070 @inlineCallbacks
Steve Crooks3c2c7582017-01-10 15:02:26 -06001071 def wait_for_response(self):
1072 log.info('wait-for-response')
1073 try:
1074 response = yield self.incoming_messages.get()
Steve Crooks9e85ce82017-03-20 12:00:53 -04001075 log.info('got-response')
1076 # resp = OmciFrame(response)
1077 # resp.show()
Steve Crooks3c2c7582017-01-10 15:02:26 -06001078 except Exception as e:
1079 self.log.info('wait-for-response-exception', exc=str(e))
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001080
Steve Crooks3c2c7582017-01-10 15:02:26 -06001081 @inlineCallbacks
Steve Crooks9b160d72017-03-31 10:48:29 -05001082 def message_exchange(self, onu, gem, cvid):
1083 log.info('message_exchange', onu=onu, gem=gem, cvid=cvid)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001084 # reset incoming message queue
1085 while self.incoming_messages.pending:
1086 _ = yield self.incoming_messages.get()
1087
Steve Crooks9b160d72017-03-31 10:48:29 -05001088 tcont = gem
1089
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001090 # construct message
Steve Crooks3c2c7582017-01-10 15:02:26 -06001091 # MIB Reset - OntData - 0
1092 self.send_mib_reset()
1093 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001094
Steve Crooks3c2c7582017-01-10 15:02:26 -06001095 # Create AR - GalEthernetProfile - 1
1096 self.send_create_gal_ethernet_profile(1, 48)
1097 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001098
Steve Crooks9b160d72017-03-31 10:48:29 -05001099 # TCONT config
1100 # Set AR - TCont - 32769 - (1025 or 1026)
1101 self.send_set_tcont(0x8001, tcont)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001102 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001103
Steve Crooks9b160d72017-03-31 10:48:29 -05001104 # Mapper Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001105 # Create AR - 802.1pMapperServiceProfile - 32769
1106 self.send_create_8021p_mapper_service_profile(0x8001)
1107 yield self.wait_for_response()
1108
Steve Crooks9b160d72017-03-31 10:48:29 -05001109 # MAC Bridge Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001110 # Create AR - MacBridgeServiceProfile - 513
1111 self.send_create_mac_bridge_service_profile(0x201)
1112 yield self.wait_for_response()
1113
Steve Crooks9b160d72017-03-31 10:48:29 -05001114 # GEM Port Network CTP config
1115 # Create AR - GemPortNetworkCtp - 257 - <gem> - 32769
1116 self.send_create_gem_port_network_ctp(0x101, gem, 0x8001, "bi-directional", 0x100)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001117 yield self.wait_for_response()
1118
1119 # Create AR - GemPortNetworkCtp - 260 - 4000 - 0
1120 self.send_create_gem_port_network_ctp(0x104, 0x0FA0, 0, "downstream", 0)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001121 yield self.wait_for_response()
1122
Steve Crooks9b160d72017-03-31 10:48:29 -05001123 # Multicast GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001124 # Create AR - MulticastGemInterworkingTp - 6 - 260
1125 self.send_create_multicast_gem_interworking_tp(0x6, 0x104)
1126 yield self.wait_for_response()
1127
Steve Crooks9b160d72017-03-31 10:48:29 -05001128 # GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001129 # Create AR - GemInterworkingTp - 32770 - 257 -32769 - 1
1130 self.send_create_gem_inteworking_tp(0x8002, 0x101, 0x8001)
1131 yield self.wait_for_response()
1132
Steve Crooks9b160d72017-03-31 10:48:29 -05001133 # Mapper Service Profile config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001134 # Set AR - 802.1pMapperServiceProfile - 32769 - 32770
1135 self.send_set_8021p_mapper_service_profile(0x8001, 0x8002)
1136 yield self.wait_for_response()
1137
Steve Crooks9b160d72017-03-31 10:48:29 -05001138 # MAC Bridge Port config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001139 # Create AR - MacBridgePortConfigData - 8450 - 513 - 3 - 3 - 32769
1140 self.send_create_mac_bridge_port_configuration_data(0x2102, 0x201, 3, 3, 0x8001)
1141 yield self.wait_for_response()
1142
Steve Crooks3c2c7582017-01-10 15:02:26 -06001143 # Create AR - MacBridgePortConfigData - 9000 - 513 - 6 - 6 - 6
1144 self.send_create_mac_bridge_port_configuration_data(0x2328, 0x201, 6, 6, 6)
1145 yield self.wait_for_response()
1146
Steve Crooks9b160d72017-03-31 10:48:29 -05001147 # VLAN Tagging Filter config
1148 # Create AR - VlanTaggingFilterData - 8450 - c-vid
1149 self.send_create_vlan_tagging_filter_data(0x2102, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001150 yield self.wait_for_response()
1151
Steve Crooks9b160d72017-03-31 10:48:29 -05001152 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001153 # Create AR - MulticastOperationsProfile
1154 self.send_create_multicast_operations_profile(0x201, 3)
1155 yield self.wait_for_response()
1156
1157 # Set AR - MulticastOperationsProfile - Dynamic Access Control List table
1158 self.send_set_multicast_operations_profile_acl_row0(0x201,
1159 'dynamic',
1160 0,
1161 0x0fa0,
1162 0x0fa0,
1163 '0.0.0.0',
1164 '224.0.0.0',
1165 '239.255.255.255')
1166 yield self.wait_for_response()
1167
Steve Crooks9b160d72017-03-31 10:48:29 -05001168 # Multicast Subscriber config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001169 # Create AR - MulticastSubscriberConfigInfo
1170 self.send_create_multicast_subscriber_config_info(0x201, 0, 0x201)
1171 yield self.wait_for_response()
1172
Steve Crooks9b160d72017-03-31 10:48:29 -05001173 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001174 # Set AR - MulticastOperationsProfile - Downstream IGMP Multicast TCI
Steve Crooks9b160d72017-03-31 10:48:29 -05001175 self.send_set_multicast_operations_profile_ds_igmp_mcast_tci(0x201, 4, cvid)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001176 yield self.wait_for_response()
1177
Steve Crooks9b160d72017-03-31 10:48:29 -05001178 # Port 2
1179 # Extended VLAN Tagging Operation config
1180 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1181 # TODO: add entry here for additional UNI interfaces
Steve Crooks9e85ce82017-03-20 12:00:53 -04001182 self.send_create_extended_vlan_tagging_operation_configuration_data(0x202, 2, 0x102)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001183 yield self.wait_for_response()
1184
1185 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
Steve Crooks46d64302017-03-10 15:11:06 -05001186 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x202, 0x8100, 0x8100)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001187 yield self.wait_for_response()
1188
Steve Crooks46d64302017-03-10 15:11:06 -05001189 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001190 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1191 #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 -04001192 #yield self.wait_for_response()
1193
1194 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001195 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1196 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x202, 0x1000, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001197 yield self.wait_for_response()
1198
Steve Crooks9b160d72017-03-31 10:48:29 -05001199 # MAC Bridge Port config
1200 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1201 # TODO: add more entries here for other UNI ports
1202 self.send_create_mac_bridge_port_configuration_data(0x201, 0x201, 2, 1, 0x102)
1203 yield self.wait_for_response()
1204
1205 # Port 5
1206 # Extended VLAN Tagging Operation config
1207 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1208 # TODO: add entry here for additional UNI interfaces
1209 self.send_create_extended_vlan_tagging_operation_configuration_data(0x205, 2, 0x105)
1210 yield self.wait_for_response()
1211
1212 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
1213 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x205, 0x8100, 0x8100)
1214 yield self.wait_for_response()
1215
1216 # Set AR - ExtendedVlanTaggingOperationConfigData
1217 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1218 #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0, 1, 8, cvid)
1219 #yield self.wait_for_response()
1220
1221 # Set AR - ExtendedVlanTaggingOperationConfigData
1222 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1223 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x205, 0x1000, cvid)
1224 yield self.wait_for_response()
1225
1226 # MAC Bridge Port config
1227 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1228 # TODO: add more entries here for other UNI ports
1229 self.send_create_mac_bridge_port_configuration_data(0x205, 0x201, 5, 1, 0x105)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001230 yield self.wait_for_response()