-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sonic-cfggen] Add unit test for DHCP relay Jinja2 templates (#1357)
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[program:start.sh] | ||
command=/usr/bin/start.sh | ||
priority=1 | ||
autostart=true | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[group:isc-dhcp-relay] | ||
programs=isc-dhcp-relay-Vlan1000 | ||
|
||
[program:isc-dhcp-relay-Vlan1000] | ||
command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i Vlan1000 -i PortChannel02 -i PortChannel03 -i PortChannel04 -i PortChannel01 192.0.0.1 192.0.0.2 | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
|
43 changes: 43 additions & 0 deletions
43
src/sonic-config-engine/tests/sample_output/wait_for_intf.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
function wait_until_iface_ready | ||
{ | ||
IFACE=$1 | ||
|
||
echo "Waiting until interface $IFACE is up..." | ||
|
||
# Wait for the interface to come up (i.e., 'ip link show' returns 0) | ||
until ip link show dev $IFACE up > /dev/null 2>&1; do | ||
sleep 1 | ||
done | ||
|
||
echo "Interface $IFACE is up" | ||
|
||
echo "Waiting until interface $IFACE has an IPv4 address..." | ||
|
||
# Wait until the interface gets assigned an IPv4 address | ||
while true; do | ||
IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1) | ||
|
||
if [ -n "$IP" ]; then | ||
break | ||
fi | ||
|
||
sleep 1 | ||
done | ||
|
||
echo "Interface $IFACE is configured with IP $IP" | ||
} | ||
|
||
|
||
# Wait for all interfaces to come up and have IPv4 addresses assigned | ||
wait_until_iface_ready Vlan1000 | ||
wait_until_iface_ready PortChannel04 | ||
wait_until_iface_ready PortChannel02 | ||
wait_until_iface_ready PortChannel03 | ||
wait_until_iface_ready PortChannel03 | ||
wait_until_iface_ready PortChannel01 | ||
wait_until_iface_ready PortChannel02 | ||
wait_until_iface_ready PortChannel04 | ||
wait_until_iface_ready PortChannel01 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters