Added FlowToggle test
This test generates ft_flow_count (test param) flows, puts
them in the table, and then does flow mods on each one just changing
the output port action. It does this ft_iter_count (test param) times.
diff --git a/tests/pktact.py b/tests/pktact.py
index ee60e96..74fc035 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -1192,13 +1192,78 @@
flow_match_test(self, pa_port_map, pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2, egr_count=-1)
+class FlowToggle(BaseMatchCase):
+ """
+ Add flows to the table and modify them repeatedly
+ """
+ def runTest(self):
+ flow_count = test_param_get(self.config, 'ft_flow_count', default=200)
+ iter_count = test_param_get(self.config, 'ft_iter_count', default=50)
+
+ pa_logger.info("Running flow toggle with %d flows, %d iterations" %
+ (flow_count, iter_count))
+ acts = []
+ acts.append(action.action_output())
+ acts.append(action.action_output())
+
+ of_ports = pa_port_map.keys()
+ if len(of_ports) < 3:
+ self.assertTrue(False, "Too few ports for test")
+
+ for idx in range(2):
+ acts[idx].port = of_ports[idx]
+
+ flows = []
+ flows.append([])
+ flows.append([])
+
+ # Create up the flows in an array
+ for toggle in range(2):
+ for f_idx in range(flow_count):
+ pkt = simple_tcp_packet(tcp_sport=f_idx)
+ msg = message.flow_mod()
+ match = parse.packet_to_flow_match(pkt)
+ match.in_port = of_ports[3]
+ match.wildcards &= ~(ofp.OFPFW_IN_PORT | ofp.OFPFW_TP_DST)
+ msg.match = match
+ msg.buffer_id = 0xffffffff
+ msg.actions.add(acts[toggle])
+ flows[toggle].append(msg)
+
+ # Install the first set of flows
+ for f_idx in range(flow_count):
+ rv = self.controller.message_send(flows[0][f_idx])
+ self.assertTrue(rv != -1, "Error installing flow %d" % f_idx)
+ do_barrier(self.controller)
+
+ pa_logger.info("Installed %d flows" % flow_count)
+
+ # Repeatedly modify all the flows back and forth
+ updates = 0
+ # Report status about 5 times
+ mod_val = (iter_count / 4) + 1
+ for iter in range(iter_count):
+ if not iter % mod_val:
+ pa_logger.info("Flow toggle intr %d of %d. Updates %d" %
+ (iter, iter_count, updates))
+ for toggle in range(2):
+ t_idx = 1 - toggle
+ for f_idx in range(flow_count):
+ rv = self.controller.message_send(flows[t_idx][f_idx])
+ updates += 1
+ self.assertTrue(rv != -1, "Error modifying flow %d" %
+ f_idx)
+ do_barrier(self.controller)
+
+
# You can pick and choose these by commenting tests in or out
iter_classes = [
basic.PacketIn,
basic.PacketOut,
DirectPacket,
+ FlowToggle,
DirectTwoPorts,
- DirectMC,
+ DirectMCNonIngress,
AllWildcardMatch,
AllWildcardMatchTagged,
SingleWildcardMatch,
@@ -1214,6 +1279,12 @@
]
class IterCases(BaseMatchCase):
+ """
+ Iterate over a bunch of test cases
+
+ The cases come from the list above
+ """
+
def runTest(self):
count = test_param_get(self.config, 'iter_count', default=10)
tests_done = 0
@@ -1227,11 +1298,13 @@
test.inheritSetup(self)
test.runTest()
tests_done += 1
+ # Report update about every minute, between tests
if time.time() - last > 60:
last = time.time()
- print("IterCases: Ran %d tests in %d " %
- (tests_done, last - start) +
- "seconds so far")
+ pa_logger.info(
+ "IterCases: Iter %d of %d; Ran %d tests in %d " %
+ (idx, count, tests_done, last - start) +
+ "seconds so far")
stats = all_stats_get(self)
last = time.time()
pa_logger.info("\nIterCases ran %d tests in %d seconds." %