1 AT_BANNER([ovn_controller_vtep])
3 # OVN_CONTROLLER_VTEP_START
5 # Starts the test with a setup with vtep device. Each test case must first
8 # Uses vtep-ovs to simulate the vtep switch 'br-vtep' with two physical ports
11 # Configures ovn-nb with a logical switch 'br-test'.
14 m4_define([OVN_CONTROLLER_VTEP_START],
17 # this will cause skip when 'make check' using Windows setup.
18 AT_SKIP_IF([test $HAVE_PYTHON = no])
20 dnl Create databases (ovn-nb, ovn-sb, vtep).
21 AT_CHECK([ovsdb-tool create vswitchd.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
22 for daemon in ovn-nb ovn-sb vtep; do
23 AT_CHECK([ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon%%-*}/${daemon}.ovsschema])
26 dnl Start ovsdb-server.
27 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db], [0], [], [stderr])
28 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr])
29 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db], [0], [], [stderr])
30 on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
31 AT_CHECK([[sed < stderr '
32 /vlog|INFO|opened log file/d
33 /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
34 AT_CAPTURE_FILE([ovsdb-server.log])
36 dnl Start ovs-vswitchd.
37 AT_CHECK([ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif], [0], [], [stderr])
38 AT_CAPTURE_FILE([ovs-vswitchd.log])
39 on_exit "kill `cat ovs-vswitchd.pid`"
40 AT_CHECK([[sed < stderr '
41 /ovs_numa|INFO|Discovered /d
42 /vlog|INFO|opened log file/d
43 /vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
45 /ofproto|INFO|using datapath ID/d
46 /netlink_socket|INFO|netlink: could not enable listening to all nsid/d
47 /ofproto|INFO|datapath ID changed to fedcba9876543210/d']])
48 AT_CHECK([ovs-vsctl -- add-br br-vtep \
49 -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15]] fail-mode=secure \
50 -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \
51 -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2])
54 AT_CHECK([vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4])
55 AT_CHECK([ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \], [0], [], [stderr])
56 on_exit "kill `cat ovs-vtep.pid`"
57 AT_CHECK([[sed < stderr '
58 /vlog|INFO|opened log file/d']])
59 # waits until ovs-vtep starts up.
60 OVS_WAIT_UNTIL([test -n "`vtep-ctl show | grep Physical_Port`"])
63 AT_CHECK([ovn-nbctl ls-add br-test])
64 AT_CHECK([ovn-northd --detach --no-chdir --pidfile --log-file], [0], [], [stderr])
65 on_exit "kill `cat ovn-northd.pid`"
66 AT_CHECK([[sed < stderr '
67 /vlog|INFO|opened log file/d']])
68 AT_CAPTURE_FILE([ovn-northd.log])
70 dnl Start ovn-controllger-vtep.
71 AT_CHECK([ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock], [0], [], [stderr])
72 AT_CAPTURE_FILE([ovn-controller-vtep.log])
73 on_exit "kill `cat ovn-controller-vtep.pid`"
74 AT_CHECK([[sed < stderr '
75 /vlog|INFO|opened log file/d
76 /reconnect|INFO|/d']])
79 # OVN_CONTROLLER_VTEP_STOP
81 # So many exits... Yeah, we started a lot daemons~
83 m4_define([OVN_CONTROLLER_VTEP_STOP],
84 [AT_CHECK([check_logs "$1"])
85 OVS_APP_EXIT_AND_WAIT([ovs-vtep])
86 OVS_APP_EXIT_AND_WAIT([ovn-northd])
87 OVS_APP_EXIT_AND_WAIT([ovn-controller-vtep])
88 OVS_APP_EXIT_AND_WAIT([ovsdb-server])
89 OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])])
91 # Adds logical port for a vtep gateway chassis in ovn-nb database.
93 # $1: logical switch name in ovn-nb database
94 # $2: logical port name
95 # $3: physical vtep gateway name
96 # $4: logical switch name on vtep gateway chassis
97 m4_define([OVN_NB_ADD_VTEP_PORT], [
98 AT_CHECK([ovn-nbctl lsp-add $1 $2])
100 AT_CHECK([ovn-nbctl lsp-set-type $2 vtep])
101 AT_CHECK([ovn-nbctl lsp-set-options $2 vtep-physical-switch=$3 vtep-logical-switch=$4])
104 ##############################################
106 # tests chassis related updates.
107 AT_SETUP([ovn-controller-vtep - chassis])
108 OVN_CONTROLLER_VTEP_START
110 # verifies the initial ovn-sb db configuration.
111 OVS_WAIT_UNTIL([test -n "`ovn-sbctl show | grep Chassis`"])
112 AT_CHECK([ovn-sbctl show], [0], [dnl
116 options: {csum="false"}
119 # deletes the chassis via ovn-sbctl and check that it is readded back
121 AT_CHECK([ovn-sbctl chassis-del br-vtep])
122 OVS_WAIT_UNTIL([test -n "`grep WARN ovn-controller-vtep.log`"])
123 AT_CHECK([sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log], [0], [dnl
124 |WARN|Chassis for VTEP physical switch (br-vtep) disappears, maybe deleted by ovn-sbctl, adding it back
127 # changes the tunnel_ip on physical switch, watches the update of chassis's
129 AT_CHECK([vtep-ctl set Physical_Switch br-vtep tunnel_ips=1.2.3.5])
130 OVS_WAIT_UNTIL([test -n "`ovn-sbctl show | grep 1\.2\.3\.5`"])
131 AT_CHECK([ovn-sbctl --columns=ip list Encap | cut -d ':' -f2 | tr -d ' '], [0], [dnl
135 # adds vlan_bindings to physical ports.
136 AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p0 200 lswitch0 -- bind-ls br-vtep p1 300 lswitch0])
137 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Chassis | grep -- lswitch0`"])
138 AT_CHECK([ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' ' ], [0], [dnl
142 # adds another logical switch and new vlan_bindings.
143 AT_CHECK([vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 300 lswitch1])
144 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Chassis | grep -- lswitch1`"])
145 AT_CHECK([ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '], [0], [dnl
146 [["lswitch0","lswitch1"]]
149 # unbinds one port from lswitch0, nothing should change.
150 AT_CHECK([vtep-ctl unbind-ls br-vtep p0 200])
151 OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=vlan_bindings list physical_port p0 | grep -- '200='`"])
152 AT_CHECK([ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' ' ], [0], [dnl
153 [["lswitch0","lswitch1"]]
156 # unbinds all ports from lswitch0.
157 AT_CHECK([vtep-ctl unbind-ls br-vtep p0 100 -- unbind-ls br-vtep p1 300])
158 OVS_WAIT_UNTIL([test -z "`ovn-sbctl list Chassis | grep -- br-vtep_lswitch0`"])
159 AT_CHECK([ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' ' ], [0], [dnl
163 # unbinds all ports from lswitch1.
164 AT_CHECK([vtep-ctl unbind-ls br-vtep p0 300])
165 OVS_WAIT_UNTIL([test -z "`ovn-sbctl list Chassis | grep -- br-vtep_lswitch1`"])
166 AT_CHECK([ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '], [0], [dnl
170 OVN_CONTROLLER_VTEP_STOP([/Chassis for VTEP physical switch (br-vtep) disappears/d])
174 # Tests binding updates.
175 AT_SETUP([ovn-controller-vtep - binding 1])
176 OVN_CONTROLLER_VTEP_START
178 # adds logical switch 'lswitch0' and vlan_bindings.
179 AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p1 300 lswitch0])
180 # adds logical switch port in ovn-nb database, and sets the type and options.
181 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0])
182 ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0 chassis!='[[]]'
183 # should see one binding, associated to chassis of 'br-vtep'.
184 chassis_uuid=$(ovn-sbctl --columns=_uuid list Chassis br-vtep | cut -d ':' -f2 | tr -d ' ')
185 AT_CHECK_UNQUOTED([ovn-sbctl --columns=chassis list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' '], [0], [dnl
189 # adds another logical switch 'lswitch1' and vlan_bindings.
190 AT_CHECK([vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 200 lswitch1])
191 # adds logical switch port in ovn-nb database for lswitch1.
192 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch1], [br-vtep], [lswitch1])
193 ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch1 chassis!='[[]]'
194 # This is allowed, but not recommended, to have two vlan_bindings (to different vtep logical switches)
195 # from one vtep gateway physical port in one ovn-nb logical swithch.
196 AT_CHECK_UNQUOTED([ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort], [0], [dnl
202 # adds another logical switch port in ovn-nb database for lswitch0.
203 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0_dup], [br-vtep], [lswitch0])
204 ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0_dup chassis!='[[]]'
205 # it is not allowed to have more than one ovn-nb logical port for the same
206 # vtep logical switch on a vtep gateway chassis, so should still see only
207 # two port_binding entries bound.
208 AT_CHECK_UNQUOTED([ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort | sort -d], [0], [dnl
215 # confirms the warning log.
216 AT_CHECK([sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([[-_0-9a-z]][[-_0-9a-z]]*)/()/g' | uniq], [0], [dnl
217 |WARN|logical switch (), on vtep gateway chassis () has already been associated with logical port (), ignore logical port ()
220 # deletes physical ports from vtep.
221 AT_CHECK([ovs-vsctl del-port p0 -- del-port p1])
222 OVS_WAIT_UNTIL([test -z "`ovn-sbctl list Chassis | grep -- br-vtep_lswitch`"])
223 OVS_WAIT_UNTIL([test -z "`vtep-ctl list physical_port p0`"])
224 OVS_WAIT_UNTIL([test -z "`vtep-ctl list physical_port p1`"])
225 # should see empty chassis column in both binding entries.
226 AT_CHECK_UNQUOTED([ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort], [0], [dnl
234 OVN_CONTROLLER_VTEP_STOP([/has already been associated with logical port/d])
238 # Tests corner case: Binding the vtep logical switch from two different
240 AT_SETUP([ovn-controller-vtep - binding 2])
241 OVN_CONTROLLER_VTEP_START
243 # adds logical switch 'lswitch0' and vlan_bindings.
244 AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0])
245 # adds logical switch port in ovn-nb database, and sets the type and options.
246 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0])
247 ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0 chassis!='[[]]'
249 # adds another lswitch 'br-void' in ovn-nb database.
250 AT_CHECK([ovn-nbctl ls-add br-void])
251 # adds another vtep pswitch 'br-vtep-void' in vtep database.
252 AT_CHECK([vtep-ctl add-ps br-vtep-void -- add-port br-vtep-void p0-void -- bind-ls br-vtep-void p0-void 100 lswitch0])
253 # adds a conflicting logical port (both br-vtep_lswitch0 and br-vtep-void_lswitch0
254 # are bound to the same logical switch, but they are on different datapath).
255 OVN_NB_ADD_VTEP_PORT([br-void], [br-vtep-void_lswitch0], [br-vtep-void], [lswitch0])
256 ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0
257 OVS_WAIT_UNTIL([test -n "`grep WARN ovn-controller-vtep.log`"])
258 # confirms the warning log.
259 AT_CHECK([sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([[-_0-9a-z]][[-_0-9a-z]]*)/()/g;s/(with tunnel key [[0-9]][[0-9]]*)/()/g' | uniq], [0], [dnl
260 |WARN|logical switch (), on vtep gateway chassis () has already been associated with logical datapath (), ignore logical port () which belongs to logical datapath ()
263 # then deletes 'br-void' and 'br-vtep-void', should see 'br-vtep_lswitch0'
265 AT_CHECK([ovn-nbctl ls-del br-void])
266 # adds another vtep pswitch 'br-vtep-void' in vtep database.
267 AT_CHECK([vtep-ctl del-ps br-vtep-void])
268 OVS_WAIT_UNTIL([test -z "`ovn-sbctl list Port_Binding | grep br-vtep-void_lswitch0`"])
269 chassis_uuid=$(ovn-sbctl --columns=_uuid list Chassis br-vtep | cut -d ':' -f2 | tr -d ' ')
270 AT_CHECK_UNQUOTED([ovn-sbctl --columns=chassis list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' '], [0], [dnl
274 OVN_CONTROLLER_VTEP_STOP([/has already been associated with logical datapath/d])
278 # Tests vtep module vtep logical switch tunnel key update.
279 AT_SETUP([ovn-controller-vtep - vtep-lswitch])
280 OVN_CONTROLLER_VTEP_START
282 # creates the logical switch in vtep and adds the corresponding logical
284 AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0])
285 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0])
286 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep -- br-vtep_lswitch0`"])
288 # retrieves the expected tunnel key.
289 datapath_uuid=$(ovn-sbctl --columns=datapath list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' ')
290 tunnel_key=$(ovn-sbctl --columns=tunnel_key list Datapath_Binding ${datapath_uuid} | cut -d ':' -f2 | tr -d ' ')
291 OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 0`"])
292 # checks the vtep logical switch tunnel key configuration.
293 AT_CHECK_UNQUOTED([vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '], [0], [dnl
297 # creates a second physical switch in vtep database, and binds its p0 vlan-100
298 # to the same logical switch 'lswitch0'.
299 AT_CHECK([vtep-ctl add-ps br-vtep-void -- add-port br-vtep-void p0 -- bind-ls br-vtep-void p0 100 lswitch0])
300 OVS_WAIT_UNTIL([test -n "`ovn-sbctl --columns=name list Chassis | grep -- br-vtep-void`"])
301 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep-void_lswitch0], [br-vtep-void], [lswitch0])
302 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep -- br-vtep-void_lswitch0`"])
304 # checks the vtep logical switch tunnel key configuration.
305 AT_CHECK_UNQUOTED([vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '], [0], [dnl
309 # now, deletes br-vtep-void.
310 AT_CHECK([vtep-ctl del-ps br-vtep-void])
311 OVS_WAIT_UNTIL([test -z "`ovn-sbctl --columns=name list Chassis | grep -- br-vtep-void`"])
312 # checks the vtep logical switch tunnel key configuration.
313 AT_CHECK_UNQUOTED([vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '], [0], [dnl
317 # changes the ovn-nb logical port type so that it is no longer
319 AT_CHECK([ovn-nbctl lsp-set-type br-vtep_lswitch0 ""])
320 OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 1`"])
321 # now should see the tunnel key reset.
322 AT_CHECK([vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '], [0], [dnl
326 OVN_CONTROLLER_VTEP_STOP
330 # Tests vtep module 'Ucast_Macs_Remote's.
331 AT_SETUP([ovn-controller-vtep - vtep-macs 1])
332 OVN_CONTROLLER_VTEP_START
334 # creates a simple logical network with the vtep device and a fake hv chassis
336 AT_CHECK([ovn-nbctl lsp-add br-test vif0])
337 AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02])
338 AT_CHECK([ovn-nbctl --timeout=10 --wait=sb sync])
339 AT_CHECK([ovn-sbctl chassis-add ch0 vxlan 1.2.3.5])
340 AT_CHECK([ovn-sbctl lsp-bind vif0 ch0])
342 # creates the logical switch in vtep and adds the corresponding logical
344 AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0])
345 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0])
346 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep br-vtep_lswitch0`"])
348 # adds another lswitch 'br-void' in ovn-nb database.
349 AT_CHECK([ovn-nbctl ls-add br-void])
350 # adds fake hv chassis 'ch1'.
351 AT_CHECK([ovn-nbctl lsp-add br-void vif1])
352 AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02])
353 AT_CHECK([ovn-nbctl --timeout=10 --wait=sb sync])
354 AT_CHECK([ovn-sbctl chassis-add ch1 vxlan 1.2.3.6])
355 AT_CHECK([ovn-sbctl lsp-bind vif1 ch1])
357 # checks Ucast_Macs_Remote creation.
358 OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep _uuid`"])
359 AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' '], [0], [dnl
363 # checks physical locator creation.
364 OVS_WAIT_UNTIL([test -n "`vtep-ctl list Physical_Locator | grep _uuid`"])
365 AT_CHECK([vtep-ctl --columns=dst_ip list Physical_Locator | cut -d ':' -f2 | tr -d ' ' | grep -v 1.2.3.4 | sed '/^$/d'], [0], [dnl
369 # checks tunnel creation by ovs-vtep.
370 OVS_WAIT_UNTIL([test -n "`ovs-vsctl list Interface bfd1.2.3.5`"])
371 AT_CHECK([ovs-vsctl --columns=options list Interface bfd1.2.3.5 | cut -d ':' -f2 | tr -d ' '], [0], [dnl
372 {remote_ip="1.2.3.5"}
375 # adds another mac to logical switch port.
376 AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02 f0:ab:cd:ef:01:03])
377 OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep 03`"])
378 AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
384 # removes one mac to logical switch port.
385 AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:03])
386 OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02`"])
387 AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
391 # migrates mac to logical switch port vif1 on 'br-void'.
392 AT_CHECK([ovn-nbctl lsp-set-addresses vif0])
393 AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03])
394 OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 03`"])
395 AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
398 OVN_CONTROLLER_VTEP_STOP
402 # Tests vtep module 'Ucast_Macs_Remote's (corner cases).
403 AT_SETUP([ovn-controller-vtep - vtep-macs 2])
404 OVN_CONTROLLER_VTEP_START
406 # creates a simple logical network with the vtep device and a fake hv chassis
408 AT_CHECK([ovn-nbctl lsp-add br-test vif0])
409 AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02])
410 AT_CHECK([ovn-nbctl --timeout=10 --wait=sb sync])
411 AT_CHECK([ovn-sbctl chassis-add ch0 vxlan 1.2.3.5])
412 AT_CHECK([ovn-sbctl lsp-bind vif0 ch0])
414 # creates another vif in the same logical switch with duplicate mac.
415 AT_CHECK([ovn-nbctl lsp-add br-test vif1])
416 AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02])
417 AT_CHECK([ovn-nbctl --timeout=10 --wait=sb sync])
418 AT_CHECK([ovn-sbctl lsp-bind vif1 ch0])
420 # creates the logical switch in vtep and adds the corresponding logical
422 AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0])
423 OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0])
424 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep br-vtep_lswitch0`"])
426 # checks Ucast_Macs_Remote creation. Should still only be one entry, since duplicate
427 # mac in the same logical switch is not allowed.
428 OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep _uuid`"])
429 AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' '], [0], [dnl
432 # confirms the warning log.
433 OVS_WAIT_UNTIL([test -n "`grep WARN ovn-controller-vtep.log`"])
434 AT_CHECK([sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([[-_:0-9a-z]][[-_:0-9a-z]]*)/()/g' | uniq], [0], [dnl
435 |WARN|MAC address () has already been known to be on logical port () in the same logical datapath, so just ignore this logical port ()
439 AT_CHECK([ovn-nbctl lsp-del vif1])
441 # adds another lswitch 'br-void' in ovn-nb database.
442 AT_CHECK([ovn-nbctl ls-add br-void])
443 # adds fake hv chassis 'ch1' and vif1 with same mac address as vif0.
444 AT_CHECK([ovn-nbctl lsp-add br-void vif1])
445 AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02])
446 AT_CHECK([ovn-nbctl --timeout=10 --wait=sb sync])
447 AT_CHECK([ovn-sbctl chassis-add ch1 vxlan 1.2.3.6])
448 AT_CHECK([ovn-sbctl lsp-bind vif1 ch1])
449 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep vif1`"])
451 # creates another logical switch in vtep and adds the corresponding logical
453 AT_CHECK([vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 200 lswitch1])
454 OVN_NB_ADD_VTEP_PORT([br-void], [br-void_lswitch1], [br-vtep], [lswitch1])
455 OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep br-void_lswitch1`"])
457 # checks Ucast_Macs_Remote creation. Should see two entries since it is allowed
458 # to have duplicate macs in different logical switches.
459 OVS_WAIT_UNTIL([test `vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02 | wc -l` -gt 1])
460 AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
466 OVN_CONTROLLER_VTEP_STOP([/has already been known to be on logical port/d])