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