From 5c179ed2f535ba830ef4b76cb4fd749a2a546279 Mon Sep 17 00:00:00 2001 From: Eduardo Olivares Date: Mon, 4 Aug 2025 12:09:45 +0200 Subject: [PATCH] Add usage message to dectect new versions of IpUtilsIpVersionPingInterface Tobiko detects ping interfaces (ping version running on the test machine or container) by running `ping --help` and matching an expected output. This patch adds an output that will match ping output for recent iputils package versions. Related-ticket: TOBIKO-169 Change-Id: I9347a071205d67fe658ff2c9b75569b71e66e274 Signed-off-by: Eduardo Olivares --- tobiko/shell/ping/_interface.py | 52 ++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/tobiko/shell/ping/_interface.py b/tobiko/shell/ping/_interface.py index ff0cf0e45..2c8e4e98c 100644 --- a/tobiko/shell/ping/_interface.py +++ b/tobiko/shell/ping/_interface.py @@ -274,12 +274,62 @@ Usage: ping -6 [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] """.strip() +IP_VERSION_IPUTILS_PING_USAGE_NEW = """ +ping: invalid option -- '-' + +Usage + ping [options] + +Options: + dns name or ip address + -a use audible ping + -A use adaptive ping + -B sticky source address + -c stop after replies + -D print timestamps + -d use SO_DEBUG socket option + -f flood ping + -h print help and exit + -I either interface name or address + -i seconds between sending each packet + -L suppress loopback of multicast packets + -l send number of packages while waiting replies + -m tag the packets going out + -M define mtu discovery, can be one of + -n no dns name resolution + -O report outstanding replies + -p contents of padding byte + -q quiet output + -Q use quality of service bits + -s use as number of data bytes to be sent + -S use as SO_SNDBUF socket option value + -t define time to live + -U print user-to-user latency + -v verbose output + -V print version and exit + -w reply wait in seconds + -W time to wait for response + +IPv4 options: + -4 use IPv4 + -b allow pinging broadcast + -R record route + -T define timestamp, can be one of {timestamp_formats} + +IPv6 options: + -6 use IPv6 + -F define flow label, default is random + -N use icmp6 node info query, try as argument +""".strip().format(timestamp_formats="") + + @ping_interface class IpUtilsIpVersionPingInterface(IpUtilsPingInterface, IpVersionPingInterface): def match_ping_usage(self, usage): - return usage.startswith(IP_VERSION_IPUTILS_PING_USAGE) + return (usage.startswith(IP_VERSION_IPUTILS_PING_USAGE) or + usage.startswith(IP_VERSION_IPUTILS_PING_USAGE_NEW)) BUSYBOX_PING_USAGE = """