MCPcopy Create free account
hub / github.com/SpaceNetLab/StarryNet / sn_ping

Function sn_ping

starrynet/sn_utils.py:715–737  ·  view source on GitHub ↗
(src, des, time_index, constellation_size, container_id_list,
            file_path, configuration_file_path, remote_ssh)

Source from the content-addressed store, hash-verified

713
714
715def sn_ping(src, des, time_index, constellation_size, container_id_list,
716 file_path, configuration_file_path, remote_ssh):
717 if des <= constellation_size:
718 ifconfig_output = sn_remote_cmd(
719 remote_ssh, "docker exec -it " + str(container_id_list[des - 1]) +
720 " ifconfig | sed 's/[ \t].*//;/^\(eth0\|\)\(lo\|\)$/d'")
721 des_IP = sn_remote_cmd(
722 remote_ssh, "docker exec -it " + str(container_id_list[des - 1]) +
723 " ifconfig " + ifconfig_output[0][:-1] +
724 "|awk -F '[ :]+' 'NR==2{print $4}'")
725 else:
726 des_IP = sn_remote_cmd(
727 remote_ssh, "docker exec -it " + str(container_id_list[des - 1]) +
728 " ifconfig B" + str(des) +
729 "-default |awk -F '[ :]+' 'NR==2{print $4}'")
730 ping_result = sn_remote_cmd(
731 remote_ssh, "docker exec -i " + str(container_id_list[src - 1]) +
732 " ping " + str(des_IP[0][:-1]) + " -c 4 -i 0.01 ")
733 f = open(
734 configuration_file_path + "/" + file_path + "/ping-" + str(src) + "-" +
735 str(des) + "_" + str(time_index) + ".txt", "w")
736 f.writelines(ping_result)
737 f.close()
738
739
740def sn_perf(src, des, time_index, constellation_size, container_id_list,

Callers

nothing calls this directly

Calls 1

sn_remote_cmdFunction · 0.85

Tested by

no test coverage detected