ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 1 | """These tests fall under Conformance Test-Suite (OF-SWITCH-1.0.0 TestCases). |
| 2 | Refer Documentation -- Detailed testing methodology |
| 3 | <Some of test-cases are directly taken from oftest> """ |
| 4 | |
| 5 | "Test Suite 5 --> Counters" |
| 6 | |
| 7 | import logging |
| 8 | |
| 9 | import unittest |
| 10 | import random |
| 11 | |
| 12 | from oftest import config |
| 13 | import oftest.controller as controller |
| 14 | import oftest.cstruct as ofp |
| 15 | import oftest.message as message |
| 16 | import oftest.dataplane as dataplane |
| 17 | import oftest.action as action |
| 18 | import oftest.parse as parse |
| 19 | import oftest.base_tests as base_tests |
| 20 | import time |
| 21 | |
| 22 | from oftest.testutils import * |
| 23 | from time import sleep |
| 24 | from FuncUtils import* |
| 25 | |
| 26 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 27 | def port_queues_get(self, queue_stats, port_num): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 28 | result = [] |
| 29 | for qs in queue_stats.stats: |
| 30 | if qs.port_no != port_num: |
| 31 | continue |
| 32 | result.append(qs.queue_id) |
| 33 | return result |
| 34 | |
| 35 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 36 | class PktPerFlow(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 37 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 38 | """Verify Packet counters per flow are |
| 39 | incremented by no. of packets received for that flow""" |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 40 | |
| 41 | def runTest(self): |
| 42 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 43 | logging.info("Running PktPerFlow test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 44 | |
| 45 | of_ports = config["port_map"].keys() |
| 46 | of_ports.sort() |
| 47 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 48 | |
| 49 | #Clear switch state |
| 50 | rv = delete_all_flows(self.controller) |
| 51 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 52 | |
| 53 | logging.info("Insert any flow") |
| 54 | logging.info("Sending N Packets matching the flow") |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 55 | logging.info("Verify packet counters increment in accordance") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 56 | |
| 57 | #Create a Match on Ingress flow |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 58 | (pkt,match) = wildcard_all_except_ingress(self,of_ports) |
| 59 | |
| 60 | #Send Packets matching the flow |
| 61 | num_pkts = 5 |
| 62 | for pkt_cnt in range(num_pkts): |
| 63 | self.dataplane.send(of_ports[0],str(pkt)) |
| 64 | |
| 65 | #Verify Recieved Packets/Bytes Per Flow |
| 66 | verify_flowstats(self,match,packet_count=num_pkts) |
| 67 | |
| 68 | |
| 69 | class BytPerFlow(base_tests.SimpleDataPlane): |
| 70 | |
| 71 | """Verify Byte counters per flow are |
| 72 | incremented by no. of bytes received for that flow""" |
| 73 | |
| 74 | def runTest(self): |
| 75 | |
| 76 | logging.info("Running BytPerFlow test") |
| 77 | |
| 78 | of_ports = config["port_map"].keys() |
| 79 | of_ports.sort() |
| 80 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 81 | |
| 82 | #Clear switch state |
| 83 | rv = delete_all_flows(self.controller) |
| 84 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 85 | |
| 86 | logging.info("Insert any flow") |
| 87 | logging.info("Sending N Packets matching the flow") |
| 88 | logging.info("Verify byte counters increment in accordance") |
| 89 | |
| 90 | #Create a Match on Ingress flow |
| 91 | (pkt,match) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 92 | |
| 93 | #Send Packets matching the flow |
| 94 | num_pkts = 5 |
| 95 | byte_count = num_pkts*len(str(pkt)) |
| 96 | for pkt_cnt in range(num_pkts): |
| 97 | self.dataplane.send(of_ports[0],str(pkt)) |
| 98 | |
| 99 | #Verify Recieved Packets/Bytes Per Flow |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 100 | verify_flowstats(self,match,byte_count=byte_count) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 101 | |
| 102 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 103 | class DurationPerFlow(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 104 | |
| 105 | """Verify Duration_sec and Duration_nsec counters per flow varies in accordance with the amount of |
| 106 | time the flow was alive""" |
| 107 | |
| 108 | def runTest(self): |
| 109 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 110 | logging.info("Running DurationPerFlow test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 111 | |
| 112 | of_ports = config["port_map"].keys() |
| 113 | of_ports.sort() |
| 114 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 115 | |
| 116 | #Clear switch state |
| 117 | rc = delete_all_flows(self.controller) |
| 118 | self.assertEqual(rc, 0, "Failed to delete all flows") |
| 119 | |
| 120 | logging.info("Insert any flow") |
| 121 | logging.info("Send Flow_stats request after n sec intervals") |
| 122 | logging.info("Verify duration_sec and nsec counters are incrementing in accordance with the life of flow") |
| 123 | |
| 124 | #Create a flow with match on ingress_port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 125 | (pkt,match) = wildcard_all_except_ingress(self,of_ports) |
| 126 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 127 | #Create flow_stats request |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 128 | stat_req = message.flow_stats_request() |
| 129 | stat_req.match= match |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 130 | stat_req.table_id = 0xff |
| 131 | stat_req.out_port = ofp.OFPP_NONE |
Rich Lane | 0b04b6c | 2012-12-31 10:12:23 -0800 | [diff] [blame^] | 132 | |
| 133 | expected_duration = 3 |
| 134 | sleep(expected_duration) |
| 135 | |
| 136 | response, pkt = self.controller.transact(stat_req) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 137 | |
Rich Lane | 0b04b6c | 2012-12-31 10:12:23 -0800 | [diff] [blame^] | 138 | self.assertTrue(response is not None,"No response to stats request") |
| 139 | self.assertTrue(len(response.stats) == 1,"Did not receive flow stats reply") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 140 | |
Rich Lane | 0b04b6c | 2012-12-31 10:12:23 -0800 | [diff] [blame^] | 141 | stat = response.stats[0] |
| 142 | logging.info("Duration of flow is %d s %d ns", stat.duration_sec, stat.duration_nsec) |
| 143 | self.assertTrue(stat.duration_sec == expected_duration, "Flow stats reply incorrect") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 144 | |
| 145 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 146 | class RxPktPerPort(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 147 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 148 | """Verify that rx_packets counter in the Port_Stats reply |
| 149 | increments when packets are received on a port""" |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 150 | |
| 151 | def runTest(self): |
| 152 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 153 | logging.info("Running RxPktPerPort test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 154 | |
| 155 | of_ports = config["port_map"].keys() |
| 156 | of_ports.sort() |
| 157 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 158 | |
| 159 | # Clear Switch State |
| 160 | rv = delete_all_flows(self.controller) |
| 161 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 162 | |
| 163 | logging.info("Insert a flow with match on ingress_port") |
| 164 | logging.info("Send N Packets on an ingress_port P ") |
| 165 | logging.info("Send Port_Stats Request for Port P , verify recieved packets counters are incrementing in accordance") |
| 166 | |
| 167 | #Insert a flow with match on all ingress port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 168 | (pkt, match ) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 169 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 170 | # Send Port_Stats request for the ingress port (retrieve old counter state) |
| 171 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 172 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 173 | # Send packets matching the flow |
| 174 | num_pkts = 5 |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 175 | for pkt_cnt in range(num_pkts): |
| 176 | self.dataplane.send(of_ports[0],str(pkt)) |
Rich Lane | 47d0ec0 | 2012-10-26 14:28:19 -0700 | [diff] [blame] | 177 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 178 | pkts = num_pkts+counter[0] |
| 179 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 180 | #Verify recieved packet counters |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 181 | verify_portstats(self,of_ports[0],rx_packets=pkts) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 182 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 183 | class TxPktPerPort(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 184 | |
| 185 | """Verify that tx_packets counter in the Port_Stats reply , increments when packets are transmitted by a port""" |
| 186 | |
| 187 | def runTest(self): |
| 188 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 189 | logging.info("Running TxPktPerPort test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 190 | |
| 191 | of_ports = config["port_map"].keys() |
| 192 | of_ports.sort() |
| 193 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 194 | |
| 195 | #Clear switch state |
| 196 | rv = delete_all_flows(self.controller) |
| 197 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 198 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 199 | logging.info("Insert any flow matching on in_port=ingress_port, action output to egress_port T ") |
| 200 | logging.info("Send N Packets matching the flow on ingress_port P ") |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 201 | logging.info("Send Port_Stats Request for Port T , verify transmitted packets counters are incrementing in accordance") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 202 | |
| 203 | #Insert a flow with match on all ingress port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 204 | (pkt,match) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 205 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 206 | # Send Port_Stats request for the ingress port (retrieve old counter state) |
| 207 | (counter) = get_portstats(self,of_ports[1]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 208 | |
| 209 | #Send packets matching the flow |
| 210 | num_pkts = 5 |
| 211 | for pkt_cnt in range(num_pkts): |
| 212 | self.dataplane.send(of_ports[0],str(pkt)) |
Rich Lane | 47d0ec0 | 2012-10-26 14:28:19 -0700 | [diff] [blame] | 213 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 214 | pkts = num_pkts+counter[1] |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 215 | |
| 216 | #Verify transmitted_packet counters |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 217 | verify_portstats(self,of_ports[1],tx_packets=pkts) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 218 | |
| 219 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 220 | |
| 221 | class RxBytPerPort(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 222 | |
| 223 | """Verify that recieved bytes counter in the Port_Stats reply , increments in accordance with the bytes recieved on a port""" |
| 224 | |
| 225 | def runTest(self): |
| 226 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 227 | logging.info("Running RxBytPerPort test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 228 | |
| 229 | of_ports = config["port_map"].keys() |
| 230 | of_ports.sort() |
| 231 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 232 | |
| 233 | #Clear switch State |
| 234 | rv = delete_all_flows(self.controller) |
| 235 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 236 | |
| 237 | logging.info("Insert any flow matching on in_port=ingress_port") |
| 238 | logging.info("Send N Packets matching the flow on ingress_port P ") |
| 239 | logging.info("Send Port_Stats Request for Port P , verify recieved bytes counters are incrementing in accordance") |
| 240 | |
| 241 | #Insert a flow with match on all ingress port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 242 | (pkt, match ) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 243 | |
| 244 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 245 | (counter) = get_portstats(self,of_ports[0]) |
| 246 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 247 | #Send packets matching the flow. |
| 248 | num_pkts = 5 |
| 249 | byte_count = num_pkts*len(str(pkt)) |
| 250 | for pkt_cnt in range(num_pkts): |
| 251 | self.dataplane.send(of_ports[0],str(pkt)) |
| 252 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 253 | byt_count = byte_count+counter[2] |
Rich Lane | 47d0ec0 | 2012-10-26 14:28:19 -0700 | [diff] [blame] | 254 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 255 | #Verify recieved_bytes counters |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 256 | verify_portstats(self,of_ports[0],rx_byte=byt_count) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 257 | |
| 258 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 259 | class TxBytPerPort(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 260 | |
| 261 | """Verify that trasnsmitted bytes counter in the Port_Stats reply , increments in accordance with the bytes trasmitted by a port""" |
| 262 | |
| 263 | def runTest(self): |
| 264 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 265 | logging.info("Running TxBytPerPort test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 266 | |
| 267 | of_ports = config["port_map"].keys() |
| 268 | of_ports.sort() |
| 269 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 270 | |
| 271 | #Clear switch State |
| 272 | rv = delete_all_flows(self.controller) |
| 273 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 274 | |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 275 | logging.info("Insert any flow matching on in_port=ingress_port,action = output to egress_port T") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 276 | logging.info("Send N Packets matching the flow on ingress_port P ") |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 277 | logging.info("Send Port_Stats Request for Port T , verify trasmitted bytes counters are incrementing in accordance") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 278 | |
| 279 | #Insert a flow with match on all ingress port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 280 | (pkt, match ) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 281 | |
| 282 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 283 | (counter) = get_portstats(self,of_ports[1]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 284 | |
| 285 | #Send packets matching the flow. |
| 286 | num_pkts = 5 |
| 287 | byte_count = num_pkts*len(str(pkt)) |
| 288 | for pkt_cnt in range(num_pkts): |
| 289 | self.dataplane.send(of_ports[0],str(pkt)) |
| 290 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 291 | byt_count = byte_count+counter[3] |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 292 | |
| 293 | #Verify trasmitted_bytes counters |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 294 | verify_portstats(self,of_ports[1],tx_byte=byt_count) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 295 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 296 | class ActiveCount(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 297 | |
| 298 | """Verify that active_count counter in the Table_Stats reply , increments in accordance with the flows inserted in a table""" |
| 299 | |
| 300 | def runTest(self): |
| 301 | |
| 302 | logging.info("Running Table_Counter_1 test") |
| 303 | |
| 304 | of_ports = config["port_map"].keys() |
| 305 | of_ports.sort() |
| 306 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 307 | |
| 308 | #Clear Switch state |
| 309 | rv = delete_all_flows(self.controller) |
| 310 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 311 | |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 312 | logging.info("Insert any flow matching on in_port=ingress_port,action = output to egress_port T ") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 313 | logging.info("Send Table_Stats, verify active_count counter is incremented in accordance") |
| 314 | |
| 315 | #Insert a flow with match on all ingress port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 316 | (pkt, match ) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 317 | |
| 318 | #Generate Table_Stats |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 319 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 320 | |
| 321 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 322 | class LookupMatchedCount(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 323 | |
| 324 | """Verify that lookup_count and matched_count counter in the Table_Stats reply |
| 325 | increments in accordance with the packets looked up and matched with the flows in the table""" |
| 326 | |
| 327 | def runTest(self): |
| 328 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 329 | logging.info("Running LookupMatchedCount test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 330 | |
| 331 | of_ports = config["port_map"].keys() |
| 332 | of_ports.sort() |
| 333 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 334 | |
| 335 | #Clear Switch state |
| 336 | rv = delete_all_flows(self.controller) |
| 337 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 338 | |
| 339 | logging.info("Insert any flow matching on in_port=ingress_port,action = output to egress_port") |
| 340 | logging.info("Send N packets matching the flow, N' packets not matching the flow") |
| 341 | logging.info("Send Table_Stats, verify lookup_count = N+N' & matched_count=N ") |
| 342 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 343 | #Get Current Table Stats |
| 344 | (current_lookedup,current_matched,current_active) = get_tablestats(self) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 345 | |
| 346 | #Insert a flow with match on all ingress port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 347 | (pkt, match ) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 348 | |
| 349 | #send packet pkt N times (pkt matches the flow) |
| 350 | num_sends = 5 |
| 351 | for pkt_cnt in range(num_sends): |
| 352 | self.dataplane.send(of_ports[0],str(pkt)) |
| 353 | |
| 354 | #send packet pkt N' (pkt does not match the flow) |
| 355 | num_sends2 = 5 |
| 356 | for pkt_cnt in range(num_sends): |
| 357 | self.dataplane.send(of_ports[1],str(pkt)) |
| 358 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 359 | new_lookup = num_sends+num_sends2+current_lookedup |
| 360 | new_matched = num_sends+current_matched |
Rich Lane | 47d0ec0 | 2012-10-26 14:28:19 -0700 | [diff] [blame] | 361 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 362 | #Verify lookup_count and matched_count counters. |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 363 | verify_tablestats(self,expect_lookup=new_lookup,expect_match=new_matched) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 364 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 365 | class TxPktPerQueue(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 366 | |
| 367 | """Verify that tx_packets in the queue_stats reply increments in accordance with the number of transmitted packets""" |
| 368 | |
| 369 | def runTest(self): |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 370 | logging.info("Running TxPktPerQueue test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 371 | |
| 372 | of_ports = config["port_map"].keys() |
| 373 | of_ports.sort() |
| 374 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 375 | |
| 376 | # Get queue stats from switch (retrieve current state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 377 | (queue_stats,p) = get_queuestats(self,ofp.OFPP_ALL,ofp.OFPQ_ALL) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 378 | |
| 379 | for idx in range(len(of_ports)): |
| 380 | ingress_port = of_ports[idx] |
| 381 | egress_port = of_ports[(idx + 1) % len(of_ports)] |
| 382 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 383 | queue_id = port_queues_get(self,queue_stats,egress_port) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 384 | |
| 385 | for egress_queue_id in queue_id: |
| 386 | |
| 387 | #Clear switch state |
| 388 | rv = delete_all_flows(self.controller) |
| 389 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 390 | |
| 391 | # Get Queue stats for selected egress queue only |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 392 | (qs_before,p) = get_queuestats(self,egress_port,egress_queue_id) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 393 | |
| 394 | #Insert a flow with enqueue action to queues configured on egress_port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 395 | (pkt,match) = enqueue(self,ingress_port,egress_port,egress_queue_id) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 396 | |
| 397 | #Send packet on the ingress_port and verify its received on egress_port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 398 | send_packet(self,pkt,ingress_port,egress_port) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 399 | |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 400 | expected_packets = qs_before.stats[0].tx_packets+1 |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 401 | |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 402 | verify_queuestats(self,egress_port,egress_queue_id,expect_packet=expected_packets) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 403 | |
| 404 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 405 | class TxBytPerQueue(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 406 | |
| 407 | """Verify that tx_bytes in the queue_stats reply increments in accordance with the number of transmitted bytes""" |
| 408 | |
| 409 | def runTest(self): |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 410 | logging.info("Running TxBytPerQueue test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 411 | |
| 412 | of_ports = config["port_map"].keys() |
| 413 | of_ports.sort() |
| 414 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 415 | |
| 416 | # Get queue stats from switch (retrieve current state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 417 | (queue_stats,p) = get_queuestats(self,ofp.OFPP_ALL,ofp.OFPQ_ALL) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 418 | |
| 419 | for idx in range(len(of_ports)): |
| 420 | ingress_port = of_ports[idx] |
| 421 | egress_port = of_ports[(idx + 1) % len(of_ports)] |
| 422 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 423 | queue_id = port_queues_get(self,queue_stats,egress_port) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 424 | |
| 425 | for egress_queue_id in queue_id: |
| 426 | |
| 427 | #Clear switch state |
| 428 | rv = delete_all_flows(self.controller) |
| 429 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 430 | |
| 431 | # Get Queue stats for selected egress queue only |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 432 | (qs_before,p) = get_queuestats(self,egress_port,egress_queue_id) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 433 | |
| 434 | #Insert a flow with enqueue action to queues configured on egress_port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 435 | (pkt,match) = enqueue(self,ingress_port,egress_port,egress_queue_id) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 436 | |
| 437 | #Send packet on the ingress_port and verify its received on egress_port |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 438 | send_packet(self,pkt,ingress_port,egress_port) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 439 | |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 440 | expected_bytes = qs_before.stats[0].tx_bytes+len(str(pkt)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 441 | |
ShreyaPandita | 8793204 | 2012-11-05 18:48:39 -0500 | [diff] [blame] | 442 | verify_queuestats(self,egress_port,egress_queue_id,expect_byte=expected_bytes) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 443 | |
ShreyaPandita | ed20996 | 2012-11-04 02:16:48 -0500 | [diff] [blame] | 444 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 445 | class RxDrops(base_tests.SimpleDataPlane): |
| 446 | |
| 447 | """Verify that rx_dropped counters in the Port_Stats reply increments in accordance with the packets dropped by RX""" |
| 448 | |
| 449 | def runTest(self): |
| 450 | |
| 451 | logging.info("Running Rx_Drops test") |
| 452 | |
| 453 | of_ports = config["port_map"].keys() |
| 454 | of_ports.sort() |
| 455 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 456 | |
| 457 | #Clear switch State |
| 458 | rv = delete_all_flows(self.controller) |
| 459 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 460 | |
| 461 | logging.info("Send Port_Stats Request") |
| 462 | logging.info("Verify reply has rx_dropped count ") |
| 463 | |
| 464 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 465 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 466 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 467 | rx_drp = counter[4] |
| 468 | logging.info("recieved dropped count is :" + str(rx_drp)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 469 | |
| 470 | |
| 471 | |
| 472 | class TxDrops(base_tests.SimpleDataPlane): |
| 473 | |
| 474 | """Verify that tx_dropped counters in the Port_Stats reply increments in accordance with the packets dropped by TX""" |
| 475 | |
| 476 | def runTest(self): |
| 477 | |
| 478 | logging.info("Running Tx_Drops test") |
| 479 | |
| 480 | of_ports = config["port_map"].keys() |
| 481 | of_ports.sort() |
| 482 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 483 | |
| 484 | #Clear switch State |
| 485 | rv = delete_all_flows(self.controller) |
| 486 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 487 | |
| 488 | logging.info("Send Port_Stats Request") |
| 489 | logging.info("Verify reply has tx_dropped count ") |
| 490 | |
| 491 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 492 | (counter) = get_portstats(self,of_ports[1]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 493 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 494 | tx_drp = counter[5] |
| 495 | logging.info("Transmitted dropped count is :" + str(tx_drp)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 496 | |
| 497 | |
| 498 | class RxErrors(base_tests.SimpleDataPlane): |
| 499 | |
| 500 | """Verify that rx_errors counters in the Port_Stats reply increments in accordance with number of recieved error |
| 501 | This is a super-set of more specific receive errors and should be greater than or equal to the sum of all |
| 502 | rx_*_err values""" |
| 503 | |
| 504 | def runTest(self): |
| 505 | |
| 506 | logging.info("Running Rx_Errors test") |
| 507 | |
| 508 | of_ports = config["port_map"].keys() |
| 509 | of_ports.sort() |
| 510 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 511 | |
| 512 | #Clear switch State |
| 513 | rv = delete_all_flows(self.controller) |
| 514 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 515 | |
| 516 | logging.info("Send Port_Stats Request") |
| 517 | logging.info("Verify reply has rx_errors count ") |
| 518 | |
| 519 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 520 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 521 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 522 | rx_err = counter[6] |
| 523 | logging.info("Recieve Errors count is :" + str(rx_err)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 524 | |
| 525 | |
| 526 | class TxErrors(base_tests.SimpleDataPlane): |
| 527 | |
| 528 | """Verify that Tx_errors counters in the Port_Stats reply increments in accordance with number of trasmit error""" |
| 529 | |
| 530 | def runTest(self): |
| 531 | |
| 532 | logging.info("Running Tx_Errors test") |
| 533 | |
| 534 | of_ports = config["port_map"].keys() |
| 535 | of_ports.sort() |
| 536 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 537 | |
| 538 | #Clear switch State |
| 539 | rv = delete_all_flows(self.controller) |
| 540 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 541 | |
| 542 | logging.info("Send Port_Stats Request") |
| 543 | logging.info("Verify reply has Tx_errors count ") |
| 544 | |
| 545 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 546 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 547 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 548 | tx_err = counter[7] |
| 549 | logging.info("Trasmit Error count is :" + str(tx_err)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 550 | |
| 551 | |
| 552 | class RxFrameErr(base_tests.SimpleDataPlane): |
| 553 | |
| 554 | """Verify that rx_frm_err counters in the Port_Stats reply increments in accordance with the number of frame alignment errors""" |
| 555 | |
| 556 | def runTest(self): |
| 557 | |
| 558 | logging.info("Running Rx_Frame_Err test") |
| 559 | |
| 560 | of_ports = config["port_map"].keys() |
| 561 | of_ports.sort() |
| 562 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 563 | |
| 564 | #Clear switch State |
| 565 | rv = delete_all_flows(self.controller) |
| 566 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 567 | |
| 568 | logging.info("Send Port_Stats Request") |
| 569 | logging.info("Verify reply has rx_frame_err count ") |
| 570 | |
| 571 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 572 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 573 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 574 | rx_fr_err = counter[8] |
| 575 | logging.info("Recieve Frame Errors count is :" + str(rx_fr_err)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 576 | |
| 577 | |
| 578 | |
| 579 | class RxOErr(base_tests.SimpleDataPlane): |
| 580 | |
| 581 | """Verify that rx_over_err counters in the Port_Stats reply increments in accordance with the number of with RX overrun""" |
| 582 | |
| 583 | def runTest(self): |
| 584 | |
| 585 | logging.info("Running Rx_O_Err test") |
| 586 | |
| 587 | of_ports = config["port_map"].keys() |
| 588 | of_ports.sort() |
| 589 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 590 | |
| 591 | #Clear switch State |
| 592 | rv = delete_all_flows(self.controller) |
| 593 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 594 | |
| 595 | logging.info("Send Port_Stats Request") |
| 596 | logging.info("Verify reply has rx_over_err count ") |
| 597 | |
| 598 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 599 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 600 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 601 | rx_over_err = counter[9] |
| 602 | logging.info("Recieve Overrun Errors count is :" + str(rx_over_err)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | class RxCrcErr(base_tests.SimpleDataPlane): |
| 608 | |
| 609 | """Verify that rx_crc_err counters in the Port_Stats reply increments in accordance with the number of crc errors""" |
| 610 | |
| 611 | def runTest(self): |
| 612 | |
| 613 | logging.info("Running Port_Counter_9 test") |
| 614 | |
| 615 | of_ports = config["port_map"].keys() |
| 616 | of_ports.sort() |
| 617 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 618 | |
| 619 | #Clear switch State |
| 620 | rv = delete_all_flows(self.controller) |
| 621 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 622 | |
| 623 | logging.info("Send Port_Stats Request") |
| 624 | logging.info("Verify reply has rx_crc_err count ") |
| 625 | |
| 626 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 627 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 628 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 629 | rx_crc_err = counter[10] |
| 630 | logging.info("Recieve CRC Errors count is :" + str(rx_crc_err)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 631 | |
| 632 | |
| 633 | |
| 634 | class Collisions(base_tests.SimpleDataPlane): |
| 635 | |
| 636 | """Verify that collisons counters in the Port_Stats reply increments in accordance with the collisions encountered by the switch """ |
| 637 | |
| 638 | def runTest(self): |
| 639 | |
| 640 | logging.info("Running Collisions test") |
| 641 | |
| 642 | of_ports = config["port_map"].keys() |
| 643 | of_ports.sort() |
| 644 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 645 | |
| 646 | #Clear switch State |
| 647 | rv = delete_all_flows(self.controller) |
| 648 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 649 | |
| 650 | logging.info("Send Port_Stats Request") |
| 651 | logging.info("Verify reply has Collisions count ") |
| 652 | |
| 653 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 654 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 655 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 656 | collisions = counter[11] |
| 657 | logging.info("collisions count is :" + str(collisions)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 658 | |
| 659 | |
| 660 | |
| 661 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 662 | class TxErrorPerQueue(base_tests.SimpleDataPlane): |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 663 | |
| 664 | """Verify that tx_errors in the queue_stats reply increments in accordance with the number of packets dropped due to overrun """ |
| 665 | |
| 666 | def runTest(self): |
| 667 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 668 | logging.info("Running TxErrorPerQueue test") |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 669 | |
| 670 | of_ports = config["port_map"].keys() |
| 671 | of_ports.sort() |
| 672 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 673 | |
| 674 | #Clear switch State |
| 675 | rv = delete_all_flows(self.controller) |
| 676 | self.assertEqual(rv, 0, "Failed to delete all flows") |
| 677 | |
| 678 | logging.info("Send Queue_Stats Request") |
| 679 | logging.info("Verify reply has Tramitted Overrun errors count ") |
| 680 | |
| 681 | # Send Port_Stats request for the ingress port (retrieve current counter state) |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 682 | (counter) = get_portstats(self,of_ports[0]) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 683 | |
ShreyaPandita | e807dfb | 2012-11-02 19:01:19 -0400 | [diff] [blame] | 684 | tx_err = counter[12] |
| 685 | logging.info("Transmit Overrun Error count is :" + str(tx_err)) |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 686 | |
ShreyaPandita | 66de26f | 2012-10-26 14:44:24 -0400 | [diff] [blame] | 687 | |
| 688 | |