Commit edd4de18 authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: enb: Start to generalize the code to handle multiple peers

Add X2 peers support for symmetry with XN peers.

As with Radio Units and cells organize a registry of peers and start to handle
that registry generally everywhere. The registry is still populated with only
LTE peers on enb and only NR peers on gnb, but the only place that is aware of
that is registry loading routine.

Tests will be added later as full tests for generic MultiRU.

Rendered gnb.cfg stays the same, but there is a small change in rendered enb
but the config remains with the previous semantic as before hereby patch:

```
$ ./pythonwitheggs slapos-render-config.py && xdiff -w config/{old,out}
```

```diff
diff --git a/config/old/enb.cfg b/config/out/enb.cfg
index 5842dfc22..1a2c41b6b 100644
--- a/config/old/enb.cfg
+++ b/config/out/enb.cfg
@@ -22,6 +22,7 @@
     },
   ],
   gtp_addr: "127.0.1.1",
+  x2_peers: [],
   enb_id: 0x1A2D0,

   // LTE cells
```
parent efef1adb
...@@ -4,11 +4,13 @@ ...@@ -4,11 +4,13 @@
{%- set bug = slaplte.bug %} {%- set bug = slaplte.bug %}
{#- for standalone testing via slapos-render-config.py {#- for standalone testing via slapos-render-config.py
NOTE: keep in sync with ru/libinstance.jinja2.cfg #} NOTE: keep in sync with instance-enb.jinja2.cfg and ru/libinstance.jinja2.cfg #}
{%- if _standalone is defined %} {%- if _standalone is defined %}
{%- set ru_dict = {} %} {%- set ru_dict = {} %}
{%- set cell_dict = {} %} {%- set cell_dict = {} %}
{%- set peer_dict = {} %}
{%- do slaplte.load_ru_and_cell(ru_dict, cell_dict) %} {%- do slaplte.load_ru_and_cell(ru_dict, cell_dict) %}
{%- do slaplte.load_peer(peer_dict) %}
{%- endif %} {%- endif %}
...@@ -165,12 +167,22 @@ ...@@ -165,12 +167,22 @@
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{#- X2/Xn peers
TODO: add info about peers as shared instances - one instance per peer *ENB*.
then query SlapOS Master about cells configured on that peer ENB and
depending on whether LTE and/or NR cells are there add X2 and/or Xn peers #}
{%- if do_lte %}
x2_peers: {{ peer_dict|dictsort | selectattr('1.peer_type', '==', 'lte')
| map(attribute='1.x2_addr')
| list | tojson }},
{%- endif %}
{%- if do_nr %} {%- if do_nr %}
xn_peers: {{ slapparameter_dict.xn_peers|dictsort xn_peers: {{ peer_dict|dictsort | selectattr('1.peer_type', '==', 'nr')
| map(attribute='1.xn_addr') | map(attribute='1.xn_addr')
| list | tojson }}, | list | tojson }},
{%- endif %} {%- endif %}
{%- if do_lte %} {%- if do_lte %}
enb_id: {{ slapparameter_dict.enb_id }}, enb_id: {{ slapparameter_dict.enb_id }},
{%- endif %} {%- endif %}
......
...@@ -110,6 +110,22 @@ ...@@ -110,6 +110,22 @@
"type": "object", "type": "object",
"default": {} "default": {}
}, },
"x2_peers": {
"title": "X2 Peers",
"description": "X2 Peers",
"patternProperties": {
".*": {
"properties": {
"x2_addr": {
"$ref": "peer/lte/input-schema.json#/properties/x2_addr"
}
},
"type": "object"
}
},
"type": "object",
"default": {}
},
"websocket_password": { "websocket_password": {
"title": "Websocket password", "title": "Websocket password",
"description": "Activates websocket for remote control and sets password", "description": "Activates websocket for remote control and sets password",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
'gnb_id_bits': 28, 'gnb_id_bits': 28,
'nssai': {'1': {'sst': 1}}, 'nssai': {'1': {'sst': 1}},
"ncell_list": {}, "ncell_list": {},
"x2_peers": {},
"xn_peers": {}, "xn_peers": {},
} %} } %}
{%- set gtp_addr_lo = '127.0.1.1' %} {%- set gtp_addr_lo = '127.0.1.1' %}
...@@ -42,6 +43,9 @@ offline = true ...@@ -42,6 +43,9 @@ offline = true
{%- import 'slaplte.jinja2' as slaplte with context %} {%- import 'slaplte.jinja2' as slaplte with context %}
{%- import 'ru_libinstance.jinja2.cfg' as rulib with context %} {%- import 'ru_libinstance.jinja2.cfg' as rulib with context %}
{%- set peer_dict = {} %}
{%- do slaplte.load_peer(peer_dict) %}
{{ rulib.buildout() }} {{ rulib.buildout() }}
[myslap] [myslap]
...@@ -213,6 +217,7 @@ extra-context = ...@@ -213,6 +217,7 @@ extra-context =
import json_module json import json_module json
json ru_dict {{ rulib.ru_dict | tojson }} json ru_dict {{ rulib.ru_dict | tojson }}
json cell_dict {{ rulib.cell_dict | tojson }} json cell_dict {{ rulib.cell_dict | tojson }}
json peer_dict {{ peer_dict | tojson }}
import-list = import-list =
rawfile slaplte.jinja2 {{ slaplte_template }} rawfile slaplte.jinja2 {{ slaplte_template }}
......
...@@ -153,6 +153,22 @@ ...@@ -153,6 +153,22 @@
"type": "object", "type": "object",
"default": {} "default": {}
}, },
"x2_peers": {
"title": "X2 Peers",
"description": "X2 Peers",
"patternProperties": {
".*": {
"properties": {
"x2_addr": {
"$ref": "peer/lte/input-schema.json#/properties/x2_addr"
}
},
"type": "object"
}
},
"type": "object",
"default": {}
},
"websocket_password": { "websocket_password": {
"$ref": "instance-enb-input-schema.json#/properties/websocket_password" "$ref": "instance-enb-input-schema.json#/properties/websocket_password"
}, },
......
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Peer eNB",
"type": "object",
"required": [
"x2_addr"
],
"properties": {
"x2_addr": {
"title": "X2 Address",
"description": "X2 Address of the neighbour node (eNB Address)",
"type": "string"
}
}
}
{#- Package slaplte provides helpers for configuring Amarisoft LTE services in SlapOS. {#- Package slaplte provides helpers for configuring Amarisoft LTE services in SlapOS.
- load_ru_and_cell initializes RU and cell registries. - load_ru_and_cell initializes RU and cell registries.
- load_peer initializes peer registry.
- ru_config emits RF driver configuration for specified Radio Units. - ru_config emits RF driver configuration for specified Radio Units.
The following utilities are also provided: The following utilities are also provided:
...@@ -188,6 +189,27 @@ ...@@ -188,6 +189,27 @@
{%- endmacro %} {%- endmacro %}
{#- load_peer initializes peer registry.
peer_dict keeps configured peers: {} peer reference -> peer
#}
{%- macro load_peer(peer_dict) %}
{%- if do_lte %}
{%- for ref, peer in slapparameter_dict.x2_peers %}
{%- do peer.update({'peer_type': 'lte'}) %}
{%- do peer_dict.update({ref: peer}) %}
{%- endfor %}
{%- elif do_nr %}
{%- for ref, peer in slapparameter_dict.xn_peers %}
{%- do peer.update({'peer_type': 'nr'}) %}
{%- do peer_dict.update({ref: peer}) %}
{%- endfor %}
{%- else %}
{%- do bug('unreachable') %}
{%- endif %}
{%- endmacro %}
{#- ---- building configuration ---- #} {#- ---- building configuration ---- #}
{#- ru_config emits RF driver configuration for specified Radio Units. #} {#- ru_config emits RF driver configuration for specified Radio Units. #}
......
...@@ -50,6 +50,7 @@ def do(src, out, rat, slapparameter_dict): ...@@ -50,6 +50,7 @@ def do(src, out, rat, slapparameter_dict):
"gnb_id_bits": 28, "gnb_id_bits": 28,
"nssai": {'1': {'sst': 1}}, "nssai": {'1': {'sst': 1}},
"ncell_list": {}, "ncell_list": {},
"x2_peers": {},
"xn_peers": {}, "xn_peers": {},
"gtp_addr": "127.0.1.1", "gtp_addr": "127.0.1.1",
} }
......
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