Skip to content

Commit

Permalink
tests: fixed another set of flaky ovn-ic tests
Browse files Browse the repository at this point in the history
Some ic tests were failing as not waiting, or not waiting properly
for some information to be available in the az:
- Adding a port to ts1 before ts1 being created in that az.
- Setting options for ports before the port got created in the az.
- Cleaning up an hv/gw and expecting that it would be immediately
  visible in different az.
- Expecting routes updates between az to happen immediately.

Reported-at: https://issues.redhat.com/browse/FDP-98
Signed-off-by: Xavier Simonart <[email protected]>
Acked-by: Ales Musil <[email protected]>
Signed-off-by: Dumitru Ceara <[email protected]>
(cherry picked from commit abe1d31)
  • Loading branch information
simonartxavier authored and dceara committed Nov 17, 2023
1 parent 13e597d commit 685a18a
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions tests/ovn-ic.at
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ check ovn-nbctl lr-add lr1
check ovn-nbctl lrp-add lr1 lrp1 00:00:00:00:00:01 10.0.0.1/24
check ovn-nbctl lrp-set-gateway-chassis lrp1 gw-az1

OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep ts1])
check ovn-nbctl lsp-add ts1 lsp1 -- \
lsp-set-addresses lsp1 router -- \
lsp-set-type lsp1 router -- \
Expand Down Expand Up @@ -156,6 +157,7 @@ create_ic_infra() {
ovn_as $az

check ovn-ic-nbctl ts-add $ts
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep $ts])
check ovn-nbctl lr-add $lr
check ovn-nbctl lrp-add $lr $lrp 00:00:00:00:00:0$az_id 10.0.$az_id.1/24
check ovn-nbctl lrp-set-gateway-chassis $lrp gw-$az
Expand Down Expand Up @@ -227,6 +229,7 @@ for i in 1 2; do
check ovn-nbctl lrp-add lr1 lrp$i 00:00:00:00:0$i:01 10.0.$i.1/24
check ovn-nbctl lrp-set-gateway-chassis lrp$i gw-az$i

OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep ts1])
check ovn-nbctl lsp-add ts1 lsp$i -- \
lsp-set-addresses lsp$i router -- \
lsp-set-type lsp$i router -- \
Expand Down Expand Up @@ -290,7 +293,7 @@ ovs-vsctl set open . external-ids:ovn-is-interconn=true
OVS_WAIT_UNTIL([ovn_as az2 ovn-sbctl show | grep gw1])

OVN_CLEANUP_SBOX(gw1)
AT_CHECK([ovn_as az2 ovn-sbctl show], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-sbctl show], [0], [dnl
])

# Test encap change
Expand Down Expand Up @@ -336,15 +339,14 @@ ovn-nbctl lsp-set-addresses lsp-ts1-lr1 router
ovn-nbctl lsp-set-type lsp-ts1-lr1 router
ovn-nbctl --wait=hv lsp-set-options lsp-ts1-lr1 router-port=lrp-lr1-ts1

OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl show | grep "aa:aa:aa:aa:aa:01 169.254.100.1/24"])
AT_CHECK([ovn_as az2 ovn-nbctl show | uuidfilt], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-nbctl show | uuidfilt], [0], [dnl
switch <0> (ts1)
port lsp-ts1-lr1
type: remote
addresses: [["aa:aa:aa:aa:aa:01 169.254.100.1/24"]]
])

AT_CHECK([ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns logical_port,type list port_binding], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns logical_port,type list port_binding], [0], [dnl
lsp-ts1-lr1,remote
])

Expand Down Expand Up @@ -528,6 +530,7 @@ for i in 1 2; do
for j in 1 2; do
ts=ts$j$j
ovn-ic-nbctl --may-exist ts-add $ts
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep $ts])

# Create LRP and connect to TS
lr=lr$j$i
Expand Down Expand Up @@ -586,6 +589,7 @@ for i in 1 2; do
# Create LRP and connect to TS
ovn-nbctl lr-add lr$i
ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 169.254.100.$i/24
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep ts1])
ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
-- lsp-set-addresses lsp-ts1-lr$i router \
-- lsp-set-type lsp-ts1-lr$i router \
Expand Down Expand Up @@ -911,6 +915,7 @@ for i in 1 2; do
for j in 1 2 3; do
ts=ts1$j
ovn-ic-nbctl --may-exist ts-add $ts
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep $ts])

lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
Expand All @@ -936,6 +941,7 @@ for i in 1 2; do
for j in 1 2; do
ts=ts2$j
ovn-ic-nbctl --may-exist ts-add $ts
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep $ts])

lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
Expand All @@ -959,32 +965,32 @@ ovn_as az2 ovn-nbctl --route-table=rtb3 lr-route-add lr12 10.10.10.0/24 192.168.
ovn_as az2 ovn-nbctl --wait=sb lrp-add lr22 lrp-lr22 aa:aa:aa:aa:bb:01 "192.168.0.1/24"

# Test direct routes from lr12 were learned to lr11
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2, $5}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2 ecmp
192.168.0.0/24 169.254.102.2 ecmp
192.168.0.0/24 169.254.103.2 ecmp
])

# Test static routes from lr12 rtbs rtb1,rtb2,rtb3 were learned to lr11
AT_CHECK([ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-list lr11], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-list lr11], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.10.10.0/24 169.254.101.2 dst-ip (learned)
])
AT_CHECK([ovn_as az1 ovn-nbctl --route-table=rtb2 lr-route-list lr11], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl --route-table=rtb2 lr-route-list lr11], [0], [dnl
IPv4 Routes
Route Table rtb2:
10.10.10.0/24 169.254.102.2 dst-ip (learned)
])
AT_CHECK([ovn_as az1 ovn-nbctl --route-table=rtb3 lr-route-list lr11], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl --route-table=rtb3 lr-route-list lr11], [0], [dnl
IPv4 Routes
Route Table rtb3:
10.10.10.0/24 169.254.103.2 dst-ip (learned)
])

# Test routes from lr12 didn't leak as learned to lr21
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep 192.168 | sort], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep 192.168 | sort], [0], [dnl
192.168.0.0/24 169.254.101.2 dst-ip (learned) ecmp
192.168.0.0/24 169.254.102.2 dst-ip (learned) ecmp
])
Expand Down Expand Up @@ -1037,6 +1043,7 @@ for i in 1 2; do
for j in 1 2 3; do
ts=ts1$j
ovn-ic-nbctl --may-exist ts-add $ts
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep $ts])

lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
Expand All @@ -1062,6 +1069,7 @@ for i in 1 2; do
for j in 1 2; do
ts=ts2$j
ovn-ic-nbctl --may-exist ts-add $ts
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep $ts])

lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
Expand Down Expand Up @@ -1114,6 +1122,7 @@ Route Table rtb3:
])

# Test routes from lr12 didn't leak as learned to lr21
OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep "2001:db8:2::2" | grep learned])
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep 2001 | sort], [0], [dnl
2001:db8:200::/64 2001:db8:1::2 dst-ip (learned) ecmp
2001:db8:200::/64 2001:db8:2::2 dst-ip (learned) ecmp
Expand All @@ -1133,6 +1142,7 @@ ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
OVS_WAIT_UNTIL([ovn-nbctl show | grep switch | grep ts1])

# Enable route learning at AZ level
ovn-nbctl set nb_global . options:ic-route-learn=true
Expand All @@ -1158,17 +1168,13 @@ for i in 1 2; do
check ovn-nbctl --wait=sb lr-route-add $lr 0.0.0.0/0 192.168.$i.11
done

OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep learned])

AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep dst-ip | sort], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep dst-ip | sort] , [0], [dnl
0.0.0.0/0 192.168.1.11 dst-ip
10.0.0.0/24 192.168.1.10 dst-ip
192.168.2.0/24 169.254.100.2 dst-ip (learned)
])

OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep learned])

AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep dst-ip | sort], [0], [dnl
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep dst-ip | sort], [0], [dnl
0.0.0.0/0 192.168.2.11 dst-ip
10.0.0.0/24 192.168.2.10 dst-ip
192.168.1.0/24 169.254.100.1 dst-ip (learned)
Expand Down

0 comments on commit 685a18a

Please sign in to comment.