blob: 732085c8845229f7315016dc22a9698af5b2dca4 [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
Nikolay Titov89004ec2017-06-19 18:22:42 -0400167 def create_interface(self, device, data):
168 raise NotImplementedError()
169
170 def update_interface(self, device, data):
171 raise NotImplementedError()
172
173 def remove_interface(self, device, data):
174 raise NotImplementedError()
175
176 def receive_onu_detect_state(self, device_id, state):
177 raise NotImplementedError()
178
Stephane Barbarie980a0912017-05-11 11:27:06 -0400179 def unsuppress_alarm(self, filter):
180 raise NotImplementedError()
Steve Crooks3c2c7582017-01-10 15:02:26 -0600181
182class BroadcomOnuHandler(object):
183
184 def __init__(self, adapter, device_id):
185 self.adapter = adapter
186 self.adapter_agent = adapter.adapter_agent
187 self.device_id = device_id
188 self.log = structlog.get_logger(device_id=device_id)
189 self.incoming_messages = DeferredQueue()
Peter Shafikd7f33772017-05-17 13:56:34 -0400190 self.event_messages = DeferredQueue()
Steve Crooks3c2c7582017-01-10 15:02:26 -0600191 self.proxy_address = None
192 self.tx_id = 0
193
Peter Shafikd7f33772017-05-17 13:56:34 -0400194 # Need to query ONU for number of supported uni ports
195 # For now, temporarily set number of ports to 1 - port #2
196 self.uni_ports = (2,)
197
198 # Handle received ONU event messages
199 reactor.callLater(0, self.handle_onu_events)
200
Steve Crooks3c2c7582017-01-10 15:02:26 -0600201 def receive_message(self, msg):
202 self.incoming_messages.put(msg)
203
Peter Shafikd7f33772017-05-17 13:56:34 -0400204 @inlineCallbacks
205 def handle_onu_events(self):
206 event_msg = yield self.event_messages.get()
207
208 if event_msg['event'] == 'activation-completed':
209
210 if event_msg['event_data']['activation_successful'] == True:
211 for uni in self.uni_ports:
212 port_no = self.proxy_address.channel_id + uni
213 reactor.callLater(1,
214 self.message_exchange,
215 self.proxy_address.onu_id,
216 self.proxy_address.onu_session_id,
217 port_no)
218
219 device = self.adapter_agent.get_device(self.device_id)
220 device.oper_status = OperStatus.ACTIVE
221 self.adapter_agent.update_device(device)
222
223 else:
224 device = self.adapter_agent.get_device(self.device_id)
225 device.oper_status = OperStatus.FAILED
226 self.adapter_agent.update_device(device)
227
228 elif event_msg['event'] == 'deactivation-completed':
229 device = self.adapter_agent.get_device(self.device_id)
230 device.oper_status = OperStatus.DISCOVERED
231 self.adapter_agent.update_device(device)
232
233 elif event_msg['event'] == 'ranging-completed':
234
235 if event_msg['event_data']['ranging_successful'] == True:
236 device = self.adapter_agent.get_device(self.device_id)
237 device.oper_status = OperStatus.ACTIVATING
238 self.adapter_agent.update_device(device)
239
240 else:
241 device = self.adapter_agent.get_device(self.device_id)
242 device.oper_status = OperStatus.FAILED
243 self.adapter_agent.update_device(device)
244
245 # Handle next event
246 reactor.callLater(0, self.handle_onu_events)
247
248
Steve Crooks3c2c7582017-01-10 15:02:26 -0600249 def activate(self, device):
250 self.log.info('activating')
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800251
252 # first we verify that we got parent reference and proxy info
253 assert device.parent_id
254 assert device.proxy_address.device_id
Steve Crooks9b160d72017-03-31 10:48:29 -0500255 #assert device.proxy_address.channel_id # c-vid
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800256
Steve Crooks3c2c7582017-01-10 15:02:26 -0600257 # register for proxied messages right away
258 self.proxy_address = device.proxy_address
259 self.adapter_agent.register_for_proxied_messages(device.proxy_address)
260
Peter Shafik9107f2e2017-05-02 15:54:39 -0400261
Steve Crooks3c2c7582017-01-10 15:02:26 -0600262 # populate device info
263 device.root = True
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800264 device.vendor = 'Broadcom'
Steve Crooks9e85ce82017-03-20 12:00:53 -0400265 device.model = 'n/a'
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800266 device.hardware_version = 'to be filled'
267 device.firmware_version = 'to be filled'
ggowdru236bd952017-06-20 20:32:55 -0700268 device.images.image.extend([
269 Image(version="to be filled")
270 ])
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800271 device.connect_status = ConnectStatus.REACHABLE
272 self.adapter_agent.update_device(device)
273
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800274 self.adapter_agent.add_port(device.id, Port(
Steve Crooks9b160d72017-03-31 10:48:29 -0500275 port_no=100,
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800276 label='PON port',
277 type=Port.PON_ONU,
278 admin_state=AdminState.ENABLED,
279 oper_status=OperStatus.ACTIVE,
280 peers=[
281 Port.PeerPort(
282 device_id=device.parent_id,
283 port_no=device.parent_port_no
284 )
285 ]
286 ))
287
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800288 parent_device = self.adapter_agent.get_device(device.parent_id)
289 logical_device_id = parent_device.parent_id
290 assert logical_device_id
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800291
Peter Shafikd7f33772017-05-17 13:56:34 -0400292 for uni in self.uni_ports:
Steve Crooks9b160d72017-03-31 10:48:29 -0500293 # register physical ports
294 uni_port = Port(
295 port_no=uni,
296 label='UNI facing Ethernet port '+str(uni),
297 type=Port.ETHERNET_UNI,
298 admin_state=AdminState.ENABLED,
299 oper_status=OperStatus.ACTIVE
300 )
301 self.adapter_agent.add_port(device.id, uni_port)
302
303 # add uni port to logical device
304 port_no = device.proxy_address.channel_id + uni
305 cap = OFPPF_1GB_FD | OFPPF_FIBER
306 self.adapter_agent.add_logical_port(logical_device_id, LogicalPort(
307 id='uni-{}'.format(port_no),
308 ofp_port=ofp_port(
309 port_no=port_no,
310 hw_addr=mac_str_to_tuple('00:00:00:%02x:%02x:%02x' %
311 (device.proxy_address.onu_id & 0xff,
312 (port_no >> 8) & 0xff,
313 port_no & 0xff)),
314 name='uni-{}'.format(port_no),
315 config=0,
316 state=OFPPS_LIVE,
317 curr=cap,
318 advertised=cap,
319 peer=cap,
320 curr_speed=OFPPF_1GB_FD,
321 max_speed=OFPPF_1GB_FD
322 ),
323 device_id=device.id,
324 device_port_no=uni_port.port_no
325 ))
326
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800327 device = self.adapter_agent.get_device(device.id)
Peter Shafikd7f33772017-05-17 13:56:34 -0400328 device.oper_status = OperStatus.DISCOVERED
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800329 self.adapter_agent.update_device(device)
330
Steve Crooks3c2c7582017-01-10 15:02:26 -0600331 @inlineCallbacks
Steve Crooksf248e182017-02-07 10:50:24 -0500332 def update_flow_table(self, device, flows):
333 #
334 # We need to proxy through the OLT to get to the ONU
335 # Configuration from here should be using OMCI
336 #
337 self.log.info('bulk-flow-update', device_id=device.id, flows=flows)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800338
Steve Crooksf248e182017-02-07 10:50:24 -0500339 def is_downstream(port):
Steve Crooks9b160d72017-03-31 10:48:29 -0500340 return port == 100 # Need a better way
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800341
Steve Crooksf248e182017-02-07 10:50:24 -0500342 def is_upstream(port):
343 return not is_downstream(port)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800344
Steve Crooksf248e182017-02-07 10:50:24 -0500345 for flow in flows:
Steve Crooks9b160d72017-03-31 10:48:29 -0500346 _type = None
347 _port = None
348 _vlan_vid = None
349 _udp_dst = None
350 _udp_src = None
351 _ipv4_dst = None
352 _ipv4_src = None
353 _metadata = None
354 _output = None
355 _push_tpid = None
356 _field = None
357 _set_vlan_vid = None
Steve Crooksf248e182017-02-07 10:50:24 -0500358 try:
359 _in_port = fd.get_in_port(flow)
360 assert _in_port is not None
Steve Crooks3c2c7582017-01-10 15:02:26 -0600361
Steve Crooksf248e182017-02-07 10:50:24 -0500362 if is_downstream(_in_port):
363 self.log.info('downstream-flow')
364 elif is_upstream(_in_port):
365 self.log.info('upstream-flow')
366 else:
367 raise Exception('port should be 1 or 2 by our convention')
368
369 _out_port = fd.get_out_port(flow) # may be None
370 self.log.info('out-port', out_port=_out_port)
371
372 for field in fd.get_ofb_fields(flow):
373 if field.type == fd.ETH_TYPE:
374 _type = field.eth_type
375 self.log.info('field-type-eth-type',
376 eth_type=_type)
377
378 elif field.type == fd.IP_PROTO:
379 _proto = field.ip_proto
380 self.log.info('field-type-ip-proto',
381 ip_proto=_proto)
382
383 elif field.type == fd.IN_PORT:
384 _port = field.port
385 self.log.info('field-type-in-port',
386 in_port=_port)
387
388 elif field.type == fd.VLAN_VID:
389 _vlan_vid = field.vlan_vid & 0xfff
390 self.log.info('field-type-vlan-vid',
391 vlan=_vlan_vid)
392
393 elif field.type == fd.VLAN_PCP:
394 _vlan_pcp = field.vlan_pcp
395 self.log.info('field-type-vlan-pcp',
396 pcp=_vlan_pcp)
397
398 elif field.type == fd.UDP_DST:
399 _udp_dst = field.udp_dst
400 self.log.info('field-type-udp-dst',
401 udp_dst=_udp_dst)
402
403 elif field.type == fd.UDP_SRC:
404 _udp_src = field.udp_src
405 self.log.info('field-type-udp-src',
406 udp_src=_udp_src)
407
408 elif field.type == fd.IPV4_DST:
409 _ipv4_dst = field.ipv4_dst
410 self.log.info('field-type-ipv4-dst',
411 ipv4_dst=_ipv4_dst)
412
413 elif field.type == fd.IPV4_SRC:
414 _ipv4_src = field.ipv4_src
415 self.log.info('field-type-ipv4-src',
416 ipv4_dst=_ipv4_src)
417
418 elif field.type == fd.METADATA:
Steve Crooks9b160d72017-03-31 10:48:29 -0500419 _metadata = field.table_metadata
Steve Crooksf248e182017-02-07 10:50:24 -0500420 self.log.info('field-type-metadata',
421 metadata=_metadata)
422
423 else:
424 raise NotImplementedError('field.type={}'.format(
425 field.type))
426
427 for action in fd.get_actions(flow):
428
429 if action.type == fd.OUTPUT:
430 _output = action.output.port
431 self.log.info('action-type-output',
432 output=_output, in_port=_in_port)
433
434 elif action.type == fd.POP_VLAN:
435 self.log.info('action-type-pop-vlan',
436 in_port=_in_port)
437
438 elif action.type == fd.PUSH_VLAN:
439 _push_tpid = action.push.ethertype
440 log.info('action-type-push-vlan',
441 push_tpid=_push_tpid, in_port=_in_port)
442 if action.push.ethertype != 0x8100:
443 self.log.error('unhandled-tpid',
444 ethertype=action.push.ethertype)
445
446 elif action.type == fd.SET_FIELD:
447 _field = action.set_field.field.ofb_field
448 assert (action.set_field.field.oxm_class ==
449 OFPXMC_OPENFLOW_BASIC)
450 self.log.info('action-type-set-field',
451 field=_field, in_port=_in_port)
452 if _field.type == fd.VLAN_VID:
Steve Crooks9b160d72017-03-31 10:48:29 -0500453 _set_vlan_vid = _field.vlan_vid & 0xfff
454 self.log.info('set-field-type-valn-vid', _set_vlan_vid)
Steve Crooksf248e182017-02-07 10:50:24 -0500455 else:
456 self.log.error('unsupported-action-set-field-type',
457 field_type=_field.type)
458 else:
459 log.error('unsupported-action-type',
460 action_type=action.type, in_port=_in_port)
461
462 #
463 # All flows created from ONU adapter should be OMCI based
464 #
Steve Crooks9b160d72017-03-31 10:48:29 -0500465 if _vlan_vid == 0:
466 # allow priority tagged packets
467 # Set AR - ExtendedVlanTaggingOperationConfigData
468 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
469 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0,
470 1, 8, _in_port)
471 yield self.wait_for_response()
472
473 # Set AR - ExtendedVlanTaggingOperationConfigData
474 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
475 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0,
476 1, 8, _in_port)
477 yield self.wait_for_response()
Steve Crooksf248e182017-02-07 10:50:24 -0500478
479 except Exception as e:
480 log.exception('failed-to-install-flow', e=e, flow=flow)
481
Steve Crooks3c2c7582017-01-10 15:02:26 -0600482 def get_tx_id(self):
483 self.tx_id += 1
484 return self.tx_id
485
486 def send_omci_message(self, frame):
487 _frame = hexify(str(frame))
488 self.log.info('send-omci-message-%s' % _frame)
489 device = self.adapter_agent.get_device(self.device_id)
490 try:
491 self.adapter_agent.send_proxied_message(device.proxy_address, _frame)
492 except Exception as e:
493 self.log.info('send-omci-message-exception', exc=str(e))
494
495 def send_get_circuit_pack(self, entity_id=0):
496 frame = OmciFrame(
497 transaction_id=self.get_tx_id(),
498 message_type=OmciGet.message_id,
499 omci_message=OmciGet(
500 entity_class=CircuitPack.class_id,
501 entity_id=entity_id,
502 attributes_mask=CircuitPack.mask_for('vendor_id')
503 )
504 )
505 self.send_omci_message(frame)
506
507 def send_mib_reset(self, entity_id=0):
508 frame = OmciFrame(
509 transaction_id=self.get_tx_id(),
510 message_type=OmciMibReset.message_id,
511 omci_message=OmciMibReset(
512 entity_class=OntData.class_id,
513 entity_id=entity_id
514 )
515 )
516 self.send_omci_message(frame)
517
Steve Crooks9e85ce82017-03-20 12:00:53 -0400518 def send_create_gal_ethernet_profile(self,
519 entity_id,
520 max_gem_payload_size):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600521 frame = OmciFrame(
522 transaction_id=self.get_tx_id(),
523 message_type=OmciCreate.message_id,
524 omci_message=OmciCreate(
525 entity_class=GalEthernetProfile.class_id,
526 entity_id=entity_id,
527 data=dict(
528 max_gem_payload_size=max_gem_payload_size
529 )
530 )
531 )
532 self.send_omci_message(frame)
533
Steve Crooks9e85ce82017-03-20 12:00:53 -0400534 def send_set_tcont(self,
535 entity_id,
536 alloc_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600537 data = dict(
538 alloc_id=alloc_id
539 )
540 frame = OmciFrame(
541 transaction_id=self.get_tx_id(),
542 message_type=OmciSet.message_id,
543 omci_message=OmciSet(
544 entity_class=Tcont.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400545 entity_id=entity_id,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600546 attributes_mask=Tcont.mask_for(*data.keys()),
547 data=data
548 )
549 )
550 self.send_omci_message(frame)
551
Steve Crooks9e85ce82017-03-20 12:00:53 -0400552 def send_create_8021p_mapper_service_profile(self,
553 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600554 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400555 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600556 message_type=OmciCreate.message_id,
557 omci_message=OmciCreate(
558 entity_class=Ieee8021pMapperServiceProfile.class_id,
559 entity_id=entity_id,
560 data=dict(
561 tp_pointer=OmciNullPointer,
562 interwork_tp_pointer_for_p_bit_priority_0=OmciNullPointer,
Steve Crooks9b160d72017-03-31 10:48:29 -0500563 interwork_tp_pointer_for_p_bit_priority_1=OmciNullPointer,
564 interwork_tp_pointer_for_p_bit_priority_2=OmciNullPointer,
565 interwork_tp_pointer_for_p_bit_priority_3=OmciNullPointer,
566 interwork_tp_pointer_for_p_bit_priority_4=OmciNullPointer,
567 interwork_tp_pointer_for_p_bit_priority_5=OmciNullPointer,
568 interwork_tp_pointer_for_p_bit_priority_6=OmciNullPointer,
569 interwork_tp_pointer_for_p_bit_priority_7=OmciNullPointer
Steve Crooks3c2c7582017-01-10 15:02:26 -0600570 )
571 )
572 )
573 self.send_omci_message(frame)
574
Steve Crooks9e85ce82017-03-20 12:00:53 -0400575 def send_create_mac_bridge_service_profile(self,
576 entity_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600577 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400578 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600579 message_type=OmciCreate.message_id,
580 omci_message=OmciCreate(
581 entity_class=MacBridgeServiceProfile.class_id,
582 entity_id=entity_id,
583 data=dict(
584 spanning_tree_ind=False,
585 learning_ind=True,
586 priority=0x8000,
587 max_age=20 * 256,
588 hello_time=2 * 256,
589 forward_delay=15 * 256,
590 unknown_mac_address_discard=True
591 )
592 )
593 )
594 self.send_omci_message(frame)
595
Steve Crooks9e85ce82017-03-20 12:00:53 -0400596 def send_create_gem_port_network_ctp(self,
597 entity_id,
598 port_id,
599 tcont_id,
600 direction,
601 tm):
602 _directions = {"upstream": 1, "downstream": 2, "bi-directional": 3}
603 if _directions.has_key(direction):
604 _direction = _directions[direction]
605 else:
606 self.log.error('invalid-gem-port-direction', direction=direction)
607 raise ValueError('Invalid GEM port direction: {_dir}'.format(_dir=direction))
608
Steve Crooks3c2c7582017-01-10 15:02:26 -0600609 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400610 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600611 message_type=OmciCreate.message_id,
612 omci_message=OmciCreate(
613 entity_class=GemPortNetworkCtp.class_id,
614 entity_id=entity_id,
615 data=dict(
616 port_id=port_id,
617 tcont_pointer=tcont_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400618 direction=_direction,
619 traffic_management_pointer_upstream=tm
Steve Crooks3c2c7582017-01-10 15:02:26 -0600620 )
621 )
622 )
623 self.send_omci_message(frame)
624
Steve Crooks9e85ce82017-03-20 12:00:53 -0400625 def send_create_multicast_gem_interworking_tp(self,
626 entity_id,
627 gem_port_net_ctp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600628 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400629 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600630 message_type=OmciCreate.message_id,
631 omci_message=OmciCreate(
632 entity_class=MulticastGemInterworkingTp.class_id,
633 entity_id=entity_id,
634 data=dict(
635 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
636 interworking_option=0,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400637 service_profile_pointer=0x1
Steve Crooks3c2c7582017-01-10 15:02:26 -0600638 )
639 )
640 )
641 self.send_omci_message(frame)
642
Steve Crooks9e85ce82017-03-20 12:00:53 -0400643 def send_create_gem_inteworking_tp(self,
644 entity_id,
645 gem_port_net_ctp_id,
646 service_profile_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600647 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400648 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600649 message_type=OmciCreate.message_id,
650 omci_message=OmciCreate(
651 entity_class=GemInterworkingTp.class_id,
652 entity_id=entity_id,
653 data=dict(
654 gem_port_network_ctp_pointer=gem_port_net_ctp_id,
655 interworking_option=5,
656 service_profile_pointer=service_profile_id,
657 interworking_tp_pointer=0x0,
658 gal_profile_pointer=0x1
659 )
660 )
661 )
662 self.send_omci_message(frame)
663
Steve Crooks9e85ce82017-03-20 12:00:53 -0400664 def send_set_8021p_mapper_service_profile(self,
665 entity_id,
666 interwork_tp_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600667 data = dict(
Steve Crooks9b160d72017-03-31 10:48:29 -0500668 interwork_tp_pointer_for_p_bit_priority_0=interwork_tp_id,
669 interwork_tp_pointer_for_p_bit_priority_1=interwork_tp_id,
670 interwork_tp_pointer_for_p_bit_priority_2=interwork_tp_id,
671 interwork_tp_pointer_for_p_bit_priority_3=interwork_tp_id,
672 interwork_tp_pointer_for_p_bit_priority_4=interwork_tp_id,
673 interwork_tp_pointer_for_p_bit_priority_5=interwork_tp_id,
674 interwork_tp_pointer_for_p_bit_priority_6=interwork_tp_id,
675 interwork_tp_pointer_for_p_bit_priority_7=interwork_tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600676 )
677 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400678 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600679 message_type=OmciSet.message_id,
680 omci_message=OmciSet(
681 entity_class=Ieee8021pMapperServiceProfile.class_id,
682 entity_id=entity_id,
683 attributes_mask=Ieee8021pMapperServiceProfile.mask_for(
684 *data.keys()),
685 data=data
686 )
687 )
688 self.send_omci_message(frame)
689
690 def send_create_mac_bridge_port_configuration_data(self,
691 entity_id,
692 bridge_id,
693 port_id,
694 tp_type,
695 tp_id):
696 frame = OmciFrame(
697 transaction_id=self.get_tx_id(),
698 message_type=OmciCreate.message_id,
699 omci_message=OmciCreate(
700 entity_class=MacBridgePortConfigurationData.class_id,
701 entity_id=entity_id,
702 data=dict(
703 bridge_id_pointer = bridge_id,
704 port_num=port_id,
705 tp_type=tp_type,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400706 tp_pointer=tp_id
Steve Crooks3c2c7582017-01-10 15:02:26 -0600707 )
708 )
709 )
710 self.send_omci_message(frame)
711
Steve Crooks9e85ce82017-03-20 12:00:53 -0400712 def send_create_vlan_tagging_filter_data(self,
713 entity_id,
714 vlan_id):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600715 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400716 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600717 message_type=OmciCreate.message_id,
718 omci_message=OmciCreate(
719 entity_class=VlanTaggingFilterData.class_id,
720 entity_id=entity_id,
721 data=dict(
722 vlan_filter_0=vlan_id,
723 forward_operation=0x10,
724 number_of_entries=1
725 )
726 )
727 )
728 self.send_omci_message(frame)
729
Steve Crooks46d64302017-03-10 15:11:06 -0500730 def send_create_extended_vlan_tagging_operation_configuration_data(self,
731 entity_id,
732 assoc_type,
733 assoc_me):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600734 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400735 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600736 message_type=OmciCreate.message_id,
737 omci_message=OmciCreate(
738 entity_class=
739 ExtendedVlanTaggingOperationConfigurationData.class_id,
740 entity_id=entity_id,
741 data=dict(
Steve Crooks46d64302017-03-10 15:11:06 -0500742 association_type=assoc_type,
743 associated_me_pointer=assoc_me
Steve Crooks3c2c7582017-01-10 15:02:26 -0600744 )
745 )
746 )
747 self.send_omci_message(frame)
748
Steve Crooks9e85ce82017-03-20 12:00:53 -0400749 def send_set_extended_vlan_tagging_operation_tpid_configuration_data(self,
750 entity_id,
751 input_tpid,
752 output_tpid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600753 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400754 input_tpid=input_tpid,
755 output_tpid=output_tpid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600756 downstream_mode=0, # inverse of upstream
757 )
758 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400759 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600760 message_type=OmciSet.message_id,
761 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400762 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600763 ExtendedVlanTaggingOperationConfigurationData.class_id,
764 entity_id=entity_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400765 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600766 ExtendedVlanTaggingOperationConfigurationData.mask_for(
767 *data.keys()),
768 data=data
769 )
770 )
771 self.send_omci_message(frame)
772
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400773 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(self,
774 entity_id,
775 filter_inner_vid,
776 treatment_inner_vid):
Steve Crooks3c2c7582017-01-10 15:02:26 -0600777 data = dict(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400778 received_frame_vlan_tagging_operation_table=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600779 VlanTaggingOperation(
780 filter_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500781 filter_outer_vid=4096,
782 filter_outer_tpid_de=0,
783
784 filter_inner_priority=15,
785 filter_inner_vid=filter_inner_vid,
786 filter_inner_tpid_de=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600787 filter_ether_type=0,
Steve Crooks46d64302017-03-10 15:11:06 -0500788
789 treatment_tags_to_remove=0,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600790 treatment_outer_priority=15,
Steve Crooks46d64302017-03-10 15:11:06 -0500791 treatment_outer_vid=0,
792 treatment_outer_tpid_de=0,
793
794 treatment_inner_priority=0,
795 treatment_inner_vid=treatment_inner_vid,
Steve Crooks3c2c7582017-01-10 15:02:26 -0600796 treatment_inner_tpid_de=4
797 )
798 )
799 frame = OmciFrame(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400800 transaction_id=self.get_tx_id(),
Steve Crooks3c2c7582017-01-10 15:02:26 -0600801 message_type=OmciSet.message_id,
802 omci_message=OmciSet(
Steve Crooks9e85ce82017-03-20 12:00:53 -0400803 entity_class=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600804 ExtendedVlanTaggingOperationConfigurationData.class_id,
Steve Crooks9e85ce82017-03-20 12:00:53 -0400805 entity_id=entity_id,
806 attributes_mask=
Steve Crooks3c2c7582017-01-10 15:02:26 -0600807 ExtendedVlanTaggingOperationConfigurationData.mask_for(
808 *data.keys()),
809 data=data
810 )
811 )
812 self.send_omci_message(frame)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -0800813
Steve Crooksa9d0a7c2017-03-28 22:40:01 -0400814 def send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(self,
815 entity_id,
816 filter_inner_priority,
817 filter_inner_vid,
818 filter_inner_tpid_de,
819 treatment_tags_to_remove,
820 treatment_inner_priority,
821 treatment_inner_vid):
822 data = dict(
823 received_frame_vlan_tagging_operation_table=
824 VlanTaggingOperation(
825 filter_outer_priority=15,
826 filter_outer_vid=4096,
827 filter_outer_tpid_de=0,
828
829 filter_inner_priority=filter_inner_priority,
830 filter_inner_vid=filter_inner_vid,
831 filter_inner_tpid_de=filter_inner_tpid_de,
832 filter_ether_type=0,
833
834 treatment_tags_to_remove=treatment_tags_to_remove,
835 treatment_outer_priority=15,
836 treatment_outer_vid=0,
837 treatment_outer_tpid_de=0,
838
839 treatment_inner_priority=treatment_inner_priority,
840 treatment_inner_vid=treatment_inner_vid,
841 treatment_inner_tpid_de=4
842 )
843 )
844 frame = OmciFrame(
845 transaction_id=self.get_tx_id(),
846 message_type=OmciSet.message_id,
847 omci_message=OmciSet(
848 entity_class=
849 ExtendedVlanTaggingOperationConfigurationData.class_id,
850 entity_id=entity_id,
851 attributes_mask=
852 ExtendedVlanTaggingOperationConfigurationData.mask_for(
853 *data.keys()),
854 data=data
855 )
856 )
857 self.send_omci_message(frame)
858
Steve Crooks9e85ce82017-03-20 12:00:53 -0400859 def send_create_multicast_operations_profile(self,
860 entity_id,
861 igmp_ver):
862 frame = OmciFrame(
863 transaction_id=self.get_tx_id(),
864 message_type=OmciCreate.message_id,
865 omci_message=OmciCreate(
866 entity_class=
867 MulticastOperationsProfile.class_id,
868 entity_id=entity_id,
869 data=dict(
870 igmp_version=igmp_ver,
871 igmp_function=0,
872 immediate_leave=0
873 )
874 )
875 )
876 self.send_omci_message(frame)
877
878 def send_set_multicast_operations_profile_acl_row0(self,
879 entity_id,
880 acl_table,
881 row_key,
882 gem_port,
883 vlan,
884 src_ip,
885 dst_ip_start,
886 dst_ip_end):
887 row0 = AccessControlRow0(
888 set_ctrl=1,
889 row_part_id=0,
890 test=0,
891 row_key=row_key,
892 gem_port_id=gem_port,
893 vlan_id=vlan,
894 src_ip=src_ip,
895 dst_ip_start=dst_ip_start,
896 dst_ip_end=dst_ip_end,
897 ipm_group_bw=0
898 )
899
900 if acl_table == 'dynamic':
901 data = dict(
902 dynamic_access_control_list_table=row0
903 )
904 else:
905 data = dict(
906 static_access_control_list_table=row0
907 )
908
909 frame = OmciFrame(
910 transaction_id=self.get_tx_id(),
911 message_type=OmciSet.message_id,
912 omci_message=OmciSet(
913 entity_class=MulticastOperationsProfile.class_id,
914 entity_id=entity_id,
915 attributes_mask=MulticastOperationsProfile.mask_for(
916 *data.keys()),
917 data=data
918 )
919 )
920 self.send_omci_message(frame)
921
922 def send_set_multicast_operations_profile_ds_igmp_mcast_tci(self,
923 entity_id,
924 ctrl_type,
925 tci):
926 data = dict(
927 ds_igmp_mcast_tci=
928 DownstreamIgmpMulticastTci(
929 ctrl_type=ctrl_type,
930 tci=tci
931 )
932 )
933 frame = OmciFrame(
934 transaction_id=self.get_tx_id(),
935 message_type=OmciSet.message_id,
936 omci_message=OmciSet(
937 entity_class=MulticastOperationsProfile.class_id,
938 entity_id=entity_id,
939 attributes_mask=MulticastOperationsProfile.mask_for(
940 *data.keys()),
941 data=data
942 )
943 )
944 self.send_omci_message(frame)
945
946 def send_create_multicast_subscriber_config_info(self,
947 entity_id,
948 me_type,
949 mcast_oper_profile):
950 frame = OmciFrame(
951 transaction_id=self.get_tx_id(),
952 message_type=OmciCreate.message_id,
953 omci_message=OmciCreate(
954 entity_class=
955 MulticastSubscriberConfigInfo.class_id,
956 entity_id=entity_id,
957 data=dict(
958 me_type=me_type,
959 mcast_operations_profile_pointer=mcast_oper_profile
960 )
961 )
962 )
963 self.send_omci_message(frame)
964
965 def send_set_multicast_subscriber_config_info(self,
966 entity_id,
967 max_groups=0,
968 max_mcast_bw=0,
969 bw_enforcement=0):
970 data = dict(
971 max_simultaneous_groups=max_groups,
972 max_multicast_bandwidth=max_mcast_bw,
973 bandwidth_enforcement=bw_enforcement
974 )
975 frame = OmciFrame(
976 transaction_id=self.get_tx_id(),
977 message_type=OmciSet.message_id,
978 omci_message=OmciSet(
979 entity_class=MulticastSubscriberConfigInfo.class_id,
980 entity_id=entity_id,
981 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
982 *data.keys()),
983 data=data
984 )
985 )
986 self.send_omci_message(frame)
987
988 def send_set_multicast_service_package(self,
989 entity_id,
990 row_key,
991 vid_uni,
992 max_groups,
993 max_mcast_bw,
994 mcast_oper_profile):
995 data = dict(
996 multicast_service_package_table=
997 MulticastServicePackage(
998 set_ctrl=1,
999 row_key=row_key,
1000
1001 vid_uni=vid_uni,
1002 max_simultaneous_groups=max_groups,
1003 max_multicast_bw=max_mcast_bw,
1004 mcast_operations_profile_pointer=mcast_oper_profile
1005 )
1006 )
1007 frame = OmciFrame(
1008 transaction_id=self.get_tx_id(),
1009 message_type=OmciSet.message_id,
1010 omci_message=OmciSet(
1011 entity_class=MulticastSubscriberConfigInfo.class_id,
1012 entity_id=entity_id,
1013 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1014 *data.keys()),
1015 data=data
1016 )
1017 )
1018 self.send_omci_message(frame)
1019
1020 def send_set_multicast_allowed_preview_groups_row0(self,
1021 entity_id,
1022 row_key,
1023 src_ip,
1024 vlan_id_ani,
1025 vlan_id_uni):
1026 data = dict(
1027 allowed_preview_groups_table=
1028 AllowedPreviewGroupsRow0(
1029 set_ctrl=1,
1030 row_part_id=0,
1031 row_key=row_key,
1032
1033 src_ip=src_ip,
1034 vlan_id_ani=vlan_id_ani,
1035 vlan_id_uni=vlan_id_uni
1036 )
1037 )
1038 frame = OmciFrame(
1039 transaction_id=self.get_tx_id(),
1040 message_type=OmciSet.message_id,
1041 omci_message=OmciSet(
1042 entity_class=MulticastSubscriberConfigInfo.class_id,
1043 entity_id=entity_id,
1044 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1045 *data.keys()),
1046 data=data
1047 )
1048 )
1049 self.send_omci_message(frame)
1050
1051 def send_set_multicast_allowed_preview_groups_row1(self,
1052 entity_id,
1053 row_key,
1054 dst_ip,
1055 duration,
1056 time_left):
1057 data = dict(
1058 allowed_preview_groups_table=
1059 AllowedPreviewGroupsRow1(
1060 set_ctrl=1,
1061 row_part_id=1,
1062 row_key=row_key,
1063
1064 dst_ip=dst_ip,
1065 duration=duration,
1066 time_left=time_left
1067 )
1068 )
1069 frame = OmciFrame(
1070 transaction_id=self.get_tx_id(),
1071 message_type=OmciSet.message_id,
1072 omci_message=OmciSet(
1073 entity_class=MulticastSubscriberConfigInfo.class_id,
1074 entity_id=entity_id,
1075 attributes_mask=MulticastSubscriberConfigInfo.mask_for(
1076 *data.keys()),
1077 data=data
1078 )
1079 )
1080 self.send_omci_message(frame)
1081
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001082 @inlineCallbacks
Steve Crooks3c2c7582017-01-10 15:02:26 -06001083 def wait_for_response(self):
1084 log.info('wait-for-response')
1085 try:
1086 response = yield self.incoming_messages.get()
Steve Crooks9e85ce82017-03-20 12:00:53 -04001087 log.info('got-response')
1088 # resp = OmciFrame(response)
1089 # resp.show()
Steve Crooks3c2c7582017-01-10 15:02:26 -06001090 except Exception as e:
1091 self.log.info('wait-for-response-exception', exc=str(e))
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001092
Steve Crooks3c2c7582017-01-10 15:02:26 -06001093 @inlineCallbacks
Steve Crooks9b160d72017-03-31 10:48:29 -05001094 def message_exchange(self, onu, gem, cvid):
1095 log.info('message_exchange', onu=onu, gem=gem, cvid=cvid)
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001096 # reset incoming message queue
1097 while self.incoming_messages.pending:
1098 _ = yield self.incoming_messages.get()
1099
Steve Crooks9b160d72017-03-31 10:48:29 -05001100 tcont = gem
1101
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001102 # construct message
Steve Crooks3c2c7582017-01-10 15:02:26 -06001103 # MIB Reset - OntData - 0
1104 self.send_mib_reset()
1105 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001106
Steve Crooks3c2c7582017-01-10 15:02:26 -06001107 # Create AR - GalEthernetProfile - 1
1108 self.send_create_gal_ethernet_profile(1, 48)
1109 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001110
Steve Crooks9b160d72017-03-31 10:48:29 -05001111 # TCONT config
1112 # Set AR - TCont - 32769 - (1025 or 1026)
1113 self.send_set_tcont(0x8001, tcont)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001114 yield self.wait_for_response()
Zsolt Haraszticc153aa2016-12-14 02:28:59 -08001115
Steve Crooks9b160d72017-03-31 10:48:29 -05001116 # Mapper Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001117 # Create AR - 802.1pMapperServiceProfile - 32769
1118 self.send_create_8021p_mapper_service_profile(0x8001)
1119 yield self.wait_for_response()
1120
Steve Crooks9b160d72017-03-31 10:48:29 -05001121 # MAC Bridge Service config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001122 # Create AR - MacBridgeServiceProfile - 513
1123 self.send_create_mac_bridge_service_profile(0x201)
1124 yield self.wait_for_response()
1125
Steve Crooks9b160d72017-03-31 10:48:29 -05001126 # GEM Port Network CTP config
1127 # Create AR - GemPortNetworkCtp - 257 - <gem> - 32769
1128 self.send_create_gem_port_network_ctp(0x101, gem, 0x8001, "bi-directional", 0x100)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001129 yield self.wait_for_response()
1130
1131 # Create AR - GemPortNetworkCtp - 260 - 4000 - 0
1132 self.send_create_gem_port_network_ctp(0x104, 0x0FA0, 0, "downstream", 0)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001133 yield self.wait_for_response()
1134
Steve Crooks9b160d72017-03-31 10:48:29 -05001135 # Multicast GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001136 # Create AR - MulticastGemInterworkingTp - 6 - 260
1137 self.send_create_multicast_gem_interworking_tp(0x6, 0x104)
1138 yield self.wait_for_response()
1139
Steve Crooks9b160d72017-03-31 10:48:29 -05001140 # GEM Interworking config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001141 # Create AR - GemInterworkingTp - 32770 - 257 -32769 - 1
1142 self.send_create_gem_inteworking_tp(0x8002, 0x101, 0x8001)
1143 yield self.wait_for_response()
1144
Steve Crooks9b160d72017-03-31 10:48:29 -05001145 # Mapper Service Profile config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001146 # Set AR - 802.1pMapperServiceProfile - 32769 - 32770
1147 self.send_set_8021p_mapper_service_profile(0x8001, 0x8002)
1148 yield self.wait_for_response()
1149
Steve Crooks9b160d72017-03-31 10:48:29 -05001150 # MAC Bridge Port config
Steve Crooks3c2c7582017-01-10 15:02:26 -06001151 # Create AR - MacBridgePortConfigData - 8450 - 513 - 3 - 3 - 32769
1152 self.send_create_mac_bridge_port_configuration_data(0x2102, 0x201, 3, 3, 0x8001)
1153 yield self.wait_for_response()
1154
Steve Crooks3c2c7582017-01-10 15:02:26 -06001155 # Create AR - MacBridgePortConfigData - 9000 - 513 - 6 - 6 - 6
1156 self.send_create_mac_bridge_port_configuration_data(0x2328, 0x201, 6, 6, 6)
1157 yield self.wait_for_response()
1158
Steve Crooks9b160d72017-03-31 10:48:29 -05001159 # VLAN Tagging Filter config
1160 # Create AR - VlanTaggingFilterData - 8450 - c-vid
1161 self.send_create_vlan_tagging_filter_data(0x2102, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001162 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 # Create AR - MulticastOperationsProfile
1166 self.send_create_multicast_operations_profile(0x201, 3)
1167 yield self.wait_for_response()
1168
1169 # Set AR - MulticastOperationsProfile - Dynamic Access Control List table
1170 self.send_set_multicast_operations_profile_acl_row0(0x201,
1171 'dynamic',
1172 0,
1173 0x0fa0,
1174 0x0fa0,
1175 '0.0.0.0',
1176 '224.0.0.0',
1177 '239.255.255.255')
1178 yield self.wait_for_response()
1179
Steve Crooks9b160d72017-03-31 10:48:29 -05001180 # Multicast Subscriber config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001181 # Create AR - MulticastSubscriberConfigInfo
1182 self.send_create_multicast_subscriber_config_info(0x201, 0, 0x201)
1183 yield self.wait_for_response()
1184
Steve Crooks9b160d72017-03-31 10:48:29 -05001185 # Multicast Operation Profile config
Steve Crooks9e85ce82017-03-20 12:00:53 -04001186 # Set AR - MulticastOperationsProfile - Downstream IGMP Multicast TCI
Steve Crooks9b160d72017-03-31 10:48:29 -05001187 self.send_set_multicast_operations_profile_ds_igmp_mcast_tci(0x201, 4, cvid)
Steve Crooks9e85ce82017-03-20 12:00:53 -04001188 yield self.wait_for_response()
1189
Steve Crooks9b160d72017-03-31 10:48:29 -05001190 # Port 2
1191 # Extended VLAN Tagging Operation config
1192 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1193 # TODO: add entry here for additional UNI interfaces
Steve Crooks9e85ce82017-03-20 12:00:53 -04001194 self.send_create_extended_vlan_tagging_operation_configuration_data(0x202, 2, 0x102)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001195 yield self.wait_for_response()
1196
1197 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
Steve Crooks46d64302017-03-10 15:11:06 -05001198 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x202, 0x8100, 0x8100)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001199 yield self.wait_for_response()
1200
Steve Crooks46d64302017-03-10 15:11:06 -05001201 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001202 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1203 #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 -04001204 #yield self.wait_for_response()
1205
1206 # Set AR - ExtendedVlanTaggingOperationConfigData
Steve Crooks9b160d72017-03-31 10:48:29 -05001207 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1208 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x202, 0x1000, cvid)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001209 yield self.wait_for_response()
1210
Steve Crooks9b160d72017-03-31 10:48:29 -05001211 # MAC Bridge Port config
1212 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1213 # TODO: add more entries here for other UNI ports
1214 self.send_create_mac_bridge_port_configuration_data(0x201, 0x201, 2, 1, 0x102)
1215 yield self.wait_for_response()
1216
1217 # Port 5
1218 # Extended VLAN Tagging Operation config
1219 # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102
1220 # TODO: add entry here for additional UNI interfaces
1221 self.send_create_extended_vlan_tagging_operation_configuration_data(0x205, 2, 0x105)
1222 yield self.wait_for_response()
1223
1224 # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100
1225 self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x205, 0x8100, 0x8100)
1226 yield self.wait_for_response()
1227
1228 # Set AR - ExtendedVlanTaggingOperationConfigData
1229 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid
1230 #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0, 1, 8, cvid)
1231 #yield self.wait_for_response()
1232
1233 # Set AR - ExtendedVlanTaggingOperationConfigData
1234 # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid
1235 self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x205, 0x1000, cvid)
1236 yield self.wait_for_response()
1237
1238 # MAC Bridge Port config
1239 # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102
1240 # TODO: add more entries here for other UNI ports
1241 self.send_create_mac_bridge_port_configuration_data(0x205, 0x201, 5, 1, 0x105)
Steve Crooks3c2c7582017-01-10 15:02:26 -06001242 yield self.wait_for_response()