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