ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 1 | |
| 2 | """These tests fall under Conformance Test-Suite (OF-SWITCH-1.0.0 TestCases). |
| 3 | Refer Documentation -- Detailed testing methodology |
| 4 | <Some of test-cases are directly taken from oftest> """ |
| 5 | |
| 6 | "Test Suite 6 ---> Actions " |
| 7 | |
| 8 | |
| 9 | import logging |
| 10 | |
| 11 | import unittest |
| 12 | import random |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 13 | import time |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 14 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 15 | from oftest import config |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 16 | import oftest.controller as controller |
Rich Lane | d7b0ffa | 2013-03-08 15:53:42 -0800 | [diff] [blame] | 17 | import ofp |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 18 | import oftest.dataplane as dataplane |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 19 | import oftest.parse as parse |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 20 | import oftest.base_tests as base_tests |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 21 | |
Rich Lane | da3b5ad | 2012-10-03 09:05:32 -0700 | [diff] [blame] | 22 | from oftest.testutils import * |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 23 | from time import sleep |
| 24 | from FuncUtils import * |
| 25 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 26 | class NoAction(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 27 | |
| 28 | """NoActionDrop : no action added to flow , drops the packet.""" |
| 29 | |
| 30 | def runTest(self): |
| 31 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 32 | logging.info("Running No_Action test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 33 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 34 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 35 | of_ports.sort() |
| 36 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 37 | |
| 38 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 39 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 40 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 41 | logging.info("Install a flow without action") |
| 42 | logging.info("Send packets matching that flow") |
| 43 | logging.info("Expecting switch to drop all packets") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 44 | |
| 45 | # Insert a flow wildcard all without any action |
| 46 | pkt = simple_tcp_packet() |
| 47 | match = parse.packet_to_flow_match(pkt) |
| 48 | self.assertTrue(match is not None, "Could not generate flow match from pkt") |
| 49 | match.wildcards=ofp.OFPFW_ALL |
| 50 | match.in_port = of_ports[0] |
| 51 | |
Rich Lane | ba3f0e2 | 2013-03-11 16:43:57 -0700 | [diff] [blame] | 52 | msg = ofp.message.flow_add() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 53 | msg.out_port = ofp.OFPP_NONE |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 54 | msg.buffer_id = 0xffffffff |
| 55 | msg.match = match |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 56 | self.controller.message_send(msg) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 57 | do_barrier(self.controller) |
ShreyaPandita | b46f852 | 2012-09-28 15:12:15 -0400 | [diff] [blame] | 58 | |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 59 | #Sending N packets matching the flow inserted |
| 60 | for pkt_cnt in range(5): |
| 61 | self.dataplane.send(of_ports[0],str(pkt)) |
| 62 | |
| 63 | #Verify packets not recieved on any of the dataplane ports |
ShreyaPandita | 7b9ec98 | 2012-09-28 14:43:08 -0400 | [diff] [blame] | 64 | (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(timeout=1,exp_pkt=pkt) |
| 65 | self.assertTrue(rcv_pkt is None, |
ShreyaPandita | d4a42c6 | 2012-09-28 15:35:27 -0400 | [diff] [blame] | 66 | "Packet received on port " + str(rcv_port)) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 67 | |
| 68 | #Verify packets not sent on control plane either |
Rich Lane | 4c504f3 | 2013-06-07 17:24:14 -0700 | [diff] [blame] | 69 | verify_no_packet_in(self, str(pkt), of_ports[0]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 70 | |
| 71 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 72 | class Announcement(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 73 | |
| 74 | """Announcement : Get all supported actions by the switch. |
| 75 | Send OFPT_FEATURES_REQUEST to get features supported by sw.""" |
| 76 | |
| 77 | def runTest(self): |
| 78 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 79 | logging.info("Running Announcement test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 80 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 81 | logging.info("Sending Features_Request") |
| 82 | logging.info("Expecting Features Reply with supported actions") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 83 | |
| 84 | # Sending Features_Request |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 85 | request = ofp.message.features_request() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 86 | (reply, pkt) = self.controller.transact(request) |
| 87 | self.assertTrue(reply is not None, "Failed to get any reply") |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame] | 88 | self.assertEqual(reply.type, ofp.OFPT_FEATURES_REPLY,'Response is not Features_reply') |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 89 | |
| 90 | supported_actions =[] |
| 91 | if(reply.actions &1<<ofp.OFPAT_OUTPUT): |
| 92 | supported_actions.append('OFPAT_OUTPUT') |
| 93 | if(reply.actions &1<<ofp.OFPAT_SET_VLAN_VID): |
| 94 | supported_actions.append('OFPAT_SET_VLAN_VID') |
| 95 | if(reply.actions &1<<ofp.OFPAT_SET_VLAN_PCP): |
| 96 | supported_actions.append('OFPAT_SET_VLAN_PCP') |
| 97 | if(reply.actions &1<<ofp.OFPAT_STRIP_VLAN): |
| 98 | supported_actions.append('OFPAT_STRIP_VLAN') |
| 99 | if(reply.actions &1<<ofp.OFPAT_SET_DL_SRC): |
| 100 | supported_actions.append('OFPAT_SET_DL_SRC') |
| 101 | if(reply.actions &1<<ofp.OFPAT_SET_DL_DST): |
| 102 | supported_actions.append('OFPAT_SET_NW_SRC') |
| 103 | if(reply.actions &1<<ofp.OFPAT_SET_NW_DST): |
| 104 | supported_actions.append('OFPAT_SET_NW_DST') |
| 105 | if(reply.actions &1<<ofp.OFPAT_SET_NW_TOS): |
| 106 | supported_actions.append('OFPAT_SET_NW_TOS') |
| 107 | if(reply.actions &1<<ofp.OFPAT_SET_TP_SRC): |
| 108 | supported_actions.append('OFPAT_SET_TP_SRC') |
| 109 | if(reply.actions &1<<ofp.OFPAT_SET_TP_DST): |
| 110 | supported_actions.append('OFPAT_SET_TP_DST') |
| 111 | if(reply.actions &1<<ofp.OFPAT_VENDOR): |
| 112 | supported_actions.append('OFPAT_VENDOR') |
| 113 | if(reply.actions &1<<ofp.OFPAT_ENQUEUE): |
| 114 | supported_actions.append('OFPAT_ENQUEUE') |
| 115 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 116 | logging.info(supported_actions) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 117 | |
| 118 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 119 | class ForwardAll(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 120 | |
| 121 | """ForwardAll : Packet is sent to all dataplane ports |
| 122 | except ingress port when output action.port = OFPP_ALL""" |
| 123 | |
| 124 | def runTest(self): |
| 125 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 126 | logging.info("Running Forward_All test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 127 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 128 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 129 | of_ports.sort() |
| 130 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 131 | |
| 132 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 133 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 134 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 135 | logging.info("Insert a flow with output action port OFPP_ALL") |
| 136 | logging.info("Send packet matching the flow") |
| 137 | logging.info("Expecting packet on all dataplane ports except ingress_port") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 138 | |
| 139 | #Create a packet |
| 140 | pkt = simple_tcp_packet() |
| 141 | match = parse.packet_to_flow_match(pkt) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 142 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 143 | |
| 144 | #Delete all flows |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 145 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 146 | ingress_port=of_ports[0] |
| 147 | match.in_port = ingress_port |
| 148 | |
| 149 | #Create a flow mod with action.port = OFPP_ALL |
Rich Lane | ba3f0e2 | 2013-03-11 16:43:57 -0700 | [diff] [blame] | 150 | request = ofp.message.flow_add() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 151 | request.match = match |
| 152 | request.match.wildcards = ofp.OFPFW_ALL&~ofp.OFPFW_IN_PORT |
| 153 | act.port = ofp.OFPP_ALL |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame] | 154 | request.actions.append(act) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 155 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 156 | logging.info("Inserting flow") |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 157 | self.controller.message_send(request) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 158 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 159 | |
| 160 | #Send Packet matching the flow |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 161 | logging.info("Sending packet to dp port " + str(ingress_port)) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 162 | self.dataplane.send(ingress_port, str(pkt)) |
| 163 | |
| 164 | #Verifying packets recieved on expected dataplane ports |
| 165 | yes_ports = set(of_ports).difference([ingress_port]) |
| 166 | receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port], |
Rich Lane | 2014f9b | 2012-10-05 15:29:40 -0700 | [diff] [blame] | 167 | self) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 168 | |
| 169 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 170 | class ForwardController(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 171 | |
| 172 | """ForwardController : Packet is sent to controller |
| 173 | output.port = OFPP_CONTROLLER""" |
| 174 | |
| 175 | def runTest(self): |
| 176 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 177 | logging.info("Running Forward_Controller test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 178 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 179 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 180 | of_ports.sort() |
| 181 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 182 | |
| 183 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 184 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 185 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 186 | logging.info("Insert a flow with output action port OFPP_CONTROLLER") |
| 187 | logging.info("Send packet matching the flow") |
| 188 | logging.info("Expecting packet on the control plane") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 189 | |
| 190 | #Create packet |
| 191 | pkt = simple_tcp_packet() |
| 192 | match = parse.packet_to_flow_match(pkt) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 193 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 194 | |
| 195 | for ingress_port in of_ports: |
| 196 | #Delete all flows |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 197 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 198 | |
| 199 | match.in_port = ingress_port |
| 200 | |
| 201 | #Create a flow mod message |
Rich Lane | ba3f0e2 | 2013-03-11 16:43:57 -0700 | [diff] [blame] | 202 | request = ofp.message.flow_add() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 203 | request.match = match |
| 204 | act.port = ofp.OFPP_CONTROLLER |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame] | 205 | request.actions.append(act) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 206 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 207 | logging.info("Inserting flow") |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 208 | self.controller.message_send(request) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 209 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 210 | |
| 211 | #Send packet matching the flow |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 212 | logging.info("Sending packet to dp port " + str(ingress_port)) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 213 | self.dataplane.send(ingress_port, str(pkt)) |
| 214 | |
| 215 | #Verifying packet recieved on the control plane port |
Rich Lane | 4c504f3 | 2013-06-07 17:24:14 -0700 | [diff] [blame] | 216 | verify_packet_in(self, str(pkt), ingress_port, ofp.OFPR_ACTION) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 217 | |
| 218 | |
| 219 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 220 | class ForwardLocal(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 221 | |
| 222 | """ForwardLocal : Packet is sent to OFPP_LOCAL port . |
| 223 | TBD : To verify packet recieved in the local networking stack of switch""" |
| 224 | |
| 225 | def runTest(self): |
| 226 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 227 | logging.info("Running Forward_Local test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 228 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 229 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 230 | of_ports.sort() |
| 231 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 232 | |
| 233 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 234 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 235 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 236 | logging.info("Insert a flow with output action port OFPP_LOCAL") |
| 237 | logging.info("Send packet matching the flow") |
| 238 | logging.info("Expecting packet in the local networking stack of switch") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 239 | |
| 240 | #Clear switch state |
| 241 | pkt = simple_tcp_packet() |
| 242 | match = parse.packet_to_flow_match(pkt) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 243 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 244 | |
| 245 | for ingress_port in of_ports: |
| 246 | #Delete the flows |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 247 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 248 | |
| 249 | match.in_port = ingress_port |
| 250 | #Create flow mod message |
Rich Lane | ba3f0e2 | 2013-03-11 16:43:57 -0700 | [diff] [blame] | 251 | request = ofp.message.flow_add() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 252 | request.match = match |
| 253 | act.port = ofp.OFPP_LOCAL |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame] | 254 | request.actions.append(act) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 255 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 256 | logging.info("Inserting flow") |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 257 | self.controller.message_send(request) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 258 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 259 | |
| 260 | #Send packet matching the flow |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 261 | logging.info("Sending packet to dp port " + str(ingress_port)) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 262 | self.dataplane.send(ingress_port, str(pkt)) |
| 263 | |
| 264 | #TBD: Verification of packets being recieved. |
| 265 | |
| 266 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 267 | class ForwardFlood(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 268 | |
| 269 | """Forward:Flood : Packet is sent to all dataplane ports |
| 270 | except ingress port when output action.port = OFPP_FLOOD |
| 271 | TBD : Verification---Incase of STP being implemented, flood the packet along the minimum spanning tree, |
| 272 | not including the incoming interface. """ |
| 273 | |
| 274 | def runTest(self): |
| 275 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 276 | logging.info("Running Forward_Flood test") |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 277 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 278 | of_ports.sort() |
| 279 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 280 | |
| 281 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 282 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 283 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 284 | logging.info("Insert a flow with output action port OFPP_FORWARD") |
| 285 | logging.info("Send packet matching the flow") |
| 286 | logging.info("Expecting packet on all the ports except the input port") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 287 | |
| 288 | #Create a packet |
| 289 | pkt = simple_tcp_packet() |
| 290 | match = parse.packet_to_flow_match(pkt) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 291 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 292 | |
| 293 | #Delete all flows |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 294 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 295 | ingress_port=of_ports[0] |
| 296 | match.in_port = ingress_port |
| 297 | |
| 298 | #Create a flow mod with action.port = OFPP_ALL |
Rich Lane | ba3f0e2 | 2013-03-11 16:43:57 -0700 | [diff] [blame] | 299 | request = ofp.message.flow_add() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 300 | request.match = match |
| 301 | request.match.wildcards = ofp.OFPFW_ALL&~ofp.OFPFW_IN_PORT |
| 302 | act.port = ofp.OFPP_FLOOD |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame] | 303 | request.actions.append(act) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 304 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 305 | logging.info("Inserting flow") |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 306 | self.controller.message_send(request) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 307 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 308 | |
| 309 | #Send Packet matching the flow |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 310 | logging.info("Sending packet to dp port " + str(ingress_port)) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 311 | self.dataplane.send(ingress_port, str(pkt)) |
| 312 | |
| 313 | #Verifying packets recieved on expected dataplane ports |
| 314 | yes_ports = set(of_ports).difference([ingress_port]) |
| 315 | receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port], |
Rich Lane | 2014f9b | 2012-10-05 15:29:40 -0700 | [diff] [blame] | 316 | self) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 317 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 318 | class ForwardInport(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 319 | |
| 320 | """ ForwardInPort : Packet sent to virtual port IN_PORT |
| 321 | If the output.port = OFPP.INPORT then the packet is sent to the input port itself""" |
| 322 | |
| 323 | def runTest(self): |
| 324 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 325 | logging.info("Running Forward_Inport test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 326 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 327 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 328 | of_ports.sort() |
| 329 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 330 | |
| 331 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 332 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 333 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 334 | logging.info("Insert a flow with output action port OFPP_INPORT") |
| 335 | logging.info("Send packet matching the flow") |
| 336 | logging.info("Expecting packet on the input port") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 337 | |
| 338 | #Create a packet |
| 339 | pkt = simple_tcp_packet() |
| 340 | match = parse.packet_to_flow_match(pkt) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 341 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 342 | |
| 343 | #Delete the flows |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 344 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 345 | ingress_port=of_ports[0] |
| 346 | match.in_port = ingress_port |
| 347 | |
| 348 | # Create a flow mod message |
Rich Lane | ba3f0e2 | 2013-03-11 16:43:57 -0700 | [diff] [blame] | 349 | request = ofp.message.flow_add() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 350 | request.match = match |
| 351 | act.port = ofp.OFPP_IN_PORT |
| 352 | |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame] | 353 | request.actions.append(act) |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 354 | logging.info("Inserting flow") |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 355 | self.controller.message_send(request) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 356 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 357 | |
| 358 | #Send packet matching the flow |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 359 | logging.info("Sending packet to dp port " + str(ingress_port)) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 360 | self.dataplane.send(ingress_port, str(pkt)) |
| 361 | yes_ports = [ingress_port] |
| 362 | |
| 363 | #Verfying packet recieved on expected dataplane ports |
| 364 | receive_pkt_check(self.dataplane, pkt, yes_ports,set(of_ports).difference([ingress_port]), |
Rich Lane | 2014f9b | 2012-10-05 15:29:40 -0700 | [diff] [blame] | 365 | self) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 366 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 367 | class ForwardTable(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 368 | |
| 369 | """ForwardTable : Perform actions in flow table. Only for packet-out messages. |
| 370 | If the output action.port in the packetout message = OFP.TABLE , then |
| 371 | the packet implements the action specified in the matching flow of the FLOW-TABLE""" |
| 372 | |
| 373 | def runTest(self): |
| 374 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 375 | logging.info("Running Forward_Table test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 376 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 377 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 378 | of_ports.sort() |
| 379 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 380 | |
| 381 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 382 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 383 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 384 | logging.info("Insert a flow F with output action port set to some egress_port") |
| 385 | logging.info("Send packet out message (matching flow F) with action.port = OFP.TABLE") |
| 386 | logging.info("Expecting packet on the egress_port") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 387 | |
| 388 | #Insert a all wildcarded flow |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 389 | (pkt,match) = wildcard_all(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 390 | |
| 391 | #Create a packet out message |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 392 | pkt_out =ofp.message.packet_out(); |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 393 | pkt_out.data = str(pkt) |
| 394 | pkt_out.in_port = of_ports[0] |
Rich Lane | ea8c472 | 2013-04-04 15:30:20 -0700 | [diff] [blame] | 395 | pkt_out.buffer_id = 0xffffffff |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 396 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 397 | act.port = ofp.OFPP_TABLE |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame] | 398 | pkt_out.actions.append(act) |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 399 | self.controller.message_send(pkt_out) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 400 | |
| 401 | #Verifying packet out message recieved on the expected dataplane port. |
| 402 | (of_port, pkt, pkt_time) = self.dataplane.poll(port_number=of_ports[1], |
| 403 | exp_pkt=pkt,timeout=3) |
| 404 | self.assertTrue(pkt is not None, 'Packet not received') |
| 405 | |
| 406 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 407 | class AddVlanTag(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 408 | |
| 409 | """AddVlanTag : Adds VLAN Tag to untagged packet.""" |
| 410 | |
| 411 | def runTest(self): |
| 412 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 413 | logging.info("Running Add_vlan_tag test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 414 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 415 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 416 | of_ports.sort() |
| 417 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 418 | |
| 419 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 420 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 421 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 422 | logging.info("Verify if switch supports the action -- set vlan id, if not skip the test") |
| 423 | logging.info("Insert a flow with set vid action") |
| 424 | logging.info("Send packet matching the flow , verify recieved packet has vid set") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 425 | |
| 426 | #Verify set_vlan_id is a supported action |
| 427 | sup_acts = sw_supported_actions(self) |
| 428 | if not(sup_acts & 1<<ofp.OFPAT_SET_VLAN_VID): |
| 429 | skip_message_emit(self, "Add VLAN tag test skipped") |
| 430 | return |
| 431 | |
| 432 | #Create packet to be sent and an expected packet with vid set |
| 433 | new_vid = 2 |
| 434 | len_wo_vid = 100 |
| 435 | len_w_vid = 104 |
| 436 | pkt = simple_tcp_packet(pktlen=len_wo_vid) |
| 437 | exp_pkt = simple_tcp_packet(pktlen=len_w_vid, dl_vlan_enable=True, |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 438 | vlan_vid=new_vid,vlan_pcp=0) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 439 | vid_act = ofp.action.set_vlan_vid() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 440 | vid_act.vlan_vid = new_vid |
| 441 | |
| 442 | #Insert flow with action -- set vid , Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 443 | flow_match_test(self, config["port_map"], pkt=pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 444 | exp_pkt=exp_pkt, action_list=[vid_act]) |
| 445 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 446 | class ModifyVlanTag(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 447 | |
| 448 | """ModifyVlanTag : Modifies VLAN Tag to tagged packet.""" |
| 449 | |
| 450 | def runTest(self): |
| 451 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 452 | logging.info("Running Modify_Vlan_Tag test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 453 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 454 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 455 | of_ports.sort() |
| 456 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 457 | |
| 458 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 459 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 460 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 461 | logging.info("Verify if switch supports the action -- modify vlan id, if not skip the test") |
| 462 | logging.info("Insert a flow with action --set vid ") |
| 463 | logging.info("Send tagged packet matching the flow , verify recieved packet has vid rewritten") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 464 | |
| 465 | #Verify set_vlan_id is a supported action |
| 466 | sup_acts = sw_supported_actions(self) |
| 467 | if not (sup_acts & 1 << ofp.OFPAT_SET_VLAN_VID): |
| 468 | skip_message_emit(self, "Modify VLAN tag test skipped") |
| 469 | return |
| 470 | |
| 471 | #Create a tagged packet with old_vid to be sent, and expected packet with new_vid |
| 472 | old_vid = 2 |
| 473 | new_vid = 3 |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 474 | pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=old_vid) |
| 475 | exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=new_vid) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 476 | vid_act = ofp.action.set_vlan_vid() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 477 | vid_act.vlan_vid = new_vid |
| 478 | |
| 479 | #Insert flow with action -- set vid , Send packet matching the flow.Verify recieved packet is expected packet. |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 480 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 481 | action_list=[vid_act]) |
| 482 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 483 | class VlanPrio1(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 484 | |
| 485 | """AddVlanPrioUntaggedPkt : Add VLAN priority to untagged packet.""" |
| 486 | |
| 487 | def runTest(self): |
| 488 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 489 | logging.info("Running vlan_Prio_1 test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 490 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 491 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 492 | of_ports.sort() |
| 493 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 494 | |
| 495 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 496 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 497 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 498 | logging.info("Verify if switch supports the action -- set vlan priority, if not skip the test") |
| 499 | logging.info("Insert a flow with action -- set vlan priority ") |
| 500 | logging.info("Send untagged packet matching the flow , verify recieved packet has specified VLAN priority and has vid set tO 0 ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 501 | |
| 502 | #Verify set_vlan_priority is a supported action |
| 503 | sup_acts = sw_supported_actions(self) |
| 504 | if not (sup_acts & 1 << ofp.OFPAT_SET_VLAN_PCP): |
| 505 | skip_message_emit(self, "Set VLAN priority test skipped") |
| 506 | return |
| 507 | |
| 508 | #Create a untagged packet to be sent and an expected packet with vid = 0 , vlan_priority set. |
| 509 | vlan_id = 0 |
Rich Lane | 123928c | 2012-10-04 21:28:53 -0700 | [diff] [blame] | 510 | vlan_pcp = 1 |
Dan Talayco | 3bfc822 | 2013-02-13 18:18:57 -0800 | [diff] [blame] | 511 | pktlen = 64 if config["minsize"] < 64 else config["minsize"] |
| 512 | pkt = simple_tcp_packet(pktlen=pktlen) |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 513 | exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vlan_id,vlan_pcp=vlan_pcp, pktlen=pktlen + 4) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 514 | act = ofp.action.set_vlan_pcp() |
Rich Lane | 123928c | 2012-10-04 21:28:53 -0700 | [diff] [blame] | 515 | act.vlan_pcp = vlan_pcp |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 516 | |
| 517 | #Insert flow with action -- set vLAN priority, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 518 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 519 | action_list=[act]) |
| 520 | |
| 521 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 522 | class VlanPrio2(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 523 | |
| 524 | """ModifyVlanPrio : Modify VLAN priority to tagged packet.""" |
| 525 | |
| 526 | def runTest(self): |
| 527 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 528 | logging.info("Running Vlan_Prio_2 test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 529 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 530 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 531 | of_ports.sort() |
| 532 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 533 | |
| 534 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 535 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 536 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 537 | logging.info("Verify if switch supports the action -- set vlan priority, if not skip the test") |
| 538 | logging.info("Insert a flow with action -- set vlan priority ") |
| 539 | logging.info("Send tagged packet matching the flow, verify recieved packet has vlan priority rewritten") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 540 | |
| 541 | #Verify set_vlan_priority is a supported action |
| 542 | sup_acts = sw_supported_actions(self,"true") |
| 543 | if not (sup_acts & 1 << ofp.OFPAT_SET_VLAN_PCP): |
| 544 | skip_message_emit(self, "modify_vlan_prio test skipped") |
| 545 | return |
| 546 | |
| 547 | #Create a tagged packet , and an expected packet with vlan_priority set to specified value |
| 548 | vid = 123 |
| 549 | old_vlan_pcp = 2 |
| 550 | new_vlan_pcp = 3 |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 551 | pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vid, vlan_pcp=old_vlan_pcp) |
| 552 | exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vid, vlan_pcp=new_vlan_pcp) |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 553 | vid_act = ofp.action.set_vlan_pcp() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 554 | vid_act.vlan_pcp = new_vlan_pcp |
| 555 | |
| 556 | #Insert flow with action -- set vLAN priority, Send tagged packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 557 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 558 | action_list=[vid_act]) |
| 559 | |
| 560 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 561 | class ModifyL2Src(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 562 | |
| 563 | """ModifyL2Src :Modify the source MAC address""" |
| 564 | |
| 565 | def runTest(self): |
| 566 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 567 | logging.info("Running Modify_L2_Src test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 568 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 569 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 570 | of_ports.sort() |
| 571 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 572 | |
| 573 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 574 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 575 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 576 | logging.info("Verify if switch supports the action -- modify_l2_src, if not skip the test") |
| 577 | logging.info("Insert a flow with action -- set etherent src address") |
| 578 | logging.info("Send packet matching the flow, verify recieved packet src address rewritten ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 579 | |
| 580 | #Verify set_dl_src is a supported action |
| 581 | sup_acts = sw_supported_actions(self,use_cache="true") |
| 582 | if not (sup_acts & 1 << ofp.OFPAT_SET_DL_SRC): |
| 583 | skip_message_emit(self, "modify_l2_src test skipped") |
| 584 | return |
| 585 | |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 586 | #Create packet to be sent and expected packet with eth_src set to specified value |
| 587 | (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_src'], |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 588 | check_test_params=True) |
| 589 | |
| 590 | #Insert flow with action -- set src address, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 591 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 592 | action_list=acts, max_test=2) |
| 593 | |
| 594 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 595 | class ModifyL2Dst(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 596 | |
| 597 | """ModifyL2SDSt :Modify the dest MAC address""" |
| 598 | |
| 599 | def runTest(self): |
| 600 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 601 | logging.info("Running Modify_L2_Dst test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 602 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 603 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 604 | of_ports.sort() |
| 605 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 606 | |
| 607 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 608 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 609 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 610 | logging.info("Verify if switch supports the action -- modify_l2_dst, if not skip the test") |
| 611 | logging.info("Insert a flow with action -- set etherent dst address ") |
| 612 | logging.info("Send packet matching the flow, verify recieved packet dst address rewritten ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 613 | |
| 614 | #Verify set_dl_dst is a supported action |
| 615 | sup_acts = sw_supported_actions(self) |
| 616 | if not (sup_acts & 1 << ofp.OFPAT_SET_DL_DST): |
| 617 | skip_message_emit(self, "modify_l2_dst test skipped") |
| 618 | return |
| 619 | |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 620 | #Create packet to be sent and expected packet with eth_src set to specified value |
| 621 | (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_dst'], |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 622 | check_test_params=True) |
| 623 | |
| 624 | #Insert flow with action -- set dst address, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 625 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 626 | action_list=acts, max_test=2) |
| 627 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 628 | class ModifyL3Src(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 629 | |
| 630 | """ModifyL3Src : Modify the source IP address of an IP packet """ |
| 631 | |
| 632 | def runTest(self): |
| 633 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 634 | logging.info("Running Modify_L3_Src test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 635 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 636 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 637 | of_ports.sort() |
| 638 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 639 | |
| 640 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 641 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 642 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 643 | logging.info("Verify if switch supports the action -- modify_l3_src, if not skip the test") |
| 644 | logging.info("Insert a flow with action -- set network src address ") |
| 645 | logging.info("Send packet matching the flow, verify recieved packet network src address rewritten ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 646 | |
| 647 | #Verify set_nw_src is a supported action |
| 648 | sup_acts = sw_supported_actions(self) |
| 649 | if not (sup_acts & 1 << ofp.OFPAT_SET_NW_SRC): |
| 650 | skip_message_emit(self, "modify_l3_src test") |
| 651 | return |
| 652 | |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 653 | #Create packet to be sent and expected packet with ipv4_src set to specified value |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 654 | (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['ip_src'], |
| 655 | check_test_params=True) |
| 656 | |
| 657 | #Insert flow with action -- set nw src address, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 658 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 659 | action_list=acts, max_test=2) |
| 660 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 661 | class ModifyL3Dst(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 662 | |
| 663 | """ModifyL3Dst :Modify the dest IP address of an IP packet""" |
| 664 | |
| 665 | def runTest(self): |
| 666 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 667 | logging.info("Running Modify_L3_Dst test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 668 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 669 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 670 | of_ports.sort() |
| 671 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 672 | |
| 673 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 674 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 675 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 676 | logging.info("Verify if switch supports the action -- modify_l3_dst, if not skip the test") |
| 677 | logging.info("Insert a flow with action -- set network dst address ") |
| 678 | logging.info("Send packet matching the flow, verify recieved packet network dst address rewritten ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 679 | |
| 680 | #Verify set_nw_dst is a supported action |
| 681 | sup_acts = sw_supported_actions(self,use_cache="true") |
| 682 | if not (sup_acts & 1 << ofp.OFPAT_SET_NW_DST): |
| 683 | skip_message_emit(self, "modify_l3_dst test skipped") |
| 684 | return |
| 685 | |
Rich Lane | d0478ff | 2013-03-11 12:46:58 -0700 | [diff] [blame] | 686 | #Create packet to be sent and expected packet with ipv4_dst set to specified value |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 687 | (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['ip_dst'], |
| 688 | check_test_params=True) |
| 689 | |
| 690 | #Insert flow with action -- set nw dst address, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 691 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 692 | action_list=acts, max_test=2) |
| 693 | |
| 694 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 695 | class ModifyL4Src(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 696 | |
| 697 | """ModifyL4Src : Modify the source TCP port of a TCP packet""" |
| 698 | |
| 699 | def runTest(self): |
| 700 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 701 | logging.info("Running Modify_L4_Src test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 702 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 703 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 704 | of_ports.sort() |
| 705 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 706 | |
| 707 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 708 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 709 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 710 | logging.info("Verify if switch supports the action -- modify_l4_src, if not skip the test") |
| 711 | logging.info("Insert a flow with action -- set src tcp port") |
| 712 | logging.info("Send packet matching the flow, verify recieved packet src tcp port is rewritten ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 713 | |
| 714 | #Verify set_tp_src is a supported action |
| 715 | sup_acts = sw_supported_actions(self,use_cache="true") |
| 716 | if not (sup_acts & 1 << ofp.OFPAT_SET_TP_SRC): |
| 717 | skip_message_emit(self, "modify_l4_src test skipped") |
| 718 | return |
| 719 | |
| 720 | #Create packet to be sent and expected packet with tcp_src set to specified value |
| 721 | (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['tcp_sport'], |
| 722 | check_test_params=True) |
| 723 | |
| 724 | #Insert flow with action -- set tcp src port, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 725 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 726 | action_list=acts, max_test=2) |
| 727 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 728 | class ModifyL4Dst(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 729 | |
| 730 | """ ModifyL4Dst: Modify the dest TCP port of a TCP packet """ |
| 731 | |
| 732 | def runTest(self): |
| 733 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 734 | logging.info("Running Modify_L4_Dst test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 735 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 736 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 737 | of_ports.sort() |
| 738 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 739 | |
| 740 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 741 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 742 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 743 | logging.info("Verify if switch supports the action -- modify_l4_dst, if not skip the test") |
| 744 | logging.info("Insert a flow with action -- set dst tcp port") |
| 745 | logging.info("Send packet matching the flow, verify recieved packet dst tcp port is rewritten ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 746 | |
| 747 | #Verify set_tp_dst is a supported action |
| 748 | sup_acts = sw_supported_actions(self,use_cache="true") |
| 749 | if not (sup_acts & 1 << ofp.OFPAT_SET_TP_DST): |
| 750 | skip_message_emit(self, "ModifyL4Dst test") |
| 751 | return |
| 752 | |
| 753 | #Create packet to be sent and expected packet with tcp_dst set to specified value |
| 754 | (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['tcp_dport'], |
| 755 | check_test_params=True) |
| 756 | |
| 757 | #Insert flow with action -- set tcp dst port, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 758 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 759 | action_list=acts, max_test=2) |
| 760 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 761 | class ModifyTos(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 762 | |
| 763 | """ModifyTOS :Modify the IP type of service of an IP packet""" |
| 764 | |
| 765 | def runTest(self): |
| 766 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 767 | logging.info("Running Modify_Tos test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 768 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 769 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 770 | of_ports.sort() |
| 771 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 772 | |
| 773 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 774 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 775 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 776 | logging.info("Verify if switch supports the action -- modify_tos, if not skip the test") |
| 777 | logging.info("Insert a flow with action -- set type of service ") |
| 778 | logging.info("Send packet matching the flow, verify recieved packet has TOS rewritten ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 779 | |
| 780 | #Verify set_tos is a supported action |
| 781 | sup_acts = sw_supported_actions(self,use_cache="true") |
| 782 | if not (sup_acts & 1 << ofp.OFPAT_SET_NW_TOS): |
| 783 | skip_message_emit(self, "ModifyTOS test") |
| 784 | return |
| 785 | |
| 786 | #Create packet to be sent and expected packet with TOS set to specified value |
| 787 | (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['ip_tos'], |
| 788 | check_test_params=True) |
| 789 | |
| 790 | #Insert flow with action -- set TOS, Send packet matching the flow, Verify recieved packet is expected packet |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 791 | flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt, |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 792 | action_list=acts, max_test=2, egr_count=-1) |