]> git.proxmox.com Git - ovs.git/blob - tests/mcast-snooping.at
tests: Fix sparse error on test-ovn.c
[ovs.git] / tests / mcast-snooping.at
1 AT_BANNER([mcast snooping])
2
3 AT_SETUP([mcast - check multicasts to trunk ports are not duplicated])
4
5 OVS_VSWITCHD_START([])
6
7 AT_CHECK([
8 ovs-vsctl set bridge br0 \
9 datapath_type=dummy \
10 mcast_snooping_enable=true \
11 other-config:mcast-snooping-disable-flood-unregistered=true
12 ], [0])
13
14 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
15
16 # Create an access port p1 on vlan 1725, and a trunk port p2.
17 AT_CHECK([
18 ovs-vsctl add-port br0 p1 tag=1725 -- set Interface p1 type=dummy \
19 other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
20 -- add-port br0 p2 -- set Interface p2 type=dummy \
21 other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2
22 ], [0])
23
24 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
25 dummy@ovs-dummy: hit:0 missed:0
26 br0:
27 br0 65534/100: (dummy-internal)
28 p1 1/1: (dummy)
29 p2 2/2: (dummy)
30 ])
31
32 ovs-appctl time/stop
33
34 # Send IGMPv3 query on p2 with vlan 1725
35 # 5c:8a:38:55:25:52 > 01:00:5e:00:00:01, ethertype 802.1Q (0x8100), length 64: vlan 1725, p 0, ethertype IPv4,
36 # 172.17.25.1 > 224.0.0.1: igmp query v3
37 AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
38 '01005e0000015c8a38552552810006bd080046c000240000000001027f00ac111901e0000001940400001164ec1e00000000027d000000000000000000000000'])
39
40 # Send IGMPv3 query on p2 with vlan 1728
41 # 5c:8a:38:55:25:52 > 01:00:5e:00:00:01, ethertype 802.1Q (0x8100), length 64: vlan 1728, p 0, ethertype IPv4,
42 # 172.17.28.1 > 224.0.0.1: igmp query v3
43 AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
44 '01005e0000015c8a38552552810006c0080046c000240000000001027c00ac111c01e0000001940400001164ec1e00000000027d000000000000000000000000'])
45
46 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
47 port VLAN GROUP Age
48 2 1725 querier 0
49 2 1728 querier 0
50 ])
51
52 AT_CHECK([ovs-vsctl set Interface p2 options:tx_pcap=p2.pcap])
53
54 # Send a multicast packet on p1
55 AT_CHECK([
56 ovs-appctl netdev-dummy/receive p1 \
57 'in_port(1),eth(src=aa:55:aa:55:00:01,dst=01:00:5e:5e:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=239.94.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)'
58 ])
59
60 # Check this packet was forwarded exactly once to p2 and has vlan tag 1725
61 # aa:55:aa:55:00:01 > 01:00:5e:5e:01:01, ethertype 802.1Q (0x8100), length 46: vlan 1725, p 0, ethertype IPv4,
62 # 10.0.0.1.0 > 239.94.1.1.8000: UDP, length 0
63 AT_CHECK([ovs-pcap p2.pcap > p2.pcap.txt 2>&1])
64 AT_CHECK([cat p2.pcap.txt], [0], [dnl
65 01005e5e0101aa55aa550001810006bd08004500001c00000000401180710a000001ef5e010100001f400008e63d
66 ])
67
68 # Clear the mdb, send a IGMP packet with invalid checksum and make sure it
69 # does not end up in the mdb.
70 AT_CHECK([ovs-appctl mdb/flush br0], [0], [dnl
71 table successfully flushed
72 ])
73
74 AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
75 '01005e0000015c8a38552552810006bd080046c000240000000001027f00ac111901e0000001940400001164ec1000000000027d000000000000000000000000'])
76
77 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
78 port VLAN GROUP Age
79 ])
80
81
82 # First send a valid packet to make sure it populates the mdb. Than Clear
83 # the mdb, send a MLD packet with invalid checksum and make sure it does
84 # not end up in the mdb.
85
86 AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
87 '3333ff0e4c67000c290e4c6786dd600000000020000100000000000000000000000000000000ff0200000000000000000001ff0e4c673a000502000001008300e7b800000000ff0200000000000000000001ff0e4c67'])
88
89 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
90 port VLAN GROUP Age
91 2 0 ff02::1:ff0e:4c67 0
92 ])
93
94 AT_CHECK([ovs-appctl mdb/flush br0], [0], [dnl
95 table successfully flushed
96 ])
97
98 AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
99 '3333ff0e4c67000c290e4c6786dd600000000020000100000000000000000000000000000000ff0200000000000000000001ff0e4c673a000502000001008300e7b000000000ff0200000000000000000001ff0e4c67'])
100
101 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
102 port VLAN GROUP Age
103 ])
104
105 OVS_VSWITCHD_STOP
106 AT_CLEANUP
107
108 AT_SETUP([mcast - delete the port mdb when vlan configuration changed])
109 OVS_VSWITCHD_START([])
110
111 AT_CHECK([
112 ovs-vsctl set bridge br0 \
113 datapath_type=dummy \
114 mcast_snooping_enable=true \
115 other-config:mcast-snooping-disable-flood-unregistered=false
116 ], [0])
117
118 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
119
120 AT_CHECK([
121 ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy \
122 other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
123 -- add-port br0 p2 \
124 -- set Interface p2 type=dummy other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2 \
125 -- add-port br0 p3 \
126 -- set Interface p3 type=dummy other-config:hwaddr=aa:55:aa:55:00:03 ofport_request=3
127 ], [0])
128
129 ovs-appctl time/stop
130
131 # send report packets
132 AT_CHECK([
133 ovs-appctl netdev-dummy/receive p1 \
134 '01005E010101000C29A027A18100000108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
135 ovs-appctl netdev-dummy/receive p1 \
136 '01005E010101000C29A027A28100000208004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
137 ], [0])
138
139 # send query packets
140 AT_CHECK([
141 ovs-appctl netdev-dummy/receive p3 \
142 '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000'
143 ovs-appctl netdev-dummy/receive p3 \
144 '01005E010101000C29A027D28100000208004500001C000100004002CBCAAC102202E00101011114EEEB00000000'
145 ], [0])
146
147 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
148 port VLAN GROUP Age
149 1 1 224.1.1.1 0
150 1 2 224.1.1.1 0
151 3 1 querier 0
152 3 2 querier 0
153 ])
154
155 AT_CHECK([ovs-vsctl set port p3 tag=2], [0])
156
157 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
158 port VLAN GROUP Age
159 1 1 224.1.1.1 0
160 1 2 224.1.1.1 0
161 ])
162
163 AT_CLEANUP
164
165 AT_SETUP([mcast - delete the port mdb when port destroyed])
166 OVS_VSWITCHD_START([])
167
168 AT_CHECK([
169 ovs-vsctl set bridge br0 \
170 datapath_type=dummy \
171 mcast_snooping_enable=true \
172 other-config:mcast-snooping-disable-flood-unregistered=false
173 ], [0])
174
175 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
176
177 AT_CHECK([
178 ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy \
179 other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
180 -- add-port br0 p2 \
181 -- set Interface p2 type=dummy other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2 \
182 ], [0])
183
184 ovs-appctl time/stop
185
186 # send report packets
187 AT_CHECK([
188 ovs-appctl netdev-dummy/receive p1 \
189 '01005E010101000C29A027A18100000108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
190 ovs-appctl netdev-dummy/receive p1 \
191 '01005E010101000C29A027A28100000208004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
192 ], [0])
193
194 # send query packets
195 AT_CHECK([
196 ovs-appctl netdev-dummy/receive p2 \
197 '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000'
198 ovs-appctl netdev-dummy/receive p2 \
199 '01005E010101000C29A027D28100000208004500001C000100004002CBCAAC102202E00101011114EEEB00000000'
200 ], [0])
201
202 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
203 port VLAN GROUP Age
204 1 1 224.1.1.1 0
205 1 2 224.1.1.1 0
206 2 1 querier 0
207 2 2 querier 0
208 ])
209
210 AT_CHECK([ovs-vsctl del-port br0 p2], [0])
211
212 AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
213 port VLAN GROUP Age
214 1 1 224.1.1.1 0
215 1 2 224.1.1.1 0
216 ])
217
218 AT_CLEANUP