blob: 2ee6d2076dc730fedf5f9d40f60b679d37e906be [file] [log] [blame]
Jonathan Hartf2511ca2015-07-07 14:18:19 -07001'''
2OFTests for functionality needed from the OLT.
3'''
Zsolt Harasztife525502016-03-02 05:18:52 +00004
Jonathan Hartf2511ca2015-07-07 14:18:19 -07005import logging
alshabibb9d4ee82016-03-01 14:12:42 -08006from __builtin__ import xrange
alshabibeff3ba92016-03-01 22:21:00 -08007from oltbase import OltBaseTest
Jonathan Hartf2511ca2015-07-07 14:18:19 -07008import oftest.packet as scapy
Jonathan Hartf2511ca2015-07-07 14:18:19 -07009import ofp
Admin7e9c91d2015-08-25 15:53:49 -070010import time
Jonathan Hartf2511ca2015-07-07 14:18:19 -070011
12from oftest.testutils import *
13
Zsolt Harasztife525502016-03-02 05:18:52 +000014from IGMP import IGMPv3
15
alshabib8292c852016-03-01 22:49:13 -080016from oltconstants import *
Jonathan Hartf2511ca2015-07-07 14:18:19 -070017
alshabibb9d4ee82016-03-01 14:12:42 -080018
alshabib8292c852016-03-01 22:49:13 -080019class EapolPacketIn(OltBaseTest):
Jonathan Hartf2511ca2015-07-07 14:18:19 -070020 """Verify packet-ins are sent for EAPOL packets """
alshabibb9d4ee82016-03-01 14:12:42 -080021
Jonathan Hartf2511ca2015-07-07 14:18:19 -070022 def runTest(self):
23 logging.info("Running EAPOL Packet In test")
24
25 match = ofp.match()
26 match.oxm_list.append(ofp.oxm.eth_type(0x888e))
27 # Use ethertype 0x888e and multicast destination MAC address
28 pkt = simple_eth_packet(pktlen=60, eth_dst='01:00:5E:7F:FF:FF', eth_type=0x888e)
alshabibb9d4ee82016-03-01 14:12:42 -080029
alshabib8292c852016-03-01 22:49:13 -080030 self.testPacketIn(match, pkt)
Jonathan Hartf2511ca2015-07-07 14:18:19 -070031
alshabibb9d4ee82016-03-01 14:12:42 -080032
alshabib8292c852016-03-01 22:49:13 -080033class ARPPacketIn(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +000034 """Verify packet-ins are sent for ARP packets """
alshabib9929a152016-03-01 21:25:18 -080035
Zsolt Harasztife525502016-03-02 05:18:52 +000036 def runTest(self):
37 logging.info("Running ARP Packet In test")
alshabib9929a152016-03-01 21:25:18 -080038
Zsolt Harasztife525502016-03-02 05:18:52 +000039 match = ofp.match()
40 match.oxm_list.append(ofp.oxm.eth_type(0x0806))
41
42 # Use ethertype 0x0806
43 pkt = simple_eth_packet(eth_type=0x0806)
44
alshabib8292c852016-03-01 22:49:13 -080045 self.testPacketIn(match, pkt)
alshabib9929a152016-03-01 21:25:18 -080046
47
alshabib8292c852016-03-01 22:49:13 -080048class IGMPPacketIn(OltBaseTest):
Jonathan Hartf2511ca2015-07-07 14:18:19 -070049 """Verify packet-ins are sent for IGMP packets """
alshabibb9d4ee82016-03-01 14:12:42 -080050
Jonathan Hartf2511ca2015-07-07 14:18:19 -070051 def runTest(self):
52 logging.info("Running IGMP Packet In test")
53
54 match = ofp.match()
55 match.oxm_list.append(ofp.oxm.eth_type(0x800))
56 match.oxm_list.append(ofp.oxm.ip_proto(2))
Jonathan Hartf2511ca2015-07-07 14:18:19 -070057
Zsolt Harasztife525502016-03-02 05:18:52 +000058 pkt = scapy.Ether(dst='01:00:5E:7F:FF:FF', src='00:00:00:00:00:01')/ \
alshabibb9d4ee82016-03-01 14:12:42 -080059 scapy.IP(src='10.0.0.1', dst='10.0.0.2', ttl=60, tos=0, id=0, proto=2)
60
61 pkt = pkt / ("0" * (100 - len(pkt)))
62
alshabib8292c852016-03-01 22:49:13 -080063 self.testPacketIn(match, pkt)
Admin7e9c91d2015-08-25 15:53:49 -070064
alshabibb9d4ee82016-03-01 14:12:42 -080065
alshabib8292c852016-03-01 22:49:13 -080066class IGMPQueryPacketOut(OltBaseTest):
Admind5212782015-12-09 17:17:57 -080067 """Verify sending multicast membership queries down to onu_ports"""
alshabibb9d4ee82016-03-01 14:12:42 -080068
Admind5212782015-12-09 17:17:57 -080069 def runTest(self):
70 logging.info("Running IGMP query packet out")
71
Zsolt Harasztife525502016-03-02 05:18:52 +000072 igmp = IGMPv3() # by default this is a query
Admind5212782015-12-09 17:17:57 -080073 pkt = buildIgmp(igmp)
74
Zsolt Harasztife525502016-03-02 05:18:52 +000075 msg = ofp.message.packet_out(
76 in_port=ofp.OFPP_CONTROLLER,
77 actions=[ofp.action.output(port=onu_port)],
78 buffer_id=ofp.OFP_NO_BUFFER,
79 data=str(pkt))
Admind5212782015-12-09 17:17:57 -080080
alshabibb9d4ee82016-03-01 14:12:42 -080081 self.controller.message_send(msg)
Admind5212782015-12-09 17:17:57 -080082
Zsolt Harasztife525502016-03-02 05:18:52 +000083 rv = self.controller.message_send(msg)
84 self.assertTrue(rv == 0, "Error sending put message")
Admind5212782015-12-09 17:17:57 -080085 verify_no_errors(self.controller)
86
87 verify_packet(self, pkt, onu_port)
88
alshabibb9d4ee82016-03-01 14:12:42 -080089
alshabib8292c852016-03-01 22:49:13 -080090class TestMeter(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +000091
Admin7e9c91d2015-08-25 15:53:49 -070092 def runTest(self):
93 logging.info("Running Meter tests")
alshabibb9d4ee82016-03-01 14:12:42 -080094 dropMeterBand = ofp.meter_band.drop(rate=640)
95 meter_mod = ofp.message.meter_mod(xid=1, command=ofp.OFPMC_ADD, meter_id=1, meters=[dropMeterBand])
Admin7e9c91d2015-08-25 15:53:49 -070096 self.controller.message_send(meter_mod)
alshabibb9d4ee82016-03-01 14:12:42 -080097
Admin7e9c91d2015-08-25 15:53:49 -070098 time.sleep(1)
99
100 verify_no_errors(self.controller)
101
Jonathan Hartf65e1812015-10-05 15:15:37 -0700102 vlan_id = 201
Admin7e9c91d2015-08-25 15:53:49 -0700103 match = ofp.match()
104 match.oxm_list.append(ofp.oxm.in_port(onu_port))
alshabibb9d4ee82016-03-01 14:12:42 -0800105 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
Admin02d052c2015-10-10 19:08:26 -0700106
107 request = ofp.message.flow_add(
108 table_id=test_param_get("table", 0),
109 cookie=42,
110 match=match,
111 instructions=[
112 ofp.instruction.apply_actions(
Zsolt Harasztife525502016-03-02 05:18:52 +0000113 actions=[ofp.action.output(port=olt_port)]),
114 ofp.instruction.meter(meter_id = 1)
alshabibb9d4ee82016-03-01 14:12:42 -0800115 ],
Admin02d052c2015-10-10 19:08:26 -0700116 buffer_id=ofp.OFP_NO_BUFFER,
117 priority=1000)
118
119 self.controller.message_send(request)
120 time.sleep(1)
121 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800122
Admin02d052c2015-10-10 19:08:26 -0700123 match = ofp.match()
124 match.oxm_list.append(ofp.oxm.in_port(olt_port))
125 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
Admin7e9c91d2015-08-25 15:53:49 -0700126
127 request = ofp.message.flow_add(
128 table_id=test_param_get("table", 0),
129 cookie=43,
130 match=match,
131 instructions=[
132 ofp.instruction.apply_actions(
Zsolt Harasztife525502016-03-02 05:18:52 +0000133 actions=[ofp.action.output(port=onu_port)]),
134 ofp.instruction.meter(meter_id = 1)
alshabibb9d4ee82016-03-01 14:12:42 -0800135 ],
Admin7e9c91d2015-08-25 15:53:49 -0700136 buffer_id=ofp.OFP_NO_BUFFER,
137 priority=1000)
138
139 self.controller.message_send(request)
Admin7e9c91d2015-08-25 15:53:49 -0700140 time.sleep(1)
Admin7e9c91d2015-08-25 15:53:49 -0700141 verify_no_errors(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700142 do_barrier(self.controller)
143 time.sleep(5)
alshabibb9d4ee82016-03-01 14:12:42 -0800144
Jonathan Hartf65e1812015-10-05 15:15:37 -0700145 inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0)
146 # downstream
alshabibb9d4ee82016-03-01 14:12:42 -0800147 # self.dataplane.send(olt_port, str(inPkt))
148 # verify_packet(self, inPkt, onu_port)
Admin02d052c2015-10-10 19:08:26 -0700149 # upstream
alshabibb9d4ee82016-03-01 14:12:42 -0800150 # for i in range(1,400):
151 # self.dataplane.send(onu_port, str(inPkt))
152 # verify_packet(self, inPkt, olt_port)
Admin02d052c2015-10-10 19:08:26 -0700153
Jonathan Hartf65e1812015-10-05 15:15:37 -0700154 # clean up the test
alshabibb9d4ee82016-03-01 14:12:42 -0800155 meter_mod = ofp.message.meter_mod(xid=2, command=ofp.OFPMC_DELETE, meter_id=1)
Admin02d052c2015-10-10 19:08:26 -0700156 self.controller.message_send(meter_mod)
157 time.sleep(1)
158 delete_all_flows(self.controller)
159 verify_no_errors(self.controller)
160
Admin7e9c91d2015-08-25 15:53:49 -0700161
alshabib8292c852016-03-01 22:49:13 -0800162class TestDuplicateMeter(OltBaseTest):
Admin7e9c91d2015-08-25 15:53:49 -0700163 def runTest(self):
164 logging.info("Running Duplicate Meter Test")
alshabibb9d4ee82016-03-01 14:12:42 -0800165 dropMeterBand = ofp.meter_band.drop(rate=500)
166 meter_mod = ofp.message.meter_mod(xid=1, command=ofp.OFPMC_ADD, meter_id=1, meters=[dropMeterBand])
Admin7e9c91d2015-08-25 15:53:49 -0700167 self.controller.message_send(meter_mod)
168 self.controller.message_send(meter_mod)
169
170 time.sleep(1)
alshabibb9d4ee82016-03-01 14:12:42 -0800171
Admin7e9c91d2015-08-25 15:53:49 -0700172 try:
173 verify_no_errors(self.controller)
174 except AssertionError as e:
Admin09b5cc62015-10-11 13:53:59 -0700175 if (not e.message == "unexpected error type=12 code=1"):
Admin7e9c91d2015-08-25 15:53:49 -0700176 raise AssertionError("Incorrect error type: %s" % e.message)
alshabibb9d4ee82016-03-01 14:12:42 -0800177
178
alshabib8292c852016-03-01 22:49:13 -0800179class VlanTest(OltBaseTest):
Admin7e9c91d2015-08-25 15:53:49 -0700180 """Verify the switch can push/pop a VLAN tag and forward out a port """
alshabibb9d4ee82016-03-01 14:12:42 -0800181
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700182 def runTest(self):
183 logging.info("Running push VLAN test")
alshabibb9d4ee82016-03-01 14:12:42 -0800184
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700185 vlan_id = 200
alshabibb9d4ee82016-03-01 14:12:42 -0800186
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700187 delete_all_flows(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800188
189 # PUSH
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700190 match = ofp.match()
191 match.oxm_list.append(ofp.oxm.in_port(onu_port))
Zsolt Harasztife525502016-03-02 05:18:52 +0000192 if device_type == "cpqd":
193 match.oxm_list.append(ofp.oxm.vlan_vid(value=ofp.OFPVID_NONE))
194 actions = [
195 ofp.action.push_vlan(ethertype=0x8100),
196 ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)),
197 ofp.action.set_field(ofp.oxm.vlan_pcp(0)),
198 ofp.action.output(port=olt_port)
199 ]
200 else: # pmc, normal
201 match.oxm_list.append(ofp.oxm.vlan_vid_masked(value=ofp.OFPVID_PRESENT, value_mask=ofp.OFPVID_PRESENT))
202 match.oxm_list.append(ofp.oxm.vlan_pcp(value = 0))
203 actions = [
204 ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id)),
205 ofp.action.set_field(ofp.oxm.vlan_pcp(0)),
206 ofp.action.output(port=olt_port)
207 ]
alshabibb9d4ee82016-03-01 14:12:42 -0800208
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700209 request = ofp.message.flow_add(
210 table_id=test_param_get("table", 0),
211 cookie=42,
212 match=match,
Zsolt Harasztife525502016-03-02 05:18:52 +0000213 instructions=[ofp.instruction.apply_actions(actions=actions)],
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700214 buffer_id=ofp.OFP_NO_BUFFER,
215 priority=1000)
216
Admin7e9c91d2015-08-25 15:53:49 -0700217 logging.info("Inserting flow tagging upstream")
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700218 self.controller.message_send(request)
Zsolt Harasztife525502016-03-02 05:18:52 +0000219 do_barrier(self.controller)
220 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800221
222 # POP
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700223 match = ofp.match()
224 match.oxm_list.append(ofp.oxm.in_port(olt_port))
225 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
Admin7e9c91d2015-08-25 15:53:49 -0700226
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700227 request = ofp.message.flow_add(
228 table_id=test_param_get("table", 0),
Admin7e9c91d2015-08-25 15:53:49 -0700229 cookie=43,
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700230 match=match,
231 instructions=[
232 ofp.instruction.apply_actions(
Jonathan Hartf65e1812015-10-05 15:15:37 -0700233 actions=[
234 ofp.action.pop_vlan(),
alshabibb9d4ee82016-03-01 14:12:42 -0800235 ofp.action.output(port=onu_port)])],
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700236 buffer_id=ofp.OFP_NO_BUFFER,
237 priority=1000)
238
Admin7e9c91d2015-08-25 15:53:49 -0700239 logging.info("Inserting flow tagging downstream")
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700240 self.controller.message_send(request)
241 do_barrier(self.controller)
Zsolt Harasztife525502016-03-02 05:18:52 +0000242 verify_no_errors(self.controller)
243
Admin7e9c91d2015-08-25 15:53:49 -0700244 time.sleep(5)
Admin99c2a272016-03-01 12:56:39 -0800245
Admin7e9c91d2015-08-25 15:53:49 -0700246 inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0)
alshabibb9d4ee82016-03-01 14:12:42 -0800247 outPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True,
Admin7e9c91d2015-08-25 15:53:49 -0700248 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0)
alshabibb9d4ee82016-03-01 14:12:42 -0800249
Admin7e9c91d2015-08-25 15:53:49 -0700250 # Send untagged packet in the ONU port and expect tagged packet out the OLT port
251 self.dataplane.send(onu_port, str(inPkt))
252 verify_packet(self, outPkt, olt_port)
alshabibb9d4ee82016-03-01 14:12:42 -0800253
Admin7e9c91d2015-08-25 15:53:49 -0700254 # Send untagged packet in the OLT port and expect no packets to come out
255 self.dataplane.send(olt_port, str(inPkt))
256 verify_packets(self, outPkt, [])
alshabibb9d4ee82016-03-01 14:12:42 -0800257
Admin7e9c91d2015-08-25 15:53:49 -0700258 inPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True,
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700259 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0)
Zsolt Harasztife525502016-03-02 05:18:52 +0000260 if device_type == 'pmc':
261 outPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0)
262 else: # "normal", "cpqd""
263 outPkt = simple_udp_packet(pktlen=100)
Admin7e9c91d2015-08-25 15:53:49 -0700264
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700265 # Send tagged packet in the OLT port and expect untagged packet out the OLT port
266 self.dataplane.send(olt_port, str(inPkt))
267 verify_packet(self, outPkt, onu_port)
Admin7e9c91d2015-08-25 15:53:49 -0700268
Jonathan Hartf2511ca2015-07-07 14:18:19 -0700269 # Send tagged packet in the ONU port and expect no packets to come out
270 self.dataplane.send(onu_port, str(inPkt))
Admin7e9c91d2015-08-25 15:53:49 -0700271 verify_packets(self, outPkt, [])
Jonathan Hartf65e1812015-10-05 15:15:37 -0700272
alshabibb9d4ee82016-03-01 14:12:42 -0800273
Jonathan Hartf65e1812015-10-05 15:15:37 -0700274
alshabibb9d4ee82016-03-01 14:12:42 -0800275
alshabibb9d4ee82016-03-01 14:12:42 -0800276
alshabib8292c852016-03-01 22:49:13 -0800277class TestGroupAdd(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000278
Admin02d052c2015-10-10 19:08:26 -0700279 def runTest(self):
280 logging.info("Running Group tests")
281 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700282 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700283
alshabibb9d4ee82016-03-01 14:12:42 -0800284 test_group_id = 1
Jonathan Hartf65e1812015-10-05 15:15:37 -0700285
286 # output to two ONU
287 group_add = createAllGroupAdd(test_group_id, ports=[onu_port, onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700288
289 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700290 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700291 verify_no_errors(self.controller)
292
293 # Remove the group and then readd it.
alshabibb9d4ee82016-03-01 14:12:42 -0800294 group_delete = ofp.message.group_delete(group_id=test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700295 self.controller.message_send(group_delete)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700296 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700297 verify_no_errors(self.controller)
298
Jonathan Hartf65e1812015-10-05 15:15:37 -0700299 group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700300 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700301 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700302 verify_no_errors(self.controller)
303
304
Jonathan Hartf65e1812015-10-05 15:15:37 -0700305 # clean up the test
alshabibb9d4ee82016-03-01 14:12:42 -0800306 group_delete = ofp.message.group_delete(group_id=test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700307 self.controller.message_send(group_delete)
alshabibb9d4ee82016-03-01 14:12:42 -0800308
Jonathan Hartf65e1812015-10-05 15:15:37 -0700309 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700310 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800311
312
alshabib8292c852016-03-01 22:49:13 -0800313class TestGroupMod(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000314
Admin02d052c2015-10-10 19:08:26 -0700315 def runTest(self):
316 logging.info("Running Group tests")
317 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700318 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700319
alshabibb9d4ee82016-03-01 14:12:42 -0800320 test_group_id = 1
Jonathan Hartf65e1812015-10-05 15:15:37 -0700321
322 group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700323
324 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700325 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700326 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800327
Jonathan Hartf65e1812015-10-05 15:15:37 -0700328 # Modifying the group
329 group_mod = createAllGroupMod(test_group_id, [onu_port2])
alshabibb9d4ee82016-03-01 14:12:42 -0800330
Jonathan Hartf65e1812015-10-05 15:15:37 -0700331 self.controller.message_send(group_mod)
332 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700333 verify_no_errors(self.controller)
334
Jonathan Hartf65e1812015-10-05 15:15:37 -0700335 # Add a bucket into the group
336 group_mod = createAllGroupMod(test_group_id, [onu_port, onu_port2])
337 self.controller.message_send(group_mod)
338 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700339 verify_no_errors(self.controller)
340
341 # Modifying a non-existing group
Jonathan Hartf65e1812015-10-05 15:15:37 -0700342 group_mod = createAllGroupMod(777, [onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700343
Jonathan Hartf65e1812015-10-05 15:15:37 -0700344 self.controller.message_send(group_mod)
345 do_barrier(self.controller)
346 errorExperienced = 0
Admin02d052c2015-10-10 19:08:26 -0700347 try:
348 verify_no_errors(self.controller)
349 except AssertionError as e:
Jonathan Hartf65e1812015-10-05 15:15:37 -0700350 errorExperienced = 1
Admin02d052c2015-10-10 19:08:26 -0700351 if (not (e.message == "unexpected error type=6 code=8")):
Jonathan Hartf65e1812015-10-05 15:15:37 -0700352 raise AssertionError("Incorrect error type: %s" % e.message)
alshabibb9d4ee82016-03-01 14:12:42 -0800353 if not errorExperienced:
Jonathan Hartf65e1812015-10-05 15:15:37 -0700354 raise AssertionError("An error message is expected, but not shown.")
alshabibb9d4ee82016-03-01 14:12:42 -0800355
356
Jonathan Hartf65e1812015-10-05 15:15:37 -0700357 # clean up the test
alshabibb9d4ee82016-03-01 14:12:42 -0800358 group_delete = ofp.message.group_delete(xid=2, group_id=test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700359 self.controller.message_send(group_delete)
alshabibb9d4ee82016-03-01 14:12:42 -0800360
Jonathan Hartf65e1812015-10-05 15:15:37 -0700361 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700362 verify_no_errors(self.controller)
363
alshabibb9d4ee82016-03-01 14:12:42 -0800364
alshabib8292c852016-03-01 22:49:13 -0800365class TestDuplicateGroup(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000366
Admin02d052c2015-10-10 19:08:26 -0700367 def runTest(self):
368 logging.info("Running Group tests")
369 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700370 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700371
alshabibb9d4ee82016-03-01 14:12:42 -0800372 test_group_id = 1
Jonathan Hartf65e1812015-10-05 15:15:37 -0700373 group_add = createAllGroupAdd(test_group_id, ports=[onu_port])
Admin02d052c2015-10-10 19:08:26 -0700374
375 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700376 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700377 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800378
Jonathan Hartf65e1812015-10-05 15:15:37 -0700379 # Add the same group id
alshabibb9d4ee82016-03-01 14:12:42 -0800380 duplicate_group_fail = 0
381
Admin02d052c2015-10-10 19:08:26 -0700382 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700383 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700384 try:
385 verify_no_errors(self.controller)
386 except AssertionError as e:
alshabibb9d4ee82016-03-01 14:12:42 -0800387 duplicate_group_fail = 1
Jonathan Hartf65e1812015-10-05 15:15:37 -0700388 if (not e.message == "unexpected error type=6 code=0"):
389 raise AssertionError("Incorrect error type: %s" % e.message)
390 if not duplicate_group_fail:
391 raise AssertionError("Adding duplicate groups didn't raise an error.")
alshabibb9d4ee82016-03-01 14:12:42 -0800392
Jonathan Hartf65e1812015-10-05 15:15:37 -0700393 # clean up the test
alshabibb9d4ee82016-03-01 14:12:42 -0800394 group_delete = ofp.message.group_delete(xid=2, group_id=test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700395 self.controller.message_send(group_delete)
alshabibb9d4ee82016-03-01 14:12:42 -0800396
Jonathan Hartf65e1812015-10-05 15:15:37 -0700397 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700398 verify_no_errors(self.controller)
399
alshabibb9d4ee82016-03-01 14:12:42 -0800400
alshabib8292c852016-03-01 22:49:13 -0800401class TestGroupAndFlow(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000402
Admin02d052c2015-10-10 19:08:26 -0700403 def runTest(self):
404 logging.info("Running Group tests")
405 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700406 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700407
Jonathan Hartf65e1812015-10-05 15:15:37 -0700408 # Create a group
alshabibb9d4ee82016-03-01 14:12:42 -0800409 test_group_id = 1
Jonathan Hartf65e1812015-10-05 15:15:37 -0700410 group_add = createAllGroupAdd(test_group_id, ports=[onu_port])
Admin02d052c2015-10-10 19:08:26 -0700411
412 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700413 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700414 verify_no_errors(self.controller)
415
416 # Create a flow rule matching olt port and vlan id
417 match = ofp.match()
418 match.oxm_list.append(ofp.oxm.in_port(olt_port))
419 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | 201))
420
Jonathan Hartf65e1812015-10-05 15:15:37 -0700421 flow_pointing_to_group = ofp.message.flow_add(
Admin02d052c2015-10-10 19:08:26 -0700422 table_id=test_param_get("table", 0),
423 cookie=43,
424 match=match,
425 instructions=[
426 ofp.instruction.apply_actions(
alshabibb9d4ee82016-03-01 14:12:42 -0800427 actions=[ofp.action.group(group_id=test_group_id)])],
428 buffer_id=ofp.OFP_NO_BUFFER, priority=1000)
Admin02d052c2015-10-10 19:08:26 -0700429
Jonathan Hartf65e1812015-10-05 15:15:37 -0700430 self.controller.message_send(flow_pointing_to_group)
431 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700432 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800433
Jonathan Hartf65e1812015-10-05 15:15:37 -0700434 # After letting a flow rule point to the group, test we can do group_mod
435 group_mod = createAllGroupMod(test_group_id, ports=[onu_port2])
436 self.controller.message_send(group_mod)
437 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700438 verify_no_errors(self.controller)
439
440 # Test we can remove flows and then remove group
alshabibb9d4ee82016-03-01 14:12:42 -0800441 flow_delete = ofp.message.flow_delete(table_id=test_param_get("table", 0))
Jonathan Hartf65e1812015-10-05 15:15:37 -0700442 self.controller.message_send(flow_delete)
443 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700444 verify_no_errors(self.controller)
445
alshabibb9d4ee82016-03-01 14:12:42 -0800446 group_delete = ofp.message.group_delete(xid=3, group_id=test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700447 self.controller.message_send(group_delete)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700448 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700449 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800450
Zsolt Harasztife525502016-03-02 05:18:52 +0000451 # Add the group and flow back, test it we can first remove group and then remove the flow.
Admindcb1bc72015-11-12 18:24:56 -0800452 '''group_add = createAllGroupAdd(test_group_id, ports=[onu_port])
Admin02d052c2015-10-10 19:08:26 -0700453 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700454
455 self.controller.message_send(flow_pointing_to_group)
456 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700457 verify_no_errors(self.controller)
458
459 group_delete = ofp.message.group_delete(xid = 4, group_id = test_group_id)
Admindcb1bc72015-11-12 18:24:56 -0800460 self.controller.message_send(group_delete)'''
Jonathan Hartf65e1812015-10-05 15:15:37 -0700461
462 self.controller.message_send(flow_delete)
463 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700464 verify_no_errors(self.controller)
465
466
alshabib8292c852016-03-01 22:49:13 -0800467class TestGroupForwarding(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000468
Admin02d052c2015-10-10 19:08:26 -0700469 def runTest(self):
470 logging.info("Running Group datapath forwarding tests")
471 delete_all_flows(self.controller)
Admin99c2a272016-03-01 12:56:39 -0800472 delete_all_groups(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700473
Admin09b5cc62015-10-11 13:53:59 -0700474 vlan_id = 201
Admin02d052c2015-10-10 19:08:26 -0700475
Jonathan Hartf65e1812015-10-05 15:15:37 -0700476 # Create a group
alshabibb9d4ee82016-03-01 14:12:42 -0800477 test_group_id = 1
Jonathan Hartf65e1812015-10-05 15:15:37 -0700478 group_add = createAllGroupAdd(test_group_id, [onu_port])
Admin02d052c2015-10-10 19:08:26 -0700479
480 self.controller.message_send(group_add)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700481 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700482 verify_no_errors(self.controller)
483
484 # Create a flow rule matching olt port and vlan id
485 match = ofp.match()
486 match.oxm_list.append(ofp.oxm.in_port(olt_port))
487 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
488
489 request = ofp.message.flow_add(
490 table_id=test_param_get("table", 0),
491 cookie=43,
492 match=match,
493 instructions=[
494 ofp.instruction.apply_actions(
alshabibb9d4ee82016-03-01 14:12:42 -0800495 actions=[ofp.action.group(group_id=test_group_id)]),
496 ],
497 buffer_id=ofp.OFP_NO_BUFFER, priority=1000)
Admin02d052c2015-10-10 19:08:26 -0700498
499 self.controller.message_send(request)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700500 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700501 verify_no_errors(self.controller)
Admin09b5cc62015-10-11 13:53:59 -0700502
503 # It takes some time for flows to propagate down to the data plane
Admindcb1bc72015-11-12 18:24:56 -0800504 time.sleep(10)
alshabibb9d4ee82016-03-01 14:12:42 -0800505
506 inPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True,
Admindcb1bc72015-11-12 18:24:56 -0800507 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0, eth_dst="01:01:11:12:11:12")
Admin02d052c2015-10-10 19:08:26 -0700508 outPkt = inPkt
509 self.dataplane.send(olt_port, str(inPkt))
510 verify_packet(self, outPkt, onu_port)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700511
Admindcb1bc72015-11-12 18:24:56 -0800512
Zsolt Harasztife525502016-03-02 05:18:52 +0000513 # Now put 2 ONU ports in the group and test that the input packet is
Jonathan Hartf65e1812015-10-05 15:15:37 -0700514 # duplicated out both ports
515 group_mod = createAllGroupMod(test_group_id, ports=[onu_port, onu_port2])
516 self.controller.message_send(group_mod)
517 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700518 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800519
Admin09b5cc62015-10-11 13:53:59 -0700520 # It takes some time for flows to propagate down to the data plane
Admindcb1bc72015-11-12 18:24:56 -0800521 time.sleep(10)
Admin09b5cc62015-10-11 13:53:59 -0700522
Jonathan Hartf65e1812015-10-05 15:15:37 -0700523 self.dataplane.send(olt_port, str(inPkt))
Jonathan Hartf65e1812015-10-05 15:15:37 -0700524 verify_packet(self, outPkt, onu_port2)
Admindcb1bc72015-11-12 18:24:56 -0800525 verify_packet(self, outPkt, onu_port)
alshabibb9d4ee82016-03-01 14:12:42 -0800526 # verify_packets(self, outPkt, [onu_port,onu_port2])
Admin02d052c2015-10-10 19:08:26 -0700527
Jonathan Hartf65e1812015-10-05 15:15:37 -0700528 # clean up the test
alshabibb9d4ee82016-03-01 14:12:42 -0800529 request = ofp.message.flow_delete(table_id=test_param_get("table", 0))
Admin02d052c2015-10-10 19:08:26 -0700530 self.controller.message_send(request)
alshabibb9d4ee82016-03-01 14:12:42 -0800531 group_delete = ofp.message.group_delete(xid=2, group_id=test_group_id)
Admin02d052c2015-10-10 19:08:26 -0700532 self.controller.message_send(group_delete)
alshabibb9d4ee82016-03-01 14:12:42 -0800533
Jonathan Hartf65e1812015-10-05 15:15:37 -0700534 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700535 verify_no_errors(self.controller)
536
Admindcb1bc72015-11-12 18:24:56 -0800537
alshabib8292c852016-03-01 22:49:13 -0800538class TestGroupModForwarding(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000539
Admindcb1bc72015-11-12 18:24:56 -0800540 def runTest(self):
alshabibb9d4ee82016-03-01 14:12:42 -0800541 logging.info("Running datapath forwarding tests for group mod")
Admindcb1bc72015-11-12 18:24:56 -0800542 delete_all_flows(self.controller)
543 delete_all_groups(self.controller)
544
545 vlan_id = 201
546
547 # Create a group
alshabibb9d4ee82016-03-01 14:12:42 -0800548 test_group_id = 1
Admindcb1bc72015-11-12 18:24:56 -0800549 group_add = createAllGroupAdd(test_group_id, [onu_port, onu_port2])
550
551 self.controller.message_send(group_add)
552 do_barrier(self.controller)
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 | vlan_id))
559
560 request = ofp.message.flow_add(
561 table_id=test_param_get("table", 0),
562 cookie=43,
563 match=match,
564 instructions=[
565 ofp.instruction.apply_actions(
alshabibb9d4ee82016-03-01 14:12:42 -0800566 actions=[ofp.action.group(group_id=test_group_id)]),
567 ],
568 buffer_id=ofp.OFP_NO_BUFFER, priority=1000)
Admindcb1bc72015-11-12 18:24:56 -0800569
570 self.controller.message_send(request)
571 do_barrier(self.controller)
572 verify_no_errors(self.controller)
573
574 # It takes some time for flows to propagate down to the data plane
575 time.sleep(10)
alshabibb9d4ee82016-03-01 14:12:42 -0800576
577 inPkt = simple_udp_packet(pktlen=104, dl_vlan_enable=True,
Admindcb1bc72015-11-12 18:24:56 -0800578 vlan_vid=vlan_id, vlan_pcp=0, dl_vlan_cfi=0, eth_dst="01:01:11:12:11:12")
579 outPkt = inPkt
580 self.dataplane.send(olt_port, str(inPkt))
581 verify_packet(self, outPkt, onu_port)
Admin99c2a272016-03-01 12:56:39 -0800582 verify_packet(self, outPkt, onu_port2)
Admindcb1bc72015-11-12 18:24:56 -0800583
584 # Now remove onu port 1 from the group and test that the input packet is no longer forwarded to onu port 1
585 group_mod = createAllGroupMod(test_group_id, ports=[onu_port2])
586 self.controller.message_send(group_mod)
587 do_barrier(self.controller)
588 verify_no_errors(self.controller)
589
590 time.sleep(10)
591 self.dataplane.send(olt_port, str(inPkt))
592 verify_no_packet(self, outPkt, onu_port)
593 verify_packet(self, outPkt, onu_port2)
594
Zsolt Harasztife525502016-03-02 05:18:52 +0000595 # Now remove all ports in the group and test that the input packet is no longer forwarded to any port
Admindcb1bc72015-11-12 18:24:56 -0800596 group_mod = createAllGroupMod(test_group_id, ports=[])
597 self.controller.message_send(group_mod)
598 do_barrier(self.controller)
599 verify_no_errors(self.controller)
600 time.sleep(10)
601 self.dataplane.send(olt_port, str(inPkt))
602 verify_packets(self, outPkt, [])
603
604
alshabib8292c852016-03-01 22:49:13 -0800605class TransparentVlanTest(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000606
Admin02d052c2015-10-10 19:08:26 -0700607 def runTest(self):
608 logging.info("Running transparent vlan tests")
Admin09b5cc62015-10-11 13:53:59 -0700609 delete_all_flows(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700610
Jonathan Hartf65e1812015-10-05 15:15:37 -0700611 vlan_id = 201
Admin02d052c2015-10-10 19:08:26 -0700612 match = ofp.match()
613 match.oxm_list.append(ofp.oxm.in_port(onu_port))
alshabibb9d4ee82016-03-01 14:12:42 -0800614 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
Admin02d052c2015-10-10 19:08:26 -0700615
616 request = ofp.message.flow_add(
617 table_id=test_param_get("table", 0),
618 cookie=42,
619 match=match,
620 instructions=[
621 ofp.instruction.apply_actions(
622 actions=[
623 ofp.action.output(port=olt_port)]),
alshabibb9d4ee82016-03-01 14:12:42 -0800624 ],
Admin02d052c2015-10-10 19:08:26 -0700625 buffer_id=ofp.OFP_NO_BUFFER,
626 priority=1000)
627
628 self.controller.message_send(request)
alshabibb9d4ee82016-03-01 14:12:42 -0800629
Admin02d052c2015-10-10 19:08:26 -0700630 match = ofp.match()
631 match.oxm_list.append(ofp.oxm.in_port(olt_port))
632 match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
633
634 request = ofp.message.flow_add(
635 table_id=test_param_get("table", 0),
636 cookie=43,
637 match=match,
638 instructions=[
639 ofp.instruction.apply_actions(
640 actions=[
641 ofp.action.output(port=onu_port)]),
alshabibb9d4ee82016-03-01 14:12:42 -0800642 ],
Admin02d052c2015-10-10 19:08:26 -0700643 buffer_id=ofp.OFP_NO_BUFFER,
644 priority=1000)
645
646 self.controller.message_send(request)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700647 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700648 verify_no_errors(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700649
Admin09b5cc62015-10-11 13:53:59 -0700650 # It takes some time for flows to propagate down to the data plane
651 time.sleep(2)
alshabibb9d4ee82016-03-01 14:12:42 -0800652
Jonathan Hartf65e1812015-10-05 15:15:37 -0700653 inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0)
Zsolt Harasztife525502016-03-02 05:18:52 +0000654
Admin02d052c2015-10-10 19:08:26 -0700655 # upstream
656 self.dataplane.send(onu_port, str(inPkt))
657 verify_packet(self, inPkt, olt_port)
Zsolt Harasztife525502016-03-02 05:18:52 +0000658
Admin99c2a272016-03-01 12:56:39 -0800659 # downstream
660 self.dataplane.send(olt_port, str(inPkt))
661 verify_packet(self, inPkt, onu_port)
Admin02d052c2015-10-10 19:08:26 -0700662
Jonathan Hartf65e1812015-10-05 15:15:37 -0700663 # clean up the test
Admin02d052c2015-10-10 19:08:26 -0700664 delete_all_flows(self.controller)
Jonathan Hartf65e1812015-10-05 15:15:37 -0700665 do_barrier(self.controller)
Admin02d052c2015-10-10 19:08:26 -0700666 verify_no_errors(self.controller)
667
alshabib8292c852016-03-01 22:49:13 -0800668class RemoveRuleTest(OltBaseTest):
alshabib28c03c32016-03-01 20:33:51 -0800669
670 def runTest(self):
671 logging.info("Testing Rule removal")
alshabibe165af22016-03-01 21:42:17 -0800672 delete_all_flows(self.controller)
Admin0d036132016-03-01 23:00:46 -0800673 self.processEapolRule(onu_port)
alshabibe165af22016-03-01 21:42:17 -0800674
alshabib9929a152016-03-01 21:25:18 -0800675 #wait for the rule to settle
676 time.sleep(3)
677
Admin0d036132016-03-01 23:00:46 -0800678 self.installDoubleTaggingRules(1, 2)
alshabibe165af22016-03-01 21:42:17 -0800679
alshabib9929a152016-03-01 21:25:18 -0800680 #wait for the rules to settle
681 time.sleep(3)
682
683 stats = get_flow_stats(self, ofp.match())
684
Admin53e10b62016-03-01 21:52:18 -0800685 self.assertTrue(len(stats) == 5, \
686 "Wrong number of rules reports; reported %s, expected 5\n\n %s" % (len(stats), stats))
alshabib9929a152016-03-01 21:25:18 -0800687
Admin0d036132016-03-01 23:00:46 -0800688 self.processEapolRule(onu_port, install = False)
alshabib9929a152016-03-01 21:25:18 -0800689 time.sleep(3)
690
691 stats = get_flow_stats(self, ofp.match())
692
Admin53e10b62016-03-01 21:52:18 -0800693 self.assertTrue(len(stats) == 4, \
694 "Wrong number of rules reports; reported %s, expected 4\n\n %s" % (len(stats), stats))
alshabib9929a152016-03-01 21:25:18 -0800695
alshabibeff3ba92016-03-01 22:21:00 -0800696 eapol = ofp.oxm.eth_type(0x888e)
697 found = False
698 for fe in stats:
699 if eapol in fe.match.oxm_list:
700 found = True
701
702 self.assertFalse(found, "Removed incorrect flow rule")
alshabib28c03c32016-03-01 20:33:51 -0800703
704
alshabib8292c852016-03-01 22:49:13 -0800705class MultipleDoubleTaggingForwarding(OltBaseTest):
alshabib28c03c32016-03-01 20:33:51 -0800706
707 def runTests(self):
708 logging.info("Testing multiple Q-in-Q rules")
709 pass
710
alshabibb9d4ee82016-03-01 14:12:42 -0800711
alshabibeff3ba92016-03-01 22:21:00 -0800712class DoubleVlanTest(OltBaseTest):
Zsolt Harasztife525502016-03-02 05:18:52 +0000713
Adminb17b1662015-10-19 15:50:53 -0700714 def runTest(self):
715 logging.info("Running double vlan tests")
716 delete_all_flows(self.controller)
717
718 c_vlan_id = 100
alshabibb9d4ee82016-03-01 14:12:42 -0800719 s_vlan_id = 102
Zsolt Harasztife525502016-03-02 05:18:52 +0000720
alshabibeff3ba92016-03-01 22:21:00 -0800721 self.installDoubleTaggingRules(s_vlan_id, c_vlan_id)
Adminb17b1662015-10-19 15:50:53 -0700722
Adminb17b1662015-10-19 15:50:53 -0700723 # It takes some time for flows to propagate down to the data plane
724 time.sleep(10)
alshabibb9d4ee82016-03-01 14:12:42 -0800725
Zsolt Harasztife525502016-03-02 05:18:52 +0000726 # Test packet flows
Admin0d036132016-03-01 23:00:46 -0800727 self.testPacketFlow(c_vlan_id, s_vlan_id)
Adminb17b1662015-10-19 15:50:53 -0700728
729 # clean up the test
730 delete_all_flows(self.controller)
731 do_barrier(self.controller)
732 verify_no_errors(self.controller)
alshabibb9d4ee82016-03-01 14:12:42 -0800733
734
alshabib8292c852016-03-01 22:49:13 -0800735class TestCyclingDoubleVlan(OltBaseTest):
alshabibb9d4ee82016-03-01 14:12:42 -0800736 """Cycle through vlans and test traffic flow"""
737
738 def runTest(self):
739 logging.info("Running cycling vlan test")
740
alshabib2ecca692016-03-01 15:10:38 -0800741 for stag in xrange(2, 4000, 100):
742 for ctag in xrange(2, 4000, 100):
alshabibf1f07dd2016-03-01 15:50:35 -0800743 delete_all_flows(self.controller)
744 time.sleep(5)
Admin0d036132016-03-01 23:00:46 -0800745 self.installDoubleTaggingRules(stag, ctag)
alshabibf1f07dd2016-03-01 15:50:35 -0800746 time.sleep(5)
Admin0d036132016-03-01 23:00:46 -0800747 self.testPacketFlow(ctag, stag)
alshabibb9d4ee82016-03-01 14:12:42 -0800748
alshabib9929a152016-03-01 21:25:18 -0800749
alshabibb9b39a72016-03-01 15:52:03 -0800750
alshabibb9d4ee82016-03-01 14:12:42 -0800751
alshabibb9d4ee82016-03-01 14:12:42 -0800752
alshabibb9d4ee82016-03-01 14:12:42 -0800753
alshabibb9d4ee82016-03-01 14:12:42 -0800754
alshabibb9d4ee82016-03-01 14:12:42 -0800755
alshabibb9d4ee82016-03-01 14:12:42 -0800756
alshabibb9d4ee82016-03-01 14:12:42 -0800757