Skip to content

Commit

Permalink
automated: linux: make network-manager delay configurable
Browse files Browse the repository at this point in the history
When restarting networking it takes some time for NM to report "full"
connectivity. The delay may be longer on some boards (notably RPi4).
This patch allows to configure the delay depending on the board.

Signed-off-by: Milosz Wasilewski <[email protected]>
  • Loading branch information
mwasilew committed Aug 18, 2023
1 parent 5312292 commit 3774ffa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions automated/linux/network-manager/network-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ RESULT_FILE="${OUTPUT}/result.txt"
export RESULT_FILE
IFACE=eth0
SKIP_INSTALL="true"
DELAY=10

usage() {
echo "Usage: $0 [-i interface] [-s <true|false>]" 1>&2
echo "Usage: $0 [-i interface] [-s <true|false>] [-d delay in seconds]" 1>&2
exit 1
}

while getopts "s:i:h" o; do
while getopts "s:i:d:h" o; do
case "$o" in
i) IFACE="${OPTARG}" ;;
s) SKIP_INSTALL="${OPTARG}" ;;
d) DELAY="${OPTARG}" ;;
h|*) usage ;;
esac
done
Expand Down Expand Up @@ -64,6 +66,7 @@ nmcli -c no general hostname
check_return "nmcli-general-hostname"

# check networking status
nmcli -c no networking connectivity check
nmcli -c no networking connectivity check | grep full
check_return "nmcli-initial-full-connectivity"

Expand All @@ -79,7 +82,8 @@ nmcli -c no -w 10 networking on
check_return "nmcli-networking-on"

# connectivity reporting is delayed despite using blocking call
sleep 10
# DELAY can be configured as it takes longer on some boards
sleep "${DELAY}"

nmcli -c no networking connectivity check | grep full
check_return "nmcli-offon-full-connectivity"
Expand Down
3 changes: 2 additions & 1 deletion automated/linux/network-manager/network-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ metadata:
params:
INTERFACE: "eth0"
SKIP_INSTALL: "true"
DELAY: 10
run:
steps:
- cd ./automated/linux/network-manager/
- ./network-manager.sh -i "${INTERFACE}" -s "${SKIP_INSTALL}"
- ./network-manager.sh -i "${INTERFACE}" -s "${SKIP_INSTALL}" -d "${DELAY}"
- ../../utils/send-to-lava.sh ./output/result.txt

0 comments on commit 3774ffa

Please sign in to comment.