mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
test: Add unit test for 'show cli'
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
[7mADDRESS MODE STATE STRATUM POLL-INTERVAL[0m
|
||||
185.125.190.56 peer candidate 2 8
|
||||
185.125.190.58 server unstable 2 7
|
||||
185.125.190.57 server falseticker 2 8
|
||||
91.189.91.157 local-clock outlier 2 6
|
||||
192.121.108.100 server candidate 3 8
|
||||
85.24.237.72 server selected 2 8
|
||||
162.159.200.1 server unusable 3 7
|
||||
85.24.237.71 server candidate 2 8
|
||||
+13
-1
@@ -59,6 +59,8 @@ if [ $# -eq 2 ] && [ $1 = "update" ]; then
|
||||
"$SR_EMULATOR_TOOL" | "$CLI_PRETTY_TOOL" "-t" "show-routing-table" -i "ipv6" > "$CLI_OUTPUT_PATH/show-routes-ipv6.txt"
|
||||
elif [ $2 = "show-bridge-mdb" ]; then
|
||||
"$SR_EMULATOR_TOOL" | "$CLI_PRETTY_TOOL" "show-bridge-mdb" > "$CLI_OUTPUT_PATH/show-bridge-mdb.txt"
|
||||
elif [ $2 = "show-ntp" ]; then
|
||||
"$SR_EMULATOR_TOOL" | "$CLI_PRETTY_TOOL" "show-ntp" > "$CLI_OUTPUT_PATH/show-ntp.txt"
|
||||
else
|
||||
echo "Unsupported cli-pretty command $2"
|
||||
exit 1
|
||||
@@ -67,7 +69,7 @@ if [ $# -eq 2 ] && [ $1 = "update" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "1..10"
|
||||
echo "1..11"
|
||||
echo "# Running:"
|
||||
|
||||
# Show interfaces
|
||||
@@ -89,6 +91,16 @@ if ! diff -u "$CLI_OUTPUT_PATH/show-bridge-mdb.txt" "$CLI_OUTPUT_FILE"; then
|
||||
fi
|
||||
ok "\"show bridge mdb\" output looks intact"
|
||||
|
||||
# Show NTP
|
||||
echo "# $SR_EMULATOR_TOOL | $CLI_PRETTY_TOOL show-ntp"
|
||||
"$SR_EMULATOR_TOOL" | "$CLI_PRETTY_TOOL" "show-ntp" > "$CLI_OUTPUT_FILE"
|
||||
|
||||
if ! diff -u "$CLI_OUTPUT_PATH/show-ntp.txt" "$CLI_OUTPUT_FILE"; then
|
||||
print_update_txt
|
||||
fail "\"show ntp\" output has changed"
|
||||
fi
|
||||
ok "\"show ntp\" output looks intact"
|
||||
|
||||
# Show ipv4 routes
|
||||
echo "# $SR_EMULATOR_TOOL | $CLI_PRETTY_TOOL -t show-routing-table -i ipv4"
|
||||
"$SR_EMULATOR_TOOL" | "$CLI_PRETTY_TOOL" "-t" "show-routing-table" -i "ipv4" > "$CLI_OUTPUT_FILE"
|
||||
|
||||
@@ -7,9 +7,11 @@ YANGER_TOOL="$ROOT_PATH/src/statd/python/yanger/yanger.py"
|
||||
|
||||
INTERFACES_OUTPUT_FILE="$(mktemp)"
|
||||
ROUTES_OUTPUT_FILE="$(mktemp)"
|
||||
SYSTEM_OUTPUT_FILE="$(mktemp)"
|
||||
cleanup() {
|
||||
rm -f "$INTERFACES_OUTPUT_FILE"
|
||||
rm -f "$ROUTES_OUTPUT_FILE"
|
||||
rm -f "$SYSTEM_OUTPUT_FILE"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
@@ -26,5 +28,7 @@ fi
|
||||
|
||||
$YANGER_TOOL "ietf-routing" -t "$SCRIPT_PATH/system-output/" > "$ROUTES_OUTPUT_FILE"
|
||||
|
||||
$YANGER_TOOL "ietf-system" -t "$SCRIPT_PATH/system-output/" > "$SYSTEM_OUTPUT_FILE"
|
||||
|
||||
# Merge all module files
|
||||
jq -s '.[0] * .[1]' $ROUTES_OUTPUT_FILE $INTERFACES_OUTPUT_FILE
|
||||
jq -s '.[0] * .[1] * .[2]' $ROUTES_OUTPUT_FILE $INTERFACES_OUTPUT_FILE $SYSTEM_OUTPUT_FILE
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=,+,185.125.190.56,2,8,377,166,0.005469983,0.005822986,0.033335429
|
||||
^,~,185.125.190.58,2,7,377,37,0.003233160,0.003233160,0.028441129
|
||||
^,x,185.125.190.57,2,8,377,167,-0.000418652,-0.000065722,0.027703809
|
||||
#,-,91.189.91.157,2,6,377,488,0.000970410,0.001490889,0.077348366
|
||||
^,+,192.121.108.100,3,8,377,101,0.005757879,0.006114979,0.024731735
|
||||
^,*,85.24.237.72,2,8,377,37,0.006444688,0.006805896,0.017862743
|
||||
^,?,162.159.200.1,3,7,377,34,-0.000447366,-0.000447366,0.009887429
|
||||
^,+,85.24.237.71,2,8,377,169,0.003875532,0.004228305,0.015323908
|
||||
@@ -1,23 +1,24 @@
|
||||
=== Simple NTP client test
|
||||
=== Basic NTP client test
|
||||
==== Description
|
||||
Verify NTP client to multiple NTP servers and verify that one get selected
|
||||
Verify NTP client with multiple servers, ensure one get selected.
|
||||
|
||||
==== Topology
|
||||
ifdef::topdoc[]
|
||||
image::../../test/case/ietf_system/ntp_client/topology.svg[Simple NTP client test topology]
|
||||
image::../../test/case/ietf_system/ntp_client/topology.svg[Basic NTP client test topology]
|
||||
endif::topdoc[]
|
||||
ifndef::topdoc[]
|
||||
ifdef::testgroup[]
|
||||
image::ntp_client/topology.svg[Simple NTP client test topology]
|
||||
image::ntp_client/topology.svg[Basic NTP client test topology]
|
||||
endif::testgroup[]
|
||||
ifndef::testgroup[]
|
||||
image::topology.svg[Simple NTP client test topology]
|
||||
image::topology.svg[Basic NTP client test topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Set up topology and attach to target DUT
|
||||
. Configure NTP client on 'target'
|
||||
. Verify one source is in 'selected' state on 'target'
|
||||
. Verify three sources exist in NTP client on 'target'
|
||||
|
||||
|
||||
<<<
|
||||
|
||||
Reference in New Issue
Block a user