blob: 50aada149c91a87fe7680f40e2dee2a5ab00136f [file] [log] [blame]
alshabib8b7e0ec2017-03-02 15:12:29 -08001#
2# Copyright 2017 the original author or authors.
3#
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"""
18PMC Sierra ONU adapter
19"""
20
21import structlog
22from twisted.internet import reactor
alshabib38ba2032017-03-14 11:19:58 +010023from twisted.internet.defer import DeferredQueue, inlineCallbacks
alshabib8b7e0ec2017-03-02 15:12:29 -080024from zope.interface import implementer
25
26from voltha.adapters.interface import IAdapterInterface
alshabib38ba2032017-03-14 11:19:58 +010027from voltha.adapters.microsemi_olt.DeviceManager import mac_str_to_tuple
alshabib1ef322b2017-03-16 10:39:59 +010028from voltha.adapters.microsemi_olt.PAS5211 import PAS5211GetOnuAllocs, PAS5211GetOnuAllocsResponse, PAS5211GetSnInfo, \
29 PAS5211GetSnInfoResponse, PAS5211GetOnusRange, PAS5211GetOnusRangeResponse
30from voltha.extensions.omci.omci_frame import OmciFrame
alshabib8b7e0ec2017-03-02 15:12:29 -080031from voltha.protos import third_party
32from voltha.protos.adapter_pb2 import Adapter
33from voltha.protos.adapter_pb2 import AdapterConfig
alshabib38ba2032017-03-14 11:19:58 +010034from voltha.protos.common_pb2 import LogLevel, ConnectStatus, AdminState, OperStatus
35from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Port
alshabib8b7e0ec2017-03-02 15:12:29 -080036from voltha.protos.health_pb2 import HealthStatus
alshabib38ba2032017-03-14 11:19:58 +010037from voltha.protos.logical_device_pb2 import LogicalPort
38from voltha.protos.openflow_13_pb2 import OFPPF_1GB_FD, OFPPF_FIBER, ofp_port, OFPPS_LIVE
alshabib8b7e0ec2017-03-02 15:12:29 -080039
alshabib1ef322b2017-03-16 10:39:59 +010040from voltha.extensions.omci.omci_messages import OmciGet, OmciGetResponse, OmciCreate, OmciMibResetResponse, OmciSet, \
41 OmciSetResponse, OmciCreateResponse, OmciMibReset
Daniel Velasco62874be2017-03-14 13:28:49 +010042
alshabib8b7e0ec2017-03-02 15:12:29 -080043_ = third_party
44log = structlog.get_logger()
45
alshabib1ef322b2017-03-16 10:39:59 +010046def sequence_generator(init):
47 num = init
48 while True:
49 yield num
50 num += 1
51
alshabib8b7e0ec2017-03-02 15:12:29 -080052@implementer(IAdapterInterface)
53class PmcsOnu(object):
54
55 name = 'pmcs_onu'
56
57 supported_device_types = [
58 DeviceType(
59 id=name,
60 adapter=name,
61 accepts_bulk_flow_update=True
62 )
63 ]
64
65 def __init__(self, adapter_agent, config):
66 self.adapter_agent = adapter_agent
67 self.config = config
68 self.descriptor = Adapter(
69 id=self.name,
70 vendor='PMCS',
71 version='0.1',
72 config=AdapterConfig(log_level=LogLevel.INFO)
73 )
alshabib38ba2032017-03-14 11:19:58 +010074 self.incoming_messages = DeferredQueue()
alshabib1ef322b2017-03-16 10:39:59 +010075 self.trangen = sequence_generator(1)
alshabib8b7e0ec2017-03-02 15:12:29 -080076
77 def start(self):
78 log.debug('starting')
79 log.info('started')
80
81 def stop(self):
82 log.debug('stopping')
83 log.info('stopped')
84
85 def adapter_descriptor(self):
86 return self.descriptor
87
88 def device_types(self):
89 return DeviceTypes(items=self.supported_device_types)
90
91 def health(self):
92 return HealthStatus(state=HealthStatus.HealthState.HEALTHY)
93
94 def change_master_state(self, master):
95 raise NotImplementedError()
96
97 def adopt_device(self, device):
alshabib38ba2032017-03-14 11:19:58 +010098 log.info('adopt-device', device=device)
99 reactor.callLater(0.1, self._onu_device_activation, device)
alshabib8b7e0ec2017-03-02 15:12:29 -0800100 return device
101
102 def abandon_device(self, device):
103 raise NotImplementedError()
104
Khen Nursimulu29e75502017-03-07 17:26:50 -0500105 def disable_device(self, device):
106 raise NotImplementedError()
107
108 def reenable_device(self, device):
109 raise NotImplementedError()
110
111 def reboot_device(self, device):
112 raise NotImplementedError()
113
114 def delete_device(self, device):
115 raise NotImplementedError()
116
117 def get_device_details(self, device):
118 raise NotImplementedError()
119
alshabib8b7e0ec2017-03-02 15:12:29 -0800120 def deactivate_device(self, device):
121 raise NotImplementedError()
122
Sergio Slobodrianec864c62017-03-09 11:41:43 -0500123 def update_pm_config(self, device, pm_configs):
124 raise NotImplementedError()
125
alshabib8b7e0ec2017-03-02 15:12:29 -0800126 def update_flows_bulk(self, device, flows, groups):
127 log.info('bulk-flow-update', device_id=device.id,
128 flows=flows, groups=groups)
129
130 def update_flows_incrementally(self, device, flow_changes, group_changes):
131 raise NotImplementedError()
132
133 def send_proxied_message(self, proxy_address, msg):
134 log.info('send-proxied-message', proxy_address=proxy_address, msg=msg)
135
136 def receive_proxied_message(self, proxy_address, msg):
137 log.info('receive-proxied-message', proxy_address=proxy_address,
alshabib1ef322b2017-03-16 10:39:59 +0100138 device_id=proxy_address.device_id)
alshabib38ba2032017-03-14 11:19:58 +0100139 self.incoming_messages.put(msg)
alshabib8b7e0ec2017-03-02 15:12:29 -0800140
141 def receive_packet_out(self, logical_device_id, egress_port_no, msg):
142 log.info('packet-out', logical_device_id=logical_device_id,
Sergio Slobodrianec864c62017-03-09 11:41:43 -0500143 egress_port_no=egress_port_no, msg_len=len(msg))
alshabib38ba2032017-03-14 11:19:58 +0100144
Peter Shafik9107f2e2017-05-02 15:54:39 -0400145 def receive_inter_adapter_message(self, msg):
146 raise NotImplementedError()
147
alshabib38ba2032017-03-14 11:19:58 +0100148 @inlineCallbacks
149 def _onu_device_activation(self, device):
150 # first we verify that we got parent reference and proxy info
151 assert device.parent_id
152 assert device.proxy_address.device_id
alshabib1ef322b2017-03-16 10:39:59 +0100153 assert device.proxy_address.channel_id == 0
alshabib38ba2032017-03-14 11:19:58 +0100154
155 device.model = 'GPON ONU'
156 device.hardware_version = 'tbd'
alshabib1ef322b2017-03-16 10:39:59 +0100157 device.firmware_version = 'tbd'
alshabib38ba2032017-03-14 11:19:58 +0100158 device.software_version = 'tbd'
159
160 device.connect_status = ConnectStatus.REACHABLE
161
162 self.adapter_agent.update_device(device)
163
alshabib1ef322b2017-03-16 10:39:59 +0100164 uni_port = Port(port_no=1000, # FIXME It becomes the alloc_id
alshabib38ba2032017-03-14 11:19:58 +0100165 label="{} ONU".format('PMCS'),
166 type=Port.ETHERNET_UNI,
167 admin_state=AdminState.ENABLED,
168 oper_status=OperStatus.ACTIVE
169 )
alshabib1ef322b2017-03-16 10:39:59 +0100170 self.adapter_agent.add_port(device.id, uni_port)
alshabib38ba2032017-03-14 11:19:58 +0100171
172 pon_port = Port(
173 port_no=1,
174 label='PON port',
175 type=Port.PON_ONU,
176 admin_state=AdminState.ENABLED,
177 oper_status=OperStatus.ACTIVE,
178 peers=[
179 Port.PeerPort(
180 device_id=device.parent_id,
181 port_no=device.parent_port_no
182 )
183 ]
184 )
185
186 self.adapter_agent.add_port(device.id, pon_port)
187
188 # obtain logical device id
189 parent_device = self.adapter_agent.get_device(device.parent_id)
190 logical_device_id = parent_device.parent_id
191 assert logical_device_id
192
193 # we are going to use the proxy_address.channel_id as unique number
194 # and name for the virtual ports, as this is guaranteed to be unique
195 # in the context of the OLT port, so it is also unique in the context
196 # of the logical device
alshabib1ef322b2017-03-16 10:39:59 +0100197 port_no = device.proxy_address.channel_id # FIXME this may need to be fixed
alshabib38ba2032017-03-14 11:19:58 +0100198 cap = OFPPF_1GB_FD | OFPPF_FIBER
199 self.adapter_agent.add_logical_port(logical_device_id, LogicalPort(
200 id=str(port_no),
201 ofp_port=ofp_port(
202 port_no=port_no,
alshabib1ef322b2017-03-16 10:39:59 +0100203 hw_addr=mac_str_to_tuple(device.serial_number)[2:8],
alshabib38ba2032017-03-14 11:19:58 +0100204 name='uni-{}'.format(port_no),
205 config=0,
206 state=OFPPS_LIVE,
207 curr=cap,
208 advertised=cap,
209 peer=cap,
210 curr_speed=OFPPF_1GB_FD,
211 max_speed=OFPPF_1GB_FD
212 ),
213 device_id=device.id,
214 device_port_no=uni_port.port_no
215 ))
216
alshabib1ef322b2017-03-16 10:39:59 +0100217 yield self._initialize_onu(device)
alshabib38ba2032017-03-14 11:19:58 +0100218
219 # and finally update to "ACTIVE"
220 device = self.adapter_agent.get_device(device.id)
221 device.oper_status = OperStatus.ACTIVE
222 self.adapter_agent.update_device(device)
223
alshabib1ef322b2017-03-16 10:39:59 +0100224 @inlineCallbacks
alshabib38ba2032017-03-14 11:19:58 +0100225 def _initialize_onu(self, device):
alshabib1ef322b2017-03-16 10:39:59 +0100226 device = self.adapter_agent.get_device(device.id)
227 self.adapter_agent.register_for_proxied_messages(device.proxy_address)
228 log.debug("INIT", device=device)
alshabib38ba2032017-03-14 11:19:58 +0100229 # DO things to the ONU
alshabib1ef322b2017-03-16 10:39:59 +0100230 # |###[ OmciFrame ]###
Daniel Velasco62874be2017-03-14 13:28:49 +0100231 # | transaction_id= 1
232 # | message_type= 79
233 # | omci = 10
234 # | \omci_message\
235 # | |###[ OmciMibReset ]###
236 # | | entity_class= 2
237 # | | entity_id = 0
238 # | omci_trailer= 40
239
Daniel Velascof37726b2017-03-14 17:36:55 +0100240 # OmciMibReset
Daniel Velasco62874be2017-03-14 13:28:49 +0100241
alshabib1ef322b2017-03-16 10:39:59 +0100242 msg = OmciMibReset(entity_class = 2, entity_id = 0)
243 frame = OmciFrame(transaction_id=self.trangen.next(),
244 message_type=OmciMibReset.message_id,
245 omci_message=msg)
246
247
248 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
249
250 response = yield self.incoming_messages.get()
251
252 if OmciMibResetResponse not in response:
253 log.error("Failed to perform a MIB reset for {}".format(device.proxy_address))
254 return
Daniel Velasco62874be2017-03-14 13:28:49 +0100255
256 # ###[ PAS5211Dot3 ]###
257 # dst = 00:0c:d5:00:01:00
258 # src = 90:e2:ba:82:f9:77
259 # len = 22
260 # ###[ PAS5211FrameHeader ]###
261 # part = 1
262 # total_parts= 1
263 # size = 16
264 # magic_number= 0x1234abcd
265 # ###[ PAS5211MsgHeader ]###
266 # sequence_number= 51
267 # opcode = 0x3009
268 # event_type= 0
269 # channel_id= 0
270 # onu_id = 0
271 # onu_session_id= 1
272 # ###[ PAS5211GetOnuAllocs ]###
273 # nothing = 0
274 # ###[ Raw ]###
275 # load = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
276
277
Daniel Velascof37726b2017-03-14 17:36:55 +0100278
279 msg = PAS5211GetOnuAllocs()
alshabib1ef322b2017-03-16 10:39:59 +0100280 self.adapter_agent.send_proxied_message(device.proxy_address, msg)
Daniel Velascof37726b2017-03-14 17:36:55 +0100281
alshabib1ef322b2017-03-16 10:39:59 +0100282 response = yield self.incoming_messages.get()
283
284 if PAS5211GetOnuAllocsResponse not in response:
285 log.error("Failed to get alloc ids for {}".format(device.proxy_address))
286 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100287
288 # ###[ PAS5211Dot3 ]###
Daniel Velasco62874be2017-03-14 13:28:49 +0100289 # dst = 00:0c:d5:00:01:00
290 # src = 90:e2:ba:82:f9:77
291 # len = 30
292 # ###[ PAS5211FrameHeader ]###
293 # part = 1
294 # total_parts= 1
295 # size = 24
296 # magic_number= 0x1234abcd
297 # ###[ PAS5211MsgHeader ]###
298 # sequence_number= 52
299 # opcode = 0x3007
300 # event_type= 0
301 # channel_id= 0
302 # onu_id = -1
303 # onu_session_id= -1
304 # ###[ PAS5211GetSnInfo ]###
305 # serial_number= 'PMCS\xd5b\x84\xac'
306 # ###[ Raw ]###
307 # load = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
308
Daniel Velascof37726b2017-03-14 17:36:55 +0100309
310 msg = PAS5211GetSnInfo(serial_number=device.serial_number)
alshabib1ef322b2017-03-16 10:39:59 +0100311 self.adapter_agent.send_proxied_message(device.proxy_address, msg)
Daniel Velascof37726b2017-03-14 17:36:55 +0100312
alshabib1ef322b2017-03-16 10:39:59 +0100313 response = yield self.incoming_messages.get()
314
315 if PAS5211GetSnInfoResponse not in response:
316 log.error("Failed to get serial number info for {}".format(device.proxy_address))
317 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100318
Daniel Velasco62874be2017-03-14 13:28:49 +0100319 # ###[ PAS5211Dot3 ]###
320 # dst = 00:0c:d5:00:01:00
321 # src = 90:e2:ba:82:f9:77
322 # len = 22
323 # ###[ PAS5211FrameHeader ]###
324 # part = 1
325 # total_parts= 1
326 # size = 16
327 # magic_number= 0x1234abcd
328 # ###[ PAS5211MsgHeader ]###
329 # sequence_number= 53
330 # opcode = 0x3074
331 # event_type= 0
332 # channel_id= 0
333 # onu_id = -1
334 # onu_session_id= -1
335 # ###[ PAS5211GetOnusRange ]###
336 # nothing = 0
337 # ###[ Raw ]###
338 # load = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Daniel Velascof37726b2017-03-14 17:36:55 +0100339
340 msg = PAS5211GetOnusRange()
alshabib1ef322b2017-03-16 10:39:59 +0100341 self.adapter_agent.send_proxied_message(device.proxy_address, msg)
Daniel Velasco62874be2017-03-14 13:28:49 +0100342
alshabib1ef322b2017-03-16 10:39:59 +0100343 response = yield self.incoming_messages.get()
344
345 if PAS5211GetOnusRangeResponse not in response:
346 log.error("Failed to get ONU Range for {}".format(device.proxy_address))
347 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100348
349 # | ###[ OmciFrame ]###
350 # | transaction_id = 2
351 # | message_type = 72
352 # | omci = 10
353 # | \omci_message \
354 # | | ###[ OmciSet ]###
355 # | | entity_class = 262
356 # | | entity_id = 32769
357 # | | attributes_mask = 32768
358 # | | data = {'alloc_id': 1000}
359 # | omci_trailer = 40
360
361 # OmciSet
362 # TODO: maskdata
363 msg = OmciSet(entity_class = 262, entity_id = 32769, attributes_mask = 32768,
364 data=dict(
365 alloc_id = 1000
366 ))
alshabib1ef322b2017-03-16 10:39:59 +0100367 frame = OmciFrame(transaction_id=self.trangen.next(),
368 message_type=OmciSet.message_id,
369 omci_message=msg)
370 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
Daniel Velascof37726b2017-03-14 17:36:55 +0100371
alshabib1ef322b2017-03-16 10:39:59 +0100372 response = yield self.incoming_messages.get()
Daniel Velascof37726b2017-03-14 17:36:55 +0100373
alshabib1ef322b2017-03-16 10:39:59 +0100374 if OmciSetResponse not in response:
375 log.error("Failed to set alloc id for {}".format(device.proxy_address))
376 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100377
Daniel Velascof37726b2017-03-14 17:36:55 +0100378 # length = 44
379 # port_type = 0
380 # port_id = 0
381 # management_frame = 1
382 # \frame \
383 # | ###[ OmciFrame ]###
384 # | transaction_id = 3
385 # | message_type = 68
386 # | omci = 10
387 # | \omci_message \
388 # | | ###[ OmciCreate ]###
389 # | | entity_class = 45
390 # | | entity_id = 1
391 # | | data = {'max_age': 5120, 'hello_time': 512, 'priority': 32768, 'port_bridging_ind': 0,
392 # 'spanning_tree_ind': 0, 'unknown_mac_address_discard': 0, 'mac_learning_depth': 128,
393 # 'learning_ind': 0, 'forward_delay': 3840}
394 # | | ###[ Raw ]###
395 # | | load = '\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
396 # | omci_trailer = 40
397
398
aitorzabalad90ace92017-03-17 15:00:30 +0100399 # Found in method: pmc_omci_mac_bridge_sp_me_create from: PMC_OFAL.c
400 # Params
401 # - priority: The bridge priority set on the LAN card
402 # - max_age: The maximum age for an entry in the spanning tree listing
403 # - hello_time: The time interval between hello packets
404 # - forward_delay: The time that the bridge on the Ethernet card in the ONT retains a packet before forwarding it
405 # - unknown_mac_address_discard: frames with unknown destination addresses will be forwarded to all allowed ports
406
Daniel Velascof37726b2017-03-14 17:36:55 +0100407 msg = OmciCreate(entity_class=45, entity_id=1,
408 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100409 max_age=5120,
410 hello_time=512,
411 priority=32768,
412 port_bridging_ind=PON_FALSE,
413 spanning_tree_ind=PON_FALSE,
414 unknown_mac_address_discard=0,
415 mac_learning_depth=128,
416 learning_ind=PON_FALSE,
417 forward_delay=3840
Daniel Velascof37726b2017-03-14 17:36:55 +0100418 ))
alshabib1ef322b2017-03-16 10:39:59 +0100419 frame = OmciFrame(transaction_id=self.trangen.next(),
420 message_type=OmciCreate.message_id,
421 omci_message=msg)
422 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
Daniel Velascof37726b2017-03-14 17:36:55 +0100423
alshabib1ef322b2017-03-16 10:39:59 +0100424 response = yield self.incoming_messages.get()
425
426 if OmciCreateResponse not in response:
427 log.error("Failed to set parameter on {}".format(device.proxy_address))
428 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100429
430
431 # |###[ OmciFrame ]###
432 # | transaction_id= 4
433 # | message_type= 68
434 # | omci = 10
435 # | \omci_message\
436 # | |###[ OmciCreate ]###
437 # | | entity_class= 47
438 # | | entity_id = 0
439 # | | data = {'tp_pointer': 257, 'encapsulation_methods': 1, 'port_num': 0, 'port_priority': 10, 'tp_type': 1, 'port_path_cost': 100, 'port_spanning_tree_in': 0, 'lan_fcs_ind': 0, 'bridge_id_pointer': 1}
440 # | omci_trailer= 40
441
aitorzabalad90ace92017-03-17 15:00:30 +0100442 # Found in method: pmc_omci_mac_bridge_pcd_me_create from: PMC_OFAL.c
443 # Params
444 # - port_path_cost: The cost contribution of the port to the path cost towards the spanning tree root bridge
445 # - bridge_id_pointer: MAC bridge controlling the port
Daniel Velascof37726b2017-03-14 17:36:55 +0100446 msg = OmciCreate(entity_class=47, entity_id=0,
447 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100448 tp_pointer=257,
449 encapsulation_methods=OMCI_MAC_BRIDGE_PCD_ENCAP_METHOD_LLC,
450 port_num=0,
451 port_priority=10,
452 tp_type=1,
453 port_path_cost=100,
454 port_spanning_tree_in=PON_FALSE,
455 lan_fcs_ind=OMCI_MAC_BRIDGE_PCD_LANFCS_FORWARDED,
456 bridge_id_pointer=1
Daniel Velascof37726b2017-03-14 17:36:55 +0100457 ))
alshabib1ef322b2017-03-16 10:39:59 +0100458
459 frame = OmciFrame(transaction_id=self.trangen.next(),
460 message_type=OmciCreate.message_id,
461 omci_message=msg)
462
463 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
464
465 response = yield self.incoming_messages.get()
Daniel Velascof37726b2017-03-14 17:36:55 +0100466
alshabib1ef322b2017-03-16 10:39:59 +0100467 if OmciCreateResponse not in response:
468 log.error("Failed to set info for {}".format(device.proxy_address))
469 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100470
471 # |###[ OmciFrame ]###
472 # | transaction_id= 5
473 # | message_type= 68
474 # | omci = 10
475 # | \omci_message\
476 # | |###[ OmciCreate ]###
477 # | | entity_class= 171
478 # | | entity_id = 0
479 # | | data = {'association_type': 2, 'associated_me_pointer': 257}
480 # | omci_trailer= 40
481
aitorzabalad90ace92017-03-17 15:00:30 +0100482 # Found in method: pmc_omci_evto_create from: PMC_OFAL.c
Daniel Velascof37726b2017-03-14 17:36:55 +0100483 msg = OmciCreate(entity_class=171, entity_id=0,
484 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100485 association_type=OMCI_EX_VLAN_TAG_OCD_ASSOCIATION_TYPE_PPTP_ETH_UNI,
486 associated_me_pointer=257
Daniel Velascof37726b2017-03-14 17:36:55 +0100487 ))
Daniel Velascof37726b2017-03-14 17:36:55 +0100488
alshabib1ef322b2017-03-16 10:39:59 +0100489 frame = OmciFrame(transaction_id=self.trangen.next(),
490 message_type=OmciCreate.message_id,
491 omci_message=msg)
492
493 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
494
495 response = yield self.incoming_messages.get()
496
497 if OmciCreateResponse not in response:
498 log.error("Failed to set association info for {}".format(device.proxy_address))
499 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100500
501 # |###[ OmciFrame ]###
502 # | transaction_id= 6
503 # | message_type= 72
504 # | omci = 10
505 # | \omci_message\
506 # | |###[ OmciSet ]###
507 # | | entity_class= 171
508 # | | entity_id = 0
509 # | | attributes_mask= 47616
510 # | | data = {'association_type': 2, 'input_tpid': 33024, 'associated_me_pointer': 257, 'downstream_mode': 0, 'output_tpid': 33024}
511 # | omci_trailer= 40
512
aitorzabalad90ace92017-03-17 15:00:30 +0100513 # Found in method: pmc_omci_evto_set from: PMC_OFAL.c
514 msg = OmciSet(entity_class=171, entity_id=0, attributes_mask=47616,
Daniel Velascof37726b2017-03-14 17:36:55 +0100515 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100516 association_type=OMCI_EX_VLAN_TAG_OCD_ASSOCIATION_TYPE_PPTP_ETH_UNI,
517 input_tpid=33024,
518 associated_me_pointer=257,
519 downstream_mode=OMCI_EX_VLAN_TAG_OCD_DS_MODE_US_INVERSE,
520 output_tpid=33024
521 ))
Daniel Velascof37726b2017-03-14 17:36:55 +0100522
alshabib1ef322b2017-03-16 10:39:59 +0100523 frame = OmciFrame(transaction_id=self.trangen.next(),
524 message_type=OmciSet.message_id,
525 omci_message=msg)
Daniel Velascof37726b2017-03-14 17:36:55 +0100526
alshabib1ef322b2017-03-16 10:39:59 +0100527 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
528
529 response = yield self.incoming_messages.get()
530
531 if OmciSetResponse not in response:
532 log.error("Failed to set association tpid info for {}".format(device.proxy_address))
533 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100534
535 # |###[ OmciFrame ]###
536 # | transaction_id= 7
537 # | message_type= 68
538 # | omci = 10
539 # | \omci_message\
540 # | |###[ OmciCreate ]###
541 # | | entity_class= 130
542 # | | entity_id = 1
alshabib1ef322b2017-03-16 10:39:59 +0100543 # | | data = {'tp_pointer': 65535, 'unmarked_frame_option': 1, 'interwork_tp_pointer_for_p_bit_priority_6': 65535,
544 # 'interwork_tp_pointer_for_p_bit_priority_7': 65535, 'interwork_tp_pointer_for_p_bit_priority_4': 65535,
545 # 'interwork_tp_pointer_for_p_bit_priority_5': 65535, 'interwork_tp_pointer_for_p_bit_priority_2': 65535,
546 # 'interwork_tp_pointer_for_p_bit_priority_3': 65535, 'interwork_tp_pointer_for_p_bit_priority_0': 65535,
547 # 'interwork_tp_pointer_for_p_bit_priority_1': 65535, 'tp_type': 0, 'default_p_bit_marking': 0}
Daniel Velascof37726b2017-03-14 17:36:55 +0100548 # | omci_trailer= 40
549
aitorzabalad90ace92017-03-17 15:00:30 +0100550 # Found in method: pmc_omci_8021p_msp_me_create from: PMC_OFAL.c
Daniel Velascof37726b2017-03-14 17:36:55 +0100551 msg = OmciCreate(entity_class=130, entity_id=1,
552 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100553 tp_pointer=65535,
554 unmarked_frame_option=OMCI_8021P_MSP_UNMARKED_FRAME_TAG_FRAME,
555 interwork_tp_pointer_for_p_bit_priority_6=65535,
556 interwork_tp_pointer_for_p_bit_priority_7=65535,
557 interwork_tp_pointer_for_p_bit_priority_4=65535,
558 interwork_tp_pointer_for_p_bit_priority_5=65535,
559 interwork_tp_pointer_for_p_bit_priority_2=65535,
560 interwork_tp_pointer_for_p_bit_priority_3=65535,
561 interwork_tp_pointer_for_p_bit_priority_0=65535,
562 interwork_tp_pointer_for_p_bit_priority_1=65535,
563 tp_type=OMCI_8021P_MSP_TP_TYPE_NULL,
564 default_p_bit_marking=0
Daniel Velascof37726b2017-03-14 17:36:55 +0100565 ))
Daniel Velascof37726b2017-03-14 17:36:55 +0100566
alshabib1ef322b2017-03-16 10:39:59 +0100567 frame = OmciFrame(transaction_id=self.trangen.next(),
568 message_type=OmciCreate.message_id,
569 omci_message=msg)
570
571 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
572
573 response = yield self.incoming_messages.get()
574
575 if OmciCreateResponse not in response:
576 log.error("Failed to set interwork info for {}".format(device.proxy_address))
577 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100578
579 # |###[ OmciFrame ]###
580 # | transaction_id= 8
581 # | message_type= 68
582 # | omci = 10
583 # | \omci_message\
584 # | |###[ OmciCreate ]###
585 # | | entity_class= 130
586 # | | entity_id = 1
587 # | | data = {'tp_pointer': 1, 'encapsulation_methods': 1, 'port_num': 1, 'port_priority': 3, 'tp_type': 5, 'port_path_cost': 32, 'port_spanning_tree_in': 1, 'lan_fcs_ind': 0, 'bridge_id_pointer': 1}
588 # | omci_trailer= 40
589
aitorzabalad90ace92017-03-17 15:00:30 +0100590 # Found in method: pmc_omci_mac_bridge_pcd_me_create from: PMC_OFAL.c
591 # Params
592 # - port_path_cost: The cost contribution of the port to the path cost towards the spanning tree root bridge
593 # - bridge_id_pointer: MAC bridge controlling the port
Daniel Velascof37726b2017-03-14 17:36:55 +0100594 msg = OmciCreate(entity_class=130, entity_id=1,
595 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100596 tp_pointer=1,
597 encapsulation_methods=OMCI_MAC_BRIDGE_PCD_ENCAP_METHOD_LLC,
598 port_num=1,
599 port_priority=3,
600 tp_type=5,
601 port_path_cost=32,
602 port_spanning_tree_in=PON_TRUE,
603 lan_fcs_ind=OMCI_MAC_BRIDGE_PCD_LANFCS_FORWARDED,
604 bridge_id_pointer=1
Daniel Velascof37726b2017-03-14 17:36:55 +0100605 ))
Daniel Velascof37726b2017-03-14 17:36:55 +0100606
alshabib1ef322b2017-03-16 10:39:59 +0100607 frame = OmciFrame(transaction_id=self.trangen.next(),
608 message_type=OmciCreate.message_id,
609 omci_message=msg)
610
611 self.adapter_agent.send_proxied_message(self, device.proxy_address, frame)
612
613 response = yield self.incoming_messages.get()
614
615 if OmciCreateResponse not in response:
616 log.error("Failed to set encap info for {}".format(device.proxy_address))
617 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100618
619 # |###[ OmciFrame ]###
620 # | transaction_id= 9
621 # | message_type= 68
622 # | omci = 10
623 # | \omci_message\
624 # | |###[ OmciCreate ]###
625 # | | entity_class= 268
626 # | | entity_id = 1
627 # | | data = {'priority_queue_pointer_downstream': 0, 'direction': 3, 'tcont_pointer': 32769, 'traffic_descriptor_profile_pointer': 0, 'traffic_management_pointer_upstream': 4, 'port_id': 1000}
628 # | omci_trailer= 40
629
aitorzabalad90ace92017-03-17 15:00:30 +0100630 # Found in method: pmc_omci_gem_nctp_create from: PMC_OFAL.c
Daniel Velascof37726b2017-03-14 17:36:55 +0100631 msg = OmciCreate(entity_class=268, entity_id=1,
632 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100633 priority_queue_pointer_downstream=0,
634 direction=GEM_DIR_BIDIRECT,
635 tcont_pointer=32769,
636 traffic_descriptor_profile_pointer=0,
637 traffic_management_pointer_upstream=4,
638 port_id=1000
Daniel Velascof37726b2017-03-14 17:36:55 +0100639 ))
Daniel Velascof37726b2017-03-14 17:36:55 +0100640
alshabib1ef322b2017-03-16 10:39:59 +0100641 frame = OmciFrame(transaction_id=self.trangen.next(),
642 message_type=OmciCreate.message_id,
643 omci_message=msg)
644
645 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
646
647 response = yield self.incoming_messages.get()
648
649 if OmciCreateResponse not in response:
650 log.error("Failed to priority queue for {}".format(device.proxy_address))
651 return
Daniel Velascof37726b2017-03-14 17:36:55 +0100652
653 # |###[ OmciFrame ]###
654 # | transaction_id= 10
655 # | message_type= 68
656 # | omci = 10
657 # | \omci_message\
658 # | |###[ OmciCreate ]###
659 # | | entity_class= 266
660 # | | entity_id = 1
661 # | | data = {'gem_port_network_ctp_pointer': 1, 'gal_profile_pointer': 0, 'service_profile_pointer': 1, 'interworking_option': 5, 'interworking_tp_pointer': 0}
662 # | omci_trailer= 40
663
aitorzabalad90ace92017-03-17 15:00:30 +0100664 # Found in method: pmc_omci_gem_iwtp_me_create from: PMC_OFAL.c
665 # Params
666 # - gem_port_network_ctp_pointer: An instance identifier of the GEM Port Network CTP that is associated with this GEM Interworking Termination Point
667 # - service_profile_pointer: The service profile type and a pointer to the instance of a service profile
668 # - interworking_tp_pointer: Used for in the case of Circuit Emulation Services and 802.1p mapper service
669 # - gal_profile_pointer: A pointer to an instance of the GAL Profile
670
Daniel Velascof37726b2017-03-14 17:36:55 +0100671 msg = OmciCreate(entity_class=266, entity_id=1,
672 data=dict(
aitorzabalad90ace92017-03-17 15:00:30 +0100673 gem_port_network_ctp_pointer=1,
674 gal_profile_pointer=0,
675 service_profile_pointer=1,
676 interworking_option=OMCI_GEM_IWTP_IW_OPT_8021P_MAPPER,
677 interworking_tp_pointer=0
Daniel Velascof37726b2017-03-14 17:36:55 +0100678 ))
Daniel Velascof37726b2017-03-14 17:36:55 +0100679
alshabib1ef322b2017-03-16 10:39:59 +0100680 frame = OmciFrame(transaction_id=self.trangen.next(),
681 message_type=OmciCreate.message_id,
682 omci_message=msg)
Daniel Velascof37726b2017-03-14 17:36:55 +0100683
alshabib1ef322b2017-03-16 10:39:59 +0100684 self.adapter_agent.send_proxied_message(device.proxy_address, frame)
685
686 response = yield self.incoming_messages.get()
687
688 if OmciCreateResponse not in response:
689 log.error("Failed to set gem info for {}".format(device.proxy_address))
690 return