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

Function sn_perf

starrynet/sn_utils.py:740–768  ·  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

738
739
740def sn_perf(src, des, time_index, constellation_size, container_id_list,
741 file_path, configuration_file_path, remote_ssh):
742 if des <= constellation_size:
743 ifconfig_output = sn_remote_cmd(
744 remote_ssh, "docker exec -it " + str(container_id_list[des - 1]) +
745 " ifconfig | sed 's/[ \t].*//;/^\(eth0\|\)\(lo\|\)$/d'")
746 des_IP = sn_remote_cmd(
747 remote_ssh, "docker exec -it " + str(container_id_list[des - 1]) +
748 " ifconfig " + ifconfig_output[0][:-1] +
749 "|awk -F '[ :]+' 'NR==2{print $4}'")
750 else:
751 des_IP = sn_remote_cmd(
752 remote_ssh, "docker exec -it " + str(container_id_list[des - 1]) +
753 " ifconfig B" + str(des) +
754 "-default |awk -F '[ :]+' 'NR==2{print $4}'")
755
756 sn_remote_cmd(
757 remote_ssh,
758 "docker exec -id " + str(container_id_list[des - 1]) + " iperf3 -s ")
759 print("iperf server success")
760 perf_result = sn_remote_cmd(
761 remote_ssh, "docker exec -i " + str(container_id_list[src - 1]) +
762 " iperf3 -c " + str(des_IP[0][:-1]) + " -t 5 ")
763 print("iperf client success")
764 f = open(
765 configuration_file_path + "/" + file_path + "/perf-" + str(src) + "-" +
766 str(des) + "_" + str(time_index) + ".txt", "w")
767 f.writelines(perf_result)
768 f.close()
769
770
771def sn_route(src, time_index, file_path, configuration_file_path,

Callers

nothing calls this directly

Calls 1

sn_remote_cmdFunction · 0.85

Tested by

no test coverage detected