(current_sat_id, current_orbit_id, container_id_list,
orbit_num, sat_num, constellation_size, matrix, bw, loss)
| 24 | |
| 25 | |
| 26 | def sn_ISL_establish(current_sat_id, current_orbit_id, container_id_list, |
| 27 | orbit_num, sat_num, constellation_size, matrix, bw, loss): |
| 28 | current_id = current_orbit_id * sat_num + current_sat_id |
| 29 | isl_idx = current_id * 2 + 1 |
| 30 | # Establish intra-orbit ISLs |
| 31 | # (Down): |
| 32 | [down_sat_id, |
| 33 | down_orbit_id] = sn_get_down_satellite(current_sat_id, current_orbit_id, |
| 34 | sat_num) |
| 35 | print("[" + str(isl_idx) + "/" + str(constellation_size * 2) + |
| 36 | "] Establish intra-orbit ISL from: (" + str(current_sat_id) + "," + |
| 37 | str(current_orbit_id) + ") to (" + str(down_sat_id) + "," + |
| 38 | str(down_orbit_id) + ")") |
| 39 | ISL_name = "Le_" + str(current_sat_id) + "-" + str(current_orbit_id) + \ |
| 40 | "_" + str(down_sat_id) + "-" + str(down_orbit_id) |
| 41 | address_16_23 = isl_idx >> 8 |
| 42 | address_8_15 = isl_idx & 0xff |
| 43 | # Create internal network in docker. |
| 44 | os.system('docker network create ' + ISL_name + " --subnet 10." + |
| 45 | str(address_16_23) + "." + str(address_8_15) + ".0/24") |
| 46 | print('[Create ISL:]' + 'docker network create ' + ISL_name + |
| 47 | " --subnet 10." + str(address_16_23) + "." + str(address_8_15) + |
| 48 | ".0/24") |
| 49 | os.system('docker network connect ' + ISL_name + " " + |
| 50 | str(container_id_list[current_orbit_id * sat_num + |
| 51 | current_sat_id]) + " --ip 10." + |
| 52 | str(address_16_23) + "." + str(address_8_15) + ".40") |
| 53 | delay = matrix[current_orbit_id * sat_num + |
| 54 | current_sat_id][down_orbit_id * sat_num + down_sat_id] |
| 55 | with os.popen( |
| 56 | "docker exec -it " + |
| 57 | str(container_id_list[current_orbit_id * sat_num + |
| 58 | current_sat_id]) + |
| 59 | " ip addr | grep -B 2 10." + str(address_16_23) + "." + |
| 60 | str(address_8_15) + |
| 61 | ".40 | head -n 1 | awk -F: '{ print $2 }' | tr -d [:blank:]") as f: |
| 62 | ifconfig_output = f.readline() |
| 63 | target_interface = str(ifconfig_output).split("@")[0] |
| 64 | os.system("docker exec -d " + |
| 65 | str(container_id_list[current_orbit_id * sat_num + |
| 66 | current_sat_id]) + |
| 67 | " ip link set dev " + target_interface + " down") |
| 68 | os.system("docker exec -d " + |
| 69 | str(container_id_list[current_orbit_id * sat_num + |
| 70 | current_sat_id]) + |
| 71 | " ip link set dev " + target_interface + " name " + "B" + |
| 72 | str(current_orbit_id * sat_num + current_sat_id + 1) + |
| 73 | "-eth" + str(down_orbit_id * sat_num + down_sat_id + 1)) |
| 74 | os.system("docker exec -d " + |
| 75 | str(container_id_list[current_orbit_id * sat_num + |
| 76 | current_sat_id]) + |
| 77 | " ip link set dev B" + |
| 78 | str(current_orbit_id * sat_num + current_sat_id + 1) + |
| 79 | "-eth" + str(down_orbit_id * sat_num + down_sat_id + 1) + |
| 80 | " up") |
| 81 | os.system("docker exec -d " + |
| 82 | str(container_id_list[current_orbit_id * sat_num + |
| 83 | current_sat_id]) + |
nothing calls this directly
no test coverage detected