alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 1 | # |
| 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 | """ |
| 18 | PMC Sierra ONU adapter |
| 19 | """ |
| 20 | |
| 21 | import structlog |
| 22 | from twisted.internet import reactor |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 23 | from twisted.internet.defer import DeferredQueue, inlineCallbacks |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 24 | from zope.interface import implementer |
| 25 | |
| 26 | from voltha.adapters.interface import IAdapterInterface |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 27 | from voltha.adapters.microsemi_olt.DeviceManager import mac_str_to_tuple |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 28 | from voltha.adapters.microsemi_olt.PAS5211 import PAS5211GetOnuAllocs, PAS5211GetOnuAllocsResponse, PAS5211GetSnInfo, \ |
| 29 | PAS5211GetSnInfoResponse, PAS5211GetOnusRange, PAS5211GetOnusRangeResponse |
| 30 | from voltha.extensions.omci.omci_frame import OmciFrame |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 31 | from voltha.protos import third_party |
| 32 | from voltha.protos.adapter_pb2 import Adapter |
| 33 | from voltha.protos.adapter_pb2 import AdapterConfig |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 34 | from voltha.protos.common_pb2 import LogLevel, ConnectStatus, AdminState, OperStatus |
| 35 | from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Port |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 36 | from voltha.protos.health_pb2 import HealthStatus |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 37 | from voltha.protos.logical_device_pb2 import LogicalPort |
| 38 | from voltha.protos.openflow_13_pb2 import OFPPF_1GB_FD, OFPPF_FIBER, ofp_port, OFPPS_LIVE |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 39 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 40 | from voltha.extensions.omci.omci_messages import OmciGet, OmciGetResponse, OmciCreate, OmciMibResetResponse, OmciSet, \ |
| 41 | OmciSetResponse, OmciCreateResponse, OmciMibReset |
Daniel Velasco | 62874be | 2017-03-14 13:28:49 +0100 | [diff] [blame] | 42 | |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 43 | _ = third_party |
| 44 | log = structlog.get_logger() |
| 45 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 46 | def sequence_generator(init): |
| 47 | num = init |
| 48 | while True: |
| 49 | yield num |
| 50 | num += 1 |
| 51 | |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 52 | @implementer(IAdapterInterface) |
| 53 | class 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 | ) |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 74 | self.incoming_messages = DeferredQueue() |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 75 | self.trangen = sequence_generator(1) |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 76 | |
| 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): |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 98 | log.info('adopt-device', device=device) |
| 99 | reactor.callLater(0.1, self._onu_device_activation, device) |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 100 | return device |
| 101 | |
| 102 | def abandon_device(self, device): |
| 103 | raise NotImplementedError() |
| 104 | |
Khen Nursimulu | 29e7550 | 2017-03-07 17:26:50 -0500 | [diff] [blame] | 105 | 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 | |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 120 | def deactivate_device(self, device): |
| 121 | raise NotImplementedError() |
| 122 | |
Sergio Slobodrian | ec864c6 | 2017-03-09 11:41:43 -0500 | [diff] [blame] | 123 | def update_pm_config(self, device, pm_configs): |
| 124 | raise NotImplementedError() |
| 125 | |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 126 | 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, |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 138 | device_id=proxy_address.device_id) |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 139 | self.incoming_messages.put(msg) |
alshabib | 8b7e0ec | 2017-03-02 15:12:29 -0800 | [diff] [blame] | 140 | |
| 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 Slobodrian | ec864c6 | 2017-03-09 11:41:43 -0500 | [diff] [blame] | 143 | egress_port_no=egress_port_no, msg_len=len(msg)) |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 144 | |
Peter Shafik | 9107f2e | 2017-05-02 15:54:39 -0400 | [diff] [blame] | 145 | def receive_inter_adapter_message(self, msg): |
| 146 | raise NotImplementedError() |
| 147 | |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 148 | @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 |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 153 | assert device.proxy_address.channel_id == 0 |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 154 | |
| 155 | device.model = 'GPON ONU' |
| 156 | device.hardware_version = 'tbd' |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 157 | device.firmware_version = 'tbd' |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 158 | device.software_version = 'tbd' |
| 159 | |
| 160 | device.connect_status = ConnectStatus.REACHABLE |
| 161 | |
| 162 | self.adapter_agent.update_device(device) |
| 163 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 164 | uni_port = Port(port_no=1000, # FIXME It becomes the alloc_id |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 165 | label="{} ONU".format('PMCS'), |
| 166 | type=Port.ETHERNET_UNI, |
| 167 | admin_state=AdminState.ENABLED, |
| 168 | oper_status=OperStatus.ACTIVE |
| 169 | ) |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 170 | self.adapter_agent.add_port(device.id, uni_port) |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 171 | |
| 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 |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 197 | port_no = device.proxy_address.channel_id # FIXME this may need to be fixed |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 198 | 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, |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 203 | hw_addr=mac_str_to_tuple(device.serial_number)[2:8], |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 204 | 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 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 217 | yield self._initialize_onu(device) |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 218 | |
| 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 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 224 | @inlineCallbacks |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 225 | def _initialize_onu(self, device): |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 226 | 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) |
alshabib | 38ba203 | 2017-03-14 11:19:58 +0100 | [diff] [blame] | 229 | # DO things to the ONU |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 230 | # |###[ OmciFrame ]### |
Daniel Velasco | 62874be | 2017-03-14 13:28:49 +0100 | [diff] [blame] | 231 | # | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 240 | # OmciMibReset |
Daniel Velasco | 62874be | 2017-03-14 13:28:49 +0100 | [diff] [blame] | 241 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 242 | 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 Velasco | 62874be | 2017-03-14 13:28:49 +0100 | [diff] [blame] | 255 | |
| 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 278 | |
| 279 | msg = PAS5211GetOnuAllocs() |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 280 | self.adapter_agent.send_proxied_message(device.proxy_address, msg) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 281 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 282 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 287 | |
| 288 | # ###[ PAS5211Dot3 ]### |
Daniel Velasco | 62874be | 2017-03-14 13:28:49 +0100 | [diff] [blame] | 289 | # 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 309 | |
| 310 | msg = PAS5211GetSnInfo(serial_number=device.serial_number) |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 311 | self.adapter_agent.send_proxied_message(device.proxy_address, msg) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 312 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 313 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 318 | |
Daniel Velasco | 62874be | 2017-03-14 13:28:49 +0100 | [diff] [blame] | 319 | # ###[ 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 339 | |
| 340 | msg = PAS5211GetOnusRange() |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 341 | self.adapter_agent.send_proxied_message(device.proxy_address, msg) |
Daniel Velasco | 62874be | 2017-03-14 13:28:49 +0100 | [diff] [blame] | 342 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 343 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 348 | |
| 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 | )) |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 367 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 371 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 372 | response = yield self.incoming_messages.get() |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 373 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 374 | if OmciSetResponse not in response: |
| 375 | log.error("Failed to set alloc id for {}".format(device.proxy_address)) |
| 376 | return |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 377 | |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 378 | # 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 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 399 | # 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 407 | msg = OmciCreate(entity_class=45, entity_id=1, |
| 408 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 409 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 418 | )) |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 419 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 423 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 424 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 429 | |
| 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 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 442 | # 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 446 | msg = OmciCreate(entity_class=47, entity_id=0, |
| 447 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 448 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 457 | )) |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 458 | |
| 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 466 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 467 | if OmciCreateResponse not in response: |
| 468 | log.error("Failed to set info for {}".format(device.proxy_address)) |
| 469 | return |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 470 | |
| 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 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 482 | # Found in method: pmc_omci_evto_create from: PMC_OFAL.c |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 483 | msg = OmciCreate(entity_class=171, entity_id=0, |
| 484 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 485 | association_type=OMCI_EX_VLAN_TAG_OCD_ASSOCIATION_TYPE_PPTP_ETH_UNI, |
| 486 | associated_me_pointer=257 |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 487 | )) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 488 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 489 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 500 | |
| 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 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 513 | # Found in method: pmc_omci_evto_set from: PMC_OFAL.c |
| 514 | msg = OmciSet(entity_class=171, entity_id=0, attributes_mask=47616, |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 515 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 516 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 522 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 523 | frame = OmciFrame(transaction_id=self.trangen.next(), |
| 524 | message_type=OmciSet.message_id, |
| 525 | omci_message=msg) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 526 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 527 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 534 | |
| 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 |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 543 | # | | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 548 | # | omci_trailer= 40 |
| 549 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 550 | # Found in method: pmc_omci_8021p_msp_me_create from: PMC_OFAL.c |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 551 | msg = OmciCreate(entity_class=130, entity_id=1, |
| 552 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 553 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 565 | )) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 566 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 567 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 578 | |
| 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 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 590 | # 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 594 | msg = OmciCreate(entity_class=130, entity_id=1, |
| 595 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 596 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 605 | )) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 606 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 607 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 618 | |
| 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 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 630 | # Found in method: pmc_omci_gem_nctp_create from: PMC_OFAL.c |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 631 | msg = OmciCreate(entity_class=268, entity_id=1, |
| 632 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 633 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 639 | )) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 640 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 641 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 652 | |
| 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 | |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 664 | # 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 671 | msg = OmciCreate(entity_class=266, entity_id=1, |
| 672 | data=dict( |
aitorzabala | d90ace9 | 2017-03-17 15:00:30 +0100 | [diff] [blame] | 673 | 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 Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 678 | )) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 679 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 680 | frame = OmciFrame(transaction_id=self.trangen.next(), |
| 681 | message_type=OmciCreate.message_id, |
| 682 | omci_message=msg) |
Daniel Velasco | f37726b | 2017-03-14 17:36:55 +0100 | [diff] [blame] | 683 | |
alshabib | 1ef322b | 2017-03-16 10:39:59 +0100 | [diff] [blame] | 684 | 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 |