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