Commit 9f2b9db5 authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: Split dnsmasq.cfg into for-core and for-enb

Core Network and ENB use dnsmasq for completely different purposes:

- core network uses it to provide DNS server, while
- enb uses dnsmasq to provide DHCP server for Radio Units to be able to access
  Control & Management channel on the CPRI link.

-> Even though both those services are handled via same dnsmasq program, it
   makes sense to split dnsmasq config for clarity and as preparation for
   further adjustments of enb part.

   We also push config rendering down to -core and -enb instances also for
   clarity, and because in enb case rendering will need to know set of
   configured Radio Units - information that will become loaded only at
   instance-enb.

/cc @jhuge, @xavier_thompson, @Daetalus
/reviewed-by @lu.xu
/reviewed-on !1472
parent 49ce8ef5
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = b2f62658035bd70231a57fcd753f0035 md5sum = e2e286ba8d40790da3da462d55276e29
[amarisoft-stats.jinja2.py] [amarisoft-stats.jinja2.py]
_update_hash_filename_ = amarisoft-stats.jinja2.py _update_hash_filename_ = amarisoft-stats.jinja2.py
...@@ -80,7 +80,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e ...@@ -80,7 +80,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb] [template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 516f993bb7835710ba08a0cc592f70d1 md5sum = 6bf3f1cfd067d8a8137be9e92f720226
[template-gnb] [template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
...@@ -88,7 +88,7 @@ md5sum = e8e87a50b861d733894eb69e1aefa683 ...@@ -88,7 +88,7 @@ md5sum = e8e87a50b861d733894eb69e1aefa683
[template-core-network] [template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg _update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = aa7fcf7f68ced7e880158d0aa3307be4 md5sum = c807be73b9304f5a4c7483a3776bbc17
[template-ue-lte] [template-ue-lte]
_update_hash_filename_ = instance-ue-lte.jinja2.cfg _update_hash_filename_ = instance-ue-lte.jinja2.cfg
...@@ -130,9 +130,13 @@ md5sum = a4f91c1c9cfd91d000f4845a88cdb38a ...@@ -130,9 +130,13 @@ md5sum = a4f91c1c9cfd91d000f4845a88cdb38a
filename = config/mme.jinja2.cfg filename = config/mme.jinja2.cfg
md5sum = 3d7833ddba3242cedcd74c7db52390c6 md5sum = 3d7833ddba3242cedcd74c7db52390c6
[dnsmasq.jinja2.cfg] [dnsmasq-core-network.jinja2.cfg]
filename = config/dnsmasq.jinja2.cfg filename = config/dnsmasq-core-network.jinja2.cfg
md5sum = ecf6081d1fc76a60ba57f042446bc161 md5sum = f167b4be5e327b276b42267e0678f577
[dnsmasq-enb.jinja2.cfg]
filename = config/dnsmasq-enb.jinja2.cfg
md5sum = e0c10a8dba6599342ccd655a81527371
[ims.jinja2.cfg] [ims.jinja2.cfg]
filename = config/ims.jinja2.cfg filename = config/ims.jinja2.cfg
......
interface={{ slap_configuration.get('tun-name', '') }}
port=5353
{%- set filtered_slave_instance_list = [] %}
{%- for slave_instance in slap_configuration.get('slave-instance-list', []) %}
{%- if slave_instance.get('_', '') != '' %}
{%- set slave = json_module.loads(slave_instance.pop('_')) %}
{%- else %}
{%- set slave = slave_instance %}
{%- endif %}
{%- if slave.get('subdomain', '') != '' %}
{%- do filtered_slave_instance_list.append(slave) %}
{%- endif %}
{%- endfor %}
{% for i, slave in enumerate(filtered_slave_instance_list) -%}
address=/{{ slave['subdomain'] }}.{{ slap_configuration['configuration'].get('local_domain', '') }}/{{ slave.get('ip', '') }}
{% endfor -%}
...@@ -15,22 +15,4 @@ ra-param=adv-send-advert ...@@ -15,22 +15,4 @@ ra-param=adv-send-advert
ra-param=adv-managed-flag ra-param=adv-managed-flag
ra-param=adv-other-config-flag ra-param=adv-other-config-flag
ra-param=adv-autonomous ra-param=adv-autonomous
{% else %}
interface={{ slap_configuration.get('tun-name', '') }}
port=5353
{%- set filtered_slave_instance_list = [] %}
{%- for slave_instance in slap_configuration.get('slave-instance-list', []) %}
{%- if slave_instance.get('_', '') != '' %}
{%- set slave = json_module.loads(slave_instance.pop('_')) %}
{%- else %}
{%- set slave = slave_instance %}
{%- endif %}
{%- if slave.get('subdomain', '') != '' %}
{%- do filtered_slave_instance_list.append(slave) %}
{%- endif %}
{%- endfor %}
{% for i, slave in enumerate(filtered_slave_instance_list) -%}
address=/{{ slave['subdomain'] }}.{{ slap_configuration['configuration'].get('local_domain', '') }}/{{ slave.get('ip', '') }}
{% endfor -%}
{% endif %} {% endif %}
...@@ -203,15 +203,28 @@ url = {{ mme_template }} ...@@ -203,15 +203,28 @@ url = {{ mme_template }}
output = ${directory:etc}/mme.cfg output = ${directory:etc}/mme.cfg
{% if slapparameter_dict.get("local_domain", '') %} {% if slapparameter_dict.get("local_domain", '') %}
[dnsmasq-config]
recipe = slapos.recipe.template:jinja2
url = {{dnsmasq_template}}
filename = dnsmasq.cfg
extensions = jinja2.ext.do
output = ${directory:etc}/${:filename}
context =
import json_module json
import netaddr netaddr
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
[dnsmasq-service] [dnsmasq-service]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
port = 5353 port = 5353
ip = ${slap-configuration:tun-ipv4-addr} ip = ${slap-configuration:tun-ipv4-addr}
command-line = {{ dnsmasq_location }}/sbin/dnsmasq --conf-file={{ dnsmasq_config_path }} -x ${directory:run}/dnsmasq.pid --local-service --keep-in-foreground 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 wrapper-path = ${directory:service}/dnsmasq
mode = 0775 mode = 0775
hash-files = hash-files =
{{ dnsmasq_config_path }} ${dnsmasq-config:output}
#[dnsmasq-listen-promise] #[dnsmasq-listen-promise]
#<= monitor-promise-base #<= monitor-promise-base
......
...@@ -120,15 +120,29 @@ environment = ...@@ -120,15 +120,29 @@ environment =
AMARISOFT_PATH=/opt/amarisoft/.amarisoft AMARISOFT_PATH=/opt/amarisoft/.amarisoft
{% if slapparameter_dict.get("dnsmasq", None) %} {% if slapparameter_dict.get("dnsmasq", None) %}
[dnsmasq-config]
recipe = slapos.recipe.template:jinja2
url = {{dnsmasq_template}}
filename = dnsmasq.cfg
extensions = jinja2.ext.do
output = ${directory:etc}/${:filename}
context =
import json_module json
import netaddr netaddr
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
raw ru {{ ru }}
[dnsmasq-service] [dnsmasq-service]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
port = 5353 port = 5353
ip = ${slap-configuration:tun-ipv4-addr} ip = ${slap-configuration:tun-ipv4-addr}
command-line = {{ dnsmasq_location }}/sbin/dnsmasq --conf-file={{ dnsmasq_config_path }} -x ${directory:run}/dnsmasq.pid --local-service --keep-in-foreground 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 wrapper-path = ${directory:service}/dnsmasq
mode = 0775 mode = 0775
hash-files = hash-files =
{{ dnsmasq_config_path }} ${dnsmasq-config:output}
#[dnsmasq-listen-promise] #[dnsmasq-listen-promise]
#<= monitor-promise-base #<= monitor-promise-base
......
...@@ -296,9 +296,8 @@ extra-context = ...@@ -296,9 +296,8 @@ extra-context =
raw default_lte_inactivity_timer ${default-params:default-lte-inactivity-timer} raw default_lte_inactivity_timer ${default-params:default-lte-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 dnsmasq_template ${dnsmasq.jinja2.cfg:target} raw dnsmasq_template ${dnsmasq-enb.jinja2.cfg:target}
raw dnsmasq_location ${dnsmasq:location} raw dnsmasq_location ${dnsmasq:location}
key dnsmasq_config_path dnsmasq-config:output
raw fluent_bit_location ${fluent-bit:location} raw fluent_bit_location ${fluent-bit:location}
raw openssh_location ${openssh:location} raw openssh_location ${openssh:location}
raw openssh_output_keygen ${openssh-output:keygen} raw openssh_output_keygen ${openssh-output:keygen}
...@@ -340,14 +339,13 @@ extra-context = ...@@ -340,14 +339,13 @@ extra-context =
key lte_expiration amarisoft:lte-expiration key lte_expiration amarisoft:lte-expiration
key mme amarisoft:mme key mme amarisoft:mme
raw mme_template ${mme.jinja2.cfg:target} raw mme_template ${mme.jinja2.cfg:target}
raw dnsmasq_template ${dnsmasq.jinja2.cfg:target} raw dnsmasq_template ${dnsmasq-core-network.jinja2.cfg:target}
raw ims_template ${ims.jinja2.cfg:target} raw ims_template ${ims.jinja2.cfg:target}
raw openssl_location ${openssl:location} raw openssl_location ${openssl:location}
raw nghttp2_location ${nghttp2:location} raw nghttp2_location ${nghttp2:location}
raw iperf3_location ${iperf3:location} raw iperf3_location ${iperf3:location}
raw dnsmasq_location ${dnsmasq:location} raw dnsmasq_location ${dnsmasq:location}
key ue_db_path ue-db-config:output key ue_db_path ue-db-config:output
key dnsmasq_config_path dnsmasq-config:output
key slave_instance_list slap-configuration:slave-instance-list key slave_instance_list slap-configuration:slave-instance-list
[dynamic-template-ue-lte] [dynamic-template-ue-lte]
...@@ -393,17 +391,3 @@ output = $${directory:etc}/$${:filename} ...@@ -393,17 +391,3 @@ output = $${directory:etc}/$${:filename}
context = context =
import json_module json import json_module json
key slave_instance_list slap-configuration:slave-instance-list key slave_instance_list slap-configuration:slave-instance-list
[dnsmasq-config]
recipe = slapos.recipe.template:jinja2
url = ${dnsmasq.jinja2.cfg:target}
filename = dnsmasq.cfg
extensions = jinja2.ext.do
output = $${directory:etc}/$${:filename}
context =
import json_module json
import netaddr netaddr
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
raw ru ${rf-mode:ru}
...@@ -23,7 +23,8 @@ parts += ...@@ -23,7 +23,8 @@ parts +=
slapos-cookbook slapos-cookbook
# copy all configs by default # copy all configs by default
mme.jinja2.cfg mme.jinja2.cfg
dnsmasq.jinja2.cfg dnsmasq-core-network.jinja2.cfg
dnsmasq-enb.jinja2.cfg
ims.jinja2.cfg ims.jinja2.cfg
enb.jinja2.cfg enb.jinja2.cfg
gnb.jinja2.cfg gnb.jinja2.cfg
...@@ -133,9 +134,10 @@ filename = ue_db.jinja2.cfg ...@@ -133,9 +134,10 @@ filename = ue_db.jinja2.cfg
[mme.jinja2.cfg] [mme.jinja2.cfg]
<= copy-config-to-instance <= copy-config-to-instance
filename = mme.jinja2.cfg filename = mme.jinja2.cfg
[dnsmasq.jinja2.cfg] [dnsmasq-core-network.jinja2.cfg]
<= copy-config-to-instance
[dnsmasq-enb.jinja2.cfg]
<= copy-config-to-instance <= copy-config-to-instance
filename = dnsmasq.jinja2.cfg
[ims.jinja2.cfg] [ims.jinja2.cfg]
<= copy-config-to-instance <= copy-config-to-instance
filename = ims.jinja2.cfg filename = ims.jinja2.cfg
......
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