From: Martin Schwenke Date: Wed, 17 Aug 2022 01:37:56 +0000 (+1000) Subject: ctdb-tests: Implement "ip -brief link show" in ip stub X-Git-Tag: talloc-2.4.0~987 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5abaec499275bc47fb596e6bf2fa9fe98a891e79;p=thirdparty%2Fsamba.git ctdb-tests: Implement "ip -brief link show" in ip stub Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ip b/ctdb/tests/UNIT/eventscripts/stubs/ip index 2856aff00a6..090afae253a 100755 --- a/ctdb/tests/UNIT/eventscripts/stubs/ip +++ b/ctdb/tests/UNIT/eventscripts/stubs/ip @@ -130,17 +130,26 @@ ip_link_show() _mac="00:00:00:00:00:00" _brd="00:00:00:00:00:00" _type="loopback" - _opts=" mtu 65536 qdisc noqueue state UNKNOWN" + _state="UNKNOWN" + _status="" + _opts="mtu 65536 qdisc noqueue state ${_state}" ;; *) _mac=$(echo "$dev" | cksum | sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@') _brd="ff:ff:ff:ff:ff:ff" _type="ether" - _opts=" mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000" + _status="" + _opts="mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000" ;; esac - echo "${n:-42}: ${dev}: ${_opts}" - echo " link/${_type} ${_mac} brd ${_brd}" + + if $brief; then + printf '%-16s %-14s %-17s %s\n' \ + "$dev" "$_status" "$_mac" "$_status" + else + echo "${n:-42}: ${dev}: ${_status} ${_opts}" + echo " link/${_type} ${_mac} brd ${_brd}" + fi } # This is incomplete because it doesn't actually look up table ids in @@ -209,6 +218,11 @@ ip_addr_show() primary=true secondary=true _to="" + + if $brief; then + not_implemented "ip -br addr show in \"$orig_args\"" + fi + while [ -n "$1" ]; do case "$1" in dev) @@ -466,6 +480,10 @@ ip_rule() ip_rule_show() { + if $brief; then + not_implemented "ip -br rule show in \"$orig_args\"" + fi + ip_rule_show_1() { _pre="$1" @@ -784,6 +802,14 @@ ip_route_del() orig_args="$*" +brief=false +case "$1" in +-br*) + brief=true + shift + ;; +esac + case "$1" in link) shift