File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -878,22 +878,27 @@ get_route_table_size_by_asic_id_and_ipver() {
878878 local asic_id=" $1 "
879879 local ip_ver=" $2 "
880880 local filepath=" /tmp/route_summary.txt"
881+ local ns=" "
881882 RC=0
882883
884+ if [[ $NUM_ASICS -gt 1 ]] ; then
885+ ns=" -n ${asic_id} "
886+ fi
887+
883888 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'"
885890 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'"
887892 else
888893 echo " Wrong argument $ip_ver ."
889894 return 255
890895 fi
891896
892-
893897 local timeout_cmd=" timeout --foreground ${TIMEOUT_MIN} m"
894898 local cmds=" $cmd > '$filepath '"
895899
896900 eval " ${timeout_cmd} bash -c \" ${cmds} \" " || RC=$?
901+
897902 if [ $RC -eq $TIMEOUT_EXIT_CODE ]; then
898903 echo " Command: $cmds timedout after ${TIMEOUT_MIN} minutes."
899904 return $RC
@@ -906,7 +911,7 @@ get_route_table_size_by_asic_id_and_ipver() {
906911import json
907912with open('$filepath ') as json_file:
908913 data = json.load(json_file)
909- print(data['routesTotal'])" )
914+ print(data['routesTotal'])" )
910915 rm $filepath
911916 echo " $route_tab_size "
912917}
You can’t perform that action at this time.
0 commit comments