From eswierk 6927ce7fa40cc770749d6495828002971eee1a77
Fix SingleWildcard and AllExceptOneWildcard tests to exercise only valid
combinations of wildcard and exact match fields (e.g. if nw_proto is
wildcarded, also wildcard l4_src and l4_dst fields), to accommodate
switches that are picky about such things
diff --git a/tests/flow_stats.py b/tests/flow_stats.py
index 38560bc..4d43672 100644
--- a/tests/flow_stats.py
+++ b/tests/flow_stats.py
@@ -30,15 +30,17 @@
# TODO: ovs has problems with VLAN id?
WILDCARD_VALUES = [ofp.OFPFW_IN_PORT,
- # ofp.OFPFW_DL_VLAN,
+ # (ofp.OFPFW_DL_VLAN | ofp.OFPFW_DL_VLAN_PCP),
ofp.OFPFW_DL_SRC,
ofp.OFPFW_DL_DST,
- ofp.OFPFW_DL_TYPE,
- ofp.OFPFW_NW_PROTO,
+ (ofp.OFPFW_DL_TYPE | 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),
+ (ofp.OFPFW_NW_PROTO | ofp.OFPFW_TP_SRC | ofp.OFPFW_TP_DST),
ofp.OFPFW_TP_SRC,
ofp.OFPFW_TP_DST,
- 0x3F << ofp.OFPFW_NW_SRC_SHIFT,
- 0x3F << ofp.OFPFW_NW_DST_SHIFT,
+ ofp.OFPFW_NW_SRC_MASK,
+ ofp.OFPFW_NW_DST_MASK,
ofp.OFPFW_DL_VLAN_PCP,
ofp.OFPFW_NW_TOS]
diff --git a/tests/pktact.py b/tests/pktact.py
index 693293b..724dcba 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -45,18 +45,38 @@
test_prio = {}
WILDCARD_VALUES = [ofp.OFPFW_IN_PORT,
- ofp.OFPFW_DL_VLAN,
+ ofp.OFPFW_DL_VLAN | ofp.OFPFW_DL_VLAN_PCP,
ofp.OFPFW_DL_SRC,
ofp.OFPFW_DL_DST,
- ofp.OFPFW_DL_TYPE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PFW_DL_VLAN_PCP),
+ (ofp.OFPFW_ALL ^ ofp.OFPFW_DL_TYPE ^ ofp.OFPFW_NW_PROTO ^
+ ofp.OFPFW_NW_TOS)]
+
MODIFY_ACTION_VALUES = [ofp.OFPAT_SET_VLAN_VID,
ofp.OFPAT_SET_VLAN_PCP,
ofp.OFPAT_STRIP_VLAN,
@@ -835,8 +855,7 @@
"""
def runTest(self):
vid = test_param_get(self.config, 'vid', default=TEST_VID_DEFAULT)
- for wc in WILDCARD_VALUES:
- all_exp_one_wildcard = ofp.OFPFW_ALL ^ wc
+ for all_exp_one_wildcard in NO_WILDCARD_VALUES:
if all_exp_one_wildcard & ofp.OFPFW_DL_VLAN:
# Set nonzero VLAN id to avoid sending priority-tagged packet
dl_vlan = vid
@@ -851,8 +870,7 @@
"""
def runTest(self):
vid = test_param_get(self.config, 'vid', default=TEST_VID_DEFAULT)
- for wc in WILDCARD_VALUES:
- all_exp_one_wildcard = ofp.OFPFW_ALL ^ wc
+ for all_exp_one_wildcard in NO_WILDCARD_VALUES:
flow_match_test(self, pa_port_map, wildcards=all_exp_one_wildcard,
dl_vlan=vid)