Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1 | # |
Zsolt Haraszti | 3eb27a5 | 2017-01-03 21:56:48 -0800 | [diff] [blame] | 2 | # Copyright 2017 the original author or authors. |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 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 | """ |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 18 | Broadcom OLT/ONU adapter. |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 19 | """ |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 20 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 21 | from uuid import uuid4 |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 22 | import structlog |
Peter Shafik | d7f3377 | 2017-05-17 13:56:34 -0400 | [diff] [blame] | 23 | from twisted.internet import reactor, task |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 24 | from twisted.internet.defer import DeferredQueue, inlineCallbacks |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 25 | from zope.interface import implementer |
| 26 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 27 | from voltha.adapters.interface import IAdapterInterface |
| 28 | from voltha.core.logical_device_agent import mac_str_to_tuple |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 29 | import voltha.core.flow_decomposer as fd |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 30 | from voltha.protos import third_party |
| 31 | from voltha.protos.adapter_pb2 import Adapter |
| 32 | from voltha.protos.adapter_pb2 import AdapterConfig |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 33 | from voltha.protos.common_pb2 import LogLevel, OperStatus, ConnectStatus, \ |
| 34 | AdminState |
ggowdru | 236bd95 | 2017-06-20 20:32:55 -0700 | [diff] [blame] | 35 | from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Port, Image |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 36 | from voltha.protos.health_pb2 import HealthStatus |
| 37 | from voltha.protos.logical_device_pb2 import LogicalPort |
| 38 | from voltha.protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, OFPPF_1GB_FD |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 39 | from voltha.protos.openflow_13_pb2 import OFPXMC_OPENFLOW_BASIC, ofp_port |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 40 | from common.frameio.frameio import hexify |
| 41 | from voltha.extensions.omci.omci import * |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 42 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 43 | _ = third_party |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 44 | log = structlog.get_logger() |
| 45 | |
| 46 | |
| 47 | @implementer(IAdapterInterface) |
| 48 | class BroadcomOnuAdapter(object): |
| 49 | |
| 50 | name = 'broadcom_onu' |
| 51 | |
| 52 | supported_device_types = [ |
| 53 | DeviceType( |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 54 | id=name, |
rshetty | c26a3c3 | 2017-07-27 11:06:38 +0530 | [diff] [blame] | 55 | vendor_id='BRCM', |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 56 | adapter=name, |
| 57 | accepts_bulk_flow_update=True |
| 58 | ) |
| 59 | ] |
| 60 | |
| 61 | def __init__(self, adapter_agent, config): |
| 62 | self.adapter_agent = adapter_agent |
| 63 | self.config = config |
| 64 | self.descriptor = Adapter( |
| 65 | id=self.name, |
| 66 | vendor='Voltha project', |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 67 | version='0.4', |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 68 | config=AdapterConfig(log_level=LogLevel.INFO) |
| 69 | ) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 70 | self.devices_handlers = dict() # device_id -> BroadcomOnuHandler() |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 71 | |
Peter Shafik | 9107f2e | 2017-05-02 15:54:39 -0400 | [diff] [blame] | 72 | # register for adapter messages |
| 73 | self.adapter_agent.register_for_inter_adapter_messages() |
| 74 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 75 | def start(self): |
| 76 | log.debug('starting') |
| 77 | log.info('started') |
| 78 | |
| 79 | def stop(self): |
| 80 | log.debug('stopping') |
| 81 | log.info('stopped') |
| 82 | |
| 83 | def adapter_descriptor(self): |
| 84 | return self.descriptor |
| 85 | |
| 86 | def device_types(self): |
| 87 | return DeviceTypes(items=self.supported_device_types) |
| 88 | |
| 89 | def health(self): |
| 90 | return HealthStatus(state=HealthStatus.HealthState.HEALTHY) |
| 91 | |
| 92 | def change_master_state(self, master): |
| 93 | raise NotImplementedError() |
| 94 | |
| 95 | def adopt_device(self, device): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 96 | log.info('adopt_device', device_id=device.id) |
| 97 | self.devices_handlers[device.proxy_address.channel_id] = BroadcomOnuHandler(self, device.id) |
| 98 | reactor.callLater(0, self.devices_handlers[device.proxy_address.channel_id].activate, device) |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 99 | return device |
| 100 | |
khenaidoo | 032d330 | 2017-06-09 14:50:04 -0400 | [diff] [blame] | 101 | def reconcile_device(self, device): |
| 102 | raise NotImplementedError() |
| 103 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 104 | def abandon_device(self, device): |
| 105 | raise NotImplementedError() |
| 106 | |
Khen Nursimulu | d068d81 | 2017-03-06 11:44:18 -0500 | [diff] [blame] | 107 | def disable_device(self, device): |
| 108 | raise NotImplementedError() |
| 109 | |
| 110 | def reenable_device(self, device): |
| 111 | raise NotImplementedError() |
| 112 | |
| 113 | def reboot_device(self, device): |
| 114 | raise NotImplementedError() |
| 115 | |
Lydia Fang | 01f2e85 | 2017-06-28 17:24:58 -0700 | [diff] [blame] | 116 | def download_image(self, device, request): |
| 117 | raise NotImplementedError() |
| 118 | |
| 119 | def get_image_download_status(self, device, request): |
| 120 | raise NotImplementedError() |
| 121 | |
| 122 | def cancel_image_download(self, device, request): |
| 123 | raise NotImplementedError() |
| 124 | |
| 125 | def activate_image_update(self, device, request): |
| 126 | raise NotImplementedError() |
| 127 | |
| 128 | def revert_image_update(self, device, request): |
| 129 | raise NotImplementedError() |
| 130 | |
sathishg | 5ae8622 | 2017-06-28 15:16:29 +0530 | [diff] [blame] | 131 | def self_test_device(self, device): |
| 132 | """ |
| 133 | This is called to Self a device based on a NBI call. |
| 134 | :param device: A Voltha.Device object. |
| 135 | :return: Will return result of self test |
| 136 | """ |
| 137 | log.info('self-test-device', device=device.id) |
| 138 | raise NotImplementedError() |
| 139 | |
Khen Nursimulu | d068d81 | 2017-03-06 11:44:18 -0500 | [diff] [blame] | 140 | def delete_device(self, device): |
| 141 | raise NotImplementedError() |
| 142 | |
| 143 | def get_device_details(self, device): |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 144 | raise NotImplementedError() |
| 145 | |
Sergio Slobodrian | ec864c6 | 2017-03-09 11:41:43 -0500 | [diff] [blame] | 146 | def update_pm_config(self, device, pm_configs): |
| 147 | raise NotImplementedError() |
| 148 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 149 | def update_flows_bulk(self, device, flows, groups): |
| 150 | log.info('bulk-flow-update', device_id=device.id, |
| 151 | flows=flows, groups=groups) |
| 152 | assert len(groups.items) == 0 |
| 153 | handler = self.devices_handlers[device.proxy_address.channel_id] |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 154 | return handler.update_flow_table(device, flows.items) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 155 | |
| 156 | def update_flows_incrementally(self, device, flow_changes, group_changes): |
| 157 | raise NotImplementedError() |
| 158 | |
| 159 | def send_proxied_message(self, proxy_address, msg): |
| 160 | log.info('send-proxied-message', proxy_address=proxy_address, msg=msg) |
| 161 | |
| 162 | def receive_proxied_message(self, proxy_address, msg): |
| 163 | log.info('receive-proxied-message', proxy_address=proxy_address, |
| 164 | device_id=proxy_address.device_id, msg=hexify(msg)) |
| 165 | handler = self.devices_handlers[proxy_address.channel_id] |
| 166 | handler.receive_message(msg) |
| 167 | |
| 168 | def receive_packet_out(self, logical_device_id, egress_port_no, msg): |
| 169 | log.info('packet-out', logical_device_id=logical_device_id, |
| 170 | egress_port_no=egress_port_no, msg_len=len(msg)) |
| 171 | |
Peter Shafik | 9107f2e | 2017-05-02 15:54:39 -0400 | [diff] [blame] | 172 | def receive_inter_adapter_message(self, msg): |
| 173 | log.info('receive_inter_adapter_message', msg=msg) |
Peter Shafik | d7f3377 | 2017-05-17 13:56:34 -0400 | [diff] [blame] | 174 | proxy_address = msg['proxy_address'] |
| 175 | assert proxy_address is not None |
| 176 | |
rshetty | c26a3c3 | 2017-07-27 11:06:38 +0530 | [diff] [blame] | 177 | if proxy_address.channel_id in self.devices_handlers: |
| 178 | handler = self.devices_handlers[proxy_address.channel_id] |
| 179 | if handler is not None: |
| 180 | handler.event_messages.put(msg) |
Peter Shafik | 9107f2e | 2017-05-02 15:54:39 -0400 | [diff] [blame] | 181 | |
Nikolay Titov | 89004ec | 2017-06-19 18:22:42 -0400 | [diff] [blame] | 182 | def create_interface(self, device, data): |
rshetty | c26a3c3 | 2017-07-27 11:06:38 +0530 | [diff] [blame] | 183 | log.info('create-interface', device_id=device.id) |
| 184 | if device.proxy_address.channel_id in self.devices_handlers: |
| 185 | handler = self.devices_handlers[device.proxy_address.channel_id] |
| 186 | if handler is not None: |
| 187 | handler.create_interface(data) |
Nikolay Titov | 89004ec | 2017-06-19 18:22:42 -0400 | [diff] [blame] | 188 | |
| 189 | def update_interface(self, device, data): |
rshetty | c26a3c3 | 2017-07-27 11:06:38 +0530 | [diff] [blame] | 190 | log.info('update-interface', device_id=device.id) |
| 191 | if device.proxy_address.channel_id in self.devices_handlers: |
| 192 | handler = self.devices_handlers[device.proxy_address.channel_id] |
| 193 | if handler is not None: |
| 194 | handler.update_interface(data) |
Nikolay Titov | 89004ec | 2017-06-19 18:22:42 -0400 | [diff] [blame] | 195 | |
| 196 | def remove_interface(self, device, data): |
rshetty | c26a3c3 | 2017-07-27 11:06:38 +0530 | [diff] [blame] | 197 | log.info('remove-interface', device_id=device.id) |
| 198 | if device.proxy_address.channel_id in self.devices_handlers: |
| 199 | handler = self.devices_handlers[device.proxy_address.channel_id] |
| 200 | if handler is not None: |
| 201 | handler.remove_interface(data) |
Nikolay Titov | 89004ec | 2017-06-19 18:22:42 -0400 | [diff] [blame] | 202 | |
| 203 | def receive_onu_detect_state(self, device_id, state): |
| 204 | raise NotImplementedError() |
| 205 | |
Nikolay Titov | 176f1db | 2017-08-10 12:38:43 -0400 | [diff] [blame^] | 206 | def create_tcont(self, device, tcont_data, traffic_descriptor_data): |
| 207 | raise NotImplementedError() |
| 208 | |
| 209 | def update_tcont(self, device, tcont_data, traffic_descriptor_data): |
| 210 | raise NotImplementedError() |
| 211 | |
| 212 | def remove_tcont(self, device, tcont_data, traffic_descriptor_data): |
| 213 | raise NotImplementedError() |
| 214 | |
| 215 | def create_gemport(self, device, data): |
| 216 | raise NotImplementedError() |
| 217 | |
| 218 | def update_gemport(self, device, data): |
| 219 | raise NotImplementedError() |
| 220 | |
| 221 | def remove_gemport(self, device, data): |
| 222 | raise NotImplementedError() |
| 223 | |
| 224 | def create_multicast_gemport(self, device, data): |
| 225 | raise NotImplementedError() |
| 226 | |
| 227 | def update_multicast_gemport(self, device, data): |
| 228 | raise NotImplementedError() |
| 229 | |
| 230 | def remove_multicast_gemport(self, device, data): |
| 231 | raise NotImplementedError() |
| 232 | |
| 233 | def create_multicast_distribution_set(self, device, data): |
| 234 | raise NotImplementedError() |
| 235 | |
| 236 | def update_multicast_distribution_set(self, device, data): |
| 237 | raise NotImplementedError() |
| 238 | |
| 239 | def remove_multicast_distribution_set(self, device, data): |
| 240 | raise NotImplementedError() |
| 241 | |
| 242 | def suppress_alarm(self, filter): |
| 243 | raise NotImplementedError() |
| 244 | |
Stephane Barbarie | 980a091 | 2017-05-11 11:27:06 -0400 | [diff] [blame] | 245 | def unsuppress_alarm(self, filter): |
| 246 | raise NotImplementedError() |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 247 | |
| 248 | class BroadcomOnuHandler(object): |
| 249 | |
| 250 | def __init__(self, adapter, device_id): |
| 251 | self.adapter = adapter |
| 252 | self.adapter_agent = adapter.adapter_agent |
| 253 | self.device_id = device_id |
| 254 | self.log = structlog.get_logger(device_id=device_id) |
| 255 | self.incoming_messages = DeferredQueue() |
Peter Shafik | d7f3377 | 2017-05-17 13:56:34 -0400 | [diff] [blame] | 256 | self.event_messages = DeferredQueue() |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 257 | self.proxy_address = None |
| 258 | self.tx_id = 0 |
| 259 | |
Peter Shafik | d7f3377 | 2017-05-17 13:56:34 -0400 | [diff] [blame] | 260 | # Need to query ONU for number of supported uni ports |
| 261 | # For now, temporarily set number of ports to 1 - port #2 |
| 262 | self.uni_ports = (2,) |
| 263 | |
| 264 | # Handle received ONU event messages |
| 265 | reactor.callLater(0, self.handle_onu_events) |
| 266 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 267 | def receive_message(self, msg): |
| 268 | self.incoming_messages.put(msg) |
| 269 | |
Peter Shafik | d7f3377 | 2017-05-17 13:56:34 -0400 | [diff] [blame] | 270 | @inlineCallbacks |
| 271 | def handle_onu_events(self): |
| 272 | event_msg = yield self.event_messages.get() |
| 273 | |
| 274 | if event_msg['event'] == 'activation-completed': |
| 275 | |
| 276 | if event_msg['event_data']['activation_successful'] == True: |
| 277 | for uni in self.uni_ports: |
| 278 | port_no = self.proxy_address.channel_id + uni |
| 279 | reactor.callLater(1, |
| 280 | self.message_exchange, |
| 281 | self.proxy_address.onu_id, |
| 282 | self.proxy_address.onu_session_id, |
| 283 | port_no) |
| 284 | |
| 285 | device = self.adapter_agent.get_device(self.device_id) |
| 286 | device.oper_status = OperStatus.ACTIVE |
| 287 | self.adapter_agent.update_device(device) |
| 288 | |
| 289 | else: |
| 290 | device = self.adapter_agent.get_device(self.device_id) |
| 291 | device.oper_status = OperStatus.FAILED |
| 292 | self.adapter_agent.update_device(device) |
| 293 | |
| 294 | elif event_msg['event'] == 'deactivation-completed': |
| 295 | device = self.adapter_agent.get_device(self.device_id) |
| 296 | device.oper_status = OperStatus.DISCOVERED |
| 297 | self.adapter_agent.update_device(device) |
| 298 | |
| 299 | elif event_msg['event'] == 'ranging-completed': |
| 300 | |
| 301 | if event_msg['event_data']['ranging_successful'] == True: |
| 302 | device = self.adapter_agent.get_device(self.device_id) |
| 303 | device.oper_status = OperStatus.ACTIVATING |
| 304 | self.adapter_agent.update_device(device) |
| 305 | |
| 306 | else: |
| 307 | device = self.adapter_agent.get_device(self.device_id) |
| 308 | device.oper_status = OperStatus.FAILED |
| 309 | self.adapter_agent.update_device(device) |
| 310 | |
| 311 | # Handle next event |
| 312 | reactor.callLater(0, self.handle_onu_events) |
| 313 | |
| 314 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 315 | def activate(self, device): |
| 316 | self.log.info('activating') |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 317 | |
| 318 | # first we verify that we got parent reference and proxy info |
| 319 | assert device.parent_id |
| 320 | assert device.proxy_address.device_id |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 321 | #assert device.proxy_address.channel_id # c-vid |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 322 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 323 | # register for proxied messages right away |
| 324 | self.proxy_address = device.proxy_address |
| 325 | self.adapter_agent.register_for_proxied_messages(device.proxy_address) |
| 326 | |
Peter Shafik | 9107f2e | 2017-05-02 15:54:39 -0400 | [diff] [blame] | 327 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 328 | # populate device info |
| 329 | device.root = True |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 330 | device.vendor = 'Broadcom' |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 331 | device.model = 'n/a' |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 332 | device.hardware_version = 'to be filled' |
| 333 | device.firmware_version = 'to be filled' |
ggowdru | 236bd95 | 2017-06-20 20:32:55 -0700 | [diff] [blame] | 334 | device.images.image.extend([ |
| 335 | Image(version="to be filled") |
| 336 | ]) |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 337 | device.connect_status = ConnectStatus.REACHABLE |
| 338 | self.adapter_agent.update_device(device) |
| 339 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 340 | self.adapter_agent.add_port(device.id, Port( |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 341 | port_no=100, |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 342 | label='PON port', |
| 343 | type=Port.PON_ONU, |
| 344 | admin_state=AdminState.ENABLED, |
| 345 | oper_status=OperStatus.ACTIVE, |
| 346 | peers=[ |
| 347 | Port.PeerPort( |
| 348 | device_id=device.parent_id, |
| 349 | port_no=device.parent_port_no |
| 350 | ) |
| 351 | ] |
| 352 | )) |
| 353 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 354 | parent_device = self.adapter_agent.get_device(device.parent_id) |
| 355 | logical_device_id = parent_device.parent_id |
| 356 | assert logical_device_id |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 357 | |
Peter Shafik | d7f3377 | 2017-05-17 13:56:34 -0400 | [diff] [blame] | 358 | for uni in self.uni_ports: |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 359 | # register physical ports |
| 360 | uni_port = Port( |
| 361 | port_no=uni, |
| 362 | label='UNI facing Ethernet port '+str(uni), |
| 363 | type=Port.ETHERNET_UNI, |
| 364 | admin_state=AdminState.ENABLED, |
| 365 | oper_status=OperStatus.ACTIVE |
| 366 | ) |
| 367 | self.adapter_agent.add_port(device.id, uni_port) |
| 368 | |
| 369 | # add uni port to logical device |
| 370 | port_no = device.proxy_address.channel_id + uni |
| 371 | cap = OFPPF_1GB_FD | OFPPF_FIBER |
| 372 | self.adapter_agent.add_logical_port(logical_device_id, LogicalPort( |
| 373 | id='uni-{}'.format(port_no), |
| 374 | ofp_port=ofp_port( |
| 375 | port_no=port_no, |
| 376 | hw_addr=mac_str_to_tuple('00:00:00:%02x:%02x:%02x' % |
| 377 | (device.proxy_address.onu_id & 0xff, |
| 378 | (port_no >> 8) & 0xff, |
| 379 | port_no & 0xff)), |
| 380 | name='uni-{}'.format(port_no), |
| 381 | config=0, |
| 382 | state=OFPPS_LIVE, |
| 383 | curr=cap, |
| 384 | advertised=cap, |
| 385 | peer=cap, |
| 386 | curr_speed=OFPPF_1GB_FD, |
| 387 | max_speed=OFPPF_1GB_FD |
| 388 | ), |
| 389 | device_id=device.id, |
| 390 | device_port_no=uni_port.port_no |
| 391 | )) |
| 392 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 393 | device = self.adapter_agent.get_device(device.id) |
Peter Shafik | d7f3377 | 2017-05-17 13:56:34 -0400 | [diff] [blame] | 394 | device.oper_status = OperStatus.DISCOVERED |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 395 | self.adapter_agent.update_device(device) |
| 396 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 397 | @inlineCallbacks |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 398 | def update_flow_table(self, device, flows): |
| 399 | # |
| 400 | # We need to proxy through the OLT to get to the ONU |
| 401 | # Configuration from here should be using OMCI |
| 402 | # |
| 403 | self.log.info('bulk-flow-update', device_id=device.id, flows=flows) |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 404 | |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 405 | def is_downstream(port): |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 406 | return port == 100 # Need a better way |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 407 | |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 408 | def is_upstream(port): |
| 409 | return not is_downstream(port) |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 410 | |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 411 | for flow in flows: |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 412 | _type = None |
| 413 | _port = None |
| 414 | _vlan_vid = None |
| 415 | _udp_dst = None |
| 416 | _udp_src = None |
| 417 | _ipv4_dst = None |
| 418 | _ipv4_src = None |
| 419 | _metadata = None |
| 420 | _output = None |
| 421 | _push_tpid = None |
| 422 | _field = None |
| 423 | _set_vlan_vid = None |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 424 | try: |
| 425 | _in_port = fd.get_in_port(flow) |
| 426 | assert _in_port is not None |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 427 | |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 428 | if is_downstream(_in_port): |
| 429 | self.log.info('downstream-flow') |
| 430 | elif is_upstream(_in_port): |
| 431 | self.log.info('upstream-flow') |
| 432 | else: |
| 433 | raise Exception('port should be 1 or 2 by our convention') |
| 434 | |
| 435 | _out_port = fd.get_out_port(flow) # may be None |
| 436 | self.log.info('out-port', out_port=_out_port) |
| 437 | |
| 438 | for field in fd.get_ofb_fields(flow): |
| 439 | if field.type == fd.ETH_TYPE: |
| 440 | _type = field.eth_type |
| 441 | self.log.info('field-type-eth-type', |
| 442 | eth_type=_type) |
| 443 | |
| 444 | elif field.type == fd.IP_PROTO: |
| 445 | _proto = field.ip_proto |
| 446 | self.log.info('field-type-ip-proto', |
| 447 | ip_proto=_proto) |
| 448 | |
| 449 | elif field.type == fd.IN_PORT: |
| 450 | _port = field.port |
| 451 | self.log.info('field-type-in-port', |
| 452 | in_port=_port) |
| 453 | |
| 454 | elif field.type == fd.VLAN_VID: |
| 455 | _vlan_vid = field.vlan_vid & 0xfff |
| 456 | self.log.info('field-type-vlan-vid', |
| 457 | vlan=_vlan_vid) |
| 458 | |
| 459 | elif field.type == fd.VLAN_PCP: |
| 460 | _vlan_pcp = field.vlan_pcp |
| 461 | self.log.info('field-type-vlan-pcp', |
| 462 | pcp=_vlan_pcp) |
| 463 | |
| 464 | elif field.type == fd.UDP_DST: |
| 465 | _udp_dst = field.udp_dst |
| 466 | self.log.info('field-type-udp-dst', |
| 467 | udp_dst=_udp_dst) |
| 468 | |
| 469 | elif field.type == fd.UDP_SRC: |
| 470 | _udp_src = field.udp_src |
| 471 | self.log.info('field-type-udp-src', |
| 472 | udp_src=_udp_src) |
| 473 | |
| 474 | elif field.type == fd.IPV4_DST: |
| 475 | _ipv4_dst = field.ipv4_dst |
| 476 | self.log.info('field-type-ipv4-dst', |
| 477 | ipv4_dst=_ipv4_dst) |
| 478 | |
| 479 | elif field.type == fd.IPV4_SRC: |
| 480 | _ipv4_src = field.ipv4_src |
| 481 | self.log.info('field-type-ipv4-src', |
| 482 | ipv4_dst=_ipv4_src) |
| 483 | |
| 484 | elif field.type == fd.METADATA: |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 485 | _metadata = field.table_metadata |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 486 | self.log.info('field-type-metadata', |
| 487 | metadata=_metadata) |
| 488 | |
| 489 | else: |
| 490 | raise NotImplementedError('field.type={}'.format( |
| 491 | field.type)) |
| 492 | |
| 493 | for action in fd.get_actions(flow): |
| 494 | |
| 495 | if action.type == fd.OUTPUT: |
| 496 | _output = action.output.port |
| 497 | self.log.info('action-type-output', |
| 498 | output=_output, in_port=_in_port) |
| 499 | |
| 500 | elif action.type == fd.POP_VLAN: |
| 501 | self.log.info('action-type-pop-vlan', |
| 502 | in_port=_in_port) |
| 503 | |
| 504 | elif action.type == fd.PUSH_VLAN: |
| 505 | _push_tpid = action.push.ethertype |
| 506 | log.info('action-type-push-vlan', |
| 507 | push_tpid=_push_tpid, in_port=_in_port) |
| 508 | if action.push.ethertype != 0x8100: |
| 509 | self.log.error('unhandled-tpid', |
| 510 | ethertype=action.push.ethertype) |
| 511 | |
| 512 | elif action.type == fd.SET_FIELD: |
| 513 | _field = action.set_field.field.ofb_field |
| 514 | assert (action.set_field.field.oxm_class == |
| 515 | OFPXMC_OPENFLOW_BASIC) |
| 516 | self.log.info('action-type-set-field', |
| 517 | field=_field, in_port=_in_port) |
| 518 | if _field.type == fd.VLAN_VID: |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 519 | _set_vlan_vid = _field.vlan_vid & 0xfff |
| 520 | self.log.info('set-field-type-valn-vid', _set_vlan_vid) |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 521 | else: |
| 522 | self.log.error('unsupported-action-set-field-type', |
| 523 | field_type=_field.type) |
| 524 | else: |
| 525 | log.error('unsupported-action-type', |
| 526 | action_type=action.type, in_port=_in_port) |
| 527 | |
| 528 | # |
| 529 | # All flows created from ONU adapter should be OMCI based |
| 530 | # |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 531 | if _vlan_vid == 0: |
| 532 | # allow priority tagged packets |
| 533 | # Set AR - ExtendedVlanTaggingOperationConfigData |
| 534 | # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid |
| 535 | self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0, |
| 536 | 1, 8, _in_port) |
| 537 | yield self.wait_for_response() |
| 538 | |
| 539 | # Set AR - ExtendedVlanTaggingOperationConfigData |
| 540 | # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid |
| 541 | self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0, |
| 542 | 1, 8, _in_port) |
| 543 | yield self.wait_for_response() |
Steve Crooks | f248e18 | 2017-02-07 10:50:24 -0500 | [diff] [blame] | 544 | |
| 545 | except Exception as e: |
| 546 | log.exception('failed-to-install-flow', e=e, flow=flow) |
| 547 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 548 | def get_tx_id(self): |
| 549 | self.tx_id += 1 |
| 550 | return self.tx_id |
| 551 | |
| 552 | def send_omci_message(self, frame): |
| 553 | _frame = hexify(str(frame)) |
| 554 | self.log.info('send-omci-message-%s' % _frame) |
| 555 | device = self.adapter_agent.get_device(self.device_id) |
| 556 | try: |
| 557 | self.adapter_agent.send_proxied_message(device.proxy_address, _frame) |
| 558 | except Exception as e: |
| 559 | self.log.info('send-omci-message-exception', exc=str(e)) |
| 560 | |
| 561 | def send_get_circuit_pack(self, entity_id=0): |
| 562 | frame = OmciFrame( |
| 563 | transaction_id=self.get_tx_id(), |
| 564 | message_type=OmciGet.message_id, |
| 565 | omci_message=OmciGet( |
| 566 | entity_class=CircuitPack.class_id, |
| 567 | entity_id=entity_id, |
| 568 | attributes_mask=CircuitPack.mask_for('vendor_id') |
| 569 | ) |
| 570 | ) |
| 571 | self.send_omci_message(frame) |
| 572 | |
| 573 | def send_mib_reset(self, entity_id=0): |
| 574 | frame = OmciFrame( |
| 575 | transaction_id=self.get_tx_id(), |
| 576 | message_type=OmciMibReset.message_id, |
| 577 | omci_message=OmciMibReset( |
| 578 | entity_class=OntData.class_id, |
| 579 | entity_id=entity_id |
| 580 | ) |
| 581 | ) |
| 582 | self.send_omci_message(frame) |
| 583 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 584 | def send_create_gal_ethernet_profile(self, |
| 585 | entity_id, |
| 586 | max_gem_payload_size): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 587 | frame = OmciFrame( |
| 588 | transaction_id=self.get_tx_id(), |
| 589 | message_type=OmciCreate.message_id, |
| 590 | omci_message=OmciCreate( |
| 591 | entity_class=GalEthernetProfile.class_id, |
| 592 | entity_id=entity_id, |
| 593 | data=dict( |
| 594 | max_gem_payload_size=max_gem_payload_size |
| 595 | ) |
| 596 | ) |
| 597 | ) |
| 598 | self.send_omci_message(frame) |
| 599 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 600 | def send_set_tcont(self, |
| 601 | entity_id, |
| 602 | alloc_id): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 603 | data = dict( |
| 604 | alloc_id=alloc_id |
| 605 | ) |
| 606 | frame = OmciFrame( |
| 607 | transaction_id=self.get_tx_id(), |
| 608 | message_type=OmciSet.message_id, |
| 609 | omci_message=OmciSet( |
| 610 | entity_class=Tcont.class_id, |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 611 | entity_id=entity_id, |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 612 | attributes_mask=Tcont.mask_for(*data.keys()), |
| 613 | data=data |
| 614 | ) |
| 615 | ) |
| 616 | self.send_omci_message(frame) |
| 617 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 618 | def send_create_8021p_mapper_service_profile(self, |
| 619 | entity_id): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 620 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 621 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 622 | message_type=OmciCreate.message_id, |
| 623 | omci_message=OmciCreate( |
| 624 | entity_class=Ieee8021pMapperServiceProfile.class_id, |
| 625 | entity_id=entity_id, |
| 626 | data=dict( |
| 627 | tp_pointer=OmciNullPointer, |
| 628 | interwork_tp_pointer_for_p_bit_priority_0=OmciNullPointer, |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 629 | interwork_tp_pointer_for_p_bit_priority_1=OmciNullPointer, |
| 630 | interwork_tp_pointer_for_p_bit_priority_2=OmciNullPointer, |
| 631 | interwork_tp_pointer_for_p_bit_priority_3=OmciNullPointer, |
| 632 | interwork_tp_pointer_for_p_bit_priority_4=OmciNullPointer, |
| 633 | interwork_tp_pointer_for_p_bit_priority_5=OmciNullPointer, |
| 634 | interwork_tp_pointer_for_p_bit_priority_6=OmciNullPointer, |
| 635 | interwork_tp_pointer_for_p_bit_priority_7=OmciNullPointer |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 636 | ) |
| 637 | ) |
| 638 | ) |
| 639 | self.send_omci_message(frame) |
| 640 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 641 | def send_create_mac_bridge_service_profile(self, |
| 642 | entity_id): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 643 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 644 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 645 | message_type=OmciCreate.message_id, |
| 646 | omci_message=OmciCreate( |
| 647 | entity_class=MacBridgeServiceProfile.class_id, |
| 648 | entity_id=entity_id, |
| 649 | data=dict( |
| 650 | spanning_tree_ind=False, |
| 651 | learning_ind=True, |
| 652 | priority=0x8000, |
| 653 | max_age=20 * 256, |
| 654 | hello_time=2 * 256, |
| 655 | forward_delay=15 * 256, |
| 656 | unknown_mac_address_discard=True |
| 657 | ) |
| 658 | ) |
| 659 | ) |
| 660 | self.send_omci_message(frame) |
| 661 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 662 | def send_create_gem_port_network_ctp(self, |
| 663 | entity_id, |
| 664 | port_id, |
| 665 | tcont_id, |
| 666 | direction, |
| 667 | tm): |
| 668 | _directions = {"upstream": 1, "downstream": 2, "bi-directional": 3} |
| 669 | if _directions.has_key(direction): |
| 670 | _direction = _directions[direction] |
| 671 | else: |
| 672 | self.log.error('invalid-gem-port-direction', direction=direction) |
| 673 | raise ValueError('Invalid GEM port direction: {_dir}'.format(_dir=direction)) |
| 674 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 675 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 676 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 677 | message_type=OmciCreate.message_id, |
| 678 | omci_message=OmciCreate( |
| 679 | entity_class=GemPortNetworkCtp.class_id, |
| 680 | entity_id=entity_id, |
| 681 | data=dict( |
| 682 | port_id=port_id, |
| 683 | tcont_pointer=tcont_id, |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 684 | direction=_direction, |
| 685 | traffic_management_pointer_upstream=tm |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 686 | ) |
| 687 | ) |
| 688 | ) |
| 689 | self.send_omci_message(frame) |
| 690 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 691 | def send_create_multicast_gem_interworking_tp(self, |
| 692 | entity_id, |
| 693 | gem_port_net_ctp_id): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 694 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 695 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 696 | message_type=OmciCreate.message_id, |
| 697 | omci_message=OmciCreate( |
| 698 | entity_class=MulticastGemInterworkingTp.class_id, |
| 699 | entity_id=entity_id, |
| 700 | data=dict( |
| 701 | gem_port_network_ctp_pointer=gem_port_net_ctp_id, |
| 702 | interworking_option=0, |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 703 | service_profile_pointer=0x1 |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 704 | ) |
| 705 | ) |
| 706 | ) |
| 707 | self.send_omci_message(frame) |
| 708 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 709 | def send_create_gem_inteworking_tp(self, |
| 710 | entity_id, |
| 711 | gem_port_net_ctp_id, |
| 712 | service_profile_id): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 713 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 714 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 715 | message_type=OmciCreate.message_id, |
| 716 | omci_message=OmciCreate( |
| 717 | entity_class=GemInterworkingTp.class_id, |
| 718 | entity_id=entity_id, |
| 719 | data=dict( |
| 720 | gem_port_network_ctp_pointer=gem_port_net_ctp_id, |
| 721 | interworking_option=5, |
| 722 | service_profile_pointer=service_profile_id, |
| 723 | interworking_tp_pointer=0x0, |
| 724 | gal_profile_pointer=0x1 |
| 725 | ) |
| 726 | ) |
| 727 | ) |
| 728 | self.send_omci_message(frame) |
| 729 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 730 | def send_set_8021p_mapper_service_profile(self, |
| 731 | entity_id, |
| 732 | interwork_tp_id): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 733 | data = dict( |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 734 | interwork_tp_pointer_for_p_bit_priority_0=interwork_tp_id, |
| 735 | interwork_tp_pointer_for_p_bit_priority_1=interwork_tp_id, |
| 736 | interwork_tp_pointer_for_p_bit_priority_2=interwork_tp_id, |
| 737 | interwork_tp_pointer_for_p_bit_priority_3=interwork_tp_id, |
| 738 | interwork_tp_pointer_for_p_bit_priority_4=interwork_tp_id, |
| 739 | interwork_tp_pointer_for_p_bit_priority_5=interwork_tp_id, |
| 740 | interwork_tp_pointer_for_p_bit_priority_6=interwork_tp_id, |
| 741 | interwork_tp_pointer_for_p_bit_priority_7=interwork_tp_id |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 742 | ) |
| 743 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 744 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 745 | message_type=OmciSet.message_id, |
| 746 | omci_message=OmciSet( |
| 747 | entity_class=Ieee8021pMapperServiceProfile.class_id, |
| 748 | entity_id=entity_id, |
| 749 | attributes_mask=Ieee8021pMapperServiceProfile.mask_for( |
| 750 | *data.keys()), |
| 751 | data=data |
| 752 | ) |
| 753 | ) |
| 754 | self.send_omci_message(frame) |
| 755 | |
| 756 | def send_create_mac_bridge_port_configuration_data(self, |
| 757 | entity_id, |
| 758 | bridge_id, |
| 759 | port_id, |
| 760 | tp_type, |
| 761 | tp_id): |
| 762 | frame = OmciFrame( |
| 763 | transaction_id=self.get_tx_id(), |
| 764 | message_type=OmciCreate.message_id, |
| 765 | omci_message=OmciCreate( |
| 766 | entity_class=MacBridgePortConfigurationData.class_id, |
| 767 | entity_id=entity_id, |
| 768 | data=dict( |
| 769 | bridge_id_pointer = bridge_id, |
| 770 | port_num=port_id, |
| 771 | tp_type=tp_type, |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 772 | tp_pointer=tp_id |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 773 | ) |
| 774 | ) |
| 775 | ) |
| 776 | self.send_omci_message(frame) |
| 777 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 778 | def send_create_vlan_tagging_filter_data(self, |
| 779 | entity_id, |
| 780 | vlan_id): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 781 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 782 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 783 | message_type=OmciCreate.message_id, |
| 784 | omci_message=OmciCreate( |
| 785 | entity_class=VlanTaggingFilterData.class_id, |
| 786 | entity_id=entity_id, |
| 787 | data=dict( |
| 788 | vlan_filter_0=vlan_id, |
| 789 | forward_operation=0x10, |
| 790 | number_of_entries=1 |
| 791 | ) |
| 792 | ) |
| 793 | ) |
| 794 | self.send_omci_message(frame) |
| 795 | |
Steve Crooks | 46d6430 | 2017-03-10 15:11:06 -0500 | [diff] [blame] | 796 | def send_create_extended_vlan_tagging_operation_configuration_data(self, |
| 797 | entity_id, |
| 798 | assoc_type, |
| 799 | assoc_me): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 800 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 801 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 802 | message_type=OmciCreate.message_id, |
| 803 | omci_message=OmciCreate( |
| 804 | entity_class= |
| 805 | ExtendedVlanTaggingOperationConfigurationData.class_id, |
| 806 | entity_id=entity_id, |
| 807 | data=dict( |
Steve Crooks | 46d6430 | 2017-03-10 15:11:06 -0500 | [diff] [blame] | 808 | association_type=assoc_type, |
| 809 | associated_me_pointer=assoc_me |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 810 | ) |
| 811 | ) |
| 812 | ) |
| 813 | self.send_omci_message(frame) |
| 814 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 815 | def send_set_extended_vlan_tagging_operation_tpid_configuration_data(self, |
| 816 | entity_id, |
| 817 | input_tpid, |
| 818 | output_tpid): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 819 | data = dict( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 820 | input_tpid=input_tpid, |
| 821 | output_tpid=output_tpid, |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 822 | downstream_mode=0, # inverse of upstream |
| 823 | ) |
| 824 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 825 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 826 | message_type=OmciSet.message_id, |
| 827 | omci_message=OmciSet( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 828 | entity_class= |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 829 | ExtendedVlanTaggingOperationConfigurationData.class_id, |
| 830 | entity_id=entity_id, |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 831 | attributes_mask= |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 832 | ExtendedVlanTaggingOperationConfigurationData.mask_for( |
| 833 | *data.keys()), |
| 834 | data=data |
| 835 | ) |
| 836 | ) |
| 837 | self.send_omci_message(frame) |
| 838 | |
Steve Crooks | a9d0a7c | 2017-03-28 22:40:01 -0400 | [diff] [blame] | 839 | def send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(self, |
| 840 | entity_id, |
| 841 | filter_inner_vid, |
| 842 | treatment_inner_vid): |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 843 | data = dict( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 844 | received_frame_vlan_tagging_operation_table= |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 845 | VlanTaggingOperation( |
| 846 | filter_outer_priority=15, |
Steve Crooks | 46d6430 | 2017-03-10 15:11:06 -0500 | [diff] [blame] | 847 | filter_outer_vid=4096, |
| 848 | filter_outer_tpid_de=0, |
| 849 | |
| 850 | filter_inner_priority=15, |
| 851 | filter_inner_vid=filter_inner_vid, |
| 852 | filter_inner_tpid_de=0, |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 853 | filter_ether_type=0, |
Steve Crooks | 46d6430 | 2017-03-10 15:11:06 -0500 | [diff] [blame] | 854 | |
| 855 | treatment_tags_to_remove=0, |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 856 | treatment_outer_priority=15, |
Steve Crooks | 46d6430 | 2017-03-10 15:11:06 -0500 | [diff] [blame] | 857 | treatment_outer_vid=0, |
| 858 | treatment_outer_tpid_de=0, |
| 859 | |
| 860 | treatment_inner_priority=0, |
| 861 | treatment_inner_vid=treatment_inner_vid, |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 862 | treatment_inner_tpid_de=4 |
| 863 | ) |
| 864 | ) |
| 865 | frame = OmciFrame( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 866 | transaction_id=self.get_tx_id(), |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 867 | message_type=OmciSet.message_id, |
| 868 | omci_message=OmciSet( |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 869 | entity_class= |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 870 | ExtendedVlanTaggingOperationConfigurationData.class_id, |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 871 | entity_id=entity_id, |
| 872 | attributes_mask= |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 873 | ExtendedVlanTaggingOperationConfigurationData.mask_for( |
| 874 | *data.keys()), |
| 875 | data=data |
| 876 | ) |
| 877 | ) |
| 878 | self.send_omci_message(frame) |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 879 | |
Steve Crooks | a9d0a7c | 2017-03-28 22:40:01 -0400 | [diff] [blame] | 880 | def send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(self, |
| 881 | entity_id, |
| 882 | filter_inner_priority, |
| 883 | filter_inner_vid, |
| 884 | filter_inner_tpid_de, |
| 885 | treatment_tags_to_remove, |
| 886 | treatment_inner_priority, |
| 887 | treatment_inner_vid): |
| 888 | data = dict( |
| 889 | received_frame_vlan_tagging_operation_table= |
| 890 | VlanTaggingOperation( |
| 891 | filter_outer_priority=15, |
| 892 | filter_outer_vid=4096, |
| 893 | filter_outer_tpid_de=0, |
| 894 | |
| 895 | filter_inner_priority=filter_inner_priority, |
| 896 | filter_inner_vid=filter_inner_vid, |
| 897 | filter_inner_tpid_de=filter_inner_tpid_de, |
| 898 | filter_ether_type=0, |
| 899 | |
| 900 | treatment_tags_to_remove=treatment_tags_to_remove, |
| 901 | treatment_outer_priority=15, |
| 902 | treatment_outer_vid=0, |
| 903 | treatment_outer_tpid_de=0, |
| 904 | |
| 905 | treatment_inner_priority=treatment_inner_priority, |
| 906 | treatment_inner_vid=treatment_inner_vid, |
| 907 | treatment_inner_tpid_de=4 |
| 908 | ) |
| 909 | ) |
| 910 | frame = OmciFrame( |
| 911 | transaction_id=self.get_tx_id(), |
| 912 | message_type=OmciSet.message_id, |
| 913 | omci_message=OmciSet( |
| 914 | entity_class= |
| 915 | ExtendedVlanTaggingOperationConfigurationData.class_id, |
| 916 | entity_id=entity_id, |
| 917 | attributes_mask= |
| 918 | ExtendedVlanTaggingOperationConfigurationData.mask_for( |
| 919 | *data.keys()), |
| 920 | data=data |
| 921 | ) |
| 922 | ) |
| 923 | self.send_omci_message(frame) |
| 924 | |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 925 | def send_create_multicast_operations_profile(self, |
| 926 | entity_id, |
| 927 | igmp_ver): |
| 928 | frame = OmciFrame( |
| 929 | transaction_id=self.get_tx_id(), |
| 930 | message_type=OmciCreate.message_id, |
| 931 | omci_message=OmciCreate( |
| 932 | entity_class= |
| 933 | MulticastOperationsProfile.class_id, |
| 934 | entity_id=entity_id, |
| 935 | data=dict( |
| 936 | igmp_version=igmp_ver, |
| 937 | igmp_function=0, |
| 938 | immediate_leave=0 |
| 939 | ) |
| 940 | ) |
| 941 | ) |
| 942 | self.send_omci_message(frame) |
| 943 | |
| 944 | def send_set_multicast_operations_profile_acl_row0(self, |
| 945 | entity_id, |
| 946 | acl_table, |
| 947 | row_key, |
| 948 | gem_port, |
| 949 | vlan, |
| 950 | src_ip, |
| 951 | dst_ip_start, |
| 952 | dst_ip_end): |
| 953 | row0 = AccessControlRow0( |
| 954 | set_ctrl=1, |
| 955 | row_part_id=0, |
| 956 | test=0, |
| 957 | row_key=row_key, |
| 958 | gem_port_id=gem_port, |
| 959 | vlan_id=vlan, |
| 960 | src_ip=src_ip, |
| 961 | dst_ip_start=dst_ip_start, |
| 962 | dst_ip_end=dst_ip_end, |
| 963 | ipm_group_bw=0 |
| 964 | ) |
| 965 | |
| 966 | if acl_table == 'dynamic': |
| 967 | data = dict( |
| 968 | dynamic_access_control_list_table=row0 |
| 969 | ) |
| 970 | else: |
| 971 | data = dict( |
| 972 | static_access_control_list_table=row0 |
| 973 | ) |
| 974 | |
| 975 | frame = OmciFrame( |
| 976 | transaction_id=self.get_tx_id(), |
| 977 | message_type=OmciSet.message_id, |
| 978 | omci_message=OmciSet( |
| 979 | entity_class=MulticastOperationsProfile.class_id, |
| 980 | entity_id=entity_id, |
| 981 | attributes_mask=MulticastOperationsProfile.mask_for( |
| 982 | *data.keys()), |
| 983 | data=data |
| 984 | ) |
| 985 | ) |
| 986 | self.send_omci_message(frame) |
| 987 | |
| 988 | def send_set_multicast_operations_profile_ds_igmp_mcast_tci(self, |
| 989 | entity_id, |
| 990 | ctrl_type, |
| 991 | tci): |
| 992 | data = dict( |
| 993 | ds_igmp_mcast_tci= |
| 994 | DownstreamIgmpMulticastTci( |
| 995 | ctrl_type=ctrl_type, |
| 996 | tci=tci |
| 997 | ) |
| 998 | ) |
| 999 | frame = OmciFrame( |
| 1000 | transaction_id=self.get_tx_id(), |
| 1001 | message_type=OmciSet.message_id, |
| 1002 | omci_message=OmciSet( |
| 1003 | entity_class=MulticastOperationsProfile.class_id, |
| 1004 | entity_id=entity_id, |
| 1005 | attributes_mask=MulticastOperationsProfile.mask_for( |
| 1006 | *data.keys()), |
| 1007 | data=data |
| 1008 | ) |
| 1009 | ) |
| 1010 | self.send_omci_message(frame) |
| 1011 | |
| 1012 | def send_create_multicast_subscriber_config_info(self, |
| 1013 | entity_id, |
| 1014 | me_type, |
| 1015 | mcast_oper_profile): |
| 1016 | frame = OmciFrame( |
| 1017 | transaction_id=self.get_tx_id(), |
| 1018 | message_type=OmciCreate.message_id, |
| 1019 | omci_message=OmciCreate( |
| 1020 | entity_class= |
| 1021 | MulticastSubscriberConfigInfo.class_id, |
| 1022 | entity_id=entity_id, |
| 1023 | data=dict( |
| 1024 | me_type=me_type, |
| 1025 | mcast_operations_profile_pointer=mcast_oper_profile |
| 1026 | ) |
| 1027 | ) |
| 1028 | ) |
| 1029 | self.send_omci_message(frame) |
| 1030 | |
| 1031 | def send_set_multicast_subscriber_config_info(self, |
| 1032 | entity_id, |
| 1033 | max_groups=0, |
| 1034 | max_mcast_bw=0, |
| 1035 | bw_enforcement=0): |
| 1036 | data = dict( |
| 1037 | max_simultaneous_groups=max_groups, |
| 1038 | max_multicast_bandwidth=max_mcast_bw, |
| 1039 | bandwidth_enforcement=bw_enforcement |
| 1040 | ) |
| 1041 | frame = OmciFrame( |
| 1042 | transaction_id=self.get_tx_id(), |
| 1043 | message_type=OmciSet.message_id, |
| 1044 | omci_message=OmciSet( |
| 1045 | entity_class=MulticastSubscriberConfigInfo.class_id, |
| 1046 | entity_id=entity_id, |
| 1047 | attributes_mask=MulticastSubscriberConfigInfo.mask_for( |
| 1048 | *data.keys()), |
| 1049 | data=data |
| 1050 | ) |
| 1051 | ) |
| 1052 | self.send_omci_message(frame) |
| 1053 | |
| 1054 | def send_set_multicast_service_package(self, |
| 1055 | entity_id, |
| 1056 | row_key, |
| 1057 | vid_uni, |
| 1058 | max_groups, |
| 1059 | max_mcast_bw, |
| 1060 | mcast_oper_profile): |
| 1061 | data = dict( |
| 1062 | multicast_service_package_table= |
| 1063 | MulticastServicePackage( |
| 1064 | set_ctrl=1, |
| 1065 | row_key=row_key, |
| 1066 | |
| 1067 | vid_uni=vid_uni, |
| 1068 | max_simultaneous_groups=max_groups, |
| 1069 | max_multicast_bw=max_mcast_bw, |
| 1070 | mcast_operations_profile_pointer=mcast_oper_profile |
| 1071 | ) |
| 1072 | ) |
| 1073 | frame = OmciFrame( |
| 1074 | transaction_id=self.get_tx_id(), |
| 1075 | message_type=OmciSet.message_id, |
| 1076 | omci_message=OmciSet( |
| 1077 | entity_class=MulticastSubscriberConfigInfo.class_id, |
| 1078 | entity_id=entity_id, |
| 1079 | attributes_mask=MulticastSubscriberConfigInfo.mask_for( |
| 1080 | *data.keys()), |
| 1081 | data=data |
| 1082 | ) |
| 1083 | ) |
| 1084 | self.send_omci_message(frame) |
| 1085 | |
| 1086 | def send_set_multicast_allowed_preview_groups_row0(self, |
| 1087 | entity_id, |
| 1088 | row_key, |
| 1089 | src_ip, |
| 1090 | vlan_id_ani, |
| 1091 | vlan_id_uni): |
| 1092 | data = dict( |
| 1093 | allowed_preview_groups_table= |
| 1094 | AllowedPreviewGroupsRow0( |
| 1095 | set_ctrl=1, |
| 1096 | row_part_id=0, |
| 1097 | row_key=row_key, |
| 1098 | |
| 1099 | src_ip=src_ip, |
| 1100 | vlan_id_ani=vlan_id_ani, |
| 1101 | vlan_id_uni=vlan_id_uni |
| 1102 | ) |
| 1103 | ) |
| 1104 | frame = OmciFrame( |
| 1105 | transaction_id=self.get_tx_id(), |
| 1106 | message_type=OmciSet.message_id, |
| 1107 | omci_message=OmciSet( |
| 1108 | entity_class=MulticastSubscriberConfigInfo.class_id, |
| 1109 | entity_id=entity_id, |
| 1110 | attributes_mask=MulticastSubscriberConfigInfo.mask_for( |
| 1111 | *data.keys()), |
| 1112 | data=data |
| 1113 | ) |
| 1114 | ) |
| 1115 | self.send_omci_message(frame) |
| 1116 | |
| 1117 | def send_set_multicast_allowed_preview_groups_row1(self, |
| 1118 | entity_id, |
| 1119 | row_key, |
| 1120 | dst_ip, |
| 1121 | duration, |
| 1122 | time_left): |
| 1123 | data = dict( |
| 1124 | allowed_preview_groups_table= |
| 1125 | AllowedPreviewGroupsRow1( |
| 1126 | set_ctrl=1, |
| 1127 | row_part_id=1, |
| 1128 | row_key=row_key, |
| 1129 | |
| 1130 | dst_ip=dst_ip, |
| 1131 | duration=duration, |
| 1132 | time_left=time_left |
| 1133 | ) |
| 1134 | ) |
| 1135 | frame = OmciFrame( |
| 1136 | transaction_id=self.get_tx_id(), |
| 1137 | message_type=OmciSet.message_id, |
| 1138 | omci_message=OmciSet( |
| 1139 | entity_class=MulticastSubscriberConfigInfo.class_id, |
| 1140 | entity_id=entity_id, |
| 1141 | attributes_mask=MulticastSubscriberConfigInfo.mask_for( |
| 1142 | *data.keys()), |
| 1143 | data=data |
| 1144 | ) |
| 1145 | ) |
| 1146 | self.send_omci_message(frame) |
| 1147 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1148 | @inlineCallbacks |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1149 | def wait_for_response(self): |
| 1150 | log.info('wait-for-response') |
| 1151 | try: |
| 1152 | response = yield self.incoming_messages.get() |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 1153 | log.info('got-response') |
| 1154 | # resp = OmciFrame(response) |
| 1155 | # resp.show() |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1156 | except Exception as e: |
| 1157 | self.log.info('wait-for-response-exception', exc=str(e)) |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1158 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1159 | @inlineCallbacks |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1160 | def message_exchange(self, onu, gem, cvid): |
| 1161 | log.info('message_exchange', onu=onu, gem=gem, cvid=cvid) |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1162 | # reset incoming message queue |
| 1163 | while self.incoming_messages.pending: |
| 1164 | _ = yield self.incoming_messages.get() |
| 1165 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1166 | tcont = gem |
| 1167 | |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1168 | # construct message |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1169 | # MIB Reset - OntData - 0 |
| 1170 | self.send_mib_reset() |
| 1171 | yield self.wait_for_response() |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1172 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1173 | # Create AR - GalEthernetProfile - 1 |
| 1174 | self.send_create_gal_ethernet_profile(1, 48) |
| 1175 | yield self.wait_for_response() |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1176 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1177 | # TCONT config |
| 1178 | # Set AR - TCont - 32769 - (1025 or 1026) |
| 1179 | self.send_set_tcont(0x8001, tcont) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1180 | yield self.wait_for_response() |
Zsolt Haraszti | cc153aa | 2016-12-14 02:28:59 -0800 | [diff] [blame] | 1181 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1182 | # Mapper Service config |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1183 | # Create AR - 802.1pMapperServiceProfile - 32769 |
| 1184 | self.send_create_8021p_mapper_service_profile(0x8001) |
| 1185 | yield self.wait_for_response() |
| 1186 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1187 | # MAC Bridge Service config |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1188 | # Create AR - MacBridgeServiceProfile - 513 |
| 1189 | self.send_create_mac_bridge_service_profile(0x201) |
| 1190 | yield self.wait_for_response() |
| 1191 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1192 | # GEM Port Network CTP config |
| 1193 | # Create AR - GemPortNetworkCtp - 257 - <gem> - 32769 |
| 1194 | self.send_create_gem_port_network_ctp(0x101, gem, 0x8001, "bi-directional", 0x100) |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 1195 | yield self.wait_for_response() |
| 1196 | |
| 1197 | # Create AR - GemPortNetworkCtp - 260 - 4000 - 0 |
| 1198 | self.send_create_gem_port_network_ctp(0x104, 0x0FA0, 0, "downstream", 0) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1199 | yield self.wait_for_response() |
| 1200 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1201 | # Multicast GEM Interworking config |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1202 | # Create AR - MulticastGemInterworkingTp - 6 - 260 |
| 1203 | self.send_create_multicast_gem_interworking_tp(0x6, 0x104) |
| 1204 | yield self.wait_for_response() |
| 1205 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1206 | # GEM Interworking config |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1207 | # Create AR - GemInterworkingTp - 32770 - 257 -32769 - 1 |
| 1208 | self.send_create_gem_inteworking_tp(0x8002, 0x101, 0x8001) |
| 1209 | yield self.wait_for_response() |
| 1210 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1211 | # Mapper Service Profile config |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1212 | # Set AR - 802.1pMapperServiceProfile - 32769 - 32770 |
| 1213 | self.send_set_8021p_mapper_service_profile(0x8001, 0x8002) |
| 1214 | yield self.wait_for_response() |
| 1215 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1216 | # MAC Bridge Port config |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1217 | # Create AR - MacBridgePortConfigData - 8450 - 513 - 3 - 3 - 32769 |
| 1218 | self.send_create_mac_bridge_port_configuration_data(0x2102, 0x201, 3, 3, 0x8001) |
| 1219 | yield self.wait_for_response() |
| 1220 | |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1221 | # Create AR - MacBridgePortConfigData - 9000 - 513 - 6 - 6 - 6 |
| 1222 | self.send_create_mac_bridge_port_configuration_data(0x2328, 0x201, 6, 6, 6) |
| 1223 | yield self.wait_for_response() |
| 1224 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1225 | # VLAN Tagging Filter config |
| 1226 | # Create AR - VlanTaggingFilterData - 8450 - c-vid |
| 1227 | self.send_create_vlan_tagging_filter_data(0x2102, cvid) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1228 | yield self.wait_for_response() |
| 1229 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1230 | # Multicast Operation Profile config |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 1231 | # Create AR - MulticastOperationsProfile |
| 1232 | self.send_create_multicast_operations_profile(0x201, 3) |
| 1233 | yield self.wait_for_response() |
| 1234 | |
| 1235 | # Set AR - MulticastOperationsProfile - Dynamic Access Control List table |
| 1236 | self.send_set_multicast_operations_profile_acl_row0(0x201, |
| 1237 | 'dynamic', |
| 1238 | 0, |
| 1239 | 0x0fa0, |
| 1240 | 0x0fa0, |
| 1241 | '0.0.0.0', |
| 1242 | '224.0.0.0', |
| 1243 | '239.255.255.255') |
| 1244 | yield self.wait_for_response() |
| 1245 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1246 | # Multicast Subscriber config |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 1247 | # Create AR - MulticastSubscriberConfigInfo |
| 1248 | self.send_create_multicast_subscriber_config_info(0x201, 0, 0x201) |
| 1249 | yield self.wait_for_response() |
| 1250 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1251 | # Multicast Operation Profile config |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 1252 | # Set AR - MulticastOperationsProfile - Downstream IGMP Multicast TCI |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1253 | self.send_set_multicast_operations_profile_ds_igmp_mcast_tci(0x201, 4, cvid) |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 1254 | yield self.wait_for_response() |
| 1255 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1256 | # Port 2 |
| 1257 | # Extended VLAN Tagging Operation config |
| 1258 | # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102 |
| 1259 | # TODO: add entry here for additional UNI interfaces |
Steve Crooks | 9e85ce8 | 2017-03-20 12:00:53 -0400 | [diff] [blame] | 1260 | self.send_create_extended_vlan_tagging_operation_configuration_data(0x202, 2, 0x102) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1261 | yield self.wait_for_response() |
| 1262 | |
| 1263 | # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100 |
Steve Crooks | 46d6430 | 2017-03-10 15:11:06 -0500 | [diff] [blame] | 1264 | self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x202, 0x8100, 0x8100) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1265 | yield self.wait_for_response() |
| 1266 | |
Steve Crooks | 46d6430 | 2017-03-10 15:11:06 -0500 | [diff] [blame] | 1267 | # Set AR - ExtendedVlanTaggingOperationConfigData |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1268 | # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid |
| 1269 | #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x202, 8, 0, 0, 1, 8, cvid) |
Steve Crooks | a9d0a7c | 2017-03-28 22:40:01 -0400 | [diff] [blame] | 1270 | #yield self.wait_for_response() |
| 1271 | |
| 1272 | # Set AR - ExtendedVlanTaggingOperationConfigData |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1273 | # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid |
| 1274 | self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x202, 0x1000, cvid) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1275 | yield self.wait_for_response() |
| 1276 | |
Steve Crooks | 9b160d7 | 2017-03-31 10:48:29 -0500 | [diff] [blame] | 1277 | # MAC Bridge Port config |
| 1278 | # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102 |
| 1279 | # TODO: add more entries here for other UNI ports |
| 1280 | self.send_create_mac_bridge_port_configuration_data(0x201, 0x201, 2, 1, 0x102) |
| 1281 | yield self.wait_for_response() |
| 1282 | |
| 1283 | # Port 5 |
| 1284 | # Extended VLAN Tagging Operation config |
| 1285 | # Create AR - ExtendedVlanTaggingOperationConfigData - 514 - 2 - 0x102 |
| 1286 | # TODO: add entry here for additional UNI interfaces |
| 1287 | self.send_create_extended_vlan_tagging_operation_configuration_data(0x205, 2, 0x105) |
| 1288 | yield self.wait_for_response() |
| 1289 | |
| 1290 | # Set AR - ExtendedVlanTaggingOperationConfigData - 514 - 8100 - 8100 |
| 1291 | self.send_set_extended_vlan_tagging_operation_tpid_configuration_data(0x205, 0x8100, 0x8100) |
| 1292 | yield self.wait_for_response() |
| 1293 | |
| 1294 | # Set AR - ExtendedVlanTaggingOperationConfigData |
| 1295 | # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to priority tagged pkts - c-vid |
| 1296 | #self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x205, 8, 0, 0, 1, 8, cvid) |
| 1297 | #yield self.wait_for_response() |
| 1298 | |
| 1299 | # Set AR - ExtendedVlanTaggingOperationConfigData |
| 1300 | # 514 - RxVlanTaggingOperationTable - add VLAN <cvid> to untagged pkts - c-vid |
| 1301 | self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x205, 0x1000, cvid) |
| 1302 | yield self.wait_for_response() |
| 1303 | |
| 1304 | # MAC Bridge Port config |
| 1305 | # Create AR - MacBridgePortConfigData - 513 - 513 - 1 - 1 - 0x102 |
| 1306 | # TODO: add more entries here for other UNI ports |
| 1307 | self.send_create_mac_bridge_port_configuration_data(0x205, 0x201, 5, 1, 0x105) |
Steve Crooks | 3c2c758 | 2017-01-10 15:02:26 -0600 | [diff] [blame] | 1308 | yield self.wait_for_response() |
rshetty | c26a3c3 | 2017-07-27 11:06:38 +0530 | [diff] [blame] | 1309 | |
| 1310 | def create_interface(self, data): |
| 1311 | self.log.info('Not Implemented yet') |
| 1312 | return; |
| 1313 | |
| 1314 | def update_interface(self, data): |
| 1315 | self.log.info('Not Implemented yet') |
| 1316 | return; |
| 1317 | |
| 1318 | def remove_interface(self, data): |
| 1319 | self.log.info('Not Implemented yet') |
| 1320 | return; |