File: system-ovn-netlink.at

package info (click to toggle)
ovn 25.09.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,492 kB
  • sloc: ansic: 106,060; xml: 23,314; sh: 3,322; python: 1,838; makefile: 836
file content (301 lines) | stat: -rw-r--r-- 11,458 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
AT_BANNER([system-ovn-netlink])

AT_SETUP([sync netlink neighbors - learn VXLAN VTEP neighbors])
AT_KEYWORDS([netlink-neighbors])

check ip link add br-test type bridge
on_exit 'ip link del br-test'
check ip link set br-test address 00:00:00:00:00:01
check ip link set dev br-test up

check ip link add vxlan-test type vxlan id 42 \
    dstport 4789 local 42.42.42.2 nolearning
on_exit 'ip link del vxlan-test'
check ip link set vxlan-test master br-test
check ip link set vxlan-test address 00:00:00:00:00:02
check ip link set dev vxlan-test up

dnl Inject permanent (vxlan) entries.
check bridge fdb append 00:00:00:00:00:00 dev vxlan-test \
    dst 42.42.42.3 port 4789 self permanent
check bridge fdb append 00:00:00:00:00:00 dev vxlan-test \
    dst 42.42.42.4 port 4790 self permanent

if_index=$(netlink_if_index vxlan-test)
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    bridge $if_index 0 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:00 dst=42.42.42.3 port=0
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:00 dst=42.42.42.4 port=4790
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:02 dst=:: port=0
])
AT_CLEANUP

AT_SETUP([sync netlink neighbors - learn VXLAN remote mac entries])
AT_KEYWORDS([netlink-neighbors])

check ip link add br-test type bridge
on_exit 'ip link del br-test'
check ip link set br-test address 00:00:00:00:00:01
check ip link set dev br-test up

check ip link add vxlan-test type vxlan id 42 \
    dstport 4789 local 42.42.42.2 nolearning
on_exit 'ip link del vxlan-test'
check ip link set vxlan-test master br-test
check ip link set vxlan-test address 00:00:00:00:00:02
check ip link set dev vxlan-test up

dnl Inject externally learnt (vxlan) mac entries.
check bridge fdb add 00:00:00:00:00:03 dev vxlan-test \
    dst 42.42.42.3 static extern_learn

if_index=$(netlink_if_index vxlan-test)
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    bridge $if_index 0 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:02 dst=:: port=0
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:03 dst=42.42.42.3 port=0
])
AT_CLEANUP

AT_SETUP([sync netlink neighbors - inject OVN static mac entries])
AT_KEYWORDS([netlink-neighbors])

check ip link add br-test type bridge
on_exit 'ip link del br-test'
check ip link set br-test address 00:00:00:00:00:01
check ip link set dev br-test up

check ip link add lo-test type dummy
on_exit 'ip link del lo-test'
check ip link set lo-test master br-test
check ip link set lo-test address 00:00:00:00:00:02
check ip link set dev lo-test up

dnl Let ovn inject some neighbor (mac) entries, we detect the lo-test mac and
dnl the L2 multicast ones.
if_index=$(netlink_if_index lo-test)
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    bridge $if_index 2 00:00:00:00:01:00 00:00:00:00:02:00 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:02 dst=:: port=0
Neighbor ifindex=$if_index vlan=0 eth=01:00:5e:00:00:01 dst=:: port=0
Neighbor ifindex=$if_index vlan=0 eth=33:33:00:00:00:01 dst=:: port=0
])

dnl Check that OVN installed its entries (these are always installed
dnl as "static").
OVS_WAIT_FOR_OUTPUT([bridge fdb show dev lo-test | grep static | sort], [0],
[dnl
00:00:00:00:01:00 master br-test static
00:00:00:00:01:00 vlan 1 master br-test static
00:00:00:00:02:00 master br-test static
00:00:00:00:02:00 vlan 1 master br-test static
])

dnl Remove the static entries, rerun the OVN test binary, they should be
dnl readded.
check bridge fdb del 00:00:00:00:01:00 dev lo-test master static
check bridge fdb del 00:00:00:00:02:00 dev lo-test master static

OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    bridge $if_index 2 00:00:00:00:01:00 00:00:00:00:02:00 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:02 dst=:: port=0
Neighbor ifindex=$if_index vlan=0 eth=01:00:5e:00:00:01 dst=:: port=0
Neighbor ifindex=$if_index vlan=0 eth=33:33:00:00:00:01 dst=:: port=0
])

OVS_WAIT_FOR_OUTPUT([bridge fdb show dev lo-test | grep static | sort], [0],
[dnl
00:00:00:00:01:00 master br-test static
00:00:00:00:01:00 vlan 1 master br-test static
00:00:00:00:02:00 master br-test static
00:00:00:00:02:00 vlan 1 master br-test static
])

dnl Inject some ovn-like entries, rerun the OVN test binary, they should
dnl be removed.
check bridge fdb add 00:00:00:00:03:00 dev lo-test master static
check bridge fdb add 00:00:00:00:04:00 dev lo-test master static

OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    bridge $if_index 2 00:00:00:00:01:00 00:00:00:00:02:00 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:00:02 dst=:: port=0
Neighbor ifindex=$if_index vlan=0 eth=01:00:5e:00:00:01 dst=:: port=0
Neighbor ifindex=$if_index vlan=0 eth=33:33:00:00:00:01 dst=:: port=0
])

OVS_WAIT_FOR_OUTPUT([bridge fdb show dev lo-test | grep static | sort], [0],
[dnl
00:00:00:00:01:00 master br-test static
00:00:00:00:01:00 vlan 1 master br-test static
00:00:00:00:02:00 master br-test static
00:00:00:00:02:00 vlan 1 master br-test static
])

AT_CLEANUP

AT_SETUP([sync netlink neighbors - learn IP neighbors])
AT_KEYWORDS([netlink-neighbors])
CHECK_VRF()

dnl NOTE: To avoid affecting the default routing table configure a test
dnl interface into a separate vrf.
check ip link add vrf-ovn type vrf table 42
on_exit 'ip link del vrf-ovn'
check ip link add br-test type bridge
on_exit 'ip link del br-test'
check ip link set br-test master vrf-ovn
check ip link set br-test address 00:00:00:00:00:01
check ip address add dev br-test 20.20.20.1/24
check ip -6 address add dev br-test 20::1/64
check ip link set dev br-test up

dnl Inject externally learnt IP neighbor entries.
check ip neigh add 10.10.10.10 \
    lladdr 00:00:00:00:10:00 dev br-test extern_learn
check ip -6 neigh add 10::10 \
    lladdr 00:00:00:00:10:00 dev br-test extern_learn

dnl Let OVN inject some IPv4 neighbors too and make sure it learnt the
dnl external ones.
if_index=$(netlink_if_index br-test)
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    inet $if_index 1 00:00:00:00:20:00 20.20.20.20 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:10:00 dst=10.10.10.10 port=0
])

dnl Check that OVN installed its entries (these are always installed
dnl as "noarp").
OVN_NEIGH_EQUAL([br-test], [nud noarp], [20.20.20], [dnl
20.20.20.20 lladdr 00:00:00:00:20:00 NOARP])

dnl Let OVN inject some IPv6 neighbors too and make sure it learnt the
dnl external ones.
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    inet6 $if_index 1 00:00:00:00:20:00 20::20 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:10:00 dst=10::10 port=0
])

dnl Check that OVN installed its entries (these are always installed
dnl as "noarp").
OVN_NEIGH_V6_EQUAL([br-test], [nud noarp], [20::], [dnl
20::20 lladdr 00:00:00:00:20:00 NOARP])

dnl Remove the "noarp" entries, rerun the OVN test binary, they should be
dnl readded.
check ip neigh del dev br-test 20.20.20.20
check ip -6 neigh del dev br-test 20::20
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    inet $if_index 1 00:00:00:00:20:00 20.20.20.20 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:10:00 dst=10.10.10.10 port=0
])
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    inet6 $if_index 1 00:00:00:00:20:00 20::20 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:10:00 dst=10::10 port=0
])

OVN_NEIGH_EQUAL([br-test], [nud noarp], [20.20.20], [dnl
20.20.20.20 lladdr 00:00:00:00:20:00 NOARP])
OVN_NEIGH_V6_EQUAL([br-test], [nud noarp], [20::], [dnl
20::20 lladdr 00:00:00:00:20:00 NOARP])

dnl Inject some ovn-like entries, rerun the OVN test binary, they should
dnl be removed.
check ip neigh add 20.20.20.40 \
    lladdr 00:00:00:00:40:00 dev br-test nud noarp
check ip -6 neigh add 20::40 \
    lladdr 00:00:00:00:40:00 dev br-test nud noarp

OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    inet $if_index 1 00:00:00:00:20:00 20.20.20.20 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:10:00 dst=10.10.10.10 port=0
])
OVS_WAIT_FOR_OUTPUT_UNQUOTED([ovstest test-ovn-netlink neighbor-sync \
    inet6 $if_index 1 00:00:00:00:20:00 20::20 | sort], [0], [dnl
Neighbor ifindex=$if_index vlan=0 eth=00:00:00:00:10:00 dst=10::10 port=0
])

OVN_NEIGH_EQUAL([br-test], [nud noarp], [20.20.20], [dnl
20.20.20.20 lladdr 00:00:00:00:20:00 NOARP])
OVN_NEIGH_V6_EQUAL([br-test], [nud noarp], [20::], [dnl
20::20 lladdr 00:00:00:00:20:00 NOARP])

AT_CLEANUP

AT_SETUP([sync netlink neighbors - table notify])
AT_KEYWORDS([netlink-neighbors])

check ip link add br-test type bridge
on_exit 'ip link del br-test'
check ip link set br-test address 00:00:00:00:00:01
check ip address add dev br-test 10.10.10.1/24
check ip link set dev br-test up

check ip link add lo-test type dummy
on_exit 'ip link del lo-test'
check ip link set lo-test master br-test
check ip link set lo-test address 00:00:00:00:00:02
check ip link set dev lo-test up
lo_if_index=$(netlink_if_index lo-test)

check ip link add br-test-unused type bridge
on_exit 'ip link del br-test-unused'
check ip link set br-test-unused address 00:00:00:00:00:03
check ip address add dev br-test-unused 20.20.20.1/24
check ip link set dev br-test-unused up

check ip link add lo-test-unused type dummy
on_exit 'ip link del lo-test-unused'
check ip link set lo-test-unused master br-test-unused
check ip link set lo-test-unused address 00:00:00:00:00:04
check ip link set dev lo-test-unused up

dnl Should notify if an entry is added to a bridge port monitored by OVN.
check ovstest test-ovn-netlink neighbor-table-notify lo-test $lo_if_index \
    'bridge fdb add 00:00:00:00:00:05 dev lo-test' \
    true

dnl Should NOT notify if an entry is added to a bridge port that's not
dnl monitored by OVN.
check ovstest test-ovn-netlink neighbor-table-notify lo-test $lo_if_index \
    'bridge fdb add 00:00:00:00:00:05 dev lo-test-unused' \
    false

br_if_index=$(netlink_if_index br-test)
dnl Should notify if an entry is added to a bridge that's monitored by
dnl OVN.
check ovstest test-ovn-netlink neighbor-table-notify br-test $br_if_index \
    'ip neigh add 10.10.10.10 lladdr 00:00:00:00:10:00 \
        dev br-test extern_learn' \
    true

dnl Should NOT notify if an entry is added to a bridge that's not monitored by
dnl OVN.
check ovstest test-ovn-netlink neighbor-table-notify br-test $br_if_index \
    'ip neigh add 20.20.20.20 lladdr 00:00:00:00:20:00 \
        dev br-test-unused extern_learn' \
    false
AT_CLEANUP

AT_SETUP([netlink - host-if-monitor])
AT_KEYWORDS([netlink])

dnl Should notify if an interface whose name is monitored by OVN is added.
on_exit 'ip link del lo-test'
if_index=$(ovstest test-ovn-netlink host-if-monitor lo-test \
    'ip link add lo-test type dummy && ip link set dev lo-test up' \
    true)
check test $? -eq 0
AT_CHECK_UNQUOTED([netlink_if_index lo-test], [0], [dnl
$if_index
])

dnl Should NOT notify if an interface whose name is not monitored by OVN
dnl is added.
check ip link del lo-test
on_exit 'ip link del lo-test-unused'
AT_CHECK([ovstest test-ovn-netlink host-if-monitor lo-test \
    'ip link add lo-test-unused type dummy && ip link set dev lo-test-unused up' \
    false], [0], [dnl
0
])
AT_CLEANUP