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