dpif-netlink: add GENEVE creation support
[cascardo/ovs.git] / tests / dpif-netdev.at
1 AT_BANNER([dpif-netdev])
2
3 m4_divert_push([PREPARE_TESTS])
4 [
5 # Strips out uninteresting parts of flow output, as well as parts
6 # that vary from one run to another (e.g., timing and bond actions).
7 strip_xout () {
8     sed '
9     s/ufid:[-0-9a-f]* //
10     s/used:[0-9]*\.[0-9]*/used:0.0/
11     s/actions:.*/actions: <del>/
12     s/packets:[0-9]*/packets:0/
13     s/bytes:[0-9]*/bytes:0/
14 ' | sort
15 }
16
17 strip_xout_keep_actions () {
18     sed '
19     s/ufid:[-0-9a-f]* //
20     s/used:[0-9]*\.[0-9]*/used:0.0/
21     s/packets:[0-9]*/packets:0/
22     s/bytes:[0-9]*/bytes:0/
23 ' | sort
24 }
25
26 filter_flow_install () {
27     grep 'flow_add' | sed 's/.*flow_add: //' | sort | uniq
28 }
29
30 filter_flow_dump () {
31     grep 'flow_dump ' | sed '
32         s/.*flow_dump //
33         s/used:[0-9]*\.[0-9]*/used:0.0/
34     ' | sort | uniq
35 }
36
37 strip_metadata () {
38     sed 's/metadata=0x[0-9a-f]*/metadata=0x0/'
39 }
40 ]
41 m4_divert_pop([PREPARE_TESTS])
42
43 m4_define([DPIF_NETDEV_DUMMY_IFACE],
44   [AT_SETUP([dpif-netdev - $1 interface])
45    # Create br0 with interfaces p1 and p7
46    #    and br1 with interfaces p2 and p8
47    # with p1 and p2 connected via unix domain socket
48    OVS_VSWITCHD_START(
49      [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \
50       add-port br0 p7 -- set interface p7 ofport_request=7 type=$1 -- \
51       add-br br1 -- \
52       set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
53       set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
54                      fail-mode=secure -- \
55       add-port br1 p2 -- set interface p2 type=$1 options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \
56       add-port br1 p8 -- set interface p8 ofport_request=8 type=$1 --], [], [],
57       [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
58    AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
59
60    AT_CHECK([ovs-ofctl add-flow br0 action=normal])
61    AT_CHECK([ovs-ofctl add-flow br1 action=normal])
62    ovs-appctl time/stop
63    ovs-appctl time/warp 5000
64    AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
65    AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
66    ovs-appctl time/warp 100
67    sleep 1  # wait for forwarders process packets
68
69    AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
70 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
71 recirc_id(0),in_port(2),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
72 recirc_id(0),in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
73 recirc_id(0),in_port(8),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
74 ])
75
76    OVS_VSWITCHD_STOP
77    AT_CLEANUP])
78
79 DPIF_NETDEV_DUMMY_IFACE([dummy])
80 DPIF_NETDEV_DUMMY_IFACE([dummy-pmd])
81
82 m4_define([DPIF_NETDEV_MISS_FLOW_INSTALL],
83   [AT_SETUP([dpif-netdev - miss upcall key matches flow_install - $1])
84    OVS_VSWITCHD_START(
85      [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock
86       set bridge br0 datapath-type=dummy other-config:datapath-id=1234 fail-mode=secure], [], [],
87       [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
88    AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
89
90    AT_CHECK([ovs-ofctl add-flow br0 action=normal])
91    AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
92    sleep 1
93
94    AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
95 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
96 ])
97    AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
98 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
99 ])
100
101    # Now, the same again without megaflows.
102    AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
103 ])
104    AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
105    sleep 1
106
107    AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
108 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
109 ])
110    AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
111 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
112 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions: <del>
113 ])
114
115    OVS_VSWITCHD_STOP
116    AT_CLEANUP])
117
118 DPIF_NETDEV_MISS_FLOW_INSTALL([dummy])
119 DPIF_NETDEV_MISS_FLOW_INSTALL([dummy-pmd])
120
121 m4_define([DPIF_NETDEV_MISS_FLOW_DUMP],
122   [AT_SETUP([dpif-netdev - miss upcall key matches flow_dump - $1])
123    OVS_VSWITCHD_START(
124      [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock
125       set bridge br0 datapath-type=dummy other-config:datapath-id=1234 fail-mode=secure], [], [],
126       [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
127    AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
128 ], [])
129    AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
130
131    AT_CHECK([ovs-ofctl add-flow br0 action=normal])
132    AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
133    sleep 1
134
135    AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
136 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
137 ])
138    AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl
139 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions: <del>
140 ])
141
142    # Now, the same again without megaflows.
143    AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
144 ])
145    AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
146 ], [])
147    AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
148    sleep 1
149
150    AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
151 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
152 ])
153    AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl
154 skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:0, bytes:0, used:never, actions: <del>
155 skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions: <del>
156 ])
157
158    OVS_VSWITCHD_STOP
159    AT_CLEANUP])
160
161 DPIF_NETDEV_MISS_FLOW_DUMP([dummy])
162 DPIF_NETDEV_MISS_FLOW_DUMP([dummy-pmd])