Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ params:
LINK_TIMEOUT_S: "10"
IP_TIMEOUT_S: "15"
ETH_INTERFACE: ""
PING_TARGET: ""
PING_TARGET: "" # Empty uses the runner default of 8.8.8.8. Set an IP to override.
PING_COUNT: "4"
PING_WAIT_S: "2"
PING_RETRIES: "3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ A disconnected port is reported as an interface-level SKIP rather than a failure
- Connect the port to a link partner or switch.
- Provide IPv4 using the image network manager, DHCP configuration, or a
preconfigured static address.
- Ensure the selected gateway or `PING_TARGET` is reachable through the tested
interface. Internet access is not required when a local peer is used.
- The default target `8.8.8.8` must be reachable and reply to ICMP through the
tested interface. For an isolated network, select a reachable local peer with
`--ping-target` or `PING_TARGET`. Internet access is not required with a local peer.

## Files

Expand All @@ -47,15 +48,17 @@ Runner/utils/lib_ethernet.sh

## Configuration

CLI options override environment variables. Run `./run.sh --help` for the
on-target option summary.
CLI options override environment variables. An omitted or empty
`--ping-target` preserves `PING_TARGET` when set, otherwise it uses `8.8.8.8`.
The default gateway is not automatically selected or used as a fallback after
ping failure. Run `./run.sh --help` for the on-target option summary.

| CLI option | Environment variable | Default | Description |
|---|---|---:|---|
| `--link-timeout` | `LINK_TIMEOUT_S` | `10` | Maximum wait for carrier |
| `--ip-timeout` | `IP_TIMEOUT_S` | `15` | Maximum wait for a valid IPv4 |
| `--interface` | `ETH_INTERFACE` | automatic | Explicit interface, otherwise auto-detect |
| `--ping-target` | `PING_TARGET` | automatic | Explicit target, otherwise gateway or `8.8.8.8` |
| `--ping-target` | `PING_TARGET` | `8.8.8.8` | User-provided target overrides the public IPv4 default |
| `--ping-count` | `PING_COUNT` | `4` | Packets per ping attempt |
| `--ping-wait` | `PING_WAIT_S` | `2` | Per-packet ping timeout |
| `--ping-retries` | `PING_RETRIES` | `3` | Ping attempts |
Expand All @@ -67,12 +70,25 @@ cd Runner/suites/Connectivity/Ethernet/Ethernet_Basic_Validation
./run.sh
```

Example:
The default command pings `8.8.8.8` through each tested interface. All retries
use the same selected target. To select a local peer explicitly:

```sh
./run.sh --ping-target 192.168.1.1 --link-timeout 20
```

The environment equivalent and CLI precedence are:

```sh
PING_TARGET=192.168.1.1 ./run.sh
PING_TARGET=192.168.1.1 ./run.sh --ping-target 192.168.1.2
```

For LAVA, set the existing `PING_TARGET` parameter to the desired IP. Its empty
default selects `8.8.8.8`. Unreachable targets fail the connectivity check after
the configured retries, even when carrier and IPv4 checks pass. Disconnected
ports and interfaces without valid IPv4 retain their existing SKIP behavior.

To test one explicit interface, use either form:

```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,30 @@ RESULT_TABLE="./$TESTNAME.results.tsv"
LINK_TIMEOUT_S="${LINK_TIMEOUT_S:-10}"
IP_TIMEOUT_S="${IP_TIMEOUT_S:-15}"
ETH_INTERFACE="${ETH_INTERFACE:-}"
PING_TARGET="${PING_TARGET:-}"
PING_TARGET="${PING_TARGET:-8.8.8.8}"
PING_COUNT="${PING_COUNT:-4}"
PING_WAIT_S="${PING_WAIT_S:-2}"
PING_RETRIES="${PING_RETRIES:-3}"

# usage
# Print supported options and the ping-target default to stdout. Returns 0.
usage() {
printf '%s\n' \
"Usage: ./run.sh [options]" \
" --link-timeout SECONDS" \
" --ip-timeout SECONDS" \
" --interface IFACE" \
" --ping-target ADDRESS" \
" --ping-target ADDRESS (default: PING_TARGET or 8.8.8.8)" \
" --ping-count COUNT" \
" --ping-wait SECONDS" \
" --ping-retries COUNT" \
" -h, --help" \
"CLI options override environment variables."
}

# parse_args [OPTIONS...]
# Apply CLI overrides to suite settings. Empty ping-target values preserve the
# environment/default target. No stdout except help, exits 2 on invalid options.
parse_args() {
while [ "$#" -gt 0 ]; do
case "$1" in
Expand Down Expand Up @@ -116,7 +121,9 @@ parse_args() {
usage
exit 2
}
PING_TARGET="$2"
if [ -n "$2" ]; then
PING_TARGET="$2"
fi
shift 2
;;
--ping-count)
Expand Down Expand Up @@ -164,7 +171,7 @@ rm -f "$RES_FILE" "$SUMMARY_FILE" "$RESULT_TABLE"

log_info "--------------------------------------------------------------------------"
log_info "------------------- Starting $TESTNAME Testcase --------------------------"
log_info "Configuration: interface=${ETH_INTERFACE:-auto} LINK_TIMEOUT_S=$LINK_TIMEOUT_S IP_TIMEOUT_S=$IP_TIMEOUT_S PING_TARGET=${PING_TARGET:-auto} PING_COUNT=$PING_COUNT PING_WAIT_S=$PING_WAIT_S PING_RETRIES=$PING_RETRIES"
log_info "Configuration: interface=${ETH_INTERFACE:-auto} LINK_TIMEOUT_S=$LINK_TIMEOUT_S IP_TIMEOUT_S=$IP_TIMEOUT_S PING_TARGET=$PING_TARGET PING_COUNT=$PING_COUNT PING_WAIT_S=$PING_WAIT_S PING_RETRIES=$PING_RETRIES"

if ! CHECK_DEPS_NO_EXIT=1 check_dependencies \
ip \
Expand Down
Loading