Commit 389afd77 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent cfd1f645
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
load_* routines process this queue and move loaded instances to i<type>_dict registries. #} load_* routines process this queue and move loaded instances to i<type>_dict registries. #}
{%- set qshared_instance_list = slap_configuration.get('slave-instance-list', []) %} {%- set qshared_instance_list = slap_configuration.get('slave-instance-list', []) %}
{#- check_loaded_everything verifies that all shared instances were handling during the load. #} {#- check_loaded_everything verifies that all shared instances were handling during the load. #}
{%- macro check_loaded_everything() %} {%- macro check_loaded_everything() %}
{%- for ishared in qshared_instance_list %} {%- for ishared in qshared_instance_list %}
...@@ -52,11 +51,19 @@ ...@@ -52,11 +51,19 @@
{%- endfor %} {%- endfor %}
{%- endmacro %} {%- endmacro %}
{#- json-decode _ in all shared instances #}
{%- for ishared in qshared_instance_list %}
{%- do ishared.update({'_': J(ishared['_'])}) %}
{%- endfor %}
{#- icell_dict keeps cell shared instances: reference -> icell {#- icell_dict keeps cell shared instances: reference -> icell
iru_dict keeps RU shared instances + RU whose definition is embedded into a cell: reference -> iRU iru_dict keeps RU shared instances + RU whose definition is embedded into a cell: reference -> iRU
in the kept instances _ is automatically json-decoded in the kept instances _ is automatically json-decoded
use load_iru_and_icell to initialize this cell and RU registries. use load_iru_and_icell to initialize this cell and RU registries.
XXX defaults ?
#} #}
{%- set icell_dict = {} %} {%- set icell_dict = {} %}
{%- set iru_dict = {} %} {%- set iru_dict = {} %}
...@@ -64,8 +71,7 @@ ...@@ -64,8 +71,7 @@
{%- set qother = [] %} {%- set qother = [] %}
{%- for ishared in qshared_instance_list %} {%- for ishared in qshared_instance_list %}
{%- set ref = J(jref_of_shared(ishared)) %} {%- set ref = J(jref_of_shared(ishared)) %}
{%- set _ = J(ishared['_']) %} {%- set _ = ishared['_'] %}
{%- do ishared.update({'_': _}) %}
{%- if 'ru_type' in _ %} {%- if 'ru_type' in _ %}
{%- set iru = ishared %} {%- set iru = ishared %}
{%- do iru_dict.update({ref: iru}) %} {%- do iru_dict.update({ref: iru}) %}
...@@ -159,6 +165,33 @@ ...@@ -159,6 +165,33 @@
{%- endmacro %} {%- endmacro %}
{#- iue_dict keeps ue shared instance: reference -> iue
use load_iue to initialize this ue registry.
#}
{%- set iue_dict = {} %}
{%- macro load_iue() %}
{%- set qother = [] %}
{%- for ishared in qshared_instance_list %}
{%- set ref = J(jref_of_shared(ishared)) %}
{%- set _ = ishared['_'] %}
{%- if 'ue_type' in _ %}
{%- set iue = ishared %}
{#- XXX verify ue.ue_type in lte|nr #}
{%- for k, v in defaults['ue'].items() %}
{%- do _.setdefault(k, v) %}
{%- endfor %}
{%- do iue_dict.update({ref: iue}) %}
{%- else %}
{%- do qother.append(ishared) %}
{%- endif %}
{%- endfor %}
{%- do qshared_instance_list.clear() %}
{%- do qshared_instance_list.extend(qother) %}
{%- endmacro %}
{# ---- XXX ---- #} {# ---- XXX ---- #}
{#- ru_config emits RF driver configuration for specified Radio Units. #} {#- ru_config emits RF driver configuration for specified Radio Units. #}
......
...@@ -36,5 +36,34 @@ ...@@ -36,5 +36,34 @@
}], }],
ue_list: [ ue_list: [
{
sim_algo: "milenage",
opc: "milenage",
amf: 0x9001,
sqn: "000000000000",
impu: "",
impi: "",
imsi: "001010123456789",
K: "00112233445566778899aabbccddeeff",
rue_addr: "host1",
ue_category: 12,
tun_setup_script: "ue-ifup",
apn: "internet",
}
{
sim_algo: "milenage",
opc: "milenage",
amf: 0x9001,
sqn: "000000000000",
impu: "",
impi: "",
imsi: "001010123456789",
K: "00112233445566778899aabbccddeeff",
rue_addr: "host2",
as_release: 15,
ue_category: "nr",
tun_setup_script: "ue-ifup",
apn: "internet",
}
], ],
} }
\ No newline at end of file
...@@ -9,44 +9,26 @@ ...@@ -9,44 +9,26 @@
'sqn': '000000000000', 'sqn': '000000000000',
'impu': '', 'impu': '',
'impi': '', 'impi': '',
'imsi': slap_configuration['configuration.default_lte_imsi'], 'imsi': '001010123456789',
'k': slap_configuration['configuration.default_lte_k'], 'k': '00112233445566778899aabbccddeeff',
} }
} }
%} %}
{%- import 'lte.jinja2' as lte with context -%} {%- import 'lte.jinja2' as lte with context -%}
{%- set iru_dict = lte.iru_dict %} {%- set iru_dict = lte.iru_dict %}
{%- set icell_dict = lte.icell_dict %} {%- set icell_dict = lte.icell_dict %}
{%- set iue_dict = lte.iue_dict %}
{%- set J = lte.J %}
{%- set jref_of_shared = lte.jref_of_shared %}
{%- set jcell_ru_ref = lte.jcell_ru_ref %}
{%- set amari = lte %}{#- XXX temp #} {%- set amari = lte %}{#- XXX temp #}
{#- iue_dict keeps ue slave instances: reference -> iue {%- do lte.load_iru_and_icell() %}
in the kept instances _ is automatically json-decoded {%- do lte.load_iue() %}
#} {%- do lte.check_loaded_everything() %}
{%- set iue_dict = {} %}
{%- for slave in slap_configuration.get('slave-instance-list', []) %}
{%- set ref = J(jref_of_shared(slave)) %}
{%- set _ = J(slave['_']) %}
{%- do slave.update({'_': _}) %}
{%- if 'ue_type' in _ %}
{%- set iue = slave %}
{%- for k, v in defaults['ue'].items() %}
{%- do _.setdefault(k, v) %}
{%- endfor %}
{%- do iue_dict.update({ref: iue}) %}
{%- else %}
{%- do error(slave, "unknown shared instance type") %}
{%- endif %}
{%- endfor %}
{#- XXX verify ue.ue_type in lte|nr #}
{%- do lte.load_iru_and_icell() %}
{%- do lte.check_loaded_everything() %}
{#- start of the config -#}
{#- start of the config -#} {#- start of the config -#}
...@@ -137,7 +119,7 @@ ...@@ -137,7 +119,7 @@
rue_addr: "{{ ue.rue_addr }}", rue_addr: "{{ ue.rue_addr }}",
{%- if ue.ue_type == 'lte' %} {%- if ue.ue_type == 'lte' %}
ue_category: 12, ue_category: 12,
{%- elif ue.ur_type == 'nr' %} {%- elif ue.ue_type == 'nr' %}
as_release: 15, as_release: 15,
ue_category: "nr", ue_category: "nr",
{%- else %} {%- else %}
......
...@@ -38,9 +38,6 @@ url = {{ slap_connection['server-url'] }} ...@@ -38,9 +38,6 @@ url = {{ slap_connection['server-url'] }}
key = {{ slap_connection['key-file'] }} key = {{ slap_connection['key-file'] }}
cert = {{ slap_connection['cert-file'] }} cert = {{ slap_connection['cert-file'] }}
configuration.default_lte_imsi = {{ default_lte_imsi }}
configuration.default_lte_k = {{default_lte_k}}
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
software = {{ buildout_directory }} software = {{ buildout_directory }}
......
...@@ -317,8 +317,6 @@ extra-context = ...@@ -317,8 +317,6 @@ extra-context =
raw ue_template ${ue.jinja2.cfg:target} raw ue_template ${ue.jinja2.cfg:target}
raw ltelogs_template ${ltelogs.jinja2.sh:target} raw ltelogs_template ${ltelogs.jinja2.sh:target}
raw openssl_location ${openssl:location} raw openssl_location ${openssl:location}
raw default_lte_imsi ${default-params:default-lte-imsi}
raw default_lte_k ${default-params:default-lte-k}
[ue-db-config] [ue-db-config]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
......
...@@ -42,12 +42,12 @@ software_list = [ ...@@ -42,12 +42,12 @@ software_list = [
for i in range (len(software_list)): for i in range (len(software_list)):
software_list[i].update({ software_list[i].update({
#'default_lte_bandwidth' : "20 MHz", #'default_lte_bandwidth' : "20 MHz",
'default_lte_imsi' : "001010123456789", #'default_lte_imsi' : "001010123456789",
'default_lte_k' : "00112233445566778899aabbccddeeff", #'default_lte_k' : "00112233445566778899aabbccddeeff",
'default_lte_inactivity_timer' : 10000, 'default_lte_inactivity_timer' : 10000,
#'default_nr_bandwidth' : 40, #'default_nr_bandwidth' : 40,
'default_nr_imsi' : "001010123456789", #'default_nr_imsi' : "001010123456789",
'default_nr_k' : "00112233445566778899aabbccddeeff", #'default_nr_k' : "00112233445566778899aabbccddeeff",
#'default_nr_ssb_pos_bitmap' : "10000000", #'default_nr_ssb_pos_bitmap' : "10000000",
#'default_n_antenna_dl' : 2, #'default_n_antenna_dl' : 2,
#'default_n_antenna_ul' : 2, #'default_n_antenna_ul' : 2,
......
...@@ -43,15 +43,16 @@ def j2render(config, jcfg): ...@@ -43,15 +43,16 @@ def j2render(config, jcfg):
# Instance simulates configuration for an instance on SlapOS Master. # Instance simulates configuration for an instance on SlapOS Master.
class Instance: class Instance:
def __init__(self): def __init__(self, slap_software_type):
self.shared_instance_list = [] self.shared_instance_list = []
self.slap_software_type = slap_software_type
# ishared appends new shared instance with specified configuration to .shared_instance_list . # ishared appends new shared instance with specified configuration to .shared_instance_list .
def ishared(self, title, slave_reference, cfg): def ishared(self, title, slave_reference, cfg):
ishared = { ishared = {
'slave_title': title, 'slave_title': title,
'slave_reference': slave_reference, 'slave_reference': slave_reference,
'slap_software_type': "enb", 'slap_software_type': self.slap_software_type,
'_': json.dumps(cfg) '_': json.dumps(cfg)
} }
self.shared_instance_list.append(ishared) self.shared_instance_list.append(ishared)
...@@ -209,7 +210,7 @@ def iRU3_SDR1_fLTE2(ienb): ...@@ -209,7 +210,7 @@ def iRU3_SDR1_fLTE2(ienb):
def do_enb(): def do_enb():
ienb = Instance() ienb = Instance('enb')
iRU1_SDR_tLTE2_tNR(ienb) iRU1_SDR_tLTE2_tNR(ienb)
#iRU2_LOPCOMM_fLTE_fNR(ienb) #iRU2_LOPCOMM_fLTE_fNR(ienb)
#iRU3_SDR1_fLTE2(ienb) #iRU3_SDR1_fLTE2(ienb)
...@@ -220,11 +221,7 @@ def do_enb(): ...@@ -220,11 +221,7 @@ def do_enb():
"slap_configuration": { "slap_configuration": {
"tap-name": "slaptap9", "tap-name": "slaptap9",
"slap-computer-partition-id": "slappart9", "slap-computer-partition-id": "slappart9",
"configuration.default_lte_imsi": "001010123456789",
"configuration.default_lte_k": "00112233445566778899aabbccddeeff",
"configuration.default_lte_inactivity_timer": 10000, "configuration.default_lte_inactivity_timer": 10000,
"configuration.default_nr_imsi": "001010123456789",
"configuration.default_nr_k": "00112233445566778899aabbccddeeff",
"configuration.default_nr_inactivity_timer": 10000, "configuration.default_nr_inactivity_timer": 10000,
"slave-instance-list": %(jshared_instance_list)s "slave-instance-list": %(jshared_instance_list)s
}, },
...@@ -243,7 +240,15 @@ def do_enb(): ...@@ -243,7 +240,15 @@ def do_enb():
# ---- UE ---- # ---- UE ----
def do_ue(): def do_ue():
iue = Instance() iue = Instance('ue')
iue.ishared('UE 1', '_UE_1', {
'ue_type': 'lte',
'rue_addr': 'host1'
})
iue.ishared('UE 2', '_UE_2', {
'ue_type': 'nr',
'rue_addr': 'host2'
})
jshared_instance_list = json.dumps(iue.shared_instance_list) jshared_instance_list = json.dumps(iue.shared_instance_list)
json_params = """{ json_params = """{
......
...@@ -6,14 +6,14 @@ extends = ...@@ -6,14 +6,14 @@ extends =
[default-params] [default-params]
#default-lte-bandwidth = {{ default_lte_bandwidth }} #default-lte-bandwidth = {{ default_lte_bandwidth }}
default-lte-inactivity-timer = {{ default_lte_inactivity_timer }} default-lte-inactivity-timer = {{ default_lte_inactivity_timer }}
default-lte-imsi = {{ default_lte_imsi }} #default-lte-imsi = {{ default_lte_imsi }}
default-lte-k = {{ default_lte_k }} #default-lte-k = {{ default_lte_k }}
#default-nr-bandwidth = {{ default_nr_bandwidth }} #default-nr-bandwidth = {{ default_nr_bandwidth }}
#default-nr-ssb-pos-bitmap = {{ default_nr_ssb_pos_bitmap }} #default-nr-ssb-pos-bitmap = {{ default_nr_ssb_pos_bitmap }}
default-nr-inactivity-timer = {{ default_nr_inactivity_timer }} default-nr-inactivity-timer = {{ default_nr_inactivity_timer }}
default-nr-imsi = {{ default_nr_imsi }} #default-nr-imsi = {{ default_nr_imsi }}
default-nr-k = {{ default_nr_k }} #default-nr-k = {{ default_nr_k }}
#default-n-antenna-dl = {{ default_n_antenna_dl }} #default-n-antenna-dl = {{ default_n_antenna_dl }}
#default-n-antenna-ul = {{ default_n_antenna_ul }} #default-n-antenna-ul = {{ default_n_antenna_ul }}
......
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