Allow table_id override from --test-params.
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 6892b39..45e5357 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -970,6 +970,17 @@
except:
return default
+def test_param_get_table():
+ """
+ Return table_id to use.
+
+ The default table_id is 0.
+ This can be overridden by specifying "table" in --test-params.
+
+ e.g: --test-params table=1
+ """
+ return test_param_get("table", 0)
+
def action_generate(parent, field_to_mod, mod_field_vals):
"""
Create an action to modify the field indicated in field_to_mod
diff --git a/tests-1.3/actions.py b/tests-1.3/actions.py
index 4d48fbe..77c1d94 100644
--- a/tests-1.3/actions.py
+++ b/tests-1.3/actions.py
@@ -36,7 +36,7 @@
logging.info("Inserting flow")
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
match=packet_to_flow_match(self, pkt),
instructions=[
ofp.instruction.apply_actions(actions)],
@@ -71,7 +71,7 @@
logging.info("Inserting flow")
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
match=packet_to_flow_match(self, pkt),
instructions=[
ofp.instruction.apply_actions(actions)],
@@ -103,7 +103,7 @@
logging.info("Inserting flow")
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
match=packet_to_flow_match(self, pkt),
instructions=[
ofp.instruction.apply_actions(actions)],
diff --git a/tests-1.3/basic.py b/tests-1.3/basic.py
index 21dd130..2d0f8e8 100644
--- a/tests-1.3/basic.py
+++ b/tests-1.3/basic.py
@@ -94,7 +94,7 @@
for out_port in ports:
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
cookie=42,
match=match,
instructions=[
@@ -134,7 +134,7 @@
for out_port in ports:
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
cookie=42,
instructions=[
ofp.instruction.apply_actions(
@@ -171,7 +171,7 @@
match = packet_to_flow_match(self, parsed_pkt)
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
cookie=42,
match=match,
instructions=[
@@ -206,7 +206,7 @@
pkt = str(simple_tcp_packet())
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
cookie=42,
instructions=[
ofp.instruction.apply_actions(
@@ -241,7 +241,7 @@
pkt = str(parsed_pkt)
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
cookie=42,
instructions=[
ofp.instruction.apply_actions(
diff --git a/tests-1.3/bsn_in_ports.py b/tests-1.3/bsn_in_ports.py
index eddcc5a..0442b85 100644
--- a/tests-1.3/bsn_in_ports.py
+++ b/tests-1.3/bsn_in_ports.py
@@ -34,7 +34,7 @@
logging.info("Inserting flow sending matching packets to port %d", out_port)
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
match=match,
instructions=[
ofp.instruction.apply_actions(
@@ -48,7 +48,7 @@
logging.info("Inserting match-all flow sending packets to controller")
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
instructions=[
ofp.instruction.apply_actions(
actions=[
diff --git a/tests-1.3/flow_stats.py b/tests-1.3/flow_stats.py
index 4a82a89..3853888 100644
--- a/tests-1.3/flow_stats.py
+++ b/tests-1.3/flow_stats.py
@@ -24,10 +24,11 @@
"""
def runTest(self):
port1, port2, port3 = openflow_ports(3)
+ table_id = test_param_get_table()
delete_all_flows(self.controller)
flow1 = ofp.message.flow_add(
- table_id=0,
+ table_id=table_id,
priority=0x11,
idle_timeout=0x21,
hard_timeout=0x31,
@@ -45,7 +46,7 @@
buffer_id=ofp.OFP_NO_BUFFER)
flow2 = ofp.message.flow_add(
- table_id=0,
+ table_id=table_id,
priority=0x12,
idle_timeout=0x22,
hard_timeout=0x32,
@@ -63,7 +64,7 @@
buffer_id=ofp.OFP_NO_BUFFER)
flow3 = ofp.message.flow_add(
- table_id=0,
+ table_id=table_id,
priority=0x13,
idle_timeout=0x23,
hard_timeout=0x33,
@@ -152,7 +153,7 @@
flows = {}
for idx, cookie in enumerate(cookies):
flows[cookie] = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
cookie=cookie,
match=ofp.match([ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT|idx)]),
buffer_id=ofp.OFP_NO_BUFFER)
diff --git a/tests-1.3/match.py b/tests-1.3/match.py
index 0b473da..b0a5167 100644
--- a/tests-1.3/match.py
+++ b/tests-1.3/match.py
@@ -35,6 +35,7 @@
packet data.
"""
in_port, out_port = openflow_ports(2)
+ table_id = test_param_get_table()
logging.info("Running match test for %s", match.show())
@@ -42,7 +43,7 @@
logging.info("Inserting flow sending matching packets to port %d", out_port)
request = ofp.message.flow_add(
- table_id=0,
+ table_id=table_id,
match=match,
instructions=[
ofp.instruction.apply_actions(
@@ -56,7 +57,7 @@
logging.info("Inserting match-all flow sending packets to controller")
request = ofp.message.flow_add(
- table_id=0,
+ table_id=table_id,
instructions=[
ofp.instruction.apply_actions(
actions=[
@@ -88,6 +89,7 @@
"""
def runTest(self):
in_port, out_port, bad_port = openflow_ports(3)
+ table_id = test_param_get_table()
match = ofp.match([
ofp.oxm.in_port(in_port)
@@ -101,7 +103,7 @@
logging.info("Inserting flow sending matching packets to port %d", out_port)
request = ofp.message.flow_add(
- table_id=0,
+ table_id=table_id,
match=match,
instructions=[
ofp.instruction.apply_actions(
@@ -115,7 +117,7 @@
logging.info("Inserting match-all flow sending packets to controller")
request = ofp.message.flow_add(
- table_id=0,
+ table_id=table_id,
instructions=[
ofp.instruction.apply_actions(
actions=[
diff --git a/tests-1.3/pktin_match.py b/tests-1.3/pktin_match.py
index 893b5e1..17da936 100644
--- a/tests-1.3/pktin_match.py
+++ b/tests-1.3/pktin_match.py
@@ -34,7 +34,7 @@
logging.debug("Inserting match-all flow sending packets to controller")
request = ofp.message.flow_add(
- table_id=0,
+ table_id=test_param_get_table(),
instructions=[
ofp.instruction.apply_actions(
actions=[