Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 1 | ''' |
| 2 | OFTests for functionality needed from the OLT. |
| 3 | ''' |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 4 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 5 | import logging |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 6 | from __builtin__ import xrange |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 7 | from oftest import config |
| 8 | import oftest.base_tests as base_tests |
| 9 | import oftest.packet as scapy |
| 10 | |
| 11 | import ofp |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 12 | import time |
Admin | ef7a055 | 2015-12-09 15:21:45 -0800 | [diff] [blame] | 13 | import copy |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 14 | |
| 15 | from oftest.testutils import * |
| 16 | |
Zsolt Haraszti | ecf8945 | 2016-03-01 22:38:13 -0800 | [diff] [blame^] | 17 | from IGMP import IGMPv3, IGMPv3gr, IGMP_TYPE_V3_MEMBERSHIP_REPORT, IGMP_V3_GR_TYPE_INCLUDE |
| 18 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 19 | |
| 20 | # These parameters can be altered from the command line using the -t or --test-params= options. |
| 21 | # Example: -t 'onu_port=129;olt_port=288;device_type=pmc' |
| 22 | # |
| 23 | onu_port = test_param_get("onu_port", 130) |
| 24 | onu_port2 = test_param_get("onu_port2", 131) |
| 25 | olt_port = test_param_get("olt_port", 258) |
| 26 | device_type = test_param_get("device_type", "normal") # options: "normal", "pmc", "cpqd" |
| 27 | logging.info("device_type: %s" % device_type) |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 28 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 29 | |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 30 | def double_vlan_udp_packet(pktlen=100, |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 31 | eth_dst='00:01:02:03:04:05', |
| 32 | eth_src='00:06:07:08:09:0a', |
| 33 | dl_vlan_enable=False, |
| 34 | c_vlan_vid=0, |
| 35 | c_vlan_pcp=0, |
| 36 | s_vlan_vid=0, |
| 37 | s_vlan_pcp=0, |
| 38 | ip_src='192.168.0.1', |
| 39 | ip_dst='192.168.0.2', |
| 40 | ip_tos=0, |
| 41 | ip_ttl=64, |
| 42 | udp_sport=1234, |
| 43 | udp_dport=80, |
| 44 | ip_ihl=None, |
| 45 | ip_options=False, |
| 46 | eth_type=0x8100 |
| 47 | ): |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 48 | """ |
| 49 | Return a double vlan tagged dataplane UDP packet |
| 50 | Supports a few parameters: |
| 51 | @param len Length of packet in bytes w/o CRC |
| 52 | @param eth_dst Destination MAC |
| 53 | @param eth_src Source MAC |
| 54 | @param dl_vlan_enable True if the packet is with vlan, False otherwise |
| 55 | @param c_vlan_vid CVLAN ID |
| 56 | @param c_vlan_pcp CVLAN priority |
| 57 | @param s_vlan_vid SVLAN ID |
| 58 | @param s_vlan_pcp SVLAN priority |
| 59 | @param ip_src IP source |
| 60 | @param ip_dst IP destination |
| 61 | @param ip_tos IP ToS |
| 62 | @param ip_ttl IP TTL |
| 63 | @param udp_dport UDP destination port |
| 64 | @param udp_sport UDP source port |
| 65 | |
| 66 | Generates a simple UDP packet. Users shouldn't assume anything about |
| 67 | this packet other than that it is a valid ethernet/IP/UDP frame. |
| 68 | """ |
| 69 | |
| 70 | if MINSIZE > pktlen: |
| 71 | pktlen = MINSIZE |
| 72 | |
| 73 | # Note Dot1Q.id is really CFI |
| 74 | if (dl_vlan_enable): |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 75 | pkt = scapy.Ether(dst=eth_dst, src=eth_src, type=eth_type) / \ |
| 76 | scapy.Dot1Q(prio=s_vlan_pcp, vlan=s_vlan_vid) / \ |
| 77 | scapy.Dot1Q(prio=c_vlan_pcp, vlan=c_vlan_vid) / \ |
| 78 | scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl) / \ |
| 79 | scapy.UDP(sport=udp_sport, dport=udp_dport) |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 80 | else: |
| 81 | if not ip_options: |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 82 | pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \ |
| 83 | scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \ |
| 84 | scapy.UDP(sport=udp_sport, dport=udp_dport) |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 85 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 86 | else: |
| 87 | pkt = scapy.Ether(dst=eth_dst, src=eth_src) / \ |
| 88 | scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl, options=ip_options) / \ |
| 89 | scapy.UDP(sport=udp_sport, dport=udp_dport) |
| 90 | |
| 91 | pkt = pkt / ("D" * (pktlen - len(pkt))) |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 92 | |
| 93 | return pkt |
| 94 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 95 | def testPacketIn(self, match, parsed_pkt): |
| 96 | delete_all_flows(self.controller) |
| 97 | |
| 98 | pkt = str(parsed_pkt) |
| 99 | |
Admin | ef7a055 | 2015-12-09 15:21:45 -0800 | [diff] [blame] | 100 | for of_port in config["port_map"]: |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 101 | m = copy.deepcopy(match) |
Admin | ef7a055 | 2015-12-09 15:21:45 -0800 | [diff] [blame] | 102 | m.oxm_list.append(ofp.oxm.in_port(of_port)) |
| 103 | request = ofp.message.flow_add( |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 104 | table_id=test_param_get("table", 0), |
| 105 | cookie=42, |
| 106 | match=m, |
| 107 | instructions=[ |
| 108 | ofp.instruction.apply_actions( |
| 109 | actions=[ |
| 110 | ofp.action.output( |
| 111 | port=ofp.OFPP_CONTROLLER, |
| 112 | max_len=ofp.OFPCML_NO_BUFFER)])], |
| 113 | buffer_id=ofp.OFP_NO_BUFFER, |
| 114 | priority=1000) |
Admin | ef7a055 | 2015-12-09 15:21:45 -0800 | [diff] [blame] | 115 | logging.info("Inserting flow sending matching packets to controller") |
| 116 | self.controller.message_send(request) |
| 117 | do_barrier(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 118 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 119 | for of_port in config["port_map"]: |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 120 | logging.info("PacketInExact test, port %d", of_port) |
| 121 | self.dataplane.send(of_port, pkt) |
| 122 | verify_packet_in(self, pkt, of_port, ofp.OFPR_ACTION) |
| 123 | verify_packets(self, pkt, []) |
| 124 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 125 | |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 126 | def buildIgmp(payload): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 127 | pkt = pkt = IGMPv3.fixup(scapy.Ether() / scapy.IP() / payload) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 128 | if len(pkt) < 60: |
| 129 | pad_len = 60 - len(pkt) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 130 | pad = scapy.scapy.layers.l2.Padding() |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 131 | pad.load = '\x00' * pad_len |
| 132 | pkt = pkt / pad |
| 133 | return pkt |
| 134 | |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 135 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 136 | class EapolPacketIn(base_tests.SimpleDataPlane): |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 137 | """Verify packet-ins are sent for EAPOL packets """ |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 138 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 139 | def runTest(self): |
| 140 | logging.info("Running EAPOL Packet In test") |
| 141 | |
| 142 | match = ofp.match() |
| 143 | match.oxm_list.append(ofp.oxm.eth_type(0x888e)) |
| 144 | # Use ethertype 0x888e and multicast destination MAC address |
| 145 | pkt = simple_eth_packet(pktlen=60, eth_dst='01:00:5E:7F:FF:FF', eth_type=0x888e) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 146 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 147 | testPacketIn(self, match, pkt) |
| 148 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 149 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 150 | class ARPPacketIn(base_tests.SimpleDataPlane): |
| 151 | """Verify packet-ins are sent for ARP packets """ |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 152 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 153 | def runTest(self): |
| 154 | logging.info("Running ARP Packet In test") |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 155 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 156 | match = ofp.match() |
| 157 | match.oxm_list.append(ofp.oxm.eth_type(0x0806)) |
| 158 | |
| 159 | # Use ethertype 0x0806 |
| 160 | pkt = simple_eth_packet(eth_type=0x0806) |
| 161 | |
| 162 | testPacketIn(self, match, pkt) |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 163 | |
| 164 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 165 | class IGMPPacketIn(base_tests.SimpleDataPlane): |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 166 | """Verify packet-ins are sent for IGMP packets """ |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 167 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 168 | def runTest(self): |
| 169 | logging.info("Running IGMP Packet In test") |
| 170 | |
| 171 | match = ofp.match() |
| 172 | match.oxm_list.append(ofp.oxm.eth_type(0x800)) |
| 173 | match.oxm_list.append(ofp.oxm.ip_proto(2)) |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 174 | |
Zsolt Haraszti | ecf8945 | 2016-03-01 22:38:13 -0800 | [diff] [blame^] | 175 | igmp = IGMPv3(type=IGMP_TYPE_V3_MEMBERSHIP_REPORT, max_resp_code=30, gaddr="224.0.0.1") |
| 176 | igmp.grps = [IGMPv3gr(rtype=IGMP_V3_GR_TYPE_INCLUDE, mcaddr="229.10.20.30")] |
| 177 | pkt = IGMPv3.fixup( scapy.Ether(src='00:00:00:00:be:ef') / scapy.IP() / igmp ) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 178 | pkt = pkt / ("0" * (100 - len(pkt))) |
| 179 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 180 | testPacketIn(self, match, pkt) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 181 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 182 | |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 183 | class IGMPQueryPacketOut(base_tests.SimpleDataPlane): |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 184 | """Verify sending multicast membership queries down to onu_ports""" |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 185 | |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 186 | def runTest(self): |
| 187 | logging.info("Running IGMP query packet out") |
| 188 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 189 | igmp = IGMPv3() # by default this is a query |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 190 | pkt = buildIgmp(igmp) |
| 191 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 192 | msg = ofp.message.packet_out( |
| 193 | in_port=ofp.OFPP_CONTROLLER, |
| 194 | actions=[ofp.action.output(port=onu_port)], |
| 195 | buffer_id=ofp.OFP_NO_BUFFER, |
| 196 | data=str(pkt)) |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 197 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 198 | self.controller.message_send(msg) |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 199 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 200 | rv = self.controller.message_send(msg) |
| 201 | self.assertTrue(rv == 0, "Error sending put message") |
Admin | d521278 | 2015-12-09 17:17:57 -0800 | [diff] [blame] | 202 | verify_no_errors(self.controller) |
| 203 | |
| 204 | verify_packet(self, pkt, onu_port) |
| 205 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 206 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 207 | class TestMeter(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 208 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 209 | def runTest(self): |
| 210 | logging.info("Running Meter tests") |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 211 | dropMeterBand = ofp.meter_band.drop(rate=640) |
| 212 | meter_mod = ofp.message.meter_mod(xid=1, command=ofp.OFPMC_ADD, meter_id=1, meters=[dropMeterBand]) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 213 | self.controller.message_send(meter_mod) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 214 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 215 | time.sleep(1) |
| 216 | |
| 217 | verify_no_errors(self.controller) |
| 218 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 219 | vlan_id = 201 |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 220 | match = ofp.match() |
| 221 | match.oxm_list.append(ofp.oxm.in_port(onu_port)) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 222 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 223 | |
| 224 | request = ofp.message.flow_add( |
| 225 | table_id=test_param_get("table", 0), |
| 226 | cookie=42, |
| 227 | match=match, |
| 228 | instructions=[ |
| 229 | ofp.instruction.apply_actions( |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 230 | actions=[ofp.action.output(port=olt_port)]), |
| 231 | ofp.instruction.meter(meter_id = 1) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 232 | ], |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 233 | buffer_id=ofp.OFP_NO_BUFFER, |
| 234 | priority=1000) |
| 235 | |
| 236 | self.controller.message_send(request) |
| 237 | time.sleep(1) |
| 238 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 239 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 240 | match = ofp.match() |
| 241 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 242 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 243 | |
| 244 | request = ofp.message.flow_add( |
| 245 | table_id=test_param_get("table", 0), |
| 246 | cookie=43, |
| 247 | match=match, |
| 248 | instructions=[ |
| 249 | ofp.instruction.apply_actions( |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 250 | actions=[ofp.action.output(port=onu_port)]), |
| 251 | ofp.instruction.meter(meter_id = 1) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 252 | ], |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 253 | buffer_id=ofp.OFP_NO_BUFFER, |
| 254 | priority=1000) |
| 255 | |
| 256 | self.controller.message_send(request) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 257 | time.sleep(1) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 258 | verify_no_errors(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 259 | do_barrier(self.controller) |
| 260 | time.sleep(5) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 261 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 262 | inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0) |
| 263 | # downstream |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 264 | # self.dataplane.send(olt_port, str(inPkt)) |
| 265 | # verify_packet(self, inPkt, onu_port) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 266 | # upstream |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 267 | # for i in range(1,400): |
| 268 | # self.dataplane.send(onu_port, str(inPkt)) |
| 269 | # verify_packet(self, inPkt, olt_port) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 270 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 271 | # clean up the test |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 272 | meter_mod = ofp.message.meter_mod(xid=2, command=ofp.OFPMC_DELETE, meter_id=1) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 273 | self.controller.message_send(meter_mod) |
| 274 | time.sleep(1) |
| 275 | delete_all_flows(self.controller) |
| 276 | verify_no_errors(self.controller) |
| 277 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 278 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 279 | class TestDuplicateMeter(base_tests.SimpleDataPlane): |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 280 | def runTest(self): |
| 281 | logging.info("Running Duplicate Meter Test") |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 282 | dropMeterBand = ofp.meter_band.drop(rate=500) |
| 283 | meter_mod = ofp.message.meter_mod(xid=1, command=ofp.OFPMC_ADD, meter_id=1, meters=[dropMeterBand]) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 284 | self.controller.message_send(meter_mod) |
| 285 | self.controller.message_send(meter_mod) |
| 286 | |
| 287 | time.sleep(1) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 288 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 289 | try: |
| 290 | verify_no_errors(self.controller) |
| 291 | except AssertionError as e: |
Admin | 09b5cc6 | 2015-10-11 13:53:59 -0700 | [diff] [blame] | 292 | if (not e.message == "unexpected error type=12 code=1"): |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 293 | raise AssertionError("Incorrect error type: %s" % e.message) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 294 | |
| 295 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 296 | class VlanTest(base_tests.SimpleDataPlane): |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 297 | """Verify the switch can push/pop a VLAN tag and forward out a port """ |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 298 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 299 | def runTest(self): |
| 300 | logging.info("Running push VLAN test") |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 301 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 302 | vlan_id = 200 |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 303 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 304 | delete_all_flows(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 305 | |
| 306 | # PUSH |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 307 | match = ofp.match() |
| 308 | match.oxm_list.append(ofp.oxm.in_port(onu_port)) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 309 | if device_type == "cpqd": |
| 310 | match.oxm_list.append(ofp.oxm.vlan_vid(value=ofp.OFPVID_NONE)) |
| 311 | actions = [ |
| 312 | ofp.action.push_vlan(ethertype=0x8100), |
| 313 | ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)), |
| 314 | ofp.action.set_field(ofp.oxm.vlan_pcp(0)), |
| 315 | ofp.action.output(port=olt_port) |
| 316 | ] |
| 317 | else: # pmc, normal |
| 318 | match.oxm_list.append(ofp.oxm.vlan_vid_masked(value=ofp.OFPVID_PRESENT, value_mask=ofp.OFPVID_PRESENT)) |
| 319 | match.oxm_list.append(ofp.oxm.vlan_pcp(value = 0)) |
| 320 | actions = [ |
| 321 | ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)), |
| 322 | ofp.action.set_field(ofp.oxm.vlan_pcp(0)), |
| 323 | ofp.action.output(port=olt_port) |
| 324 | ] |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 325 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 326 | request = ofp.message.flow_add( |
| 327 | table_id=test_param_get("table", 0), |
| 328 | cookie=42, |
| 329 | match=match, |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 330 | instructions=[ofp.instruction.apply_actions(actions=actions)], |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 331 | buffer_id=ofp.OFP_NO_BUFFER, |
| 332 | priority=1000) |
| 333 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 334 | logging.info("Inserting flow tagging upstream") |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 335 | self.controller.message_send(request) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 336 | do_barrier(self.controller) |
| 337 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 338 | |
| 339 | # POP |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 340 | match = ofp.match() |
| 341 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 342 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 343 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 344 | request = ofp.message.flow_add( |
| 345 | table_id=test_param_get("table", 0), |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 346 | cookie=43, |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 347 | match=match, |
| 348 | instructions=[ |
| 349 | ofp.instruction.apply_actions( |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 350 | actions=[ |
| 351 | ofp.action.pop_vlan(), |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 352 | ofp.action.output(port=onu_port)])], |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 353 | buffer_id=ofp.OFP_NO_BUFFER, |
| 354 | priority=1000) |
| 355 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 356 | logging.info("Inserting flow tagging downstream") |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 357 | self.controller.message_send(request) |
| 358 | do_barrier(self.controller) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 359 | verify_no_errors(self.controller) |
| 360 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 361 | time.sleep(5) |
Admin | 99c2a27 | 2016-03-01 12:56:39 -0800 | [diff] [blame] | 362 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 363 | inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 364 | outPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 365 | vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 366 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 367 | # Send untagged packet in the ONU port and expect tagged packet out the OLT port |
| 368 | self.dataplane.send(onu_port, str(inPkt)) |
| 369 | verify_packet(self, outPkt, olt_port) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 370 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 371 | # Send untagged packet in the OLT port and expect no packets to come out |
| 372 | self.dataplane.send(olt_port, str(inPkt)) |
| 373 | verify_packets(self, outPkt, []) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 374 | |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 375 | inPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True, |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 376 | vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 377 | if device_type == 'pmc': |
| 378 | outPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0) |
| 379 | else: # "normal", "cpqd"" |
| 380 | outPkt = simple_udp_packet(pktlen=100) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 381 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 382 | # Send tagged packet in the OLT port and expect untagged packet out the OLT port |
| 383 | self.dataplane.send(olt_port, str(inPkt)) |
| 384 | verify_packet(self, outPkt, onu_port) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 385 | |
Jonathan Hart | f2511ca | 2015-07-07 14:18:19 -0700 | [diff] [blame] | 386 | # Send tagged packet in the ONU port and expect no packets to come out |
| 387 | self.dataplane.send(onu_port, str(inPkt)) |
Admin | 7e9c91d | 2015-08-25 15:53:49 -0700 | [diff] [blame] | 388 | verify_packets(self, outPkt, []) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 389 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 390 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 391 | def createAllGroupAdd(group_id, ports=[]): |
| 392 | buckets = [] |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 393 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 394 | for portNum in ports: |
| 395 | buckets.append(ofp.common.bucket(watch_port=ofp.OFPP_ANY, watch_group=ofp.OFPG_ANY, |
Admin | 99c2a27 | 2016-03-01 12:56:39 -0800 | [diff] [blame] | 396 | actions=[ofp.action.pop_vlan(), ofp.action.output(port=portNum)])) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 397 | |
| 398 | group_add = ofp.message.group_add(group_type=ofp.OFPGT_ALL, group_id=group_id, buckets=buckets) |
| 399 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 400 | return group_add |
| 401 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 402 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 403 | def createAllGroupMod(group_id, ports=[]): |
| 404 | buckets = [] |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 405 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 406 | for portNum in ports: |
| 407 | buckets.append(ofp.common.bucket(watch_port=ofp.OFPP_ANY, watch_group=ofp.OFPG_ANY, |
| 408 | actions=[ofp.action.output(port=portNum)])) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 409 | |
| 410 | group_mod = ofp.message.group_mod(command=ofp.OFPGC_MODIFY, group_type=ofp.OFPGT_ALL, group_id=group_id, |
| 411 | buckets=buckets) |
| 412 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 413 | return group_mod |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 414 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 415 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 416 | class TestGroupAdd(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 417 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 418 | def runTest(self): |
| 419 | logging.info("Running Group tests") |
| 420 | delete_all_flows(self.controller) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 421 | delete_all_groups(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 422 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 423 | test_group_id = 1 |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 424 | |
| 425 | # output to two ONU |
| 426 | group_add = createAllGroupAdd(test_group_id, ports=[onu_port, onu_port2]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 427 | |
| 428 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 429 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 430 | verify_no_errors(self.controller) |
| 431 | |
| 432 | # Remove the group and then readd it. |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 433 | group_delete = ofp.message.group_delete(group_id=test_group_id) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 434 | self.controller.message_send(group_delete) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 435 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 436 | verify_no_errors(self.controller) |
| 437 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 438 | group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 439 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 440 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 441 | verify_no_errors(self.controller) |
| 442 | |
| 443 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 444 | # clean up the test |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 445 | group_delete = ofp.message.group_delete(group_id=test_group_id) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 446 | self.controller.message_send(group_delete) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 447 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 448 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 449 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 450 | |
| 451 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 452 | class TestGroupMod(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 453 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 454 | def runTest(self): |
| 455 | logging.info("Running Group tests") |
| 456 | delete_all_flows(self.controller) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 457 | delete_all_groups(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 458 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 459 | test_group_id = 1 |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 460 | |
| 461 | group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 462 | |
| 463 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 464 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 465 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 466 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 467 | # Modifying the group |
| 468 | group_mod = createAllGroupMod(test_group_id, [onu_port2]) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 469 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 470 | self.controller.message_send(group_mod) |
| 471 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 472 | verify_no_errors(self.controller) |
| 473 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 474 | # Add a bucket into the group |
| 475 | group_mod = createAllGroupMod(test_group_id, [onu_port, onu_port2]) |
| 476 | self.controller.message_send(group_mod) |
| 477 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 478 | verify_no_errors(self.controller) |
| 479 | |
| 480 | # Modifying a non-existing group |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 481 | group_mod = createAllGroupMod(777, [onu_port2]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 482 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 483 | self.controller.message_send(group_mod) |
| 484 | do_barrier(self.controller) |
| 485 | errorExperienced = 0 |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 486 | try: |
| 487 | verify_no_errors(self.controller) |
| 488 | except AssertionError as e: |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 489 | errorExperienced = 1 |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 490 | if (not (e.message == "unexpected error type=6 code=8")): |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 491 | raise AssertionError("Incorrect error type: %s" % e.message) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 492 | if not errorExperienced: |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 493 | raise AssertionError("An error message is expected, but not shown.") |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 494 | |
| 495 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 496 | # clean up the test |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 497 | group_delete = ofp.message.group_delete(xid=2, group_id=test_group_id) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 498 | self.controller.message_send(group_delete) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 499 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 500 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 501 | verify_no_errors(self.controller) |
| 502 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 503 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 504 | class TestDuplicateGroup(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 505 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 506 | def runTest(self): |
| 507 | logging.info("Running Group tests") |
| 508 | delete_all_flows(self.controller) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 509 | delete_all_groups(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 510 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 511 | test_group_id = 1 |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 512 | group_add = createAllGroupAdd(test_group_id, ports=[onu_port]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 513 | |
| 514 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 515 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 516 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 517 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 518 | # Add the same group id |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 519 | duplicate_group_fail = 0 |
| 520 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 521 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 522 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 523 | try: |
| 524 | verify_no_errors(self.controller) |
| 525 | except AssertionError as e: |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 526 | duplicate_group_fail = 1 |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 527 | if (not e.message == "unexpected error type=6 code=0"): |
| 528 | raise AssertionError("Incorrect error type: %s" % e.message) |
| 529 | if not duplicate_group_fail: |
| 530 | raise AssertionError("Adding duplicate groups didn't raise an error.") |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 531 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 532 | # clean up the test |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 533 | group_delete = ofp.message.group_delete(xid=2, group_id=test_group_id) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 534 | self.controller.message_send(group_delete) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 535 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 536 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 537 | verify_no_errors(self.controller) |
| 538 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 539 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 540 | class TestGroupAndFlow(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 541 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 542 | def runTest(self): |
| 543 | logging.info("Running Group tests") |
| 544 | delete_all_flows(self.controller) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 545 | delete_all_groups(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 546 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 547 | # Create a group |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 548 | test_group_id = 1 |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 549 | group_add = createAllGroupAdd(test_group_id, ports=[onu_port]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 550 | |
| 551 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 552 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 553 | verify_no_errors(self.controller) |
| 554 | |
| 555 | # Create a flow rule matching olt port and vlan id |
| 556 | match = ofp.match() |
| 557 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 558 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | 201)) |
| 559 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 560 | flow_pointing_to_group = ofp.message.flow_add( |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 561 | table_id=test_param_get("table", 0), |
| 562 | cookie=43, |
| 563 | match=match, |
| 564 | instructions=[ |
| 565 | ofp.instruction.apply_actions( |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 566 | actions=[ofp.action.group(group_id=test_group_id)])], |
| 567 | buffer_id=ofp.OFP_NO_BUFFER, priority=1000) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 568 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 569 | self.controller.message_send(flow_pointing_to_group) |
| 570 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 571 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 572 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 573 | # After letting a flow rule point to the group, test we can do group_mod |
| 574 | group_mod = createAllGroupMod(test_group_id, ports=[onu_port2]) |
| 575 | self.controller.message_send(group_mod) |
| 576 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 577 | verify_no_errors(self.controller) |
| 578 | |
| 579 | # Test we can remove flows and then remove group |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 580 | flow_delete = ofp.message.flow_delete(table_id=test_param_get("table", 0)) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 581 | self.controller.message_send(flow_delete) |
| 582 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 583 | verify_no_errors(self.controller) |
| 584 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 585 | group_delete = ofp.message.group_delete(xid=3, group_id=test_group_id) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 586 | self.controller.message_send(group_delete) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 587 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 588 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 589 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 590 | # Add the group and flow back, test it we can first remove group and then remove the flow. |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 591 | '''group_add = createAllGroupAdd(test_group_id, ports=[onu_port]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 592 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 593 | |
| 594 | self.controller.message_send(flow_pointing_to_group) |
| 595 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 596 | verify_no_errors(self.controller) |
| 597 | |
| 598 | group_delete = ofp.message.group_delete(xid = 4, group_id = test_group_id) |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 599 | self.controller.message_send(group_delete)''' |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 600 | |
| 601 | self.controller.message_send(flow_delete) |
| 602 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 603 | verify_no_errors(self.controller) |
| 604 | |
| 605 | |
| 606 | class TestGroupForwarding(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 607 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 608 | def runTest(self): |
| 609 | logging.info("Running Group datapath forwarding tests") |
| 610 | delete_all_flows(self.controller) |
Admin | 99c2a27 | 2016-03-01 12:56:39 -0800 | [diff] [blame] | 611 | delete_all_groups(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 612 | |
Admin | 09b5cc6 | 2015-10-11 13:53:59 -0700 | [diff] [blame] | 613 | vlan_id = 201 |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 614 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 615 | # Create a group |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 616 | test_group_id = 1 |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 617 | group_add = createAllGroupAdd(test_group_id, [onu_port]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 618 | |
| 619 | self.controller.message_send(group_add) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 620 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 621 | verify_no_errors(self.controller) |
| 622 | |
| 623 | # Create a flow rule matching olt port and vlan id |
| 624 | match = ofp.match() |
| 625 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 626 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)) |
| 627 | |
| 628 | request = ofp.message.flow_add( |
| 629 | table_id=test_param_get("table", 0), |
| 630 | cookie=43, |
| 631 | match=match, |
| 632 | instructions=[ |
| 633 | ofp.instruction.apply_actions( |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 634 | actions=[ofp.action.group(group_id=test_group_id)]), |
| 635 | ], |
| 636 | buffer_id=ofp.OFP_NO_BUFFER, priority=1000) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 637 | |
| 638 | self.controller.message_send(request) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 639 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 640 | verify_no_errors(self.controller) |
Admin | 09b5cc6 | 2015-10-11 13:53:59 -0700 | [diff] [blame] | 641 | |
| 642 | # It takes some time for flows to propagate down to the data plane |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 643 | time.sleep(10) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 644 | |
| 645 | inPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True, |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 646 | vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0, eth_dst="01:01:11:12:11:12") |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 647 | outPkt = inPkt |
| 648 | self.dataplane.send(olt_port, str(inPkt)) |
| 649 | verify_packet(self, outPkt, onu_port) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 650 | |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 651 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 652 | # Now put 2 ONU ports in the group and test that the input packet is |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 653 | # duplicated out both ports |
| 654 | group_mod = createAllGroupMod(test_group_id, ports=[onu_port, onu_port2]) |
| 655 | self.controller.message_send(group_mod) |
| 656 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 657 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 658 | |
Admin | 09b5cc6 | 2015-10-11 13:53:59 -0700 | [diff] [blame] | 659 | # It takes some time for flows to propagate down to the data plane |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 660 | time.sleep(10) |
Admin | 09b5cc6 | 2015-10-11 13:53:59 -0700 | [diff] [blame] | 661 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 662 | self.dataplane.send(olt_port, str(inPkt)) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 663 | verify_packet(self, outPkt, onu_port2) |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 664 | verify_packet(self, outPkt, onu_port) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 665 | # verify_packets(self, outPkt, [onu_port,onu_port2]) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 666 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 667 | # clean up the test |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 668 | request = ofp.message.flow_delete(table_id=test_param_get("table", 0)) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 669 | self.controller.message_send(request) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 670 | group_delete = ofp.message.group_delete(xid=2, group_id=test_group_id) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 671 | self.controller.message_send(group_delete) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 672 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 673 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 674 | verify_no_errors(self.controller) |
| 675 | |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 676 | |
| 677 | class TestGroupModForwarding(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 678 | |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 679 | def runTest(self): |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 680 | logging.info("Running datapath forwarding tests for group mod") |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 681 | delete_all_flows(self.controller) |
| 682 | delete_all_groups(self.controller) |
| 683 | |
| 684 | vlan_id = 201 |
| 685 | |
| 686 | # Create a group |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 687 | test_group_id = 1 |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 688 | group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2]) |
| 689 | |
| 690 | self.controller.message_send(group_add) |
| 691 | do_barrier(self.controller) |
| 692 | verify_no_errors(self.controller) |
| 693 | |
| 694 | # Create a flow rule matching olt port and vlan id |
| 695 | match = ofp.match() |
| 696 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 697 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)) |
| 698 | |
| 699 | request = ofp.message.flow_add( |
| 700 | table_id=test_param_get("table", 0), |
| 701 | cookie=43, |
| 702 | match=match, |
| 703 | instructions=[ |
| 704 | ofp.instruction.apply_actions( |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 705 | actions=[ofp.action.group(group_id=test_group_id)]), |
| 706 | ], |
| 707 | buffer_id=ofp.OFP_NO_BUFFER, priority=1000) |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 708 | |
| 709 | self.controller.message_send(request) |
| 710 | do_barrier(self.controller) |
| 711 | verify_no_errors(self.controller) |
| 712 | |
| 713 | # It takes some time for flows to propagate down to the data plane |
| 714 | time.sleep(10) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 715 | |
| 716 | inPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True, |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 717 | vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0, eth_dst="01:01:11:12:11:12") |
| 718 | outPkt = inPkt |
| 719 | self.dataplane.send(olt_port, str(inPkt)) |
| 720 | verify_packet(self, outPkt, onu_port) |
Admin | 99c2a27 | 2016-03-01 12:56:39 -0800 | [diff] [blame] | 721 | verify_packet(self, outPkt, onu_port2) |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 722 | |
| 723 | # Now remove onu port 1 from the group and test that the input packet is no longer forwarded to onu port 1 |
| 724 | group_mod = createAllGroupMod(test_group_id, ports=[onu_port2]) |
| 725 | self.controller.message_send(group_mod) |
| 726 | do_barrier(self.controller) |
| 727 | verify_no_errors(self.controller) |
| 728 | |
| 729 | time.sleep(10) |
| 730 | self.dataplane.send(olt_port, str(inPkt)) |
| 731 | verify_no_packet(self, outPkt, onu_port) |
| 732 | verify_packet(self, outPkt, onu_port2) |
| 733 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 734 | # Now remove all ports in the group and test that the input packet is no longer forwarded to any port |
Admin | dcb1bc7 | 2015-11-12 18:24:56 -0800 | [diff] [blame] | 735 | group_mod = createAllGroupMod(test_group_id, ports=[]) |
| 736 | self.controller.message_send(group_mod) |
| 737 | do_barrier(self.controller) |
| 738 | verify_no_errors(self.controller) |
| 739 | time.sleep(10) |
| 740 | self.dataplane.send(olt_port, str(inPkt)) |
| 741 | verify_packets(self, outPkt, []) |
| 742 | |
| 743 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 744 | class TransparentVlanTest(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 745 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 746 | def runTest(self): |
| 747 | logging.info("Running transparent vlan tests") |
Admin | 09b5cc6 | 2015-10-11 13:53:59 -0700 | [diff] [blame] | 748 | delete_all_flows(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 749 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 750 | vlan_id = 201 |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 751 | match = ofp.match() |
| 752 | match.oxm_list.append(ofp.oxm.in_port(onu_port)) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 753 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 754 | |
| 755 | request = ofp.message.flow_add( |
| 756 | table_id=test_param_get("table", 0), |
| 757 | cookie=42, |
| 758 | match=match, |
| 759 | instructions=[ |
| 760 | ofp.instruction.apply_actions( |
| 761 | actions=[ |
| 762 | ofp.action.output(port=olt_port)]), |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 763 | ], |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 764 | buffer_id=ofp.OFP_NO_BUFFER, |
| 765 | priority=1000) |
| 766 | |
| 767 | self.controller.message_send(request) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 768 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 769 | match = ofp.match() |
| 770 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 771 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)) |
| 772 | |
| 773 | request = ofp.message.flow_add( |
| 774 | table_id=test_param_get("table", 0), |
| 775 | cookie=43, |
| 776 | match=match, |
| 777 | instructions=[ |
| 778 | ofp.instruction.apply_actions( |
| 779 | actions=[ |
| 780 | ofp.action.output(port=onu_port)]), |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 781 | ], |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 782 | buffer_id=ofp.OFP_NO_BUFFER, |
| 783 | priority=1000) |
| 784 | |
| 785 | self.controller.message_send(request) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 786 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 787 | verify_no_errors(self.controller) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 788 | |
Admin | 09b5cc6 | 2015-10-11 13:53:59 -0700 | [diff] [blame] | 789 | # It takes some time for flows to propagate down to the data plane |
| 790 | time.sleep(2) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 791 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 792 | inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 793 | |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 794 | # upstream |
| 795 | self.dataplane.send(onu_port, str(inPkt)) |
| 796 | verify_packet(self, inPkt, olt_port) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 797 | |
Admin | 99c2a27 | 2016-03-01 12:56:39 -0800 | [diff] [blame] | 798 | # downstream |
| 799 | self.dataplane.send(olt_port, str(inPkt)) |
| 800 | verify_packet(self, inPkt, onu_port) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 801 | |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 802 | # clean up the test |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 803 | delete_all_flows(self.controller) |
Jonathan Hart | f65e181 | 2015-10-05 15:15:37 -0700 | [diff] [blame] | 804 | do_barrier(self.controller) |
Admin | 02d052c | 2015-10-10 19:08:26 -0700 | [diff] [blame] | 805 | verify_no_errors(self.controller) |
| 806 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 807 | class RemoveRuleTest(base_tests.SimpleDataPlane): |
| 808 | |
| 809 | def runTest(self): |
| 810 | logging.info("Testing Rule removal") |
alshabib | e165af2 | 2016-03-01 21:42:17 -0800 | [diff] [blame] | 811 | delete_all_flows(self.controller) |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 812 | processEapolRule(self, onu_port) |
alshabib | e165af2 | 2016-03-01 21:42:17 -0800 | [diff] [blame] | 813 | |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 814 | #wait for the rule to settle |
| 815 | time.sleep(3) |
| 816 | |
alshabib | dde38ea | 2016-03-01 21:49:44 -0800 | [diff] [blame] | 817 | installDoubleTaggingRules(1, 2, self.controller) |
alshabib | e165af2 | 2016-03-01 21:42:17 -0800 | [diff] [blame] | 818 | |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 819 | #wait for the rules to settle |
| 820 | time.sleep(3) |
| 821 | |
| 822 | stats = get_flow_stats(self, ofp.match()) |
| 823 | |
Admin | 53e10b6 | 2016-03-01 21:52:18 -0800 | [diff] [blame] | 824 | self.assertTrue(len(stats) == 5, \ |
| 825 | "Wrong number of rules reports; reported %s, expected 5\n\n %s" % (len(stats), stats)) |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 826 | |
| 827 | processEapolRule(self, onu_port, install = False) |
| 828 | time.sleep(3) |
| 829 | |
| 830 | stats = get_flow_stats(self, ofp.match()) |
| 831 | |
Admin | 53e10b6 | 2016-03-01 21:52:18 -0800 | [diff] [blame] | 832 | self.assertTrue(len(stats) == 4, \ |
| 833 | "Wrong number of rules reports; reported %s, expected 4\n\n %s" % (len(stats), stats)) |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 834 | |
| 835 | logging.info(stats) |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 836 | |
| 837 | |
| 838 | class MultipleDoubleTaggingForwarding(base_tests.SimpleDataPlane): |
| 839 | |
| 840 | def runTests(self): |
| 841 | logging.info("Testing multiple Q-in-Q rules") |
| 842 | pass |
| 843 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 844 | |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 845 | class DoubleVlanTest(base_tests.SimpleDataPlane): |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 846 | |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 847 | def runTest(self): |
| 848 | logging.info("Running double vlan tests") |
| 849 | delete_all_flows(self.controller) |
| 850 | |
| 851 | c_vlan_id = 100 |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 852 | s_vlan_id = 102 |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 853 | |
| 854 | installDoubleTaggingRules(s_vlan_id, c_vlan_id, self.controller) |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 855 | |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 856 | # It takes some time for flows to propagate down to the data plane |
| 857 | time.sleep(10) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 858 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 859 | # Test packet flows |
| 860 | testPacketFlow(self, c_vlan_id, s_vlan_id) |
Admin | b17b166 | 2015-10-19 15:50:53 -0700 | [diff] [blame] | 861 | |
| 862 | # clean up the test |
| 863 | delete_all_flows(self.controller) |
| 864 | do_barrier(self.controller) |
| 865 | verify_no_errors(self.controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 866 | |
| 867 | |
| 868 | class TestCyclingDoubleVlan(base_tests.SimpleDataPlane): |
| 869 | """Cycle through vlans and test traffic flow""" |
| 870 | |
| 871 | def runTest(self): |
| 872 | logging.info("Running cycling vlan test") |
| 873 | |
alshabib | 2ecca69 | 2016-03-01 15:10:38 -0800 | [diff] [blame] | 874 | for stag in xrange(2, 4000, 100): |
| 875 | for ctag in xrange(2, 4000, 100): |
alshabib | f1f07dd | 2016-03-01 15:50:35 -0800 | [diff] [blame] | 876 | delete_all_flows(self.controller) |
| 877 | time.sleep(5) |
alshabib | dde38ea | 2016-03-01 21:49:44 -0800 | [diff] [blame] | 878 | installDoubleTaggingRules(stag, ctag, self.controller) |
alshabib | f1f07dd | 2016-03-01 15:50:35 -0800 | [diff] [blame] | 879 | time.sleep(5) |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 880 | testPacketFlow(self, ctag, stag) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 881 | |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 882 | def processEapolRule(test, in_port, install = True): |
| 883 | match = ofp.match() |
| 884 | match.oxm_list.append(ofp.oxm.eth_type(0x888e)) |
| 885 | match.oxm_list.append(ofp.oxm.in_port(in_port)) |
| 886 | if install: |
| 887 | request = ofp.message.flow_add( |
| 888 | table_id=test_param_get("table", 0), |
| 889 | cookie=42, |
alshabib | d24fca6 | 2016-03-01 21:26:35 -0800 | [diff] [blame] | 890 | match=match, |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 891 | instructions=[ |
| 892 | ofp.instruction.apply_actions( |
| 893 | actions=[ |
| 894 | ofp.action.output( |
| 895 | port=ofp.OFPP_CONTROLLER, |
| 896 | max_len=ofp.OFPCML_NO_BUFFER)])], |
| 897 | buffer_id=ofp.OFP_NO_BUFFER, |
| 898 | priority=1000) |
| 899 | else: |
| 900 | request = ofp.message.flow_delete( |
| 901 | table_id=test_param_get("table", 0), |
| 902 | cookie=42, |
Admin | 53e10b6 | 2016-03-01 21:52:18 -0800 | [diff] [blame] | 903 | match=match, |
alshabib | 9929a15 | 2016-03-01 21:25:18 -0800 | [diff] [blame] | 904 | instructions=[ |
| 905 | ofp.instruction.apply_actions( |
| 906 | actions=[ |
| 907 | ofp.action.output( |
| 908 | port=ofp.OFPP_CONTROLLER, |
| 909 | max_len=ofp.OFPCML_NO_BUFFER)])], |
| 910 | buffer_id=ofp.OFP_NO_BUFFER, |
| 911 | priority=1000) |
| 912 | logging.info("%s flow sending matching packets to controller" % "Install" if install else "Remove") |
| 913 | test.controller.message_send(request) |
| 914 | do_barrier(test.controller) |
| 915 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 916 | def testPacketFlow(test, c_vlan_id, s_vlan_id): |
alshabib | b9b39a7 | 2016-03-01 15:52:03 -0800 | [diff] [blame] | 917 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 918 | incorrectTagPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=100, vlan_pcp=1) |
| 919 | zeroTaggedPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0) |
| 920 | untaggedPkt = simple_udp_packet(pktlen=96) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 921 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 922 | upstreamDoubleTaggedPkt = double_vlan_udp_packet(pktlen=104, dl_vlan_enable=True, |
| 923 | c_vlan_vid=c_vlan_id, |
| 924 | s_vlan_vid=s_vlan_id, |
| 925 | c_vlan_pcp=0, s_vlan_pcp=0) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 926 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 927 | logging.info("Testing s-tag %d, c-tag %d" % (s_vlan_id, c_vlan_id)) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 928 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 929 | # test upstream untagged packet got double tag at OLT |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 930 | test.dataplane.send(onu_port, str(zeroTaggedPkt)) |
| 931 | verify_packet(test, upstreamDoubleTaggedPkt, olt_port) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 932 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 933 | # test downstream doubletagged packet got untagged at ONU |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 934 | test.dataplane.send(olt_port, str(upstreamDoubleTaggedPkt)) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 935 | if device_type == "pmc": |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 936 | verify_packet(test, zeroTaggedPkt, onu_port) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 937 | else: |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 938 | verify_packet(test, untaggedPkt, onu_port) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 939 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 940 | # test upstream doubletagged packet got dropped |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 941 | test.dataplane.send(onu_port, str(upstreamDoubleTaggedPkt)) |
| 942 | verify_no_packet(test, upstreamDoubleTaggedPkt, olt_port) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 943 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 944 | # test downstream untagged packet got dropped at ONU |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 945 | test.dataplane.send(olt_port, str(untaggedPkt)) |
| 946 | verify_no_packet(test, untaggedPkt, onu_port) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 947 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 948 | # test upstream icorrectly tagged packet; should get dropped |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 949 | test.dataplane.send(onu_port, str(incorrectTagPkt)) |
| 950 | verify_no_packet(test, upstreamDoubleTaggedPkt, olt_port) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 951 | |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 952 | |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 953 | def installDoubleTaggingRules(s_vlan_id, c_vlan_id, controller, cookie=42): |
| 954 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 955 | # upstream flow rule |
| 956 | match = ofp.match() |
| 957 | match.oxm_list.append(ofp.oxm.in_port(onu_port)) |
Zsolt Haraszti | fe52550 | 2016-03-02 05:18:52 +0000 | [diff] [blame] | 958 | if device_type == "cpqd": |
| 959 | match.oxm_list.append(ofp.oxm.vlan_vid(value=ofp.OFPVID_NONE)) |
| 960 | actions = [ |
| 961 | ofp.action.push_vlan(ethertype=0x8100), |
| 962 | ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id)), |
| 963 | ofp.action.set_field(ofp.oxm.vlan_pcp(0)) |
| 964 | ] |
| 965 | else: # "pmc", "normal" |
| 966 | match.oxm_list.append(ofp.oxm.vlan_vid(value=ofp.OFPVID_PRESENT)) |
| 967 | match.oxm_list.append(ofp.oxm.vlan_pcp(value=0)) |
| 968 | actions = [ |
| 969 | ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id)) |
| 970 | ] |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 971 | cookie += 1 |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 972 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 973 | # push inner vlan (c-vlan) for upstream |
| 974 | request = ofp.message.flow_add( |
| 975 | table_id=test_param_get("table", 0), |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 976 | cookie=cookie, |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 977 | match=match, |
| 978 | instructions=[ |
Zsolt Haraszti | 6888383 | 2016-03-02 05:45:11 +0000 | [diff] [blame] | 979 | ofp.instruction.apply_actions(actions=actions), |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 980 | ofp.instruction.goto_table(1)], |
| 981 | buffer_id=ofp.OFP_NO_BUFFER, |
| 982 | priority=1000) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 983 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 984 | controller.message_send(request) |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 985 | do_barrier(controller) |
| 986 | verify_no_errors(controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 987 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 988 | # push outer vlan (s-vlan) for upstream |
| 989 | match = ofp.match() |
| 990 | match.oxm_list.append(ofp.oxm.in_port(onu_port)) |
| 991 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id)) |
| 992 | match.oxm_list.append(ofp.oxm.vlan_pcp(0)) |
| 993 | cookie += 1 |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 994 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 995 | request = ofp.message.flow_add( |
| 996 | table_id=test_param_get("table", 1), |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 997 | cookie=cookie, |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 998 | match=match, |
| 999 | instructions=[ |
| 1000 | ofp.instruction.apply_actions( |
| 1001 | actions=[ |
| 1002 | ofp.action.push_vlan(ethertype=0x8100), |
| 1003 | ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | s_vlan_id)), |
| 1004 | ofp.action.set_field(ofp.oxm.vlan_pcp(0)), |
| 1005 | ofp.action.output(port=olt_port)]), |
| 1006 | ], |
| 1007 | buffer_id=ofp.OFP_NO_BUFFER, |
| 1008 | priority=1000) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 1009 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1010 | controller.message_send(request) |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 1011 | do_barrier(controller) |
| 1012 | verify_no_errors(controller) |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1013 | cookie += 1 |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 1014 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1015 | # strip outer vlan (s-vlan) for downstream |
| 1016 | match = ofp.match() |
| 1017 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 1018 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | s_vlan_id)) |
| 1019 | match.oxm_list.append(ofp.oxm.vlan_pcp(0)) |
| 1020 | request = ofp.message.flow_add( |
| 1021 | table_id=test_param_get("table", 0), |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 1022 | cookie=cookie, |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1023 | match=match, |
| 1024 | instructions=[ |
| 1025 | ofp.instruction.apply_actions( |
| 1026 | actions=[ofp.action.pop_vlan()]), |
| 1027 | ofp.instruction.goto_table(1)], |
| 1028 | buffer_id=ofp.OFP_NO_BUFFER, |
| 1029 | priority=1000) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 1030 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1031 | controller.message_send(request) |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 1032 | do_barrier(controller) |
| 1033 | verify_no_errors(controller) |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 1034 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1035 | # rewrite inner vlan (c-vlan) to default (0) for downstream |
| 1036 | match = ofp.match() |
| 1037 | match.oxm_list.append(ofp.oxm.in_port(olt_port)) |
| 1038 | match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id)) |
| 1039 | match.oxm_list.append(ofp.oxm.vlan_pcp(0)) |
| 1040 | cookie += 1 |
alshabib | b9d4ee8 | 2016-03-01 14:12:42 -0800 | [diff] [blame] | 1041 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1042 | request = ofp.message.flow_add( |
| 1043 | table_id=test_param_get("table", 1), |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 1044 | cookie=cookie, |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1045 | match=match, |
| 1046 | instructions=[ |
| 1047 | ofp.instruction.apply_actions( |
| 1048 | actions=[ |
| 1049 | ofp.action.pop_vlan(), |
| 1050 | ofp.action.output(port=onu_port)]) |
| 1051 | ], |
| 1052 | buffer_id=ofp.OFP_NO_BUFFER, |
| 1053 | priority=1000) |
alshabib | f1f07dd | 2016-03-01 15:50:35 -0800 | [diff] [blame] | 1054 | |
alshabib | 28c03c3 | 2016-03-01 20:33:51 -0800 | [diff] [blame] | 1055 | controller.message_send(request) |
Admin | 965eeda | 2016-03-01 20:56:14 -0800 | [diff] [blame] | 1056 | do_barrier(controller) |
| 1057 | verify_no_errors(controller) |