Update egress port selection to use config["port_map"] instead of
config["base_of_port"].
Update port_map, logger, and config prefix to "fe_".
diff --git a/tests/flow_expire.py b/tests/flow_expire.py
index 55f8ebc..53d7181 100644
--- a/tests/flow_expire.py
+++ b/tests/flow_expire.py
@@ -22,11 +22,11 @@
#@var port_map Local copy of the configuration map from OF port
# numbers to OS interfaces
-pa_port_map = None
-#@var pa_logger Local logger object
-pa_logger = None
-#@var pa_config Local copy of global configuration data
-pa_config = None
+fe_port_map = None
+#@var fe_logger Local logger object
+fe_logger = None
+#@var fe_config Local copy of global configuration data
+fe_config = None
def test_set_init(config):
"""
@@ -37,14 +37,14 @@
basic.test_set_init(config)
- global pa_port_map
- global pa_logger
- global pa_config
+ global fe_port_map
+ global fe_logger
+ global fe_config
- pa_logger = logging.getLogger("pkt_act")
- pa_logger.info("Initializing test set")
- pa_port_map = config["port_map"]
- pa_config = config
+ fe_logger = logging.getLogger("flow_expire")
+ fe_logger.info("Initializing test set")
+ fe_port_map = config["port_map"]
+ fe_config = config
class FlowExpire(basic.SimpleDataPlane):
"""
@@ -55,13 +55,16 @@
Verify the flow expiration message is received
"""
def runTest(self):
- global pa_port_map
+ global fe_port_map
- of_ports = pa_port_map.keys()
+ # TODO: set from command-line parameter
+ test_timeout = 60
+
+ of_ports = fe_port_map.keys()
of_ports.sort()
self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
- rc = delete_all_flows(self.controller, pa_logger)
+ rc = delete_all_flows(self.controller, fe_logger)
self.assertEqual(rc, 0, "Failed to delete all flows")
pkt = simple_tcp_packet()
@@ -71,9 +74,13 @@
"Could not generate flow match from pkt")
act = action.action_output()
- ingress_port = pa_config["base_of_port"]
- egress_port = (pa_config["base_of_port"] + 1) % len(of_ports)
- pa_logger.info("Ingress " + str(ingress_port) +
+ of_ports = fe_port_map.keys()
+ of_ports.sort()
+ self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+ ingress_port = of_ports[0]
+ egress_port = of_ports[1]
+ fe_logger.info("Ingress " + str(ingress_port) +
" to egress " + str(egress_port))
match.in_port = ingress_port
@@ -87,13 +94,14 @@
act.port = egress_port
self.assertTrue(request.actions.add(act), "Could not add action")
- pa_logger.info("Inserting flow")
+ fe_logger.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
do_barrier(self.controller)
- (response, raw) = self.controller.poll(ofp.OFPT_FLOW_REMOVED, 2)
-
+ (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
+ timeout=test_timeout)
+
self.assertTrue(response is not None,
'Did not receive flow removed message ')