ofproto-dpif: Have lookup_input_bundle() return a bundle.
[openvswitch] / tests / ofproto.at
1 AT_BANNER([ofproto])
2
3 AT_SETUP([ofproto - echo request])
4 OVS_VSWITCHD_START
5 AT_CHECK([ovs-ofctl -vANY:ANY:WARN probe br0])
6 OVS_VSWITCHD_STOP
7 AT_CLEANUP
8
9 AT_SETUP([ofproto - feature request, config request])
10 OVS_VSWITCHD_START
11 AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout])
12 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
13 OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210
14 n_tables:255, n_buffers:256
15 features: capabilities:0xc7, actions:0xfff
16  LOCAL(br0): addr:aa:55:aa:55:00:00
17      config:     PORT_DOWN
18      state:      LINK_DOWN
19 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
20 ])
21 OVS_VSWITCHD_STOP
22 AT_CLEANUP
23
24 dnl This is really bare-bones.
25 dnl It at least checks request and reply serialization and deserialization.
26 AT_SETUP([ofproto - port stats])
27 OVS_VSWITCHD_START
28 AT_CHECK([ovs-ofctl -vANY:ANY:WARN dump-ports br0], [0], [stdout])
29 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
30 OFPST_PORT reply: 1 ports
31   port 65534: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
32            tx pkts=0, bytes=0, drop=0, errs=0, coll=0
33 ])
34 OVS_VSWITCHD_STOP
35 AT_CLEANUP
36
37 dnl This is really bare-bones.
38 dnl It at least checks request and reply serialization and deserialization.
39 AT_SETUP([ofproto - queue stats])
40 OVS_VSWITCHD_START
41 AT_CHECK([ovs-ofctl -vANY:ANY:WARN queue-stats br0], [0], [stdout])
42 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
43 OFPST_QUEUE reply: 0 queues
44 ])
45 OVS_VSWITCHD_STOP
46 AT_CLEANUP
47
48 AT_SETUP([ofproto - mod-port])
49 OVS_VSWITCHD_START
50 for command_config_state in \
51     'up 0 0' \
52     'noflood NO_FLOOD 0' \
53     'down PORT_DOWN,NO_FLOOD LINK_DOWN' \
54     'flood PORT_DOWN LINK_DOWN'
55 do
56     set $command_config_state
57     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
58     AT_CHECK([ovs-ofctl -vANY:ANY:WARN mod-port br0 br0 $command])
59     AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout])
60     AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
61 OFPT_FEATURES_REPLY: ver:0x1, dpid:fedcba9876543210
62 n_tables:255, n_buffers:256
63 features: capabilities:0xc7, actions:0xfff
64  LOCAL(br0): addr:aa:55:aa:55:00:00
65      config:     $config
66      state:      $state
67 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
68 ])
69 done
70 OVS_VSWITCHD_STOP
71 AT_CLEANUP
72
73 AT_SETUP([ofproto - basic flow_mod commands (NXM)])
74 OVS_VSWITCHD_START
75 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS], [0], [NXST_FLOW reply:
76 ])
77 AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl add-flows br0 -])
78 AT_CHECK([ovs-ofctl add-flow br0 in_port=0,actions=1])
79 AT_CHECK([ovs-ofctl -F nxm add-flow br0 table=1,in_port=3,actions=2])
80 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
81  cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=0 actions=output:1
82  cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
83  cookie=0x0, duration=?s, table=1, n_packets=0, n_bytes=0, in_port=3 actions=output:2
84 NXST_FLOW reply:
85 ])
86 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
87 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
88 ])
89 AT_CHECK([ovs-ofctl del-flows br0])
90 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS], [0], [NXST_FLOW reply:
91 ])
92 OVS_VSWITCHD_STOP
93 AT_CLEANUP
94
95 AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.0)])
96 OVS_VSWITCHD_START
97 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | STRIP_XIDS], [0], [OFPST_FLOW reply:
98 ])
99 AT_CHECK([echo 'in_port=1,actions=0' | ovs-ofctl -F openflow10 add-flows br0 -])
100 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 in_port=0,actions=1])
101 AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 table=1,in_port=3,actions=2])
102 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
103  cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=0 actions=output:1
104  cookie=0x0, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
105  cookie=0x0, duration=?s, table=1, n_packets=0, n_bytes=0, in_port=3 actions=output:2
106 OFPST_FLOW reply:
107 ])
108 AT_CHECK([ovs-ofctl -F openflow10 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
109 OFPST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
110 ])
111 AT_CHECK([ovs-ofctl -F openflow10 del-flows br0])
112 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | STRIP_XIDS], [0], [OFPST_FLOW reply:
113 ])
114 OVS_VSWITCHD_STOP
115 AT_CLEANUP
116
117 AT_SETUP([ofproto - dump flows with cookie])
118 OVS_VSWITCHD_START
119 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
120 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
121 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
122 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
123  cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
124  cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0
125  cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0
126 NXST_FLOW reply:
127 ])
128 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
129 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
130 ])
131 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
132  cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0
133 NXST_FLOW reply:
134 ])
135 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3 | STRIP_XIDS], [0], [dnl
136 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=1
137 ])
138 OVS_VSWITCHD_STOP
139 AT_CLEANUP
140
141 AT_SETUP([ofproto - dump flows with cookie mask])
142 OVS_VSWITCHD_START
143 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
144 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
145 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
146 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
147  cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
148  cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0
149  cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0
150 NXST_FLOW reply:
151 ])
152 AT_CHECK([ovs-ofctl dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl
153 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=3
154 ])
155 AT_CHECK([ovs-ofctl dump-flows br0 cookie=0x3/0x1 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
156  cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
157  cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0
158 NXST_FLOW reply:
159 ])
160 AT_CHECK([ovs-ofctl dump-aggregate br0 cookie=0x3/0x1 | STRIP_XIDS], [0], [dnl
161 NXST_AGGREGATE reply: packet_count=0 byte_count=0 flow_count=2
162 ])
163 OVS_VSWITCHD_STOP
164 AT_CLEANUP
165
166 AT_SETUP([ofproto - del flows with cookie])
167 OVS_VSWITCHD_START
168 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
169 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
170 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
171 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
172  cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
173  cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0
174  cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0
175 NXST_FLOW reply:
176 ])
177 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3])
178 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
179  cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
180  cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0
181 NXST_FLOW reply:
182 ])
183 OVS_VSWITCHD_STOP
184 AT_CLEANUP
185
186 AT_SETUP([ofproto - del flows with cookie mask])
187 OVS_VSWITCHD_START
188 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0])
189 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0])
190 AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0])
191 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
192  cookie=0x1, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=1 actions=output:0
193  cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0
194  cookie=0x3, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=3 actions=output:0
195 NXST_FLOW reply:
196 ])
197 AT_CHECK([ovs-ofctl del-flows br0 cookie=0x3/0x1])
198 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION | sort], [0], [dnl
199  cookie=0x2, duration=?s, table=0, n_packets=0, n_bytes=0, in_port=2 actions=output:0
200 NXST_FLOW reply:
201 ])
202 OVS_VSWITCHD_STOP
203 AT_CLEANUP