Commit 00d0b51a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2ddcf248
......@@ -7,12 +7,12 @@ from os.path import dirname
sys.path.insert(0, dirname(__file__))
import kslap
import json
import json, copy
from pprint import pprint
ors = "/srv/slapgrid/slappart35/srv/project/slapos/software/ors-amarisoft/software.cfg"
enb = request(ors,
enb1 = request(ors,
software_type="enb",
partition_reference="kenb",
filter_kw={"computer_guid": "slaprunner"},
......@@ -20,37 +20,43 @@ enb = request(ors,
'testing': True,
})})
enb2 = request(ors,
software_type="enb",
partition_reference="kenb2",
filter_kw={"computer_guid": "slaprunner"},
partition_parameter_kw={"_": json.dumps({
'testing': True,
})})
print('enb:', enb)
print('ref(enb):', kslap.ref_of_instance(slap, enb))
print('enb1:', enb1)
print('ref(enb1):', kslap.ref_of_instance(slap, enb1))
print('enb1.slap_computer_partition_i:', enb1.slap_computer_partition_id)
#""" (not needed for now)
# enb -> enb_part to retrieve all information about instance state
# (see about core_part in krequest_ors.core for details)
enb_part = slap.registerComputerPartition(enb.slap_computer_id, enb.slap_computer_partition_id)
enb_part = slap.registerComputerPartition(enb1.slap_computer_id, enb1.slap_computer_partition_id)
print('enb_part:', enb_part)
print('enb_part.getInstanceParameterDict:')
pprint(enb_part.getInstanceParameterDict())
#"""
def request_ru(enb, **kw):
1/0
def request_cell(enb, cell_ref, kw):
assert 'cell_type' in kw
# 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=cell_ref,
partition_reference=ref,
shared=True,
filter_kw={"instance_guid": enb_guid},
partition_parameter_kw={"_": json.dumps(kw
)})
partition_parameter_kw={"_": json.dumps(kw)})
return cell
def request_peer(enb, **kw):
1/0
RU1 = {
'ru_type': 'sdr',
......@@ -72,8 +78,7 @@ CELL1_a = {
'ru': RU1, # RU definition embedded into CELL
}
iCELL1_a = request_cell(enb, 'CELL1_a', CELL1_a)
print('iCELL1_a:', iCELL1_a)
iCELL1_a = iENB(enb1, 'CELL1_a', CELL1_a)
CELL1_b = {
......@@ -89,6 +94,66 @@ CELL1_b = {
}
}
iCELL1_b = request_cell(enb, 'CELL1_b', CELL1_b)
print('iCELL1_b:', iCELL1_b)
iCELL1_b = iENB(enb1, 'CELL1_b', CELL1_b)
RU2_a = {
'ru_type': 'lopcomm',
'ru_link_type': 'cpri',
'mac_addr': 'XXX',
'cpri_link': {
'sdr_dev': 2,
'sfp_port': 0,
'mult': 8,
'mapping': 'standard',
'rx_delay': 10,
'tx_delay': 11,
'tx_dbm': 50
},
'n_antenna_dl': 2,
'n_antenna_ul': 1,
'tx_gain': -21,
'rx_gain': -22,
}
RU2_b = copy.deepcopy(RU2_a)
RU2_b['mac_addr'] = 'YYY'
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)
iENB(enb1, 'CELL2_a', {
'cell_type': 'lte',
'rf_mode': 'fdd',
'bandwidth': '5 MHz',
'dl_earfcn': 3350, # 2680 MHz
'pci': 21,
'cell_id': '0x21',
'ru': { # CELL2_a links to RU2_a by its reference
'ru_type': 'ru_ref',
'ru_ref': 'RU2_a'
}
})
iENB(enb1, 'CELL2_b', {
'cell_type': 'nr',
'rf_mode': 'fdd',
'bandwidth': 5,
'dl_nr_arfcn': 537200, # 2686 MHz
'nr_band': 7,
'pci': 22,
'cell_id': '0x22',
'ru': {
'ru_type': 'ru_ref',
'ru_ref': 'RU2_b'
}
})
print('\n\n\n----\n\n\n')
kenb_ = kslap.instance_by_ref(slap, 'kenb')
print(kenb_)
pprint(kenb_)
# Module kslap provides utility routines for dealing with SlapOS.
# ref_of_instance returns reference an instance was requested with
# ref_of_instance returns reference an instance was requested with.
def ref_of_instance(slap, inst):
i_comp_id = inst.slap_computer_id
i_part_id = inst.slap_computer_partition_id
......@@ -9,3 +9,11 @@ def ref_of_instance(slap, inst):
x._reference == i_part_id:
return x._partition_reference
raise KeyError('not found reference of instance_guid=%s-%s' % (i_comp_id, i_part_id))
# instance_by_ref returns instance corresponding to specified reference.
def instance_by_ref(slap, ref):
for x in slap.getOpenOrderDict().values(): # XXX linear search
if x._partition_reference == ref:
return x
raise KeyError('not found instance coresponding to reference %s' % ref)
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