learn: Correct example in nicira-ext.h and add examples as test cases.
authorBen Pfaff <blp@nicira.com>
Tue, 27 Sep 2011 20:35:09 +0000 (13:35 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 18 Oct 2011 20:43:39 +0000 (13:43 -0700)
include/openflow/nicira-ext.h
tests/learn.at

index 51f21f00ae0c15cef7fd1baaf81da660736c94f6..a6d2db458875a1d7403e847111d9c424d0e63c99 100644 (file)
@@ -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]:
index 20a012de02e6b165871fc64eeca9de972fc2e3b6..1a34b9af317ee35a8a8cb568a8b8b1861ff56a8e 100644 (file)
@@ -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[])