Commit f3f1cb46 authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: Start to introduce ORS mode

In MultiRU we are going to have generic software with flexible configuration
and many features + ORS software, which wraps the generic part, adds ORS
specific features, and translates simple ORS schema to generic ones.

Let's first move ORS-specific bits to dedicated place as a preparatory step for that:

- add software-ors.cfg . In the future software-ors.cfg will be the entry point
  for ORS mode, but for now it is only a place from where software-ors-* extend from.

- add instance-ors.cfg . We move ORS-specific code from instance.cfg here and
  set it to use instance-ors-enb.jinja2.cfg when instantiating enb/gnb.

- add instance-ors-enb.jinja2.cfg . This pulls ORS-specific code from
  instance-enb.jinja2.cfg + instance-gnb.jinja2.cfg and wraps them with ORS
  context built by instance-ors.cfg

- in the templates the way to see whether it is ORS or not, and if yes, to access
  ORS parameters is changed: now it is always via checking `ors` object, which
  can be either False for non-ORS mode, or dict for ORS mode, and if it is dict
  the keys inside that dict are ORS specific properties, e.g. ors['one-watt'].

  This adjustment is handy to organize ORS mode extension from generic with
  generic setting `json ors false` in the context, and ORS mode undoing that and
  setting ORS context properly. I think the code also reads more clear this way, i.e. with

 	{%- if one_watt == "True" %}

  changed to

	{%- if ors['one-watt'] %}

  because in the second variant it is clear that one-watt is a property of ORS.

The rendered configs for enb.cfg and gnb.cfg stay unchanged.

/cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
/proposed-for-review-on !1522
/reviewed-by TrustMe
parent a6a4d2d4
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = b174cb8e4c99d02094960f472584b350 md5sum = c7579dbbf9da34bb832b92a93267015f
[template-ors]
filename = instance-ors.cfg
md5sum = 60ed8bb3bee3f9121fb179abd65cc70b
[slaplte.jinja2] [slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2 _update_hash_filename_ = slaplte.jinja2
...@@ -80,11 +84,15 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e ...@@ -80,11 +84,15 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb] [template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 9b90e7a418644a4b439cc9784e827263 md5sum = 460206ee7730098e1c324907f6fc16d8
[template-ors-enb]
_update_hash_filename_ = instance-ors-enb.jinja2.cfg
md5sum = 204786f37ea8e34556facd044f201ed3
[template-gnb] [template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum = 53a3835bd4da5bef0c893671b6e454ee md5sum = e718dd27f7f85ed9f4aaaaef767c8777
[template-core-network] [template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg _update_hash_filename_ = instance-core-network.jinja2.cfg
...@@ -104,7 +112,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149 ...@@ -104,7 +112,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg] [enb.jinja2.cfg]
filename = config/enb.jinja2.cfg filename = config/enb.jinja2.cfg
md5sum = 93a235dbab99cf7c4f3f2759278ecaed md5sum = 6f67e0b5d0d6f4407c493c88d0e3569e
[drb_lte.jinja2.cfg] [drb_lte.jinja2.cfg]
filename = config/drb_lte.jinja2.cfg filename = config/drb_lte.jinja2.cfg
...@@ -116,7 +124,7 @@ md5sum = 84d3cef8fc7f1c2aed7c348d500f5636 ...@@ -116,7 +124,7 @@ md5sum = 84d3cef8fc7f1c2aed7c348d500f5636
[sib23.jinja2.asn] [sib23.jinja2.asn]
filename = config/sib23.jinja2.asn filename = config/sib23.jinja2.asn
md5sum = a1973ba6e43d40e510d61d461c2d13ac md5sum = 0d709fafde394dc05441d110c2e41858
[mme.jinja2.cfg] [mme.jinja2.cfg]
filename = config/mme.jinja2.cfg filename = config/mme.jinja2.cfg
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
}, },
tx_gain: 0, tx_gain: 0,
rx_gain: 0, rx_gain: 0,
{% elif bbu == "ors" %} {% elif ors %}
rf_driver: { rf_driver: {
{%- if slapparameter_dict.get('disable_sdr', False) %} {%- if slapparameter_dict.get('disable_sdr', False) %}
name: "dummy", name: "dummy",
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
{%- endfor %} {%- endfor %}
], ],
{% if bbu == "ors" %} {% if ors %}
manual_ref_signal_power: true, manual_ref_signal_power: true,
{% endif %} {% endif %}
...@@ -528,9 +528,9 @@ ...@@ -528,9 +528,9 @@
{%- endfor -%} {%- endfor -%}
], ],
{% endif %} {% endif %}
{%- if bbu == "ors" %} {%- if ors %}
manual_ref_signal_power: true, manual_ref_signal_power: true,
{%- if one_watt == "True" %} {%- if ors['one-watt'] %}
ss_pbch_block_power: {{ (tx_gain | int) - 54 }}, ss_pbch_block_power: {{ (tx_gain | int) - 54 }},
{%- else %} {%- else %}
ss_pbch_block_power: {{ (tx_gain | int) - 35 }}, ss_pbch_block_power: {{ (tx_gain | int) - 35 }},
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
} }
}, },
pdsch-ConfigCommon { pdsch-ConfigCommon {
{% if bbu == "ors" %} {% if ors %}
{%- if one_watt == "True" %} {%- if ors['one-watt'] %}
referenceSignalPower {{ (tx_gain | int) - 54 }}, /* patched by eNB */ referenceSignalPower {{ (tx_gain | int) - 54 }}, /* patched by eNB */
{%- else %} {%- else %}
referenceSignalPower {{ (tx_gain | int) - 35 }}, /* patched by eNB */ referenceSignalPower {{ (tx_gain | int) - 35 }}, /* patched by eNB */
......
{#- defaults for eNB radio parameters.
NOTE they are installed temporary and will go away after switch to generic multiRU. #}
{%- do RF.setdefault('tx_gain', slapparameter_dict.get('tx_gain', 0)) %}
{%- do RF.setdefault('rx_gain', slapparameter_dict.get('rx_gain', 0)) %}
{%- do RF.setdefault('dl_earfcn', slapparameter_dict.get('dl_earfcn', 0)) %}
[buildout] [buildout]
parts = parts =
directory directory
...@@ -176,15 +182,15 @@ recipe = slapos.recipe.template:jinja2 ...@@ -176,15 +182,15 @@ recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do extensions = jinja2.ext.do
extra-context = extra-context =
context = context =
json ors false
section directory directory section directory directory
section slap_configuration slap-configuration section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key gtp_addr_v6 slap-configuration:ipv6-random key gtp_addr_v6 slap-configuration:ipv6-random
raw gtp_addr_v4 {{ lan_ipv4 }} raw gtp_addr_v4 {{ lan_ipv4 }}
raw one_watt {{ ors_version['one-watt'] }} raw tx_gain {{ RF.tx_gain }}
raw tx_gain {{ ors_version['current-tx-gain'] }} raw rx_gain {{ RF.rx_gain }}
raw rx_gain {{ ors_version['current-rx-gain'] }} raw earfcn {{ RF.dl_earfcn }}
raw earfcn {{ ors_version['current-earfcn'] }}
raw software_name {{ software_name }} raw software_name {{ software_name }}
raw rf_mode {{ rf_mode }} raw rf_mode {{ rf_mode }}
raw trx {{ trx }} raw trx {{ trx }}
...@@ -230,14 +236,7 @@ websocket_url = ws://[${slap-configuration:ipv6-random}]:9001 ...@@ -230,14 +236,7 @@ websocket_url = ws://[${slap-configuration:ipv6-random}]:9001
{%- endif %} {%- endif %}
enb-ipv6 = ${slap-configuration:ipv6-random} enb-ipv6 = ${slap-configuration:ipv6-random}
enb-ipv4 = {{ lan_ipv4 }} enb-ipv4 = {{ lan_ipv4 }}
{% if bbu == "ors" %} current-earfcn = {{ RF.dl_earfcn }}
ors-version = {{ ors_version['ors-version'] }}
frequency-range-rating = {{ ors_version['range'] }}
current-tx-power-estimate = {{ ors_version['power-estimate'] }}
current-tx-gain = {{ ors_version['current-tx-gain'] }}
current-rx-gain = {{ ors_version['current-rx-gain'] }}
{% endif %}
current-earfcn = {{ ors_version['current-earfcn'] }}
amarisoft-version = {{ lte_version }} amarisoft-version = {{ lte_version }}
license-expiration = {{ lte_expiration }} license-expiration = {{ lte_expiration }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
......
{#- defaults for eNB radio parameters.
NOTE they are installed temporary and will go away after switch to generic multiRU. #}
{%- do RF.setdefault('tx_gain', slapparameter_dict.get('tx_gain', 0)) %}
{%- do RF.setdefault('rx_gain', slapparameter_dict.get('rx_gain', 0)) %}
{%- do RF.setdefault('dl_nr_arfcn', slapparameter_dict.get('dl_nr_arfcn', 0)) %}
{%- do RF.setdefault('nr_band', slapparameter_dict.get('nr_band', 0)) %}
[buildout] [buildout]
parts = parts =
directory directory
...@@ -227,16 +234,16 @@ recipe = slapos.recipe.template:jinja2 ...@@ -227,16 +234,16 @@ recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do extensions = jinja2.ext.do
extra-context = extra-context =
context = context =
json ors false
section directory directory section directory directory
section slap_configuration slap-configuration section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key gtp_addr_v6 slap-configuration:ipv6-random key gtp_addr_v6 slap-configuration:ipv6-random
raw gtp_addr_v4 {{ lan_ipv4 }} raw gtp_addr_v4 {{ lan_ipv4 }}
raw one_watt {{ ors_version['one-watt'] }} raw tx_gain {{ RF.tx_gain }}
raw tx_gain {{ ors_version['current-tx-gain'] }} raw rx_gain {{ RF.rx_gain }}
raw rx_gain {{ ors_version['current-rx-gain'] }} raw nr_arfcn {{ RF.dl_nr_arfcn }}
raw nr_arfcn {{ ors_version['current-nr-arfcn'] }} raw nr_band {{ RF.nr_band }}
raw nr_band {{ ors_version['current-nr-band'] }}
raw software_name {{ software_name }} raw software_name {{ software_name }}
raw rf_mode {{ rf_mode }} raw rf_mode {{ rf_mode }}
raw trx {{ trx }} raw trx {{ trx }}
...@@ -274,13 +281,8 @@ websocket_url = ws://[${slap-configuration:ipv6-random}]:9001 ...@@ -274,13 +281,8 @@ websocket_url = ws://[${slap-configuration:ipv6-random}]:9001
{%- endif %} {%- endif %}
gnb-ipv6 = ${slap-configuration:ipv6-random} gnb-ipv6 = ${slap-configuration:ipv6-random}
gnb-ipv4 = {{ lan_ipv4 }} gnb-ipv4 = {{ lan_ipv4 }}
ors-version = {{ ors_version['ors-version'] }} current-nr-arfcn = {{ RF.dl_nr_arfcn }}
frequency-range-rating = {{ ors_version['range'] }} current-nr-band = {{ RF.nr_band }}
current-tx-power-estimate = {{ ors_version['power-estimate'] }}
current-tx-gain = {{ ors_version['current-tx-gain'] }}
current-rx-gain = {{ ors_version['current-rx-gain'] }}
current-nr-arfcn = {{ ors_version['current-nr-arfcn'] }}
current-nr-band = {{ ors_version['current-nr-band'] }}
amarisoft-version = {{ lte_version }} amarisoft-version = {{ lte_version }}
license-expiration = {{ lte_expiration }} license-expiration = {{ lte_expiration }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
......
# instance-ors-enb translates ORS enb/gnb into base enb/gnb.
{#- enb_mode indicates with which mode ors' enb is instantiated with - enb | gnb #}
{%- set enb_mode = slap_configuration['slap-software-type'] %}
{%- do assert(enb_mode in ('enb', 'gnb'), enb_mode) %}
{#- inject ORS defaults #}
{%- do RF.setdefault('tx_gain', ors_version['current-tx-gain']) %}
{%- do RF.setdefault('rx_gain', ors_version['current-rx-gain']) %}
{%- do RF.setdefault('earfcn', ors_version['current-earfcn']) %}
{%- do RF.setdefault('nr_arfcn', ors_version['current-nr-arfcn']) %}
{%- do RF.setdefault('nr_band', ors_version['current-nr-band']) %}
# code of base enb/gnb
{% if enb_mode == 'enb' %}
{%- include 'instance-enb-base.jinja2.cfg' %}
{%- elif enb_mode == 'gnb' %}
{%- include 'instance-gnb-base.jinja2.cfg' %}
{%- endif %}
# let all templates know we are running in ORS mode
[config-base]
context -=
json ors false
context +=
key ors :ors
ors = {{ dumps(ors_version) }}
# add ORS-specific bits to published information
[publish-connection-information]
ors-version = {{ ors_version['ors-version'] }}
frequency-range-rating = {{ ors_version['range'] }}
current-tx-power-estimate = {{ ors_version['power-estimate'] }}
current-tx-gain = {{ ors_version['current-tx-gain'] }}
current-rx-gain = {{ ors_version['current-rx-gain'] }}
{%- if enb_mode == 'enb' %}
current-earfcn = {{ ors_version['current-earfcn'] }}
{%- elif enb_mode == 'gnb' %}
current-nr-arfcn = {{ ors_version['current-nr-arfcn'] }}
current-nr-band = {{ ors_version['current-nr-band'] }}
{%- endif %}
[buildout]
extends =
${template:output}
[switch-softwaretype]
enb = dynamic-template-ors-enb:output
gnb = dynamic-template-ors-enb:output
obsolete = dynamic-template-obsolete:output
enb-epc = $${:obsolete}
gnb-epc = $${:obsolete}
epc = $${:obsolete}
mme = $${:obsolete}
ue-lte =
ue-nr =
[dynamic-template-obsolete]
< = jinja2-template-base
url = ${template-obsolete:target}
filename = instance-obsolete.cfg
extensions = jinja2.ext.do
extra-context =
key slave_instance_list slap-configuration:slave-instance-list
# ORS-specific enb and gnb
# both are served by instance-ors-enb
[dynamic-template-ors-enb]
< = dynamic-template-enb
url = ${template-ors-enb:target}
filename = instance-enb.cfg
extra-context +=
section ors ors-version
section ors_version ors-version
import-list +=
rawfile instance-enb-base.jinja2.cfg ${template-enb:target}
rawfile instance-gnb-base.jinja2.cfg ${template-gnb:target}
[ors-version]
recipe = slapos.recipe.build
configuration = $${slap-configuration:configuration}
init =
import subprocess
range_map = {
"B38": "2570MHz - 2620MHz",
"B39": "1880MHz - 1920MHz",
"B42": "3400MHz - 3600MHz",
"B43": "3600MHz - 3800MHz",
"B28": "758MHz - 803MHz",
"N77": "3300MHz - 4200MHz",
"N79": "4400MHz - 5000MHz",
"UNKNOWN": "Information not available for this band",
}
default_tx_gain_map = {
"B38": (59, 65),
"B39": (59, 64),
"B42": (63, 62),
"B43": (63, 62),
"B28": (60, 62),
"N77": (60, 62),
"N79": (60, 62),
"UNKNOWN": (60, 62),
}
default_rx_gain_map = {
"B38": (43, 43),
"B39": (43, 43),
"B42": (43, 43),
"B43": (43, 43),
"B28": (43, 43),
"N77": (43, 43),
"N79": (43, 43),
"UNKNOWN": (43, 43),
}
default_earfcn_map = {
"B38": 38050,
"B39": 38350,
"B42": 42590,
"B43": 44590,
"B28": 9550,
"N77": 0,
"N79": 0,
"UNKNOWN": 0,
}
default_nr_arfcn_map = {
"B38": 519000,
"B39": 378000,
"B42": 632628,
"B43": 646666,
"B28": 0,
"N77": 660000,
"N79": 720000,
"UNKNOWN": 0,
}
default_nr_band_map = {
"B38": 41,
"B39": 39,
"B42": 78,
"B43": 78,
"B28": 0,
"N77": 77,
"N79": 79,
"UNKNOWN": 0,
}
power_map = {
"B38": (
lambda x: (-0.008712931375092506) * x**2 + (2.1973585140044642) * x + (-94.29420762479742),
lambda x: (-0.004472751640641793) * x**2 + (1.6308290630103919) * x + (-81.84549245154561),
),
"B39": (
lambda x: (-0.008712931375092506) * x**2 + (2.1973585140044642) * x + (-94.29420762479742),
lambda x: (-0.0022523817802900985) * x**2 + (1.2674016231310092) * x + (-66.57165215468584),
),
"B42": (
lambda x: (-0.014198126839751619) * x**2 + (2.980758813262773) * x + (-125.25800492285738),
lambda x: (0.003977721774394756) * x**2 + (0.527208191717173) * x + (-42.761142655285376),
),
"B43": (
lambda x: (-0.014198126839751619) * x**2 + (2.980758813262773) * x + (-125.25800492285738),
lambda x: (-0.0036530114002551943) * x**2 + (1.510856844601873) * x + (-74.58790185136355),
),
"B28": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"N77": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"N79": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"UNKNOWN": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
}
def get_sdr_info(cmd):
if options['configuration'].get('testing', False):
return {'t': 'TDD', 'b': 'B39', 'v': '4.2', 's': 'B53'}[cmd].encode()
return subprocess.check_output(
["sudo", "-n", "/opt/amarisoft/get-sdr-info", "-" + cmd]
)
version = get_sdr_info('v').decode()
options['version'] = float(version) if version != 'UNKNOWN' else 0
options['band'] = get_sdr_info('b').decode()
options['tdd'] = get_sdr_info('t').decode()
options['one-watt'] = bool(options['version'] >= 4)
options['ors-version'] = "{} {} {}".format(
options['tdd'],
options['band'],
"2x1W" if options['one-watt'] else "2x0.5W",
)
default_tx_gain = default_tx_gain_map [options['band']][int(options['one-watt'])]
default_rx_gain = default_rx_gain_map [options['band']][int(options['one-watt'])]
default_earfcn = default_earfcn_map [options['band']]
default_nr_arfcn = default_nr_arfcn_map[options['band']]
default_nr_band = default_nr_band_map [options['band']]
options['range'] = range_map [options['band']]
options['current-tx-gain'] = options['configuration'].get('tx_gain' , default_tx_gain )
options['current-rx-gain'] = options['configuration'].get('rx_gain' , default_rx_gain )
options['current-earfcn'] = options['configuration'].get('dl_earfcn' , default_earfcn )
options['current-nr-arfcn'] = options['configuration'].get('dl_nr_arfcn', default_nr_arfcn)
options['current-nr-band'] = options['configuration'].get('nr_band' , default_nr_band )
power_estimate_dbm = power_map[options['band']][int(options['one-watt'])](float(options['current-tx-gain']))
if power_estimate_dbm == "UNKNOWN":
power_estimate = "Information not available for this band"
else:
power_estimate_mw = 10 ** ( power_estimate_dbm / 10 )
if power_estimate_mw < 0.01:
power_estimate_s = "{:0.2f} µW".format(power_estimate_mw * 1000)
else:
power_estimate_s = "{:0.2f} mW".format(power_estimate_mw)
power_estimate = "{:0.2f} dBm ({})".format(power_estimate_dbm, power_estimate_s)
options['power-estimate'] = power_estimate
...@@ -79,144 +79,6 @@ init = ...@@ -79,144 +79,6 @@ init =
pass pass
options['lte-expiration'] = lte_expiration options['lte-expiration'] = lte_expiration
[ors-version]
recipe = slapos.recipe.build
configuration = $${slap-configuration:configuration}
init =
import subprocess
range_map = {
"B38": "2570MHz - 2620MHz",
"B39": "1880MHz - 1920MHz",
"B42": "3400MHz - 3600MHz",
"B43": "3600MHz - 3800MHz",
"B28": "758MHz - 803MHz",
"N77": "3300MHz - 4200MHz",
"N79": "4400MHz - 5000MHz",
"UNKNOWN": "Information not available for this band",
}
default_tx_gain_map = {
"B38": (59, 65),
"B39": (59, 64),
"B42": (63, 62),
"B43": (63, 62),
"B28": (60, 62),
"N77": (60, 62),
"N79": (60, 62),
"UNKNOWN": (60, 62),
}
default_rx_gain_map = {
"B38": (43, 43),
"B39": (43, 43),
"B42": (43, 43),
"B43": (43, 43),
"B28": (43, 43),
"N77": (43, 43),
"N79": (43, 43),
"UNKNOWN": (43, 43),
}
default_earfcn_map = {
"B38": 38050,
"B39": 38350,
"B42": 42590,
"B43": 44590,
"B28": 9550,
"N77": 0,
"N79": 0,
"UNKNOWN": 0,
}
default_nr_arfcn_map = {
"B38": 519000,
"B39": 378000,
"B42": 632628,
"B43": 646666,
"B28": 0,
"N77": 660000,
"N79": 720000,
"UNKNOWN": 0,
}
default_nr_band_map = {
"B38": 41,
"B39": 39,
"B42": 78,
"B43": 78,
"B28": 0,
"N77": 77,
"N79": 79,
"UNKNOWN": 0,
}
power_map = {
"B38": (
lambda x: (-0.008712931375092506) * x**2 + (2.1973585140044642) * x + (-94.29420762479742),
lambda x: (-0.004472751640641793) * x**2 + (1.6308290630103919) * x + (-81.84549245154561),
),
"B39": (
lambda x: (-0.008712931375092506) * x**2 + (2.1973585140044642) * x + (-94.29420762479742),
lambda x: (-0.0022523817802900985) * x**2 + (1.2674016231310092) * x + (-66.57165215468584),
),
"B42": (
lambda x: (-0.014198126839751619) * x**2 + (2.980758813262773) * x + (-125.25800492285738),
lambda x: (0.003977721774394756) * x**2 + (0.527208191717173) * x + (-42.761142655285376),
),
"B43": (
lambda x: (-0.014198126839751619) * x**2 + (2.980758813262773) * x + (-125.25800492285738),
lambda x: (-0.0036530114002551943) * x**2 + (1.510856844601873) * x + (-74.58790185136355),
),
"B28": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"N77": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"N79": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"UNKNOWN": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
}
def get_sdr_info(cmd):
if options['configuration'].get('testing', False):
return {'t': 'TDD', 'b': 'B39', 'v': '4.2', 's': 'B53'}[cmd].encode()
return subprocess.check_output(
["sudo", "-n", "/opt/amarisoft/get-sdr-info", "-" + cmd]
)
version = get_sdr_info('v').decode()
options['version'] = float(version) if version != 'UNKNOWN' else 0
options['band'] = get_sdr_info('b').decode()
options['tdd'] = get_sdr_info('t').decode()
options['one-watt'] = bool(options['version'] >= 4)
options['ors-version'] = "{} {} {}".format(
options['tdd'],
options['band'],
"2x1W" if options['one-watt'] else "2x0.5W",
)
default_tx_gain = default_tx_gain_map [options['band']][int(options['one-watt'])]
default_rx_gain = default_rx_gain_map [options['band']][int(options['one-watt'])]
default_earfcn = default_earfcn_map [options['band']]
default_nr_arfcn = default_nr_arfcn_map[options['band']]
default_nr_band = default_nr_band_map [options['band']]
options['range'] = range_map [options['band']]
options['current-tx-gain'] = options['configuration'].get('tx_gain' , default_tx_gain )
options['current-rx-gain'] = options['configuration'].get('rx_gain' , default_rx_gain )
options['current-earfcn'] = options['configuration'].get('dl_earfcn' , default_earfcn )
options['current-nr-arfcn'] = options['configuration'].get('dl_nr_arfcn', default_nr_arfcn)
options['current-nr-band'] = options['configuration'].get('nr_band' , default_nr_band )
power_estimate_dbm = power_map[options['band']][int(options['one-watt'])](float(options['current-tx-gain']))
if power_estimate_dbm == "UNKNOWN":
power_estimate = "Information not available for this band"
else:
power_estimate_mw = 10 ** ( power_estimate_dbm / 10 )
if power_estimate_mw < 0.01:
power_estimate_s = "{:0.2f} µW".format(power_estimate_mw * 1000)
else:
power_estimate_s = "{:0.2f} mW".format(power_estimate_mw)
power_estimate = "{:0.2f} dBm ({})".format(power_estimate_dbm, power_estimate_s)
options['power-estimate'] = power_estimate
[lan-ip] [lan-ip]
recipe = slapos.recipe.build recipe = slapos.recipe.build
init = init =
...@@ -248,19 +110,6 @@ core-network = dynamic-template-core-network:output ...@@ -248,19 +110,6 @@ core-network = dynamic-template-core-network:output
ue-lte = dynamic-template-ue:output ue-lte = dynamic-template-ue:output
ue-nr = dynamic-template-ue:output ue-nr = dynamic-template-ue:output
RootSoftwareInstance = $${:core-network} RootSoftwareInstance = $${:core-network}
obsolete = dynamic-template-obsolete:output
enb-epc = $${:obsolete}
gnb-epc = $${:obsolete}
epc = $${:obsolete}
mme = $${:obsolete}
[dynamic-template-obsolete]
< = jinja2-template-base
url = ${template-obsolete:target}
filename = instance-obsolete.cfg
extensions = jinja2.ext.do
extra-context =
key slave_instance_list slap-configuration:slave-instance-list
[dynamic-template-enb] [dynamic-template-enb]
< = jinja2-template-base < = jinja2-template-base
...@@ -269,7 +118,7 @@ filename = instance-enb.cfg ...@@ -269,7 +118,7 @@ filename = instance-enb.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
extra-context = extra-context =
raw monitor_template ${monitor2-template:output} raw monitor_template ${monitor2-template:output}
section ors_version ors-version json RF {}
section comp_id comp-id section comp_id comp-id
section slap_configuration slap-configuration section slap_configuration slap-configuration
key lte_version amarisoft:lte-version key lte_version amarisoft:lte-version
...@@ -279,6 +128,7 @@ extra-context = ...@@ -279,6 +128,7 @@ extra-context =
raw enb_template ${enb.jinja2.cfg:target} raw enb_template ${enb.jinja2.cfg:target}
raw slaplte_template ${slaplte.jinja2:target} raw slaplte_template ${slaplte.jinja2:target}
raw drb_lte_template ${drb_lte.jinja2.cfg:target} raw drb_lte_template ${drb_lte.jinja2.cfg:target}
raw drb_nr_template ${drb_nr.jinja2.cfg:target}
raw sib23_template ${sib23.jinja2.asn:target} raw sib23_template ${sib23.jinja2.asn:target}
raw ru_amarisoft_stats_template ${ru_amarisoft-stats.jinja2.py:target} raw ru_amarisoft_stats_template ${ru_amarisoft-stats.jinja2.py:target}
raw ru_amarisoft_rf_info_template ${ru_amarisoft-rf-info.jinja2.py:target} raw ru_amarisoft_rf_info_template ${ru_amarisoft-rf-info.jinja2.py:target}
...@@ -296,6 +146,9 @@ extra-context = ...@@ -296,6 +146,9 @@ extra-context =
raw openssl_location ${openssl:location} raw openssl_location ${openssl:location}
raw default_lte_bandwidth ${default-params:default-lte-bandwidth} raw default_lte_bandwidth ${default-params:default-lte-bandwidth}
raw default_lte_inactivity_timer ${default-params:default-lte-inactivity-timer} raw default_lte_inactivity_timer ${default-params:default-lte-inactivity-timer}
raw default_nr_bandwidth ${default-params:default-nr-bandwidth}
raw default_nr_ssb_pos_bitmap ${default-params:default-nr-ssb-pos-bitmap}
raw default_nr_inactivity_timer ${default-params:default-nr-inactivity-timer}
raw default_n_antenna_dl ${default-params:default-n-antenna-dl} raw default_n_antenna_dl ${default-params:default-n-antenna-dl}
raw default_n_antenna_ul ${default-params:default-n-antenna-ul} raw default_n_antenna_ul ${default-params:default-n-antenna-ul}
raw ru_dnsmasq_template ${ru_dnsmasq.jinja2.cfg:target} raw ru_dnsmasq_template ${ru_dnsmasq.jinja2.cfg:target}
...@@ -311,7 +164,7 @@ filename = instance-gnb.cfg ...@@ -311,7 +164,7 @@ filename = instance-gnb.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
extra-context = extra-context =
raw monitor_template ${monitor2-template:output} raw monitor_template ${monitor2-template:output}
section ors_version ors-version json RF {}
section comp_id comp-id section comp_id comp-id
key lte_version amarisoft:lte-version key lte_version amarisoft:lte-version
key lte_expiration amarisoft:lte-expiration key lte_expiration amarisoft:lte-expiration
......
...@@ -59,7 +59,7 @@ def do(src, out, rat, slapparameter_dict): ...@@ -59,7 +59,7 @@ def do(src, out, rat, slapparameter_dict):
"trx": "sdr", "trx": "sdr",
"bbu": "ors", "bbu": "ors",
"ru_type": "ors", "ru_type": "ors",
"one_watt": "True", "ors": {"one-watt": true},
"earfcn": 36100, "earfcn": 36100,
"nr_arfcn": 380000, "nr_arfcn": 380000,
"nr_band": 39, "nr_band": 39,
......
# This file was generated using a jinja2 template and the render-templates script, don't modify directly. # This file was generated using a jinja2 template and the render-templates script, don't modify directly.
[buildout] [buildout]
extends = extends =
software-base.cfg software-ors.cfg
[default-params] [default-params]
default-lte-bandwidth = 20 MHz default-lte-bandwidth = 20 MHz
......
# software for Open Radio Station.
#
# It is a wrapper around base software which adds ORS-specific features.
[buildout]
extends =
software-base.cfg
parts +=
template-ors
# switch instance.cfg to be installed from instance-ors.cfg instead of template.cfg
# remember original template.cfg as template-base.cfg
[template]
output = ${buildout:directory}/template-base.cfg
[template-ors]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/template.cfg
[template-ors-enb]
<= download-base
# This file was generated using a jinja2 template and the render-templates script, don't modify directly. # This file was generated using a jinja2 template and the render-templates script, don't modify directly.
[buildout] [buildout]
extends = extends =
software-base.cfg software-ors.cfg
[default-params] [default-params]
default-lte-bandwidth = 20 MHz default-lte-bandwidth = 20 MHz
......
# {{ generated_file_message }} # {{ generated_file_message }}
[buildout] [buildout]
extends = extends =
{%- if bbu == 'ors' %}
software-ors.cfg
{%- else %}
software-base.cfg software-base.cfg
{%- endif %}
[default-params] [default-params]
default-lte-bandwidth = {{ default_lte_bandwidth }} default-lte-bandwidth = {{ default_lte_bandwidth }}
......
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