Commit 2995a8d1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent af1903a3
......@@ -16,7 +16,7 @@
[template]
filename = instance.cfg
md5sum = 883fc0c659b94ad732809db09d4f4665
md5sum = f1309feb2d86e61f0c542a97594622f9
[template-ors]
filename = instance-ors.cfg
......@@ -28,7 +28,7 @@ md5sum = 9c1cf42bbf5286f8ddd4e14f19447d30
[ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = af0d3626f504af02f22780696820e401
md5sum = 415d002d8f89e11194de24223edb3b02
[ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
......@@ -36,7 +36,7 @@ md5sum = b7906ca3a6b17963f78f680fc0842b74
[ru_lopcomm_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/lopcomm/libinstance.jinja2.cfg
md5sum = 667bf3d0af1ae3e6d740c667957449dc
md5sum = ec34535512448db3fa40caa00bee3151
[ru_sunwave_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sunwave/libinstance.jinja2.cfg
......@@ -88,19 +88,19 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 29b5a5a61b0498681d480726be9e56bf
md5sum = d6b3e494db278d2ecc28ea1a9e4a7826
[template-ors-enb]
_update_hash_filename_ = instance-ors-enb.jinja2.cfg
md5sum = 0c7f21fab83a3310bf83663ac3fa49c7
md5sum = 2600aabd8ad60d9acaae10e4af8c13d0
[template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = c807be73b9304f5a4c7483a3776bbc17
md5sum = 9402b750221765b6b124cf5ecb3e520c
[template-ue]
_update_hash_filename_ = instance-ue.jinja2.cfg
md5sum = be16ae9b38dd4e46c09bc9eb4bb7eb93
md5sum = 096c7cbf869e2c2ae783821ec8391bbd
[template-obsolete]
_update_hash_filename_ = instance-obsolete.jinja2.cfg
......@@ -112,7 +112,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
md5sum = f13d4b8acd065dc4e71e7c7a47b1eb5c
md5sum = b876c63b0ebc133ce058a1203183d193
[drb_lte.jinja2.cfg]
filename = config/drb_lte.jinja2.cfg
......
......@@ -117,20 +117,18 @@
{{ slaplte.ru_config(iru_dict, slapparameter_dict) }}
{%- if slapparameter_dict.get('websocket_password', '') %}
com_addr: "[{{ gtp_addr_v6 }}]:{{ slap_configuration['configuration.com_ws_port'] }}",
com_addr: "[{{ gtp_addr_v6 }}]:{{ slapparameter_dict.com_ws_port }}",
com_auth: {
password: "{{ slapparameter_dict['websocket_password'] }}",
},
{%- else %}
com_addr: "{{ slap_configuration['configuration.com_addr'] }}:{{ slap_configuration['configuration.com_ws_port'] }}",
com_addr: "{{ slapparameter_dict.com_addr }}:{{ slapparameter_dict.com_ws_port }}",
{%- endif %}
{% if do_lte %}
// LTE core network
mme_list: [
{%- for _, mme in slapparameter_dict.get('mme_list',
{'1':{'mme_addr': slap_configuration['configuration.mme_addr']}})
| dictsort %}
{%- for _, mme in slapparameter_dict.mme_list |dictsort %}
{
mme_addr: "{{ mme['mme_addr'] }}",
},
......@@ -141,9 +139,7 @@
{% if do_nr %}
// NR core network
amf_list: [
{%- for _, amf in slapparameter_dict.get('amf_list',
{'1':{'amf_addr': slap_configuration['configuration.amf_addr']}})
| dictsort %}
{%- for _, amf in slapparameter_dict.amf_list |dictsort %}
{
amf_addr: "{{ amf['amf_addr'] }}",
},
......@@ -162,15 +158,38 @@
| map(attribute='1._.xn_addr')
| list | tojson }},
{% if slapparameter_dict.get('mme_list', '') or slapparameter_dict.get('amf_list', '') %}
{% if slapparameter_dict.get('use_ipv4', False) %}
{#- listen-address for GTP-U - either explicitly given, or autodetect #}
{%- if slapparameter_dict.get('gtp_addr') %}
gtp_addr: "{{ slapparameter_dict.gtp_addr }}",
{%- else %}
{#- use loopback if address of core network is on loopback as well #}
{%- set vcore = [] %}
{%- if do_lte %}
{%- do vcore.extend(slapparameter_dict.mme_list |dictsort |map(attribute='1.mme_addr')) %}
{%- endif %}
{%- if do_nr %}
{%- do vcore.extend(slapparameter_dict.amf_list |dictsort |map(attribute='1.amf_addr')) %}
{%- endif %}
{#- remove optional :port from addresses and see if they are on loopback #}
{%- set vip = [] %}
{%- for a in vcore %}
{%- set _ = namespace() %}
{%- set _.ip = urllib.parse.urlparse('z://%s' % a).hostname %}
{%- set _.islo = netaddr.IPAddress(_.ip).is_loopback() %}
{%- do vip.append(_) %}
{%- endfor %}
{%- if len(vip) > 0 and all(vip |map(attribute='islo')) %}
gtp_addr: "{{ vip[0] }}",
{%- else %}
{#- core is external - use external ipv4/ipv6 #}
{%- if slapparameter_dict.use_ipv4 %}
gtp_addr: "{{ gtp_addr_v4 }}",
{% else %}
{%- else %}
gtp_addr: "{{ gtp_addr_v6 }}",
{% endif %}
{% else %}
gtp_addr: "{{ slap_configuration['configuration.gtp_addr'] }}",
{% endif %}
{%- endif %}
{%- endif %}
{%- endif %}
{%- if do_lte %}
enb_id: {{ slapparameter_dict.enb_id }},
......@@ -714,10 +733,13 @@
{
plmn: "{{ plmn.plmn }}",
tac: {{ plmn.tac }},
{%- if plmn.get('ranac') %}
ranac: {{ plmn.ranac }},
{%- endif %}
reserved: {{ plmn.get('reserved', false) |tojson }},
nssai: [
{%- for _, nssai in slapparameter_dict.nssai |dictsort %}
{
{%- for _, nssai in slapparameter_dict.get('nssai', {1: {'sst': 1}}) |dictsort %}
sst: {{ nssai.sst }},
{%- if nssai.get('sd') %}
sd: {{ nssai.sd }},
......
......@@ -183,7 +183,7 @@ context =
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
key gtp_addr_v6 slap-configuration:ipv6-random
raw gtp_addr_v6 {{ my_ipv6 }}
raw gtp_addr_v4 {{ lan_ipv4 }}
import netaddr netaddr
key ifup_empty mme-ifup-empty:wrapper-path
......@@ -245,7 +245,7 @@ password = {{ slapparameter_dict['monitor-password'] | string }}
[publish-connection-information]
<= monitor-publish
recipe = slapos.cookbook:publish.serialised
core-network-ipv6 = ${slap-configuration:ipv6-random}
core-network-ipv6 = {{ my_ipv6 }}
core-network-ipv4 = {{ lan_ipv4 }}
amarisoft-version = {{ lte_version }}
license-expiration = {{ lte_expiration }}
......
......@@ -16,7 +16,7 @@
},
"mme_list": {
"title": "MME list",
"description": "Optional. List of MME to which the gNodeB is connected",
"description": "List of MME to which the eNodeB is connected. (must be set if there are LTE cells)",
"patternProperties": {
".*": {
"properties": {
......@@ -29,12 +29,11 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
},
"plmn_list": {
"title": "PLMN list (4G)",
"description": "List of PLMNs broadcasted by the eNodeB, at most 6",
"description": "List of PLMNs broadcasted by the eNodeB, at most 6. (must be set if there are LTE cells)",
"patternProperties": {
".*": {
"properties": {
......@@ -74,7 +73,7 @@
},
"amf_list": {
"title": "AMF list",
"description": "Optional. List of AMF to which the gNodeB is connected",
"description": "List of AMF to which the gNodeB is connected. (must set if there are NR cells)",
"patternProperties": {
".*": {
"properties": {
......@@ -87,12 +86,11 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
},
"plmn_list_5g": {
"title": "PLMN list (5G)",
"description": "List of PLMNs broadcasted by the gNodeB, at most 12",
"description": "List of PLMNs broadcasted by the gNodeB, at most 12. (must set if there are NR cells)",
"patternProperties": {
".*": {
"properties": {
......
# instance-enb implements eNB/gNB service.
{#- defaults for global eNB/gNB parameters.
TODO automatically enb defaults from JSON schema #}
{%- set enb_defaults = {
"com_ws_port": 9001,
"com_addr": '127.0.1.2',
"use_ipv4": False,
"nssai": {'1': {'sst': 1}}
} %}
{%- for k,v in enb_defaults|dictsort %}
{%- do slapparameter_dict.setdefault(k, v) %}
{%- endfor %}
[buildout]
parts =
directory
......@@ -31,6 +44,12 @@ offline = true
{{ rulib.buildout() }}
[myslap]
# NOTE we don't query slapos.cookbook:slapconfiguration the second time because
# slapparameter_dict is potentially modified with defaults.
parameter_dict = {{ dumps(slapparameter_dict) }}
configuration = {{ dumps(slap_configuration) }}
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
......@@ -46,19 +65,6 @@ minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
partition = {{ slap_connection['partition-id'] }}
url = {{ slap_connection['server-url'] }}
key = {{ slap_connection['key-file'] }}
cert = {{ slap_connection['cert-file'] }}
configuration.com_ws_port = 9001
configuration.com_addr = 127.0.1.2
configuration.mme_addr = 127.0.1.100
configuration.amf_addr = 127.0.1.100
configuration.gtp_addr = 127.0.1.1
[directory]
recipe = slapos.cookbook:mkdirectory
......@@ -125,7 +131,7 @@ drb_stats_logspec =
rotatespec = 100MB.9
logspec = ${:stats_logspec} ${:drb_stats_logspec}
{%- if slapparameter_dict.get("websocket_password", "") %}
websock = ws://[${slap-configuration:ipv6-random}]:9001
websock = ws://[{{my_ipv6}}]:9001
{%- else %}
websock = ws://127.0.1.2:9001
{%- endif %}
......@@ -185,12 +191,13 @@ extra-context =
context =
json ors false
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
key gtp_addr_v6 slap-configuration:ipv6-random
key slap_configuration myslap:configuration
key slapparameter_dict myslap:parameter_dict
raw gtp_addr_v6 {{ my_ipv6 }}
raw gtp_addr_v4 {{ lan_ipv4 }}
import xbuildout xbuildout
import netaddr netaddr
import urllib urllib
${:extra-context}
[enb-config]
......@@ -219,9 +226,9 @@ ipeercell_dict = {{ dumps(ipeercell_dict) }}
<= monitor-publish
recipe = slapos.cookbook:publish.serialised
{%- if slapparameter_dict.get("websocket_password", "") %}
websocket_url = ws://[${slap-configuration:ipv6-random}]:9001
websocket_url = ws://[{{my_ipv6}}]:9001
{%- endif %}
enb-ipv6 = ${slap-configuration:ipv6-random}
enb-ipv6 = {{ my_ipv6 }}
enb-ipv4 = {{ lan_ipv4 }}
amarisoft-version = {{ lte_version }}
license-expiration = {{ lte_expiration }}
......
......@@ -74,7 +74,8 @@
"default": "127.0.1.1"
},
"mme_list": {
"$ref": "instance-enb-input-schema.json#/properties/mme_list"
"$ref": "instance-enb-input-schema.json#/properties/mme_list",
"default": {"1": {"mme_addr": "127.0.1.100"}}
},
"plmn_list": {
"$ref": "instance-enb-input-schema.json#/properties/plmn_list",
......
......@@ -17,8 +17,8 @@
"tac": "0x0001",
"root_sequence_index": 204,
"enb_id": "0x1A2D0",
"gtp_addr": "127.0.1.1",
"plmn_list": {"1": {"plmn": "00101"}},
"mme_list": {'1': {'mme_addr': '127.0.1.100'}},
"plmn_list": {"1": {'plmn': '00101'}},
"lte_handover_a3_offset": 6,
"lte_handover_a3_time_to_trigger": 480,
"ncell_list": {},
......@@ -37,7 +37,8 @@
"cell_id": "0x01",
"gnb_id": "0x12345",
"gnb_id_bits": 28,
"plmn_list": {"1": {"plmn": "00101", "tac": 100}},
"amf_list": {'1': {'amf_addr': '127.0.1.100'}},
"plmn_list": {'1': {'plmn': '00101', 'tac': 100}},
"nr_handover_a3_offset": 6,
"nr_handover_time_to_trigger": 100,
"ncell_list": {},
......@@ -45,7 +46,6 @@
"inactivity_timer": 10000,
"disable_sdr": false
} %}
# XXX plmn_list -> plmn_list_5g + .tac=100
{%- set ors_defaults = {'enb': ors_enb_defaults, 'gnb': ors_gnb_defaults} [enb_mode] %}
{%- for k,v in ors_defaults|dictsort %}
......@@ -191,6 +191,14 @@
{%- endif %}
{#- gnb: plmn_list -> plmn_list_5g #}
{%- if enb_mode == 'gnb' %}
{%- set _ = slapparameter_dict %}
{%- do _.update({'plmn_list_5g': _.plmn_list}) %}
{%- do _.pop('plmn_list') %}
{%- endif %}
{#- backward compatibility: if ORS is running in gnb mode, and gnb_* parameters
are present, replace their generic enb_* counterparts with gnb_* ones #}
{%- if enb_mode == 'gnb' %}
......@@ -219,7 +227,8 @@
context -=
json ors false
context +=
json ors {{ ors_version | tojson }}
key ors :ors
ors = {{ dumps(ors_version) }}
# add ORS-specific bits to published information
......
......@@ -51,7 +51,8 @@
"default": 28
},
"amf_list": {
"$ref": "instance-enb-input-schema.json#/properties/amf_list"
"$ref": "instance-enb-input-schema.json#/properties/amf_list",
"default": {"1": {"amf_addr": "127.0.1.100"}}
},
"plmn_list": {
"$ref": "instance-enb-input-schema.json#/properties/plmn_list_5g",
......
......@@ -23,6 +23,11 @@ offline = true
{{ rulib.buildout() }}
[myslap]
# see instance-enb.jinja2.cfg about myslap
parameter_dict = {{ dumps(slapparameter_dict) }}
configuration = {{ dumps(slap_configuration) }}
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
......@@ -38,14 +43,6 @@ minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
partition = {{ slap_connection['partition-id'] }}
url = {{ slap_connection['server-url'] }}
key = {{ slap_connection['key-file'] }}
cert = {{ slap_connection['cert-file'] }}
[directory]
recipe = slapos.cookbook:mkdirectory
software = {{ buildout_directory }}
......@@ -104,9 +101,9 @@ extensions = jinja2.ext.do
extra-context =
context =
section directory directory
section slap_configuration slap-configuration
section pub_info publish-connection-information
key slapparameter_dict slap-configuration:configuration
key slap_configuration myslap:configuration
key slapparameter_dict myslap:parameter_dict
import xbuildout xbuildout
${:extra-context}
......@@ -133,8 +130,8 @@ iue_dict = {{ dumps(iue_dict) }}
[publish-connection-information]
<= monitor-publish
recipe = slapos.cookbook:publish.serialised
rue_bind_addr = ${slap-configuration:ipv6-random}
com_addr = [${slap-configuration:ipv6-random}]:9002
rue_bind_addr = {{my_ipv6}}
com_addr = [{{my_ipv6}}]:9002
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
[monitor-instance-parameter]
......
......@@ -38,6 +38,7 @@ context =
section slap_connection slap-connection
key slapparameter_dict slap-configuration:configuration
key lan_ipv4 lan-ip:ipv4
key my_ipv6 slap-configuration:ipv6-random
$${:extra-context}
import-list =
rawfile slaplte.jinja2 ${slaplte.jinja2:target}
......
......@@ -160,7 +160,6 @@ iru_dict = {{ dumps(iru_dict) }}
{{ part('dnsmasq-service') }}
recipe = slapos.cookbook:wrapper
port = 5353
#ip = ${slap-configuration:tun-ipv4-addr}
command-line = {{ dnsmasq_location }}/sbin/dnsmasq --conf-file=${dnsmasq-config:output} -x ${directory:run}/dnsmasq.pid --local-service --keep-in-foreground
wrapper-path = ${directory:service}/dnsmasq
mode = 0775
......@@ -302,7 +301,7 @@ extensions = jinja2.ext.do
log-output = ${directory:var}/log/amarisoft-rf-info.json.log
context =
section directory directory
key slapparameter_dict slap-configuration:configuration
key slapparameter_dict myslap:parameter_dict
key log_file :log-output
raw stats_period {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
raw testing {{ testing }}
......@@ -325,7 +324,7 @@ extensions = jinja2.ext.do
log-output = ${directory:var}/log/amarisoft-stats.json.log
context =
section directory directory
key slapparameter_dict slap-configuration:configuration
key slapparameter_dict myslap:parameter_dict
key log_file :log-output
raw stats_period {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
raw testing {{ testing }}
......
......@@ -31,7 +31,7 @@ is_firmware_updated = ${directory:etc}/{{B('%s.is_firmware_updated' % ru_ref)}}
context =
section directory directory
section vtap vtap.{{ ru.cpri_link._tap }}
key slapparameter_dict slap-configuration:configuration
key slapparameter_dict myslap:parameter_dict
key log_file :log-output
key software_reply_json_log_file :software-reply-json-log-output
key remote_file_path :remote-file-path
......@@ -116,7 +116,7 @@ is_netconf_connected = ${directory:etc}/{{B('%s.is_netconf_connected' % ru_ref)}
context =
section directory directory
section vtap vtap.{{ ru.cpri_link._tap }}
key slapparameter_dict slap-configuration:configuration
key slapparameter_dict myslap:parameter_dict
key log_file :log-output
key json_log_file :json-log-output
key cfg_json_log_file :cfg-json-log-output
......@@ -248,7 +248,7 @@ recipe = slapos.cookbook:userinfo
recipe = slapos.cookbook:free_port
minimum = 22222
maximum = 22231
ip = ${slap-configuration:ipv6-random}
ip = {{my_ipv6}}
[sshd-config]
recipe = slapos.recipe.template:jinja2
......@@ -257,7 +257,7 @@ path_pid = ${directory:run}/sshd.pid
inline =
PidFile ${:path_pid}
Port ${sshd-port:port}
ListenAddress ${slap-configuration:ipv6-random}
ListenAddress {{my_ipv6}}
Protocol 2
HostKey ${sshd-ssh-host-rsa-key:output}
HostKey ${sshd-ssh-host-ecdsa-key:output}
......
......@@ -412,11 +412,6 @@ def do_enb():
"slap_configuration": {
"tap-name": "slaptap9",
"slap-computer-partition-id": "slappart9",
"configuration.com_ws_port": 9001,
"configuration.com_addr": "127.0.1.2",
"configuration.mme_addr": "127.0.1.100",
"configuration.amf_addr": "127.0.1.100",
"configuration.gtp_addr": "127.0.1.1",
"slave-instance-list": %(jshared_instance_list)s
},
"directory": {
......
......@@ -273,6 +273,22 @@ class ENBTestCase4(RFTestCase4):
'enb_id': '0x17',
'gnb_id': '0x23',
'gnb_id_bits': 30,
'mme_list': {
'1': {'mme_addr': '1.2.3.4'},
'2': {'mme_addr': '[1234::1]:78'},
},
'amf_list': {
'1': {'amf_addr': '4.3.2.1:77'},
'2': {'amf_addr': '4321::1'},
},
'plmn_list': {
'1': {'plmn': '31415'},
'2': {'plmn': '44444', 'attach_without_pdn': True, 'reserved': True},
},
'plmn_list_5g': {
'1': {'plmn': '51413', 'tac': 0x124},
'2': {'plmn': '55555', 'tac': 0x125, 'ranac': 210, 'reserved': True},
},
})}
@classmethod
......@@ -301,8 +317,22 @@ class ENBTestCase4(RFTestCase4):
# basic enb parameters
def test_enb_cfg_basic(t):
assertMatch(t, t.enb_cfg, dict(
enb_id=0x17, gnb_id=0x23, gnb_id_bits=30,
x2_peers=['44.1.1.1'], xn_peers=['55.1.1.1'],
enb_id=0x17, gnb_id=0x23, gnb_id_bits=30,
mme_list=[{'mme_addr': '1.2.3.4'}, {'mme_addr': '[1234::1]:78'}],
amf_list=[{'amf_addr': '4.3.2.1:77'}, {'amf_addr': '4321::1'}],
x2_peers=['44.1.1.1'], xn_peers=['55.1.1.1'],
cell_default={
'plmn_list': [
dict(plmn='31415', attach_without_pdn=False, reserved=False),
dict(plmn='44444', attach_without_pdn=True, reserved=True),
]
},
nr_cell_default={
'plmn_list': [
dict(plmn='51413', tac=0x124, ranac=NO, reserved=False),
dict(plmn='55555', tac=0x125, ranac=210, reserved=True),
]
},
))
# basic cell parameters
......
......@@ -13,13 +13,14 @@ export SLAPOS_TEST_LOG_DIRECTORY=`pwd`/snapshot
#time ../k/kpython_for_test -m unittest discover -v
#time ../k/kpython_for_test -m unittest discover -vf
time ../k/kpython_for_test -m unittest discover -vf -k TestENBParameters
#time ../k/kpython_for_test -m unittest discover -vf -k TestENBParameters
#time ../k/kpython_for_test -m unittest discover -vf -k TestGNBParameters
#time ../k/kpython_for_test -m unittest discover -vf -k NBParameters
#time ../k/kpython_for_test -m unittest discover -vf -k CoreNetwork
#time ../k/kpython_for_test -m unittest discover -vf -k MonitorGadget
#time ../k/kpython_for_test -m unittest discover -vf -k SimCard
#time ../k/kpython_for_test -m unittest discover -vf -k TestENB_
#time ../k/kpython_for_test -m unittest discover -vf -k TestENB_SDR
time ../k/kpython_for_test -m unittest discover -vf -k TestENB_SDR
#time ../k/kpython_for_test -m unittest discover -vf -k TestENB_Lopcomm
#time ../k/kpython_for_test -m unittest discover -vf -k TestENB_Sunwave
#time ../k/kpython_for_test -m unittest discover -vf -k TestENB_RUMultiType
......
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