Commit cbc3929c authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: enb: Adjust DHCP server to provide dedicated IPv6 to each Radio Unit

By reusing recently added "split TAP" infrastructure we can adjust dnsmasq
configuration to provide unique IPv6 to each RU.

- ru_mac_addr becomes per-RU setting and without default. We talked with Lu, and
  since now all Lopcomm units are shipped from the factory with unique MAC, it
  both does not make sense to provide the default, and we can rely on all units
  to have different MACs and configure DHCP replies based on that.

- No need to provide /64 network to every RU. We cannot actually do that anyway
  because normally SlapOS provides /71 address range for its slaptap. In the
  new configuration everything works with smaller networks just ok.

/cc @jhuge, @xavier_thompson, @Daetalus
/reviewed-by @lu.xu
/reviewed-on nexedi/slapos!1472
parent 30b4cec5
Pipeline #31197 failed with stage
......@@ -28,7 +28,7 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883
[ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = 46f5ba10f37f188806b5c5de104dc185
md5sum = 91ef336b7e913c07d89b82b27ffad11d
[ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
......@@ -80,7 +80,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 6bf3f1cfd067d8a8137be9e92f720226
md5sum = 815d57a36c7e3b4361230fbd3c76a9ef
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
......@@ -136,7 +136,7 @@ md5sum = f167b4be5e327b276b42267e0678f577
[dnsmasq-enb.jinja2.cfg]
filename = config/dnsmasq-enb.jinja2.cfg
md5sum = c0dc073b68b93b99ff87f106e9b69d7f
md5sum = 03e2e642d86b5c21181c7dba874cc08c
[ims.jinja2.cfg]
filename = config/ims.jinja2.cfg
......
{% if ru == "lopcomm" %}
dhcp-leasefile={{ directory['etc'] }}/dnsmasq.leases
port=5354
dhcp-range=::1,::1,constructor:{{ slap_configuration.get('tap-name', '') }},ra-names,64,5m
dhcp-host={{ slapparameter_dict.get('rrh_mac_addr', '00:0a:00:00:10:20') }},[{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}]
{%- for (cell_ref, cell) in cell_list|dictsort | selectattr('1._tap', 'defined') %}
{%- set ru_tap = cell._tap %}
{%- set vtap = json_module.loads(vtap_jdict[ru_tap]) %}
{%- set plen = netaddr.IPNetwork(vtap.network).prefixlen %}
# {{ cell_ref }} @ {{ ru_tap }}
dhcp-range=tag:{{ ru_tap }},{{ vtap.gateway }},{{ vtap.gateway }},static,{{ plen }},5m
dhcp-host={{ cell.ru_mac_addr }},tag:{{ ru_tap }},[{{ vtap.gateway }}]
# option 17 used for RU callhome
# dhcp-option=option6:17,[{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-addr', '')) }}]
# dhcp-option=option6:17,[{{ vtap.addr }}]
{%- endfor %}
log-queries
log-dhcp
log-facility={{ directory['home'] }}/var/log/dnsmasq.log
......
......@@ -139,6 +139,11 @@
"type": "number",
"default": 0
},
"ru_mac_addr": {
"title": "RU MAC address",
"description": "RU MAC address used for NETCONF",
"type": "string"
},
{%- endif %}
"dl_earfcn": {
"title": "DL EARFCN",
......@@ -182,12 +187,6 @@
"description": "dnsmasq",
"type": "boolean"
},
"rrh_mac_addr": {
"default": "00:0a:00:00:10:20",
"title": "RRH MAC address",
"description": "RRH MAC address used for DNSMASQ",
"type": "string"
},
{%- endif %}
{%- if ru == 'lopcomm' %}
"txa0cc00_active": {
......
......@@ -130,8 +130,8 @@ context =
import json_module json
import netaddr netaddr
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
section vtap_jdict vtap_jdict
json cell_list {{ rulib.cell_list | tojson }}
raw ru {{ ru }}
[dnsmasq-service]
......
......@@ -83,6 +83,11 @@
"type": "number",
"default": 0
},
"ru_mac_addr": {
"title": "RU MAC address",
"description": "RU MAC address used for NETCONF",
"type": "string"
},
"dl_earfcn": {
"title": "DL EARFCN",
"description": "Downlink E-UTRA Absolute Radio Frequency Channel Number of the cell",
......@@ -111,12 +116,6 @@
"description": "dnsmasq",
"type": "boolean"
},
"rrh_mac_addr": {
"default": "00:0a:00:00:10:20",
"title": "RRH MAC address",
"description": "RRH MAC address used for DNSMASQ",
"type": "string"
},
"txa0cc00_active": {
"title": "Lopcomm ORAN TX array carriers (TXA0CC00)",
"description": "Activate or inactivate Lopcomm ORAN TX array carriers (TXA0CC00)",
......
......@@ -93,6 +93,11 @@
"type": "number",
"default": 0
},
"ru_mac_addr": {
"title": "RU MAC address",
"description": "RU MAC address used for NETCONF",
"type": "string"
},
"dl_earfcn": {
"title": "DL EARFCN",
"description": "Downlink E-UTRA Absolute Radio Frequency Channel Number of the cell",
......@@ -121,12 +126,6 @@
"description": "dnsmasq",
"type": "boolean"
},
"rrh_mac_addr": {
"default": "00:0a:00:00:10:20",
"title": "RRH MAC address",
"description": "RRH MAC address used for DNSMASQ",
"type": "string"
},
"enb_id": {
"title": "eNB ID",
"description": "eNB ID",
......
......@@ -54,6 +54,7 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
https://lab.nexedi.com/nexedi/slapos/merge_requests/1471#note_194356
for details. #}
{%- set ntap = len(list(cell_list|dictsort)) %}
{%- set vtap_list = [] %}
[vtap]
recipe = plone.recipe.command
ntap = {{ ntap }}
......@@ -67,6 +68,7 @@ ntap = 0
stop-on-error = false
{%- if ntap == 1 %}
{%- do vtap_list.append(slaptap) %}
[vtap.{{ slaptap }}]
network = {{ slap_configuration['tap-ipv6-network'] }}
gateway = {{ slap_configuration['tap-ipv6-gateway'] }}
......@@ -77,6 +79,7 @@ addr = {{ slap_configuration['tap-ipv6-addr'] }}
{%- for i in range(1,1+ntap) %}
{%- set tap = '%s-%d' % (slaptap, i) %}
{%- do vtap_list.append(tap) %}
[vtap.{{ tap }}]
recipe = slapos.recipe.build
depends = ${vtap:recipe}
......@@ -103,6 +106,18 @@ init =
{%- endif %}
# vtap_jdict maps tapname -> json(interface-info)
[vtap_jdict]
recipe = slapos.recipe.build
depends = {% for tap in vtap_list %} ${vtap.{{tap}}:addr} {% endfor %}
init =
import json
{%- for tap in vtap_list %}
tap = self.buildout['vtap.{{tap}}']
tap = {k: tap[k] for k in ('network', 'gateway', 'addr')}
options['{{tap}}'] = json.dumps(tap)
{%- endfor %}
{#- assign TAP interfaces to RUs #}
{%- for i, (cell_ref, cell) in enumerate(cell_list|dictsort) %}
......
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