From eddfcba7ed6b169030451390f47e7efb23f732af Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 27 Sep 2011 13:35:09 -0700 Subject: [PATCH] learn: Correct example in nicira-ext.h and add examples as test cases. --- include/openflow/nicira-ext.h | 3 ++- tests/learn.at | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h index 51f21f00..a6d2db45 100644 --- a/include/openflow/nicira-ext.h +++ b/include/openflow/nicira-ext.h @@ -784,7 +784,8 @@ enum nx_mp_algorithm { * actions=load:A->NXM_NX_REG1[16..31]". * * In syntax accepted by ovs-ofctl, this action is: learn(in_port=99, - * NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], NXM_OF_IN_PORT[]->NXM_NX_REG1[16..31]) + * NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], + * load:NXM_OF_IN_PORT[]->NXM_NX_REG1[16..31]) * * 2. Output to input port based on the source MAC and VLAN VID, with lookup * into NXM_NX_REG1[16:31]: diff --git a/tests/learn.at b/tests/learn.at index 20a012de..1a34b9af 100644 --- a/tests/learn.at +++ b/tests/learn.at @@ -13,6 +13,23 @@ OFPT_FLOW_MOD (xid=0x3): ADD actions=learn(table=1,idle_timeout=1,hard_timeout=2 ]]) AT_CLEANUP +AT_SETUP([learning action - examples]) +AT_DATA([flows.txt], [[ +# These are the examples from nicira-ext.h. +actions=learn(in_port=99,NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], load:NXM_OF_IN_PORT[]->NXM_NX_REG1[16..31]) +actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]) +table=0 actions=learn(table=1,hard_timeout=10, NXM_OF_VLAN_TCI[0..11],output:NXM_OF_IN_PORT[]), resubmit(,1) +table=1 priority=0 actions=flood +]]) +AT_CHECK([ovs-ofctl parse-flows flows.txt], [0], +[[OFPT_FLOW_MOD (xid=0x1): ADD 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 actions=learn(table=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]) +NXT_FLOW_MOD_TABLE_ID (xid=0x3): enable +OFPT_FLOW_MOD (xid=0x4): ADD actions=learn(table=1,hard_timeout=10,NXM_OF_VLAN_TCI[0..11],output:NXM_OF_IN_PORT[]),resubmit(,1) +OFPT_FLOW_MOD (xid=0x5): ADD table:1 priority=0 actions=FLOOD +]]) +AT_CLEANUP + AT_SETUP([learning action - satisfied prerequisites]) AT_DATA([flows.txt], [[actions=learn(eth_type=0x800,load:5->NXM_OF_IP_DST[]) -- 2.30.2