Commit e57d2dae authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 57ade8ff
#!/usr/bin/env -S slapos console
"""request mme/enb/... on callbox-005"""
# XXX workaround for `slapos console` not setting up sys.path the same way as std python does
import sys
from os.path import dirname
sys.path.insert(0, dirname(__file__))
import kslap
import json, copy
from pprint import pprint
kamari = "https://lab.nexedi.com/kirr/slapos/raw/x/lte-multiru/software/ors-amarisoft/software.cfg"
CB5 = "COMP-4020"
supply(kamari, computer_guid=CB5)
icore = request(kamari,
software_type="core-network",
partition_reference="CB5-CORE",
filter_kw={"computer_guid": CB5},
partition_parameter_kw={"_": json.dumps({
'core_network_plmn': '31415',
})})
ienb = request(kamari,
software_type="enb",
partition_reference="CB5-ENB",
filter_kw={"computer_guid": CB5},
partition_parameter_kw={"_": json.dumps({
})})
isim1 = kslap.iSIM(icore, 1)
# eref returns full reference for a enb subreference ref.
def eref(ref):
enb_ref = kslap.ref_of_instance(slap, ienb)
return '%s/%s' % (enb_ref, ref)
# XXX shorthand
def iENB(ref, kw):
return kslap.iENB(ienb, ref, kw)
RU1 = {
'ru_type': 'lopcomm',
'ru_link_type': 'cpri',
'cpri_link': {
'sdr_dev': 0,
'sfp_port': 1,
'mult': 4,
'mapping': 'hw',
'rx_delay': 25.11,
'tx_delay': 14.71,
'tx_dbm': 63
},
'n_antenna_dl': 1,
'n_antenna_ul': 1,
'tx_gain': -20,
'rx_gain': -20,
}
iru1 = iENB('RU1', RU1) # XXX -> eref('RU1') ?
......@@ -78,28 +78,8 @@ for x in '_computer_id', '_instance_guid', '_parameter_dict', '_partition_id', '
"""
def request_sim(core, sim_n):
core_ref = kslap.ref_of_instance(slap, core)
core_guid = core.getInstanceGuid()
sim = request(ors,
software_type="core-network",
partition_reference="%s/sim%d" % (core_ref, sim_n),
shared=True,
filter_kw={"instance_guid": core_guid},
partition_parameter_kw={"_": json.dumps({
"sim_algo": "milenage",
"imsi": "001010000000%d" % sim_n,
"opc": "000102030405060708090A0B0C0D0E0F",
"amf": "0x9001",
"sqn": "000000000000",
"k": "00112233445566778899AABBCCDDEEFF",
"impu": "impu%d" % sim_n,
"impi": "impi%d@amarisoft.com" % sim_n,
})})
return sim
print()
sim1 = request_sim(core, 1)
sim2 = request_sim(core, 2)
sim1 = kslap.request_sim(core, 1)
sim2 = kslap.request_sim(core, 2)
print('sim1:', sim1)
print('sim2:', sim2)
......@@ -49,18 +49,6 @@ pprint(enb_part.getInstanceParameterDict())
# iENB adds to enb a shared instance with specified reference and parameters.
def iENB(enb, ref, kw):
enb_ref = kslap.ref_of_instance(slap, enb)
enb_guid = enb.getInstanceGuid()
cell = request(ors,
software_type="enb",
partition_reference=ref,
shared=True,
filter_kw={"instance_guid": enb_guid},
partition_parameter_kw={"_": json.dumps(kw)})
return cell
RU1 = {
'ru_type': 'sdr',
......@@ -82,7 +70,7 @@ CELL1_a = {
'ru': RU1, # RU definition embedded into CELL
}
iCELL1_a = iENB(enb1, 'CELL1_a', CELL1_a)
iCELL1_a = kslap.iENB(enb1, 'CELL1_a', CELL1_a)
CELL1_b = {
......@@ -98,7 +86,7 @@ CELL1_b = {
}
}
iCELL1_b = iENB(enb1, 'CELL1_b', CELL1_b)
iCELL1_b = kslap.iENB(enb1, 'CELL1_b', CELL1_b)
RU2_a = {
......@@ -126,10 +114,10 @@ RU2_b['cpri_link']['sfp_port'] = 1
RU2_b['tx_gain'] += 10
RU2_b['rx_gain'] += 10
iRU2_a = iENB(enb1, 'RU2_a', RU2_a)
iRU2_b = iENB(enb1, 'RU2_b', RU2_b)
iRU2_a = kslap.iENB(enb1, 'RU2_a', RU2_a)
iRU2_b = kslap.iENB(enb1, 'RU2_b', RU2_b)
iENB(enb1, 'CELL2_a', {
kslap.iENB(enb1, 'CELL2_a', {
'cell_type': 'lte',
'rf_mode': 'fdd',
'bandwidth': '5 MHz',
......@@ -142,7 +130,7 @@ iENB(enb1, 'CELL2_a', {
}
})
iENB(enb1, 'CELL2_b', {
kslap.iENB(enb1, 'CELL2_b', {
'cell_type': 'nr',
'rf_mode': 'fdd',
'bandwidth': 5,
......
......@@ -26,3 +26,38 @@ def instance_by_ref(slap, ref):
inst = slap.registerOpenOrder().getInformation(partition_reference=ref)
return inst
"""
# iSIM adds to core a shared SIM instance with specified number.
def iSIM(core, sim_n):
core_ref = ref_of_instance(slap, core)
core_guid = core.getInstanceGuid()
core_sr = core.getSoftwareRelease()
sim = request(core_sr,
software_type="core-network",
partition_reference="%s/sim%d" % (core_ref, sim_n),
shared=True,
filter_kw={"instance_guid": core_guid},
partition_parameter_kw={"_": json.dumps({
"sim_algo": "milenage",
"imsi": "001010000000%d" % sim_n,
"opc": "000102030405060708090A0B0C0D0E0F",
"amf": "0x9001",
"sqn": "000000000000",
"k": "00112233445566778899AABBCCDDEEFF",
"impu": "impu%d" % sim_n,
"impi": "impi%d@amarisoft.com" % sim_n,
})})
return sim
# iENB adds to enb a shared instance with specified reference and parameters.
def iENB(enb, ref, kw):
enb_ref = ref_of_instance(slap, enb)
enb_guid = enb.getInstanceGuid()
enb_sr = enb.getSoftwareRelease()
ishared = request(enb_sr,
software_type="enb",
partition_reference=ref,
shared=True,
filter_kw={"instance_guid": enb_guid},
partition_parameter_kw={"_": json.dumps(kw)})
return ishared
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment