-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.py
222 lines (184 loc) · 6.64 KB
/
profile.py
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# Emulab specific extensions.
import geni.rspec.emulab as emulab
# Route specific extensions.
import geni.rspec.emulab.route as route
import os
# Create the PC object
pc = portal.Context()
OSIMAGE = 'urn:publicid:IDN+emulab.net+image+PowderTeam:cots-focal-image'
#
# Install script from the repository. This installs the uhd tools,
# gnuradio, and starts up uhd_fft (displayed in the X11 VNC console).
#
INSTALL = 'sudo /bin/bash /local/repository/install.sh' #COTS UE
BIN_PATH = "/local/repository/bin"
CONFIG_PATH = "/local/repository/configs"
ETC_PATH = "/local/repository/etc"
LOWLAT_IMG = "urn:publicid:IDN+emulab.net+image+PowderTeam:U18LL-SRSLTE"
UBUNTU_IMG = "urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU18-64-STD"
COTS_UE_IMG = "urn:publicid:IDN+emulab.net+image+PowderTeam:cots-base-image"
COMP_MANAGER_ID = "urn:publicid:IDN+emulab.net+authority+cm"
# hash includes fix for avx build patch issue
#TODO: check if merged to develop
DEFAULT_NR_RAN_HASH = "565b8482f926bea13b5b72e4a6651032fdac7083"
DEFAULT_NR_CN_HASH = "v1.4.0"
OAI_DEPLOY_SCRIPT = lambda x:os.path.join(x, "deploy-oai.sh") # gNB
OPEN5GS_DEPLOY_SCRIPT = lambda x: os.path.join(x, "deploy-open5gs.sh") # EPC
OPEN5GS_CONFIG_PATH="/etc/open5gs"
NUM_CNS = None
def gnb_cn_pair(idx, b210_node):
# role = "cn"
cn_node = request.RawPC("cn5g-{}".format(b210_node.device.split("-")[-1]))
cn_node.component_manager_id = COMP_MANAGER_ID
cn_node.hardware_type = params.cn_nodetype
cn_node.disk_image = UBUNTU_IMG
cn_if = cn_node.addInterface("cn-if-{}".format(idx))
idx = idx + 1
cn_if.addAddress(pg.IPv4Address("192.168.1.{}".format(idx), "255.255.255.0"))
cn_link = request.Link("cn-link-{}".format(idx))
cn_link.bandwidth = 1*1000*1000
cn_link.addInterface(cn_if)
if params.oai_cn_commit_hash:
n_hash = params.oai_cn_commit_hash
else:
oai_cn_hash = DEFAULT_NR_CN_HASH
cmd = "cp {}/core/{}/* {}".format(CONFIG_PATH, idx, OPEN5GS_CONFIG_PATH)
cn_node.addService(pg.Execute(shell="bash", command=cmd))
cn_node.addService(pg.Execute(shell="bash", command=OPEN5GS_DEPLOY_SCRIPT(BIN_PATH)))
#*********************************************
# Execute core network configuration here
node = request.RawPC("gnb-{}".format(b210_node.device.split("-")[-1]))
node.component_manager_id = COMP_MANAGER_ID
node.component_id = b210_node.device
if params.sdr_compute_image:
node.disk_image = params.sdr_compute_image
else:
node.disk_image = LOWLAT_IMG
nodeb_cn_if = node.addInterface("nodeb-cn-if")
gnb_idx = idx + 1 + NUM_CNS
nodeb_cn_if.addAddress(pg.IPv4Address("192.168.1.{}".format(gnb_idx), "255.255.255.0"))
cn_link.addInterface(nodeb_cn_if)
if params.oai_ran_commit_hash:
oai_ran_hash = params.oai_ran_commit_hash
else:
oai_ran_hash = DEFAULT_NR_RAN_HASH
#ENB_CONFIG_PATH="/srsran/enb.conf"
#RRC_CONFIG_PATH="/srsran/rr.conf"
# Execute eNode deploy script
#cmd = "cp {}/enb/{}/* {}".format(CONFIG_PATH, idx, ENB_CONFIG_PATH)
cmd = "{} '{}' {}".format(OAI_DEPLOY_SCRIPT(BIN_PATH), oai_ran_hash, "nodeb")
node.addService(pg.Execute(shell="bash", command=cmd))
node.addService(pg.Execute(shell="bash", command="/local/repository/bin/tune-cpu.sh"))
node_types = [
("d430", "Emulab, d430"),
("d740", "Emulab, d740"),
]
pc.defineParameter(
name="cn_nodetype",
description="Type of compute node to use for CN node (if included)",
typ=portal.ParameterType.STRING,
defaultValue=node_types[0],
legalValues=node_types
)
pc.defineParameter(
name="oai_ran_commit_hash",
description="Commit hash for OAI RAN",
typ=portal.ParameterType.STRING,
defaultValue="",
advanced=True
)
pc.defineParameter(
name="oai_cn_commit_hash",
description="Commit hash for OAI (5G)CN",
typ=portal.ParameterType.STRING,
defaultValue="",
advanced=True
)
pc.defineParameter(
name="sdr_compute_image",
description="Image to use for compute connected to SDRs",
typ=portal.ParameterType.STRING,
defaultValue="",
advanced=True
)
dense_radios = [
("cnode-wasatch",
"Wasatch"),
("cnode-mario",
"Mario"),
("cnode-moran",
"Moran"),
("cnode-guesthouse",
"Guesthouse"),
("cnode-ebc",
"EBC"),
("cnode-ustar",
"USTAR"),
]
pc.defineStructParameter(
"dense_radios", "Dense Site Radios", [],
multiValue=True,
min=1,
multiValueTitle="Dense Site NUC+B210 radios to allocate.",
members=[
portal.Parameter(
"device",
"SFF Compute + NI B210 device",
portal.ParameterType.STRING,
dense_radios[0], dense_radios,
longDescription="A Small Form Factor compute with attached NI B210 device at the given Dense Deployment site will be allocated."
),
]
)
portal.context.defineStructParameter(
"freq_ranges", "Frequency Ranges To Transmit In",
defaultValue=[{"freq_min": 3430.0, "freq_max": 3470.0}],
multiValue=True,
min=0,
multiValueTitle="Frequency ranges to be used for transmission.",
members=[
portal.Parameter(
"freq_min",
"Frequency Range Min",
portal.ParameterType.BANDWIDTH,
3430.0,
longDescription="Values are rounded to the nearest kilohertz."
),
portal.Parameter(
"freq_max",
"Frequency Range Max",
portal.ParameterType.BANDWIDTH,
3470.0,
longDescription="Values are rounded to the nearest kilohertz."
),
]
)
params = pc.bindParameters()
pc.verifyParameters()
request = pc.makeRequestRSpec()
NUM_CNS = len(params.dense_radios)
for idx, dense_radio in enumerate(params.dense_radios):
gnb_cn_pair(idx, dense_radio)
for frange in params.freq_ranges:
request.requestSpectrum(frange.freq_min, frange.freq_max, 0)
#
# Declare that you will be starting X11 VNC on (some of) your nodes.
# You must have this line for X11 VNC to work.
#
request.initVNC()
#
# Request all bus routes. On a typical day, 4-6 buses are running across
# a few common routes. Morning is when the most buses run.
#
allroutes = request.requestAllRoutes()
allroutes.disk_image = OSIMAGE
#cmd = "{} '{}' {}".format(OAI_DEPLOY_SCRIPT, oai_ran_hash, "nodeb")
#allroutes.addService(pg.Execute(shell="bash", command=INSTALL))
#allroute.addService(pg.Execute(shell="bash", command="/local/repository/bin/tune-cpu.sh"))
allroutes.addService(pg.Execute(shell="sh", command=INSTALL))
allroutes.startVNC()
portal.context.printRequestRSpec()