Commit 9b1e9ec8 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e57d2dae
......@@ -6,6 +6,7 @@ import sys
from os.path import dirname
sys.path.insert(0, dirname(__file__))
import kslap
kslap.init(slap)
import json, copy
from pprint import pprint
......@@ -24,6 +25,12 @@ icore = request(kamari,
'core_network_plmn': '31415',
})})
isim1 = kslap.iSIM(icore, 1)
print(icore)
print(isim1)
sys.exit(1)
ienb = request(kamari,
software_type="enb",
partition_reference="CB5-ENB",
......@@ -31,7 +38,6 @@ ienb = request(kamari,
partition_parameter_kw={"_": json.dumps({
})})
isim1 = kslap.iSIM(icore, 1)
# eref returns full reference for a enb subreference ref.
def eref(ref):
......
......@@ -6,6 +6,7 @@ import sys
from os.path import dirname
sys.path.insert(0, dirname(__file__))
import kslap
kslap.init(slap)
import json
from pprint import pprint
......@@ -34,7 +35,7 @@ core = request(ors,
})})
print("core:", core)
print("ref(core):", kslap.ref_of_instance(slap, core))
print("ref(core):", kslap.ref_of_instance(core))
print("core.getInstanceParameterDict:")
pprint(core.getInstanceParameterDict())
print()
......
......@@ -6,6 +6,7 @@ import sys
from os.path import dirname
sys.path.insert(0, dirname(__file__))
import kslap
kslap.init(slap)
import json, copy
from pprint import pprint
......@@ -34,7 +35,7 @@ enb2.destroyed()
print('enb1:', enb1)
print('ref(enb1):', kslap.ref_of_instance(slap, enb1))
print('ref(enb1):', kslap.ref_of_instance(enb1))
print('enb1.slap_computer_partition_i:', enb1.slap_computer_partition_id)
#""" (not needed for now)
......@@ -152,7 +153,7 @@ kslap.iENB(enb1, 'CELL2_b', {
# whether it is possible (lookup of instance by reference is currently only
# possible with linear search and Rafael said that the lookup will also be
# constrained to work only in the same instance tree).
kenb_ = kslap.instance_by_ref(slap, 'kenb')
kenb_ = kslap.instance_by_ref('kenb')
"""
print()
print(kenb_)
......
# Module kslap provides utility routines for dealing with SlapOS.
# after importing users should do kslap.init(slap)
slap = None
def init(slap_):
global slap
slap = slap_
# ref_of_instance returns reference an instance was requested with.
def ref_of_instance(slap, inst):
def ref_of_instance(inst):
i_comp_id = inst.slap_computer_id
i_part_id = inst.slap_computer_partition_id
for x in slap.getOpenOrderDict().values(): # XXX linear search
......@@ -12,7 +18,7 @@ def ref_of_instance(slap, inst):
# instance_by_ref returns instance corresponding to specified reference.
def instance_by_ref(slap, ref):
def instance_by_ref(ref):
for x in slap.getOpenOrderDict().values(): # XXX linear search
if x._partition_reference == ref:
return x
......@@ -29,7 +35,7 @@ def instance_by_ref(slap, ref):
# iSIM adds to core a shared SIM instance with specified number.
def iSIM(core, sim_n):
core_ref = ref_of_instance(slap, core)
core_ref = ref_of_instance(core)
core_guid = core.getInstanceGuid()
core_sr = core.getSoftwareRelease()
sim = request(core_sr,
......@@ -51,7 +57,7 @@ def iSIM(core, sim_n):
# 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_ref = ref_of_instance(enb)
enb_guid = enb.getInstanceGuid()
enb_sr = enb.getSoftwareRelease()
ishared = request(enb_sr,
......
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