File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -878,22 +878,27 @@ get_route_table_size_by_asic_id_and_ipver() {
878
878
local asic_id=" $1 "
879
879
local ip_ver=" $2 "
880
880
local filepath=" /tmp/route_summary.txt"
881
+ local ns=" "
881
882
RC=0
882
883
884
+ if [[ $NUM_ASICS -gt 1 ]] ; then
885
+ ns=" -n ${asic_id} "
886
+ fi
887
+
883
888
if [ $ip_ver = " ipv4" ]; then
884
- cmd=" vtysh -n $asic_id -c 'show ip route summary json'"
889
+ cmd=" vtysh ${ns} -c 'show ip route summary json'"
885
890
elif [ $ip_ver = " ipv6" ]; then
886
- cmd=" vtysh -n $asic_id -c 'show ipv6 route summary json'"
891
+ cmd=" vtysh ${ns} -c 'show ipv6 route summary json'"
887
892
else
888
893
echo " Wrong argument $ip_ver ."
889
894
return 255
890
895
fi
891
896
892
-
893
897
local timeout_cmd=" timeout --foreground ${TIMEOUT_MIN} m"
894
898
local cmds=" $cmd > '$filepath '"
895
899
896
900
eval " ${timeout_cmd} bash -c \" ${cmds} \" " || RC=$?
901
+
897
902
if [ $RC -eq $TIMEOUT_EXIT_CODE ]; then
898
903
echo " Command: $cmds timedout after ${TIMEOUT_MIN} minutes."
899
904
return $RC
@@ -906,7 +911,7 @@ get_route_table_size_by_asic_id_and_ipver() {
906
911
import json
907
912
with open('$filepath ') as json_file:
908
913
data = json.load(json_file)
909
- print(data['routesTotal'])" )
914
+ print(data['routesTotal'])" )
910
915
rm $filepath
911
916
echo " $route_tab_size "
912
917
}
You can’t perform that action at this time.
0 commit comments