Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathexample.py
More file actions
Latest commit
95 lines (77 loc) · 3.27 KB
/
Copy pathexample.py
File metadata and controls
95 lines (77 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
StarryNet: empowering researchers to evaluate futuristic integrated space and terrestrial networks.
author: Zeqi Lai (zeqilai@tsinghua.edu.cn) and Yangtao Deng (dengyt21@mails.tsinghua.edu.cn)
"""
fromstarrynet.sn_observerimport*
fromstarrynet.sn_orchestraterimport*
fromstarrynet.sn_synchronizerimport*
if__name__=="__main__":
# Starlink 5*5: 25 satellite nodes, 2 ground stations.
# The node index sequence is: 25 sattelites, 2 ground stations.
# In this example, 25 satellites and 2 ground stations are one AS.
AS= [[1, 27]] # Node #1 to Node #27 are within the same AS.
GS_lat_long= [[50.110924, 8.682127], [46.635700, 14.311817]
] # latitude and longitude of frankfurt and Austria
configuration_file_path="./config.json"
hello_interval=1# hello_interval(s) in OSPF. 1-200 are supported.
print('Start StarryNet.')
sn=StarryNet(configuration_file_path, GS_lat_long, hello_interval, AS)
sn.create_nodes()
sn.create_links()
sn.run_routing_deamon()
node_index1=1
node_index2=2
time_index=2
# distance between nodes at a certain time
node_distance=sn.get_distance(node_index1, node_index2, time_index)
print("node_distance (km): "+str(node_distance))
# neighbor node indexes of node at a certain time
neighbors_index=sn.get_neighbors(node_index1, time_index)
print("neighbors_index: "+str(neighbors_index))
# GS connected to the node at a certain time
node_index1=7
GSes=sn.get_GSes(node_index1, time_index)
print("GSes are: "+str(GSes))
# LLA of a node at a certain time
LLA=sn.get_position(node_index1, time_index)
print("LLA: "+str(LLA))
sn.get_utility(time_index) # CPU and memory useage
# IPList of a node
IP_list=sn.get_IP(node_index1)
print("IP: "+str(IP_list))
ratio=0.3
time_index=5
# random damage of a given ratio at a certain time
sn.set_damage(ratio, time_index)
time_index=10
sn.set_recovery(time_index) # recover the damages at a certain time
node_index1=27
time_index=15
# routing table of a node at a certain time. The output file will be written at the working directory.
sn.check_routing_table(node_index1, time_index)
sat=1
des=27
next_hop_sat=2
time_index=20
# set the next hop at a certain time. Sat, Des and NextHopSat are indexes and Sat and NextHopSat are neighbors.
sn.set_next_hop(sat, des, next_hop_sat, time_index)
node_index1=13
node_index2=14
time_index=3
# ping msg of two nodes at a certain time. The output file will be written at the working directory.
sn.set_ping(node_index1, node_index2, time_index)
foriinrange(35, 80):
node_index1=26
node_index2=27
time_index=i
# ping msg of two nodes at a certain time. The output file will be written at the working directory.
sn.set_ping(node_index1, node_index2, time_index)
node_index1=13
node_index2=14
time_index=4
# perf msg of two nodes at a certain time. The output file will be written at the working directory.
sn.set_perf(node_index1, node_index2, time_index)
sn.start_emulation()
sn.stop_emulation()