remove config parameter from several testutils functions
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index d7e5e9d..f005b39 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -66,7 +66,7 @@
self.assertEqual(rv, 0, "Failed to reset port config")
def required_wildcards(parent):
- w = test_param_get(config, 'required_wildcards', default='default')
+ w = test_param_get('required_wildcards', default='default')
if w == 'l3-l4':
return (ofp.OFPFW_NW_SRC_ALL | ofp.OFPFW_NW_DST_ALL | ofp.OFPFW_NW_TOS
| ofp.OFPFW_NW_PROTO | ofp.OFPFW_TP_SRC | ofp.OFPFW_TP_DST)
@@ -252,7 +252,7 @@
rv = controller.message_send(mod)
return rv
-def receive_pkt_check(dp, pkt, yes_ports, no_ports, assert_if, config):
+def receive_pkt_check(dp, pkt, yes_ports, no_ports, assert_if):
"""
Check for proper receive packets across all ports
@param dp The dataplane object
@@ -262,7 +262,7 @@
@param assert_if Object that implements assertXXX
"""
exp_pkt_arg = None
- if config and config["relax"]:
+ if config["relax"]:
exp_pkt_arg = pkt
for ofport in yes_ports:
@@ -502,7 +502,7 @@
@param clear_table If true, clear the flow table before installing
"""
- clear_table = test_param_get(config, 'clear_table', default=True)
+ clear_table = test_param_get('clear_table', default=True)
if(clear_table_override != None):
clear_table = clear_table_override
@@ -604,7 +604,7 @@
test_count = 0
if egr_count == -1:
- egr_count = test_param_get(config, 'egr_count', default=2)
+ egr_count = test_param_get('egr_count', default=2)
for ing_idx in range(len(of_ports)):
ingress_port = of_ports[ing_idx]
@@ -625,11 +625,10 @@
logging.info("Ran " + str(test_count) + " tests; exiting")
return
-def test_param_get(config, key, default=None):
+def test_param_get(key, default=None):
"""
Return value passed via test-params if present
- @param config The configuration structure for OFTest
@param key The lookup key
@param default Default value to use if not found
@@ -708,7 +707,7 @@
"""
Set up the ingress and expected packet and action list for a test
- @param parent Must implement, assertTrue, and config hash
+ @param parent Must implement assertTrue
@param start_field_values Field values to use for ingress packet (optional)
@param mod_field_values Field values to use for modified packet (optional)
@param mod_fields The list of fields to be modified by the switch in the test.
@@ -753,9 +752,9 @@
# Check for test param modifications
strip = False
if check_test_params:
- add_vlan = test_param_get(config, 'add_vlan')
- strip_vlan = test_param_get(config, 'strip_vlan')
- vid = test_param_get(config, 'vid')
+ add_vlan = test_param_get('add_vlan')
+ strip_vlan = test_param_get('strip_vlan')
+ vid = test_param_get('vid')
if add_vlan and strip_vlan:
parent.assertTrue(0, "Add and strip VLAN both specified")
diff --git a/tests/actions.py b/tests/actions.py
index 0712302..590a91c 100644
--- a/tests/actions.py
+++ b/tests/actions.py
@@ -174,7 +174,7 @@
#Verifying packets recieved on expected dataplane ports
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, config)
+ self)
class ForwardController(base_tests.SimpleDataPlane):
@@ -334,7 +334,7 @@
#Verifying packets recieved on expected dataplane ports
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, config)
+ self)
class ForwardInport(base_tests.SimpleDataPlane):
@@ -386,7 +386,7 @@
#Verfying packet recieved on expected dataplane ports
receive_pkt_check(self.dataplane, pkt, yes_ports,set(of_ports).difference([ingress_port]),
- self, config)
+ self)
class ForwardTable(base_tests.SimpleDataPlane):
diff --git a/tests/basic.py b/tests/basic.py
index 5681ed8..113640a 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -81,7 +81,7 @@
self.assertEqual(rc, 0, "Failed to delete all flows")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
for of_port in config["port_map"].keys():
for pkt, pt in [
@@ -277,7 +277,7 @@
receive_pkt_check(self.dataplane, outpkt, dp_ports,
set(of_ports).difference(dp_ports),
- self, config)
+ self)
class FlowStatsGet(base_tests.SimpleProtocol):
"""
diff --git a/tests/cxn.py b/tests/cxn.py
index eeea564..da15c9e 100644
--- a/tests/cxn.py
+++ b/tests/cxn.py
@@ -46,8 +46,7 @@
def setUp(self):
logging.info("** START TEST CASE " + str(self))
- self.test_timeout = test_param_get(config,
- 'handshake_timeout') or 60
+ self.test_timeout = test_param_get('handshake_timeout', default=60)
def inheritSetup(self, parent):
"""
diff --git a/tests/flow_query.py b/tests/flow_query.py
index 7d86172..e3dc1a7 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -147,8 +147,8 @@
self.dl_addrs.append(rand_dl_addr())
i = i + 1
- if test_param_get(config, "vlans", []) != []:
- self.vlans = test_param_get(config, "vlans", [])
+ if test_param_get("vlans", []) != []:
+ self.vlans = test_param_get("vlans", [])
logging.info("Overriding VLAN ids to:")
logging.info(self.vlans)
@@ -394,7 +394,7 @@
return True
def actions_equal(self, x):
- if test_param_get(config, "conservative_ordered_actions", True):
+ if test_param_get("conservative_ordered_actions", True):
# Compare actions lists as unordered
aa = copy.deepcopy(x.actions.actions)
@@ -498,7 +498,7 @@
# Action lists are ordered, so pick an ordered random subset of
# supported actions
- actions_force = test_param_get(config, "actions_force", 0)
+ actions_force = test_param_get("actions_force", 0)
if actions_force != 0:
logging.info("Forced actions:")
logging.info(actions_bmap_to_str(actions_force))
@@ -607,11 +607,11 @@
# By default, test with conservative ordering conventions
# This should probably be indicated in a profile
- if test_param_get(config, "conservative_ordered_actions", True):
+ if test_param_get("conservative_ordered_actions", True):
self.rand_actions_ordered(fi, valid_actions, valid_ports, valid_queues)
return self
- actions_force = test_param_get(config, "actions_force", 0)
+ actions_force = test_param_get("actions_force", 0)
if actions_force != 0:
logging.info("Forced actions:")
logging.info(actions_bmap_to_str(actions_force))
@@ -1238,7 +1238,7 @@
self.valid_ports = map(lambda x: x.port_no, self.sw_features.ports)
logging.info("Ports reported by switch:")
logging.info(self.valid_ports)
- ports_override = test_param_get(config, "ports", [])
+ ports_override = test_param_get("ports", [])
if ports_override != []:
logging.info("Overriding ports to:")
logging.info(ports_override)
@@ -1263,7 +1263,7 @@
actions_bmap_to_str(self.sw_features.actions) \
) \
)
- actions_override = test_param_get(config, "actions", -1)
+ actions_override = test_param_get("actions", -1)
if actions_override != -1:
logging.info("Overriding supported actions to:")
logging.info(actions_bmap_to_str(actions_override))
@@ -1287,7 +1287,7 @@
wildcards_to_str(ts.wildcards) \
) \
)
- wildcards_override = test_param_get(config, "wildcards", -1)
+ wildcards_override = test_param_get("wildcards", -1)
if wildcards_override != -1:
logging.info("Overriding supported wildcards for table %d to:"
% (i)
@@ -1311,7 +1311,7 @@
)
logging.info("(Port, queue) pairs reported by switch:")
logging.info(self.valid_queues)
- queues_override = test_param_get(config, "queues", [])
+ queues_override = test_param_get("queues", [])
if queues_override != []:
logging.info("Overriding (port, queue) pairs to:")
logging.info(queues_override)
@@ -1578,7 +1578,7 @@
def runTest(self):
logging.info("Flow_Add_5 TEST BEGIN")
- num_flows = test_param_get(config, "num_flows", 100)
+ num_flows = test_param_get("num_flows", 100)
# Clear all flows from switch
@@ -1681,7 +1681,7 @@
def runTest(self):
logging.info("Flow_Add_5_1 TEST BEGIN")
- num_flows = test_param_get(config, "num_flows", 100)
+ num_flows = test_param_get("num_flows", 100)
# Clear all flows from switch
@@ -2305,7 +2305,7 @@
def runTest(self):
logging.info("Flow_Mod_2 TEST BEGIN")
- num_flows = test_param_get(config, "num_flows", 100)
+ num_flows = test_param_get("num_flows", 100)
# Clear all flows from switch
@@ -2789,7 +2789,7 @@
def runTest(self):
logging.info("Flow_Del_2 TEST BEGIN")
- num_flows = test_param_get(config, "num_flows", 100)
+ num_flows = test_param_get("num_flows", 100)
# Clear all flows from switch
diff --git a/tests/load.py b/tests/load.py
index a05a373..e913445 100644
--- a/tests/load.py
+++ b/tests/load.py
@@ -50,8 +50,8 @@
def runTest(self):
# Set up flow to send from port 1 to port 2 and copy to CPU
# Test parameter gives LB port base (assumes consecutive)
- lb_port = test_param_get(config, 'lb_port', default=1)
- barrier_count = test_param_get(config, 'barrier_count',
+ lb_port = test_param_get('lb_port', default=1)
+ barrier_count = test_param_get('barrier_count',
default=10)
# Set controller to filter packet ins
diff --git a/tests/pktact.py b/tests/pktact.py
index 76dea36..a68e773 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -537,7 +537,7 @@
no_ports = set(of_ports).difference(yes_ports)
receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports,
- self, config)
+ self)
class DirectMCNonIngress(base_tests.SimpleDataPlane):
"""
@@ -591,7 +591,7 @@
self.dataplane.send(ingress_port, str(pkt))
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, config)
+ self)
class DirectMC(base_tests.SimpleDataPlane):
@@ -644,7 +644,7 @@
logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
- receive_pkt_check(self.dataplane, pkt, of_ports, [], self, config)
+ receive_pkt_check(self.dataplane, pkt, of_ports, [], self)
class Flood(base_tests.SimpleDataPlane):
"""
@@ -692,7 +692,7 @@
self.dataplane.send(ingress_port, str(pkt))
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, config)
+ self)
class FloodPlusIngress(base_tests.SimpleDataPlane):
"""
@@ -742,7 +742,7 @@
logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
- receive_pkt_check(self.dataplane, pkt, of_ports, [], self, config)
+ receive_pkt_check(self.dataplane, pkt, of_ports, [], self)
class All(base_tests.SimpleDataPlane):
"""
@@ -790,7 +790,7 @@
self.dataplane.send(ingress_port, str(pkt))
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, config)
+ self)
class AllPlusIngress(base_tests.SimpleDataPlane):
"""
@@ -840,7 +840,7 @@
logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
- receive_pkt_check(self.dataplane, pkt, of_ports, [], self, config)
+ receive_pkt_check(self.dataplane, pkt, of_ports, [], self)
class FloodMinusPort(base_tests.SimpleDataPlane):
"""
@@ -897,7 +897,7 @@
self.dataplane.send(ingress_port, str(pkt))
no_ports = set([ingress_port, no_flood_port])
yes_ports = set(of_ports).difference(no_ports)
- receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports, self, config)
+ receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports, self)
# Turn no flood off again
rv = port_config_set(self.controller, no_flood_port,
@@ -936,7 +936,7 @@
"""
def runTest(self):
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
flow_match_test(self, config["port_map"], dl_vlan=vid)
class ExactMatchTaggedMany(BaseMatchCase):
@@ -1167,7 +1167,7 @@
Verify flow_expiration message is correct when command option is set
"""
def runTest(self):
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
for wc in WILDCARD_VALUES:
wc |= required_wildcards(self)
if wc & ofp.OFPFW_DL_VLAN:
@@ -1183,7 +1183,7 @@
SingleWildcardMatch with tagged packets
"""
def runTest(self):
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
for wc in WILDCARD_VALUES:
wc |= required_wildcards(self)
flow_match_test(self, config["port_map"], wildcards=wc, dl_vlan=vid,
@@ -1201,7 +1201,7 @@
Verify flow_expiration message is correct when command option is set
"""
def runTest(self):
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
for all_exp_one_wildcard in NO_WILDCARD_VALUES:
all_exp_one_wildcard |= required_wildcards(self)
if all_exp_one_wildcard & ofp.OFPFW_DL_VLAN:
@@ -1217,7 +1217,7 @@
Match one field with tagged packets
"""
def runTest(self):
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
for all_exp_one_wildcard in NO_WILDCARD_VALUES:
all_exp_one_wildcard |= required_wildcards(self)
flow_match_test(self, config["port_map"], wildcards=all_exp_one_wildcard,
@@ -1242,7 +1242,7 @@
AllWildcardMatch with tagged packets
"""
def runTest(self):
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
flow_match_test(self, config["port_map"], wildcards=ofp.OFPFW_ALL,
dl_vlan=vid)
@@ -1293,7 +1293,7 @@
priority = -1
def runTest(self):
- vid = test_param_get(config, 'vid', default=TEST_VID_DEFAULT)
+ vid = test_param_get('vid', default=TEST_VID_DEFAULT)
pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vid)
of_ports = config["port_map"].keys()
of_ports.sort()
@@ -1681,8 +1681,8 @@
(add, modify, delete +/- strict).
"""
def runTest(self):
- flow_count = test_param_get(config, 'ft_flow_count', default=20)
- iter_count = test_param_get(config, 'ft_iter_count', default=10)
+ flow_count = test_param_get('ft_flow_count', default=20)
+ iter_count = test_param_get('ft_iter_count', default=10)
logging.info("Running flow toggle with %d flows, %d iterations" %
(flow_count, iter_count))
@@ -1789,7 +1789,7 @@
priority = -1
def runTest(self):
- count = test_param_get(config, 'iter_count', default=10)
+ count = test_param_get('iter_count', default=10)
tests_done = 0
logging.info("Running iteration test " + str(count) + " times")
start = time.time()
diff --git a/tests/serial_failover.py b/tests/serial_failover.py
index 7baeae0..fab5141 100644
--- a/tests/serial_failover.py
+++ b/tests/serial_failover.py
@@ -88,8 +88,7 @@
def buildControllerList(self):
# controller_list is list of ip/port tuples
- partial_list = test_param_get(config,
- 'controller_list')
+ partial_list = test_param_get('controller_list')
logging.debug("ctrl list: " + str(partial_list))
self.controller_list = [(config["controller_host"],
config["controller_port"])]
@@ -114,10 +113,8 @@
def setUp(self):
logging.info("** START TEST CASE " + str(self))
- self.test_timeout = test_param_get(config,
- 'failover_timeout') or 60
- self.test_iterations = test_param_get(config,
- 'failover_iterations') or 4
+ self.test_timeout = test_param_get('failover_timeout') or 60
+ self.test_iterations = test_param_get('failover_iterations') or 4
self.buildControllerList()
self.controller_idx = 0