Skip to content

Commit

Permalink
test: Use check for ovn-sbctl wherever possible.
Browse files Browse the repository at this point in the history
Reported-at: https://issues.redhat.com/browse/FDP-875
Signed-off-by: Lorenzo Bianconi <[email protected]>
Acked-by: Xavier Simonart <[email protected]>
Signed-off-by: Dumitru Ceara <[email protected]>
  • Loading branch information
LorenzoBianconi authored and dceara committed Dec 2, 2024
1 parent a51e3ae commit cfcf345
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 50 deletions.
16 changes: 8 additions & 8 deletions tests/ovn-controller.at
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ AT_CHECK([test "${expected_iface_types}" = "${chassis_iface_types}"])

# Change the value of other_config:iface-types using ovn-sbctl.
# ovn-controller should again set it back to proper one.
ovn-sbctl set Chassis ${sysid} other_config:iface-types="foo"
check ovn-sbctl set Chassis ${sysid} other_config:iface-types="foo"
OVS_WAIT_UNTIL([
chassis_iface_types=$(ovn-sbctl get Chassis ${sysid} other_config:iface-types | sed -e 's/\"//g')
echo "chassis_iface_types = ${chassis_iface_types}"
Expand Down Expand Up @@ -290,7 +290,7 @@ check_tunnel_property () {
}

# create "empty" chassis. vxlan is used here as a stub
ovn-sbctl chassis-add fakechassis vxlan 192.168.0.2
check ovn-sbctl chassis-add fakechassis vxlan 192.168.0.2

# See if we switch to Geneve as the first choice when it is available
# With multi-VTEP support we support tunnels with different IPs to the
Expand All @@ -305,15 +305,15 @@ OVS_WAIT_UNTIL([check_tunnel_property type geneve])

# change geneve to stt and check that tun interface was deleted and there is
# no stt encap on the second chassis, only vxlan
ovn-sbctl set encap ${encap_uuid} type=stt
check ovn-sbctl set encap ${encap_uuid} type=stt
OVS_WAIT_WHILE([check_tunnel_property type stt])
OVS_WAIT_UNTIL([check_tunnel_property type vxlan])

# change back to geneve
ovn-sbctl set encap ${encap_uuid} type=geneve
check ovn-sbctl set encap ${encap_uuid} type=geneve

# Check that changes within an encap row are propagated
ovn-sbctl set encap ${encap_uuid} ip=192.168.0.2
check ovn-sbctl set encap ${encap_uuid} ip=192.168.0.2
OVS_WAIT_UNTIL([check_tunnel_property options:remote_ip "\"192.168.0.2\""])

# Change the type on the OVS side and check than OVN fixes it
Expand Down Expand Up @@ -395,7 +395,7 @@ ovn_attach n1 br-phys 192.168.0.1

OVS_WAIT_UNTIL([test xhv = x`ovn-sbctl --columns name --bare find chassis`])
# Delete the chassis "hv"
ovn-sbctl chassis-del hv
check ovn-sbctl chassis-del hv
# ovn-controller should recreate its chassis row.
OVS_WAIT_UNTIL([test xhv = x`ovn-sbctl --columns name --bare find chassis`])

Expand Down Expand Up @@ -822,7 +822,7 @@ no_tos_options="{csum=\"true\", key=flow, local_ip=\"192.168.0.1\", remote_ip=\"

#
# Start off with a remote chassis supporting geneve
ovn-sbctl chassis-add fakechassis geneve 192.168.0.2
check ovn-sbctl chassis-add fakechassis geneve 192.168.0.2
OVS_WAIT_UNTIL([check_tunnel_property type geneve])

tos_option=$(ovs-vsctl get interface ovn-fakech-0 options)
Expand Down Expand Up @@ -2855,7 +2855,7 @@ ovn_attach n1 br-phys 192.168.0.1
check ovn-nbctl --wait=sb sync
wait_row_count Chassis 1 name=hv1

ovn-sbctl chassis-add fakechassis geneve 192.168.0.2
check ovn-sbctl chassis-add fakechassis geneve 192.168.0.2
fakech_tunnel=ovn-fakech-0
OVS_WAIT_UNTIL([ovs-vsctl list port $fakech_tunnel])
port_uuid=$(ovs-vsctl get port $fakech_tunnel _uuid)
Expand Down
2 changes: 1 addition & 1 deletion tests/ovn-ic.at
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ovn_init_ic_db
ovn_start az1

# create fake chassis with vxlan encap to enforce requested tunnel key checks
ovn-sbctl chassis-add fakechassis vxlan 192.168.0.2
check ovn-sbctl chassis-add fakechassis vxlan 192.168.0.2

AT_CHECK([ovn-ic-nbctl ts-add ts1])
AT_CHECK([ovn-ic-nbctl --wait=sb ts-add ts2])
Expand Down
62 changes: 31 additions & 31 deletions tests/ovn-northd.at
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ AT_SETUP([check from NBDB to SBDB])
ovn_start

ovn-nbctl create Logical_Router name=R1
ovn-sbctl chassis-add gw1 geneve 127.0.0.1
ovn-sbctl chassis-add gw2 geneve 1.2.4.8
check ovn-sbctl chassis-add gw1 geneve 127.0.0.1
check ovn-sbctl chassis-add gw2 geneve 1.2.4.8

# Connect alice to R1 as distributed router gateway port on hv2
check ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24
Expand Down Expand Up @@ -123,13 +123,13 @@ ovn-sbctl list ha_chassis_group
# Delete chassis - gw2 in SB DB.
# ovn-northd should not recreate ha_chassis rows
# repeatedly when gw2 is deleted.
ovn-sbctl chassis-del gw2
check ovn-sbctl chassis-del gw2

ha_ch_list=$(fetch_column HA_Chassis _uuid)
check_column "$ha_ch_list" HA_Chassis _uuid

# Add back the gw2 chassis
ovn-sbctl chassis-add gw2 geneve 1.2.4.8
check ovn-sbctl chassis-add gw2 geneve 1.2.4.8

# delete the 2nd Gateway_Chassis on NBDB for alice port
check_column '' Port_Binding gateway_chassis logical_port=cr-alice
Expand Down Expand Up @@ -163,8 +163,8 @@ check ovn-nbctl ls-add S1
check ovn-nbctl --wait=sb lsp-add S1 S1-vm1
wait_row_count nb:Logical_Switch_Port 1 name=S1-vm1 'up!=true'

ovn-sbctl chassis-add hv1 geneve 127.0.0.1
ovn-sbctl lsp-bind S1-vm1 hv1
check ovn-sbctl chassis-add hv1 geneve 127.0.0.1
check ovn-sbctl lsp-bind S1-vm1 hv1
wait_row_count nb:Logical_Switch_Port 1 name=S1-vm1 'up=true'

AT_CLEANUP
Expand All @@ -191,7 +191,7 @@ OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check up state of router LSP linked to a gateway LR])
ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1
check ovn-sbctl chassis-add gw1 geneve 127.0.0.1

ovn-nbctl create Logical_Router name=R1 options:chassis=gw1
check ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24
Expand All @@ -202,7 +202,7 @@ check ovn-nbctl lsp-set-type S1-R1 router
check ovn-nbctl lsp-set-addresses S1-R1 02:ac:10:01:00:01
check ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1

ovn-sbctl lsp-bind S1-R1 gw1
check ovn-sbctl lsp-bind S1-R1 gw1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup])

AT_CLEANUP
Expand All @@ -212,7 +212,7 @@ OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check up state of router LSP linked to an LRP with set Gateway Chassis])
ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1
check ovn-sbctl chassis-add gw1 geneve 127.0.0.1

check ovn-nbctl lr-add R1
check ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24
Expand Down Expand Up @@ -580,7 +580,7 @@ check ovn-nbctl lsp-set-type sw0-lr0 router
check ovn-nbctl lsp-set-addresses sw0-lr0 router
check ovn-nbctl --wait=sb lsp-set-options sw0-lr0 router-port=lr0-sw0

ovn-sbctl lsp-bind sw0-p1 comp1
check ovn-sbctl lsp-bind sw0-p1 comp1
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=true

comp1_ch_uuid=$(fetch_column Chassis _uuid name=comp1)
Expand All @@ -598,12 +598,12 @@ ovn-sbctl clear Port_Binding sw0-p1 additional_chassis
wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis

# unbind sw0-p1
ovn-sbctl lsp-unbind sw0-p1
check ovn-sbctl lsp-unbind sw0-p1
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=false
wait_column "" HA_Chassis_Group ref_chassis

# Bind sw0-p1 in comp2
ovn-sbctl lsp-bind sw0-p1 comp2
check ovn-sbctl lsp-bind sw0-p1 comp2
wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis

check ovn-nbctl ls-add sw1
Expand Down Expand Up @@ -636,7 +636,7 @@ exp_ref_ch_list="$comp1_ch_uuid $comp2_ch_uuid"
wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis

# Unind sw1-p1. comp2 should not be in the ref_chassis.
ovn-sbctl lsp-unbind sw1-p1
check ovn-sbctl lsp-unbind sw1-p1
wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=false
wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis

Expand Down Expand Up @@ -671,12 +671,12 @@ wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis

# Create sw0-p2 and bind it to comp1
check ovn-nbctl --wait=sb lsp-add sw0 sw0-p2
ovn-sbctl lsp-bind sw0-p2 comp1
check ovn-sbctl lsp-bind sw0-p2 comp1
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p2 up=true
wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis

# unbind sw0-p2
ovn-sbctl lsp-unbind sw0-p2
check ovn-sbctl lsp-unbind sw0-p2
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p2 up=false
wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis

Expand Down Expand Up @@ -970,7 +970,7 @@ OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check Redirect Chassis propagation from NB to SB])
ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1
check ovn-sbctl chassis-add gw1 geneve 127.0.0.1

check ovn-nbctl lr-add R1
check ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24
Expand All @@ -995,7 +995,7 @@ OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check stateless dnat_and_snat rule])
ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1
check ovn-sbctl chassis-add gw1 geneve 127.0.0.1

check ovn-nbctl lr-add R1
check ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24
Expand Down Expand Up @@ -1079,7 +1079,7 @@ OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check portrange dnat, snat and dnat_and_snat rules])
ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1
check ovn-sbctl chassis-add gw1 geneve 127.0.0.1

check ovn-nbctl lr-add R1
check ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24
Expand Down Expand Up @@ -1402,9 +1402,9 @@ check ovn-nbctl --wait=sb lsp-add sw1 sw1-p1 -- lsp-set-addresses sw1-p1 \
"02:00:00:00:00:03 20.0.0.3"

# service_monitors state online requires corresponding port_binding to be "up"
ovn-sbctl chassis-add hv1 geneve 127.0.0.1
ovn-sbctl lsp-bind sw0-p1 hv1
ovn-sbctl lsp-bind sw1-p1 hv1
check ovn-sbctl chassis-add hv1 geneve 127.0.0.1
check ovn-sbctl lsp-bind sw0-p1 hv1
check ovn-sbctl lsp-bind sw1-p1 hv1
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 'up=true'
wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 'up=true'

Expand Down Expand Up @@ -1487,7 +1487,7 @@ OVS_WAIT_FOR_OUTPUT(
])

AS_BOX([Set the service monitor for sw0-p1 to offline])
ovn-sbctl set service_monitor $sm_sw0_p1 status=offline
check ovn-sbctl set service_monitor $sm_sw0_p1 status=offline

wait_row_count Service_Monitor 1 logical_port=sw0-p1 status=offline
check ovn-nbctl --wait=sb sync
Expand All @@ -1503,8 +1503,8 @@ OVS_WAIT_FOR_OUTPUT(
])

AS_BOX([Set the service monitor for sw0-p1 and sw1-p1 to online])
ovn-sbctl set service_monitor $sm_sw0_p1 status=online
ovn-sbctl set service_monitor $sm_sw1_p1 status=online
check ovn-sbctl set service_monitor $sm_sw0_p1 status=online
check ovn-sbctl set service_monitor $sm_sw1_p1 status=online

wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=online
check ovn-nbctl --wait=sb sync
Expand All @@ -1516,7 +1516,7 @@ OVS_WAIT_FOR_OUTPUT(
])

AS_BOX([Set the service monitor for sw1-p1 to error])
ovn-sbctl set service_monitor $sm_sw1_p1 status=error
check ovn-sbctl set service_monitor $sm_sw1_p1 status=error
wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=error
check ovn-nbctl --wait=sb sync

Expand Down Expand Up @@ -1625,8 +1625,8 @@ wait_row_count Service_Monitor 2
sm_sw0_p1=$(fetch_column Service_Monitor _uuid logical_port=sw0-p1)
sm_sw1_p1=$(fetch_column Service_Monitor _uuid logical_port=sw1-p1)

ovn-sbctl set service_monitor $sm_sw0_p1 status=offline
ovn-sbctl set service_monitor $sm_sw1_p1 status=offline
check ovn-sbctl set service_monitor $sm_sw0_p1 status=offline
check ovn-sbctl set service_monitor $sm_sw1_p1 status=offline

AT_CAPTURE_FILE([sbflows12])
OVS_WAIT_FOR_OUTPUT(
Expand Down Expand Up @@ -1974,7 +1974,7 @@ OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check router ARP/NS responder])
ovn_start

ovn-sbctl chassis-add ch geneve 127.0.0.1
check ovn-sbctl chassis-add ch geneve 127.0.0.1

check ovn-nbctl lr-add lr
check ovn-nbctl lrp-add lr lrp-public 00:00:00:00:01:00 43.43.43.1/24 4343::1/64
Expand Down Expand Up @@ -6364,8 +6364,8 @@ wait_row_count Service_Monitor 2
sm_vip1=$(fetch_column Service_Monitor _uuid logical_port=vip1)
sm_vip2=$(fetch_column Service_Monitor _uuid logical_port=vip2)

ovn-sbctl set service_monitor $sm_vip1 status=offline
ovn-sbctl set service_monitor $sm_vip2 status=offline
check ovn-sbctl set service_monitor $sm_vip1 status=offline
check ovn-sbctl set service_monitor $sm_vip2 status=offline
check ovn-nbctl --wait=sb sync

AT_CHECK([ovn-sbctl dump-flows lr0 | grep "lr_in_dnat" | ovn_strip_lflows], [0], [dnl
Expand Down Expand Up @@ -12142,7 +12142,7 @@ as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.11

ovn-sbctl chassis-add gw1 geneve 127.0.0.1
check ovn-sbctl chassis-add gw1 geneve 127.0.0.1

check ovn-nbctl ls-add sw0
check ovn-nbctl --wait=sb lsp-add sw0 sw0p1 -- lsp-set-addresses sw0p1 "00:00:20:20:12:01 10.0.0.4"
Expand Down
16 changes: 8 additions & 8 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -2854,7 +2854,7 @@ ovn_start
# Make ls1 a destination for unknown MACs.
# Add some ACLs for Ethertypes 1234, 1235, 1236.
check ovn-nbctl ls-add lsw0
ovn-sbctl chassis-add hv0 geneve 127.0.0.1
check ovn-sbctl chassis-add hv0 geneve 127.0.0.1
for i in 1 2 3; do
ovn-nbctl lsp-add lsw0 lp$i
done
Expand Down Expand Up @@ -14251,7 +14251,7 @@ check ovn-nbctl --wait=hv sync
# Chassis entry is not replaced.

gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)
ovn-sbctl destroy Chassis $gw2_chassis
check ovn-sbctl destroy Chassis $gw2_chassis

# Wait for the gw2_chassis row is recreated.
wait_row_count Chassis 1 name=gw2
Expand Down Expand Up @@ -22123,7 +22123,7 @@ check_virtual_offlows_not_present hv2
# Forcibly clear virtual_parent. ovn-controller should release the binding
# gracefully.
pb_uuid=$(ovn-sbctl --bare --columns _uuid find port_binding logical_port=sw0-vir)
ovn-sbctl clear port_binding $pb_uuid virtual_parent
check ovn-sbctl clear port_binding $pb_uuid virtual_parent

OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x])
Expand Down Expand Up @@ -22554,7 +22554,7 @@ AT_CHECK([ovn-sbctl get controller_event $uuid seq_num], [0], [dnl
1
])

ovn-sbctl destroy controller_event $uuid
check ovn-sbctl destroy controller_event $uuid
packet1="inport==\"sw1-p0\" && eth.src==00:00:00:00:00:33 && eth.dst==00:00:00:00:ff:02 &&
ip4 && ip.ttl==64 && ip4.src==192.168.2.11 && ip4.dst==192.168.2.100 &&
tcp && tcp.src==10000 && tcp.dst==80"
Expand All @@ -22569,7 +22569,7 @@ empty_lb_backends
AT_CHECK([ovn-sbctl get controller_event $uuid event_info:vip], [0], [dnl
"192.168.2.100:80"
])
ovn-sbctl destroy controller_event $uuid
check ovn-sbctl destroy controller_event $uuid

packet2="inport==\"sw0-p11\" && eth.src==00:00:00:00:00:11 && eth.dst==00:00:00:00:00:21 &&
ip6 && ip.ttl==64 && ip6.src==2001::11 && ip6.dst==2001::10 &&
Expand Down Expand Up @@ -23075,9 +23075,9 @@ OVS_WAIT_UNTIL(
[$at_diff -F'^---' exp rcv])

# Flush IGMP groups.
ovn-sbctl ip-multicast-flush sw1
ovn-sbctl ip-multicast-flush sw2
ovn-sbctl ip-multicast-flush sw3
check ovn-sbctl ip-multicast-flush sw1
check ovn-sbctl ip-multicast-flush sw2
check ovn-sbctl ip-multicast-flush sw3
wait_row_count IGMP_Group 0 address=239.0.1.68
check ovn-nbctl --wait=hv sync

Expand Down
4 changes: 2 additions & 2 deletions tests/system-ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -4347,7 +4347,7 @@ OVS_WAIT_UNTIL([
])

# Flush IGMP groups.
ovn-sbctl ip-multicast-flush sw1
check ovn-sbctl ip-multicast-flush sw1
check ovn-nbctl --wait=hv -t 3 sync
OVS_WAIT_UNTIL([
total_entries=`ovn-sbctl find IGMP_Group address="${group_v4}" | grep _uuid -c`
Expand Down Expand Up @@ -11844,7 +11844,7 @@ NS_CHECK_EXEC([vif0], [ping -q -c 3 -i 0.3 -w 2 fe80::200:ff:fe00:1 | FORMAT_PIN
])

check_row_count mac_binding 1 mac=\"00:00:00:00:00:02\"
ovn-sbctl --all destroy mac_binding
check ovn-sbctl --all destroy mac_binding

check ovn-nbctl --wait=hv set logical_router lr0 options:always_learn_from_arp_request=true

Expand Down

0 comments on commit cfcf345

Please sign in to comment.