Skip to content

Commit

Permalink
system-tests: Use alternate lease and configuration files for dhcpd.
Browse files Browse the repository at this point in the history
Default lease file for dhcp varies between OSes. For instance,
/var/lib/dhcp/dhcpd6.leases or /var/lib/dhcpd/dhcpd6.leases might be used.
Before this patch, lease file was not deleted on some OSes, resulting in
potential test failures (e.g. when multiple prefix delgation tests were
executed within a certain time).

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
(cherry picked from commit b5ee129)
  • Loading branch information
simonartxavier authored and dceara committed Feb 28, 2025
1 parent b5100b1 commit d8e3fb6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
32 changes: 23 additions & 9 deletions tests/system-common-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,25 @@ m4_define([NETNS_START_TCPDUMP],
]
)

# NETNS_START_DHCPD([namespace], [iface], [dhcpd.conf])
#
# Helper to properly start dhcpd
m4_define([NETNS_START_DHCPD],
[
DHCP_TEST_DIR="$ovs_base/dhcp-test"
mkdir -p $DHCP_TEST_DIR

mv $3 $DHCP_TEST_DIR/dhcpd.conf

touch $DHCP_TEST_DIR/dhcpd.leases
chown root:dhcpd $DHCP_TEST_DIR $DHCP_TEST_DIR/dhcpd.leases
chmod 775 $DHCP_TEST_DIR
chmod 664 $DHCP_TEST_DIR/dhcpd.leases

NETNS_START_TCPDUMP([$1], [-nni $2], [$1])
NETNS_DAEMONIZE([$1], [dhcpd -6 -f -lf $DHCP_TEST_DIR/dhcpd.leases -cf $DHCP_TEST_DIR/dhcpd.conf $2 > dhcpd.log 2>&1], [dhcpd.pid])
]
)

# OVS_CHECK_VXLAN()
#
Expand Down Expand Up @@ -446,21 +465,16 @@ OVN_POPULATE_ARP

check ovn-nbctl --wait=hv sync

cat > /etc/dhcp/dhcpd.conf <<EOF
cat > dhcpd.conf <<EOF
option dhcp-rebinding-time 10;
option dhcp-renewal-time 5;
subnet6 2001:db8:3333::/56 {
prefix6 2001:db8:3333:100:: 2001:db8:3333:111:: /64;
}
EOF
rm -f /var/lib/dhcp/dhcpd6.leases
touch /var/lib/dhcp/dhcpd6.leases
chown root:dhcpd /var/lib/dhcp /var/lib/dhcp/dhcpd6.leases
chmod 775 /var/lib/dhcp
chmod 664 /var/lib/dhcp/dhcpd6.leases

NETNS_START_TCPDUMP([server], [-nni s1], [server])
NETNS_DAEMONIZE([server], [dhcpd -6 -f s1 > dhcpd.log 2>&1], [dhcpd.pid])

NETNS_START_DHCPD([server], [s1], [dhcpd.conf])

check ovn-nbctl --wait=hv sync

OVS_WAIT_WHILE([test "$(ovn-nbctl get logical_router_port rp-public ipv6_prefix | cut -c4-15)" = ""])
Expand Down
12 changes: 3 additions & 9 deletions tests/system-ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -14605,21 +14605,15 @@ OVN_POPULATE_ARP

check ovn-nbctl --wait=hv sync

cat > /etc/dhcp/dhcpd.conf <<EOF
cat > dhcpd.conf <<EOF
option dhcp-rebinding-time 10;
option dhcp-renewal-time 5;
subnet6 2001:db8:3333::/56 {
prefix6 2001:db8:3333:100:: 2001:db8:3333:111:: /64;
}
EOF
rm -f /var/lib/dhcp/dhcpd6.leases
touch /var/lib/dhcp/dhcpd6.leases
chown root:dhcpd /var/lib/dhcp /var/lib/dhcp/dhcpd6.leases
chmod 775 /var/lib/dhcp
chmod 664 /var/lib/dhcp/dhcpd6.leases

NETNS_START_TCPDUMP([server], [-nni s1], [server])
NETNS_DAEMONIZE([server], [dhcpd -6 -f s1 > dhcpd.log 2>&1], [dhcpd.pid])

NETNS_START_DHCPD([server], [s1], [dhcpd.conf])
check ovn-nbctl --wait=hv sync

AT_CHECK([ovn-appctl debug/dump-peer-ports | sort], [0], [dnl
Expand Down

0 comments on commit d8e3fb6

Please # to comment.