]> git.proxmox.com Git - mirror_ovs.git/blobdiff - tests/ovs-ofctl.at
tests: Improve logging for async message control test.
[mirror_ovs.git] / tests / ovs-ofctl.at
index e1fc8299a2df39f6e0d6638c74f77c9a9f14e415..c8062c8acc34b070ab0893eb3e4f62464ad53d19 100644 (file)
@@ -409,17 +409,23 @@ actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
 tcp,tp_src=0x1230/0xfff0,tun_id=0x1234,cookie=0x5678,actions=flood
 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel:0x123456789
 actions=multipath(eth_src, 50, hrw, 12, 0, NXM_NX_REG0[0..3]),multipath(symmetric_l4, 1024, iter_hash, 5000, 5050, reg0[0..12])
+actions=multipath(eth_src, 50, hrw, 12, 0, NXM_NX_REG0[0..3]),multipath(symmetric_l3, 1024, iter_hash, 5000, 5050, reg0[0..12])
 table=1,actions=drop
 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
 metadata=0x1234ffff5678ffff/0xffff0000ffff0000,actions=drop
 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
+actions=bundle(symmetric_l3,60,hrw,ofport,slaves:2,3)
+actions=bundle(symmetric_l3,60,hrw,ofport,slaves:)
 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
 actions=bundle_load(eth_src,50,active_backup,ofport,reg0,slaves:1)
 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
 actions=bundle_load(symmetric_l4,60,hrw,ofport,reg0[0..15],slaves:[2,3])
 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
+actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
+actions=bundle_load(symmetric_l3,60,hrw,ofport,reg0[0..15],slaves:[2,3])
+actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
 actions=resubmit:1,resubmit(2),resubmit(,3),resubmit(2,3)
 send_flow_rem,actions=output:1,output:NXM_NX_REG0,output:2,output:reg1[16..31],output:3
@@ -459,17 +465,23 @@ NXT_FLOW_MOD: ADD table:255 actions=note:41.42.43.00.00.00,note:00.01.02.03.04.0
 NXT_FLOW_MOD: ADD table:255 tcp,tun_id=0x1234,tp_src=0x1230/0xfff0 cookie:0x5678 actions=FLOOD
 NXT_FLOW_MOD: ADD table:255 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
 NXT_FLOW_MOD: ADD table:255 actions=multipath(eth_src,50,hrw,12,0,NXM_NX_REG0[0..3]),multipath(symmetric_l4,1024,iter_hash,5000,5050,NXM_NX_REG0[0..12])
+NXT_FLOW_MOD: ADD table:255 actions=multipath(eth_src,50,hrw,12,0,NXM_NX_REG0[0..3]),multipath(symmetric_l3,1024,iter_hash,5000,5050,NXM_NX_REG0[0..12])
 NXT_FLOW_MOD: ADD table:1 actions=drop
 NXT_FLOW_MOD: ADD table:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
 NXT_FLOW_MOD: ADD table:255 metadata=0x1234000056780000/0xffff0000ffff0000 actions=drop
 NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
+NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l3,60,hrw,ofport,slaves:2,3)
+NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l3,60,hrw,ofport,slaves:)
 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
+NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
+NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
+NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
 NXT_FLOW_MOD: ADD table:255 actions=resubmit:1,resubmit:2,resubmit(,3),resubmit(2,3)
 NXT_FLOW_MOD: ADD table:255 send_flow_rem actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
@@ -942,6 +954,12 @@ NXM_OF_ETH_TYPE(0800) NXM_NX_CT_LABEL_W(10203040506070809000a0b0c0d0e0f0/f1f2f3f
 NXM_NX_DP_HASH(01234567)
 NXOXM_ET_DP_HASH(01234567)
 
+# ERSPAN (testing experimenter OXM).
+NXOXM_ET_ERSPAN_VER(01)
+NXOXM_ET_ERSPAN_IDX(01020304)
+NXOXM_ET_ERSPAN_DIR(01)
+NXOXM_ET_ERSPAN_HWID(12)
+
 # Invalid field number.
 01020304(1111/3333)
 
@@ -1238,6 +1256,12 @@ NXM_OF_ETH_TYPE(0800), NXM_NX_CT_LABEL_W(10203040506070809000a0b0c0d0e0f0/f1f2f3
 NXM_NX_DP_HASH(01234567)
 NXM_NX_DP_HASH(01234567)
 
+# ERSPAN (testing experimenter OXM).
+NXOXM_ET_ERSPAN_VER_W(01/01)
+NXOXM_ET_ERSPAN_IDX(01020304)
+NXOXM_ET_ERSPAN_DIR_W(01/01)
+NXOXM_ET_ERSPAN_HWID_W(12/12)
+
 # Invalid field number.
 nx_pull_match() returned error OFPBMC_BAD_FIELD
 
@@ -2425,48 +2449,49 @@ AT_CLEANUP
 
 AT_SETUP([experimenter OXM encoding])
 AT_DATA([oxm.txt], [dnl
-NXM_NX_DP_HASH(01234567)
-NXOXM_ET_DP_HASH(01234567)
+NXOXM_ET_ERSPAN_VER(01)
 
-NXM_NX_DP_HASH_W(01234567/0fffffff)
-NXOXM_ET_DP_HASH_W(01234567/0fffffff)
+NXOXM_ET_ERSPAN_IDX(01020304)
+NXOXM_ET_ERSPAN_IDX_W(01020304/0fffffff)
+
+NXOXM_ET_ERSPAN_DIR(01)
+
+NXOXM_ET_ERSPAN_HWID(12)
 ])
 
-# To allow for testing experimenter OXM, which doesn't really have many
-# examples in the wild, we've defined a variant of NXM_NX_DP_HASH that uses
-# the experimenter OXM mechanism, called NXOXM_ET_DP_HASH.  We've defined
-# it as if it were introduced with OpenFlow 1.5, which gives us the
-# opportunity to see that both forms are accepted in all OpenFlow versions
-# but the experimenter form is used for encoding in OF1.5+.
-#
-# First verify that both forms are accepted and NXOXM_ET_DP_HASH is encoded
-# in OF1.5.
+# Test experimenter OXM encoding.
 AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow15 < oxm.txt], [0], [dnl
-NXOXM_ET_DP_HASH(01234567)
-00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67
-NXOXM_ET_DP_HASH(01234567)
-00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67
+NXOXM_ET_ERSPAN_VER_W(01/01)
+00000000  00 01 00 0e ff ff 19 06-00 00 23 20 01 01 00 00
 
-NXOXM_ET_DP_HASH_W(01234567/0fffffff)
-00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67
-00000010  0f ff ff ff 00 00 00 00
-NXOXM_ET_DP_HASH_W(01234567/0fffffff)
-00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67
+NXOXM_ET_ERSPAN_IDX(01020304)
+00000000  00 01 00 10 ff ff 16 08-00 00 23 20 01 02 03 04
+NXOXM_ET_ERSPAN_IDX_W(01020304/0fffffff)
+00000000  00 01 00 14 ff ff 17 0c-00 00 23 20 01 02 03 04
 00000010  0f ff ff ff 00 00 00 00
+
+NXOXM_ET_ERSPAN_DIR_W(01/01)
+00000000  00 01 00 0e ff ff 1b 06-00 00 23 20 01 01 00 00
+
+NXOXM_ET_ERSPAN_HWID_W(12/12)
+00000000  00 01 00 0e ff ff 1d 06-00 00 23 20 12 12 00 00
 ])
 
-# Then verify that both forms are accepted and NXM_NX_DP_HASH is encoded
-# in OF1.2.
 AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow12 < oxm.txt], [0], [dnl
-NXM_NX_DP_HASH(01234567)
-00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00
-NXM_NX_DP_HASH(01234567)
-00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00
+NXOXM_ET_ERSPAN_VER_W(01/01)
+00000000  00 01 00 0e ff ff 19 06-00 00 23 20 01 01 00 00
 
-NXM_NX_DP_HASH_W(01234567/0fffffff)
-00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff
-NXM_NX_DP_HASH_W(01234567/0fffffff)
-00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff
+NXOXM_ET_ERSPAN_IDX(01020304)
+00000000  00 01 00 10 ff ff 16 08-00 00 23 20 01 02 03 04
+NXOXM_ET_ERSPAN_IDX_W(01020304/0fffffff)
+00000000  00 01 00 14 ff ff 17 0c-00 00 23 20 01 02 03 04
+00000010  0f ff ff ff 00 00 00 00
+
+NXOXM_ET_ERSPAN_DIR_W(01/01)
+00000000  00 01 00 0e ff ff 1b 06-00 00 23 20 01 01 00 00
+
+NXOXM_ET_ERSPAN_HWID_W(12/12)
+00000000  00 01 00 0e ff ff 1d 06-00 00 23 20 12 12 00 00
 ])
 AT_CLEANUP
 
@@ -2921,13 +2946,13 @@ AT_SETUP([tcp flags - filtering])
 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 \
                     -- add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2])
 AT_DATA([flows.txt], [dnl
-       in_port=1,tcp,tp_dst=80,tcp_flags=+syn-rst-ack-fin,action=2  # Allow outbound web traffic bare-SYN
-       in_port=1,tcp,tp_dst=80,tcp_flags=+ack,action=2  # Allow outbound web traffic with ACK bit
-       in_port=1,tcp,tp_dst=80,tcp_flags=+rst,action=2  # Allow outbound web traffic with RST bit
-       in_port=2,tcp,tp_src=80,tcp_flags=+ack,action=1  # Allow inbound web traffic with ACK bit
-       in_port=2,tcp,tp_src=80,tcp_flags=+rst,action=1  # Allow inbound web traffic with RST bit
-       priority=0,in_port=1,action=drop  # Default drop outbound
-       priority=0,in_port=2,action=drop  # Default drop inbound
+        in_port=1,tcp,tp_dst=80,tcp_flags=+syn-rst-ack-fin,action=2  # Allow outbound web traffic bare-SYN
+        in_port=1,tcp,tp_dst=80,tcp_flags=+ack,action=2  # Allow outbound web traffic with ACK bit
+        in_port=1,tcp,tp_dst=80,tcp_flags=+rst,action=2  # Allow outbound web traffic with RST bit
+        in_port=2,tcp,tp_src=80,tcp_flags=+ack,action=1  # Allow inbound web traffic with ACK bit
+        in_port=2,tcp,tp_src=80,tcp_flags=+rst,action=1  # Allow inbound web traffic with RST bit
+        priority=0,in_port=1,action=drop  # Default drop outbound
+        priority=0,in_port=2,action=drop  # Default drop inbound
 ])
 
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
@@ -2937,8 +2962,8 @@ AT_CHECK([ovs-ofctl add-flow br0 "tcp,tcp_flags=+ack-ack,action="], [1], [],
 ])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +4], [0], [dnl
-               p1 1/1: (dummy)
-               p2 2/2: (dummy)
+    p1 1/1: (dummy)
+    p2 2/2: (dummy)
 ])
 
 dnl Outbound web traffic with bare-SYN
@@ -3055,11 +3080,11 @@ dnl Check logs for OpenFlow trace
 OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): OFPST_FLOW reply" | wc -l` -ge 2])
 # AT_CHECK([sed -n "s/^.*\(|vconn|DBG|.*xid=.*:\).*$/\1/p" ovs-vswitchd.log], [0], [dnl
 AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
-vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
- version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
+ version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
  version bitmap: 0x05
-vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
+vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
@@ -3094,11 +3119,11 @@ vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
  bundle_id=0 type=COMMIT_REPLY flags=0
-vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
- version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
+ version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
  version bitmap: 0x05
-vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
+vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
  table=1, importance=1, dl_vlan=1 actions=drop
@@ -3143,11 +3168,11 @@ vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
  bundle_id=0 type=COMMIT_REPLY flags=0
-vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.6):
- version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
+ version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
  version bitmap: 0x05
-vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x07 and earlier, peer supports version 0x05)
+vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
  table=1, importance=11, dl_vlan=1 actions=drop
@@ -3171,3 +3196,30 @@ AT_CHECK([grep -q "ct_dpif|DBG|.*ct_flush: zone 123" ovs-vswitchd.log])
 
 OVS_VSWITCHD_STOP
 AT_CLEANUP
+
+
+AT_SETUP([ovs-ofctl snoop])
+OVS_VSWITCHD_START
+
+dnl setup controller for br0 before starting the controller
+AT_CHECK([ovs-vsctl -vsyslog:off set-controller br0 unix:testcontroller])
+
+dnl then start listening on the '.snoop' connection
+on_exit 'kill `cat ovs-ofctl-snoop.pid`'
+AT_CHECK([ovs-ofctl -vsyslog:off --detach --no-chdir --pidfile=ovs-ofctl-snoop.pid snoop br0 > snoopbr0.txt 2>&1])
+
+dnl finally start the controller
+on_exit 'kill `cat ovs-testcontroller.pid`'
+AT_CHECK([ovs-testcontroller -vsyslog:off --detach --no-chdir --pidfile punix:testcontroller], [0], [ignore])
+OVS_WAIT_UNTIL([test -e testcontroller])
+
+dnl check for some of the initial handshake messages
+OVS_WAIT_UNTIL([egrep "OFPT_FEATURES_REQUEST" snoopbr0.txt >/dev/null 2>&1])
+OVS_WAIT_UNTIL([egrep "OFPT_FEATURES_REPLY" snoopbr0.txt >/dev/null 2>&1])
+OVS_WAIT_UNTIL([egrep "OFPT_SET_CONFIG" snoopbr0.txt >/dev/null 2>&1])
+
+dnl need to suppress the 'connection failed' WARN message in ovs-vswitchd
+dnl because we need ovs-vswitchd to have the controller config before starting
+dnl the controller to 'snoop' the OpenFlow messages from beginning
+OVS_VSWITCHD_STOP(["/connection failed (No such file or directory)/d"])
+AT_CLEANUP