test/vpp: fix error handling in vppctl non-interactive mode
On Fedora 30 we have noticed VPP 19.04 related issues:
1) Error values returned by vppctl in non-interactive mode
are not relevant to the success/fail of command.
Vppctl ALWAYS returns 0, so "-e" bash option is unable
to detect any errors.
2) We have intermittent pipefail errors (error 141) returned
by vppctl on disconnect from vpp, even though commands are
executed succesfully.
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1214 (master)
(cherry picked from commit 7b7e97604b
)
Change-Id: Ie22ea24f7e81017089b899111724d338eeb81113
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1287
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
1dfd2cf594
commit
400316351f
@ -107,6 +107,7 @@ function start_vpp() {
|
|||||||
# for VPP side maximal size of MTU for TCP is 1460 and tests doesn't work
|
# for VPP side maximal size of MTU for TCP is 1460 and tests doesn't work
|
||||||
# stable with larger packets
|
# stable with larger packets
|
||||||
MTU=1460
|
MTU=1460
|
||||||
|
MTU_W_HEADER=$((MTU+20))
|
||||||
ip link set dev $INITIATOR_INTERFACE mtu $MTU
|
ip link set dev $INITIATOR_INTERFACE mtu $MTU
|
||||||
ethtool -K $INITIATOR_INTERFACE tso off
|
ethtool -K $INITIATOR_INTERFACE tso off
|
||||||
ethtool -k $INITIATOR_INTERFACE
|
ethtool -k $INITIATOR_INTERFACE
|
||||||
@ -131,7 +132,7 @@ function start_vpp() {
|
|||||||
xtrace_disable
|
xtrace_disable
|
||||||
counter=40
|
counter=40
|
||||||
while [ $counter -gt 0 ] ; do
|
while [ $counter -gt 0 ] ; do
|
||||||
vppctl show version &> /dev/null && break
|
vppctl show version | grep -E "vpp v[0-9]+\.[0-9]+" && break
|
||||||
counter=$(( counter - 1 ))
|
counter=$(( counter - 1 ))
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
done
|
done
|
||||||
@ -140,37 +141,47 @@ function start_vpp() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup host interface
|
# Below VPP commands are masked with "|| true" for the sake of
|
||||||
vppctl create host-interface name $TARGET_INTERFACE
|
# running the test in the CI system. For reasons unknown when
|
||||||
VPP_TGT_INT="host-$TARGET_INTERFACE"
|
# run via CI these commands result in 141 return code (pipefail)
|
||||||
vppctl set interface state $VPP_TGT_INT up
|
# even despite producing valid output.
|
||||||
vppctl set interface ip address $VPP_TGT_INT $TARGET_IP/24
|
# Using "|| true" does not impact the "-e" flag used in test scripts
|
||||||
vppctl set interface mtu $MTU $VPP_TGT_INT
|
# because vppctl cli commands always return with 0, even if
|
||||||
|
# there was an error.
|
||||||
|
# As a result - grep checks on command outputs must be used to
|
||||||
|
# verify vpp configuration and connectivity.
|
||||||
|
|
||||||
vppctl show interface
|
# Setup host interface
|
||||||
|
vppctl create host-interface name $TARGET_INTERFACE || true
|
||||||
|
VPP_TGT_INT="host-$TARGET_INTERFACE"
|
||||||
|
vppctl set interface state $VPP_TGT_INT up || true
|
||||||
|
vppctl set interface ip address $VPP_TGT_INT $TARGET_IP/24 || true
|
||||||
|
vppctl set interface mtu $MTU $VPP_TGT_INT || true
|
||||||
|
|
||||||
|
vppctl show interface | tr -s " " | grep -E "host-$TARGET_INTERFACE [0-9]+ up $MTU/0/0/0"
|
||||||
|
|
||||||
# Disable session layer
|
# Disable session layer
|
||||||
# NOTE: VPP net framework should enable it itself.
|
# NOTE: VPP net framework should enable it itself.
|
||||||
vppctl session disable
|
vppctl session disable || true
|
||||||
|
|
||||||
# Verify connectivity
|
# Verify connectivity
|
||||||
vppctl show int addr
|
vppctl show int addr | grep -E "$TARGET_IP/24"
|
||||||
ip addr show $INITIATOR_INTERFACE
|
ip addr show $INITIATOR_INTERFACE
|
||||||
ip netns exec $TARGET_NAMESPACE ip addr show $TARGET_INTERFACE
|
ip netns exec $TARGET_NAMESPACE ip addr show $TARGET_INTERFACE
|
||||||
sleep 3
|
sleep 3
|
||||||
# SC1010: ping -M do - in this case do is an option not bash special word
|
# SC1010: ping -M do - in this case do is an option not bash special word
|
||||||
# shellcheck disable=SC1010
|
# shellcheck disable=SC1010
|
||||||
ping -c 1 $TARGET_IP -s $(( MTU - 28 )) -M do
|
ping -c 1 $TARGET_IP -s $(( MTU - 28 )) -M do
|
||||||
vppctl ping $INITIATOR_IP repeat 1 size $(( MTU - (28 + 8) )) verbose
|
vppctl ping $INITIATOR_IP repeat 1 size $(( MTU - (28 + 8) )) verbose | grep -E "$MTU_W_HEADER bytes from $INITIATOR_IP"
|
||||||
}
|
}
|
||||||
|
|
||||||
function kill_vpp() {
|
function kill_vpp() {
|
||||||
vppctl delete host-interface name $TARGET_INTERFACE
|
vppctl delete host-interface name $TARGET_INTERFACE || true
|
||||||
|
|
||||||
# Dump VPP configuration before kill
|
# Dump VPP configuration before kill
|
||||||
vppctl show api clients
|
vppctl show api clients || true
|
||||||
vppctl show session
|
vppctl show session || true
|
||||||
vppctl show errors
|
vppctl show errors || true
|
||||||
|
|
||||||
killprocess $vpp_pid
|
killprocess $vpp_pid
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user