From e71bff1bef0252209d01e618a33d80d59e366829 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 28 Nov 2012 20:43:02 -0800 Subject: [PATCH] ofp-util: Make "OXM" flow format name include both OpenFlow 1.2 and 1.3. To my mind, it makes sense, when a user requests OXM as the flow format, to allow any protocol based on the OXM flow format to be used. Until this commit, however, "OXM" was specifically OpenFlow 1.2, and "OpenFlow13" was required to request OXM on OpenFlow 1.3. This doesn't affect the behavior of any released version of Open vSwitch. Signed-off-by: Ben Pfaff Acked-by: Simon Horman --- lib/ofp-util.c | 5 +++-- lib/ofp-util.h | 1 + tests/learn.at | 2 +- tests/ovs-ofctl.at | 12 ++++++------ utilities/ovs-ofctl.8.in | 7 +++++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index edac120b1..b53001ecb 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -584,6 +584,7 @@ static const struct proto_abbrev proto_abbrevs[] = { { OFPUTIL_P_ANY, "any" }, { OFPUTIL_P_OF10_STD_ANY, "OpenFlow10" }, { OFPUTIL_P_OF10_NXM_ANY, "NXM" }, + { OFPUTIL_P_ANY_OXM, "OXM" }, }; #define N_PROTO_ABBREVS ARRAY_SIZE(proto_abbrevs) @@ -738,10 +739,10 @@ ofputil_protocol_to_string(enum ofputil_protocol protocol) return "OpenFlow10+table_id"; case OFPUTIL_P_OF12_OXM: - return "OXM"; + return "OXM-OpenFlow12"; case OFPUTIL_P_OF13_OXM: - return "OpenFlow13"; + return "OXM-OpenFlow13"; } /* Check abbreviations. */ diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 60c9f3192..9e9f32a27 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -86,6 +86,7 @@ enum ofputil_protocol { * variant. */ OFPUTIL_P_OF12_OXM = 1 << 4, OFPUTIL_P_OF13_OXM = 1 << 5, +#define OFPUTIL_P_ANY_OXM (OFPUTIL_P_OF12_OXM | OFPUTIL_P_OF13_OXM) /* All protocols. */ #define OFPUTIL_P_ANY ((1 << 6) - 1) diff --git a/tests/learn.at b/tests/learn.at index d60b0d33d..47c1d3288 100644 --- a/tests/learn.at +++ b/tests/learn.at @@ -24,7 +24,7 @@ table=0 actions=learn(table=1,hard_timeout=10, NXM_OF_VLAN_TCI[0..11],output:NXM table=1 priority=0 actions=flood ]]) AT_CHECK([ovs-ofctl parse-flows flows.txt], [0], -[[usable protocols: OpenFlow10+table_id,NXM+table_id,OXM,OpenFlow13 +[[usable protocols: OXM,OpenFlow10+table_id,NXM+table_id chosen protocol: OpenFlow10+table_id OFPT_FLOW_MOD (xid=0x1): ADD table:255 actions=learn(table=1,in_port=99,NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG1[16..31]) OFPT_FLOW_MOD (xid=0x2): ADD table:255 actions=learn(table=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]) diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index f7290a694..d94d75cea 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -78,7 +78,7 @@ actions=controller(max_len=123,reason=invalid_ttl,id=555) AT_CHECK([ovs-ofctl parse-flows flows.txt ], [0], [stdout]) AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], -[[usable protocols: NXM+table_id,OXM,OpenFlow13 +[[usable protocols: OXM,NXM+table_id chosen protocol: NXM+table_id NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD NXT_FLOW_MOD: ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop @@ -143,7 +143,7 @@ dl_dst=aa:bb:cc:dd:ee:ff/00:00:00:00:00:00,actions=drop ]) AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout]) AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl -usable protocols: NXM,OXM,OpenFlow13 +usable protocols: NXM,OXM chosen protocol: NXM-table_id NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop @@ -205,7 +205,7 @@ vlan_tci=0x1123/0x1fff,actions=drop ]]) AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout], [stderr]) AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], -[[usable protocols: NXM,OXM,OpenFlow13 +[[usable protocols: NXM,OXM chosen protocol: NXM-table_id NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop @@ -1875,10 +1875,10 @@ dnl Check that "-F openflow10" rejects a flow_mod with unsupported features, dnl such as tunnels and metadata. AT_SETUP([ovs-ofctl -F option and NXM features]) AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop], - [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM,OpenFlow13) is among the allowed flow formats (OpenFlow10) + [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10) ]) AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy metadata=123,actions=drop], - [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM,OpenFlow13) is among the allowed flow formats (OpenFlow10) + [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10) ]) AT_CLEANUP @@ -1913,7 +1913,7 @@ dnl can't be represented in OpenFlow 1.0. AT_SETUP([ovs-ofctl dump-flows rejects bad -F option]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [], - [ovs-ofctl: none of the usable flow formats (NXM,OXM,OpenFlow13) is among the allowed flow formats (OpenFlow10) + [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10) ]) OVS_VSWITCHD_STOP AT_CLEANUP diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 5e70dba5f..5ac4f97e7 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -1369,6 +1369,11 @@ registers. Open vSwitch 1.1 and later supports this flow format. This combines Nicira Extended match with the ability to place a flow in a specific table. Open vSwitch 1.2 and later supports this flow format. +. +.IP "\fBOXM-OpenFlow12\fR" +.IQ "\fBOXM-OpenFlow13\fR" +These are the standard OXM (OpenFlow Extensible Match) flow format in +OpenFlow 1.2 and 1.3, respectively. .RE . .IP @@ -1381,6 +1386,8 @@ Any supported flow format. \fBOpenFlow10\-table_id\fR or \fBOpenFlow10+table_id\fR. .IP "\fBNXM\fR" \fBNXM\-table_id\fR or \fBNXM+table_id\fR. +.IP "\fBOXM\fR" +\fBOXM-OpenFlow12\fR or \fBOXM-OpenFlow13\fR. .RE . .IP -- 2.43.0