tests: Change ADD_OF_PORTS from macro to shell function.
[cascardo/ovs.git] / tests / ofproto.at
index e96012a..f206442 100644 (file)
@@ -146,7 +146,7 @@ AT_CLEANUP
 
 AT_SETUP([ofproto - port-desc stats (OpenFlow 1.5)])
 OVS_VSWITCHD_START
-ADD_OF_PORTS([br0], 1, 2, 3)
+add_of_ports br0 1 2 3
 AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-ports-desc br0], [0], [stdout])
 AT_CHECK([STRIP_XIDS stdout | sed 's/00:0./00:0x/'], [0], [dnl
 OFPST_PORT_DESC reply (OF1.5):
@@ -178,67 +178,70 @@ OFPST_PORT_DESC reply (OF1.5):
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
-dnl This is really bare-bones.
-dnl It at least checks request and reply serialization and deserialization.
-AT_SETUP([ofproto - queue stats - (OpenFlow 1.0)])
+dnl CHECK_QUEUE_STATS(label, option, format)
+m4_define([CHECK_QUEUE_STATS], [
+AT_SETUP([ofproto - queue stats - (OpenFlow $1)])
 OVS_VSWITCHD_START
-AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
-AT_CHECK([STRIP_XIDS stdout], [0], [dnl
-OFPST_QUEUE reply: 0 queues
-])
-AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
-  [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
-OFPST_QUEUE request (xid=0x2):port=ANY queue=5
-])
-AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
-  [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
-OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
+
+AT_CHECK([ovs-ofctl -O $2 queue-stats br0 | STRIP_XIDS], [0],
+  [OFPST_QUEUE reply$3: 1 queues
+  port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
 ])
-OVS_VSWITCHD_STOP
-AT_CLEANUP
 
-AT_SETUP([ofproto - queue stats - (OpenFlow 1.2)])
-OVS_VSWITCHD_START
-AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0], [0], [stdout])
-AT_CHECK([STRIP_XIDS stdout], [0], [dnl
-OFPST_QUEUE reply (OF1.2): 0 queues
+AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL | STRIP_XIDS], [0],
+  [OFPST_QUEUE reply$3: 1 queues
+  port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
 ])
-AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
-  [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
-OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
+
+AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 0 | STRIP_XIDS], [0],
+  [OFPST_QUEUE reply$3: 1 queues
+  port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
 ])
-AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
-  [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
-OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
+
+AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 0 | STRIP_XIDS], [0],
+  [OFPST_QUEUE reply$3: 1 queues
+  port LOCAL queue 0: bytes=?, pkts=?, errors=?, duration=?
 ])
-OVS_VSWITCHD_STOP
-AT_CLEANUP
 
-AT_SETUP([ofproto - queue stats - (OpenFlow 1.4)])
-OVS_VSWITCHD_START
-AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0], [0], [stdout])
-AT_CHECK([STRIP_XIDS stdout], [0], [dnl
-OFPST_QUEUE reply (OF1.4): 0 queues
+AT_CHECK([ovs-ofctl -O $2 queue-stats br0 LOCAL 5 | STRIP_XIDS], [0],
+  [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
+OFPST_QUEUE request$3: port=LOCAL queue=5
 ])
-AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 ALL 5], [0],
-  [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_QUEUE
-OFPST_QUEUE request (OF1.4) (xid=0x2):port=ANY queue=5
+
+AT_CHECK([ovs-ofctl -O $2 queue-stats br0 ANY 5 | STRIP_XIDS], [0],
+  [OFPT_ERROR$3: OFPQOFC_BAD_QUEUE
+OFPST_QUEUE request$3: port=ANY queue=5
 ])
-AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 10], [0],
-  [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_PORT
-OFPST_QUEUE request (OF1.4) (xid=0x2):port=10 queue=ALL
+
+AT_CHECK([ovs-ofctl -O $2 queue-stats br0 10 | STRIP_XIDS], [0],
+  [OFPT_ERROR$3: OFPQOFC_BAD_PORT
+OFPST_QUEUE request$3: port=10 queue=ALL
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
+])
+CHECK_QUEUE_STATS([1.0], [OpenFlow10], [])
+CHECK_QUEUE_STATS([1.1], [OpenFlow11], [ (OF1.1)])
+CHECK_QUEUE_STATS([1.2], [OpenFlow12], [ (OF1.2)])
+CHECK_QUEUE_STATS([1.3], [OpenFlow13], [ (OF1.3)])
+CHECK_QUEUE_STATS([1.4], [OpenFlow14], [ (OF1.4)])
 
 dnl This is really bare-bones.
 dnl It at least checks request and reply serialization and deserialization.
 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.0)])
 OVS_VSWITCHD_START
-ADD_OF_PORTS([br0], [1], [2])
+add_of_ports br0 1 2
 AT_CHECK([ovs-ofctl queue-get-config br0 1], [0], [stdout])
 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
 OFPT_QUEUE_GET_CONFIG_REPLY: port=1
+queue 0:
+])
+AT_CHECK([ovs-ofctl queue-get-config br0], [0], [stdout])
+AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
+OFPT_QUEUE_GET_CONFIG_REPLY: port=1
+OFPT_QUEUE_GET_CONFIG_REPLY: port=2
+queue 0:
+queue 0:
 ])
 AT_CHECK([ovs-ofctl queue-get-config br0 10], [0],
   [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
@@ -247,16 +250,69 @@ OFPT_QUEUE_GET_CONFIG_REQUEST (xid=0x2): port=10
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([ofproto - queue configuration - (OpenFlow 1.1)])
+OVS_VSWITCHD_START
+add_of_ports br0 1 2
+AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 1], [0], [stdout])
+AT_CHECK([STRIP_XIDS stdout], [0], [dnl
+OFPT_QUEUE_GET_CONFIG_REPLY (OF1.1): port=1
+queue 0:
+])
+AT_CHECK([ovs-ofctl -O OpenFlow11 queue-get-config br0 10 | STRIP_XIDS], [0],
+  [OFPT_ERROR (OF1.1): OFPQOFC_BAD_PORT
+OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.1): port=10
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([ofproto - queue configuration - (OpenFlow 1.2)])
 OVS_VSWITCHD_START
-ADD_OF_PORTS([br0], [1], [2])
+add_of_ports br0 1 2
 AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 1], [0], [stdout])
 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
 OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=1
+queue 0:
+])
+AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 ANY], [0], [stdout])
+AT_CHECK([STRIP_XIDS stdout], [0], [dnl
+OFPT_QUEUE_GET_CONFIG_REPLY (OF1.2): port=ANY
+queue 0:
+queue 0:
+queue 0:
+])
+AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10 | STRIP_XIDS], [0],
+  [OFPT_ERROR (OF1.2): OFPQOFC_BAD_PORT
+OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2): port=10
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([ofproto - queue configuration - (OpenFlow 1.4)])
+OVS_VSWITCHD_START
+add_of_ports br0 1 2
+
+AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 any | STRIP_XIDS], [0],
+  [OFPST_QUEUE_DESC reply (OF1.4): port=1
+queue 0:
+port=LOCAL
+queue 0:
+port=2
+queue 0:
 ])
-AT_CHECK([ovs-ofctl -O OpenFlow12 queue-get-config br0 10], [0],
-  [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
-OFPT_QUEUE_GET_CONFIG_REQUEST (OF1.2) (xid=0x2): port=10
+
+AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 | STRIP_XIDS], [0],
+  [OFPST_QUEUE_DESC reply (OF1.4): port=1
+queue 0:
+])
+
+AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 10 | STRIP_XIDS], [0],
+  [OFPT_ERROR (OF1.4): OFPQOFC_BAD_PORT
+OFPST_QUEUE_DESC request (OF1.4): port=10
+])
+
+AT_CHECK([ovs-ofctl -O OpenFlow14 queue-get-config br0 1 2 | STRIP_XIDS], [0],
+  [OFPT_ERROR (OF1.4): OFPQOFC_BAD_QUEUE
+OFPST_QUEUE_DESC request (OF1.4): port=1 queue=2
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
@@ -386,25 +442,25 @@ group_id=1235,type=all,bucket=output:10
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt])
 AT_DATA([flows.txt], [dnl
 tcp actions=group:1234
-udp actions=group:1235
+table=2 udp actions=group:1235
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-flows br0 flows.txt])
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
 [0], [dnl
+ table=2, udp actions=group:1235
  tcp actions=group:1234
- udp actions=group:1235
 OFPST_FLOW reply (OF1.1):
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
 [0], [dnl
- udp actions=group:1235
table=2, udp actions=group:1235
 OFPST_FLOW reply (OF1.1):
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234])
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-flows br0 | ofctl_strip | sort],
 [0], [dnl
- udp actions=group:1235
table=2, udp actions=group:1235
 OFPST_FLOW reply (OF1.1):
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0])
@@ -1719,7 +1775,7 @@ head_table () {
       instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
       Write-Actions and Apply-Actions features:
         actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
-        supported on Set-Field: tun_id tun_src tun_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
+        supported on Set-Field: tun_id tun_src tun_dst tun_ipv6_src tun_ipv6_dst tun_flags tun_gbp_id tun_gbp_flags tun_metadata0 dnl
 tun_metadata1 tun_metadata2 tun_metadata3 tun_metadata4 tun_metadata5 tun_metadata6 tun_metadata7 tun_metadata8 tun_metadata9 tun_metadata10 tun_metadata11 tun_metadata12 tun_metadata13 tun_metadata14 tun_metadata15 tun_metadata16 tun_metadata17 tun_metadata18 tun_metadata19 tun_metadata20 tun_metadata21 tun_metadata22 tun_metadata23 tun_metadata24 tun_metadata25 tun_metadata26 tun_metadata27 tun_metadata28 tun_metadata29 tun_metadata30 tun_metadata31 tun_metadata32 tun_metadata33 tun_metadata34 tun_metadata35 tun_metadata36 tun_metadata37 tun_metadata38 tun_metadata39 tun_metadata40 tun_metadata41 tun_metadata42 tun_metadata43 tun_metadata44 tun_metadata45 tun_metadata46 tun_metadata47 tun_metadata48 tun_metadata49 tun_metadata50 tun_metadata51 tun_metadata52 tun_metadata53 tun_metadata54 tun_metadata55 tun_metadata56 tun_metadata57 tun_metadata58 tun_metadata59 tun_metadata60 tun_metadata61 tun_metadata62 tun_metadata63 dnl
 metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 xreg0 xreg1 xreg2 xreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ipv6_label nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst icmp_type icmp_code icmpv6_type icmpv6_code nd_target nd_sll nd_tll
     matching:
@@ -1729,6 +1785,8 @@ metadata in_port in_port_oxm pkt_mark ct_mark ct_label reg0 reg1 reg2 reg3 reg4
       tun_id: arbitrary mask
       tun_src: arbitrary mask
       tun_dst: arbitrary mask
+      tun_ipv6_src: arbitrary mask
+      tun_ipv6_dst: arbitrary mask
       tun_flags: arbitrary mask
       tun_gbp_id: arbitrary mask
       tun_gbp_flags: arbitrary mask
@@ -3133,25 +3191,25 @@ check_async () {
     shift
 
     # OFPGC_ADD
-    ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020000000000000001
+    ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020000000000000001 00100000 ffffffffffffffff 00000000"
     if test X"$1" = X"OFPGC_ADD"; then shift;
         echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
- ADD group_id=1,type=all"
+ ADD group_id=1,type=all,bucket=actions=drop"
         echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
- ADD group_id=1,type=all"
+ ADD group_id=1,type=all,bucket=bucket_id:0,actions=drop"
         echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
- ADD group_id=1,type=all"
+ ADD group_id=1,type=all,bucket=actions=drop"
     fi
 
     # OFPGC_MODIFY
-    ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020001010000000001
+    ovs-appctl -t `pwd`/c2 ofctl/send "050f0020000000020001010000000001 00100000 ffffffffffffffff 00000000"
     if test X"$1" = X"OFPGC_MODIFY"; then shift;
         echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
- MOD group_id=1,type=select"
+ MOD group_id=1,type=select,bucket=weight:0,actions=drop"
         echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
- MOD group_id=1,type=select"
+ MOD group_id=1,type=select,bucket=bucket_id:0,weight:0,actions=drop"
         echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
- MOD group_id=1,type=select"
+ MOD group_id=1,type=select,bucket=weight:0,actions=drop"
     fi
 
     ovs-appctl -t `pwd`/c1 ofctl/barrier
@@ -3199,7 +3257,7 @@ dnl controllers despite the spec) as meaning a packet that was generated
 dnl by the controller.
 AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
 OVS_VSWITCHD_START
-ADD_OF_PORTS([br0], [1])
+add_of_ports br0 1
 
 # Start a monitor listening for packet-ins.
 AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
@@ -3787,11 +3845,17 @@ OFPT_GET_ASYNC_REPLY (OF1.3):
        PACKET_IN: no_match action
      PORT_STATUS: add delete modify
     FLOW_REMOVED: idle hard delete
+     ROLE_STATUS: (off)
+    TABLE_STATUS: (off)
+  REQUESTFORWARD: (off)
 
  slave:
        PACKET_IN: (off)
      PORT_STATUS: add delete modify
     FLOW_REMOVED: (off)
+     ROLE_STATUS: (off)
+    TABLE_STATUS: (off)
+  REQUESTFORWARD: (off)
 OFPT_BARRIER_REPLY (OF1.3):
 ])
 
@@ -3800,7 +3864,7 @@ AT_CLEANUP
 
 AT_SETUP([ofproto - ofport_request])
 OVS_VSWITCHD_START
-ADD_OF_PORTS([br0], [1], [2], [3])
+add_of_ports br0 1 2 3
 
 set_and_check_specific_ofports () {
     ovs-vsctl set Interface p1 ofport_request="$1" -- \