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

Function sn_recover_link

starrynet/sn_orchestrater.py:446–463  ·  view source on GitHub ↗
(
    damaged_satellite,
    container_id_list,
    sat_loss,
)

Source from the content-addressed store, hash-verified

444
445
446def sn_recover_link(
447 damaged_satellite,
448 container_id_list,
449 sat_loss,
450):
451 with os.popen(
452 "docker exec -it " + str(container_id_list[damaged_satellite]) +
453 " ifconfig | sed 's/[ \t].*//;/^\(eth0\|\)\(lo\|\)$/d'") as f:
454 ifconfig_output = f.readlines()
455 for i in range(0, len(ifconfig_output), 2):
456 os.system("docker exec -d " +
457 str(container_id_list[damaged_satellite]) +
458 " tc qdisc change dev " + ifconfig_output[i][:-1] +
459 " root netem loss " + str(sat_loss) + "%")
460 print("docker exec -d " +
461 str(container_id_list[damaged_satellite]) +
462 " tc qdisc change dev " + ifconfig_output[i][:-1] +
463 " root netem loss " + str(sat_loss) + "%")
464
465
466def sn_del_network(network_name):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected