Commit c1f2b72e authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

software/ors-amarisoft: render ue-db.cfg inside core-network buildout

parent 649249ca
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 22e06207fab996bcc1c26992106618ab md5sum = 5cf7674e2f6c3afb1b2f6b7646457284
[template-ors] [template-ors]
filename = instance-ors.cfg filename = instance-ors.cfg
...@@ -96,7 +96,7 @@ md5sum = 601d6237059fa665d3f3ffb6a78ad9ca ...@@ -96,7 +96,7 @@ md5sum = 601d6237059fa665d3f3ffb6a78ad9ca
[template-core-network] [template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg _update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = 9402b750221765b6b124cf5ecb3e520c md5sum = 4d05284cd328f5fce054b8f227097e25
[template-ue] [template-ue]
_update_hash_filename_ = instance-ue.jinja2.cfg _update_hash_filename_ = instance-ue.jinja2.cfg
...@@ -108,7 +108,7 @@ md5sum = c5f581ba01654b2aec46000abf8d0e35 ...@@ -108,7 +108,7 @@ md5sum = c5f581ba01654b2aec46000abf8d0e35
[ue_db.jinja2.cfg] [ue_db.jinja2.cfg]
filename = config/ue_db.jinja2.cfg filename = config/ue_db.jinja2.cfg
md5sum = dcaac06553a3222b14c0013a13f4a149 md5sum = 87a273c99ce64192506811d7718c2b36
[enb.jinja2.cfg] [enb.jinja2.cfg]
filename = config/enb.jinja2.cfg filename = config/enb.jinja2.cfg
......
{%- set filtered_slave_instance_list = [] %}
{%- for slave_instance in slave_instance_list %}
{%- if slave_instance.get('_', '') != '' %}
{%- set slave = json_module.loads(slave_instance.pop('_')) %}
{%- else %}
{%- set slave = slave_instance %}
{%- endif %}
{%- if slave.get('imsi', '') != '' %}
{%- do filtered_slave_instance_list.append(slave) %}
{%- endif %}
{%- endfor -%}
ue_db: [ ue_db: [
{%- for i, slave in enumerate(filtered_slave_instance_list) %} {%- for i, slave in enumerate(slap_configuration['sim_list']) %}
{%- set s = json_module.loads(slave.pop('_')) %}
{%- if i == 0 -%} {%- if i == 0 -%}
{ {
{%- else -%} {%- else -%}
, { , {
{%- endif %} {%- endif %}
sim_algo: "{{ slave.get('sim_algo', 'milenage') }}", sim_algo: "{{ s.get('sim_algo', 'milenage') }}",
imsi: "{{ slave.get('imsi', '') }}", imsi: "{{ s.get('imsi', '') }}",
opc: "{{ slave.get('opc', '') }}", opc: "{{ s.get('opc', '') }}",
amf: {{ slave.get('amf', '0x9001') }}, amf: {{ s.get('amf', '0x9001') }},
sqn: "{{ slave.get('sqn', '000000000000') }}", sqn: "{{ s.get('sqn', '000000000000') }}",
K: "{{ slave.get('k', '') }}", K: "{{ s.get('k', '') }}",
impu: "{{ slave.get('impu', '') }}", impu: "{{ s.get('impu', '') }}",
impi: "{{ slave.get('impi', '') }}", impi: "{{ s.get('impi', '') }}",
} }
{%- endfor -%} {%- endfor -%}
] ]
......
...@@ -69,7 +69,8 @@ cert = {{ slap_connection['cert-file'] }} ...@@ -69,7 +69,8 @@ cert = {{ slap_connection['cert-file'] }}
configuration.gtp_addr = 127.0.1.100 configuration.gtp_addr = 127.0.1.100
configuration.ims_addr = 127.0.0.1 configuration.ims_addr = 127.0.0.1
configuration.ims_bind = 127.0.0.2 configuration.ims_bind = 127.0.0.2
ue_db_path = {{ ue_db_path }} ue_db_path = ${ue-db-config:output}
sim_list = {{ dumps(sim_slave_instance_list) }}
[monitor-httpd-conf-parameter] [monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
...@@ -116,7 +117,7 @@ mode = 0775 ...@@ -116,7 +117,7 @@ mode = 0775
pidfile = ${directory:run}/ims.pid pidfile = ${directory:run}/ims.pid
hash-files = hash-files =
${ims-config:output} ${ims-config:output}
{{ ue_db_path }} ${ue-db-config:output}
environment = AMARISOFT_PATH=/opt/amarisoft/.amarisoft environment = AMARISOFT_PATH=/opt/amarisoft/.amarisoft
[mme-sh-wrapper] [mme-sh-wrapper]
...@@ -144,7 +145,7 @@ mode = 0775 ...@@ -144,7 +145,7 @@ mode = 0775
pidfile = ${directory:run}/mme.pid pidfile = ${directory:run}/mme.pid
hash-files = hash-files =
${mme-config:output} ${mme-config:output}
{{ ue_db_path }} ${ue-db-config:output}
${mme-sh-wrapper:output} ${mme-sh-wrapper:output}
environment = environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib:{{ nghttp2_location }}/lib LD_LIBRARY_PATH={{ openssl_location }}/lib:{{ nghttp2_location }}/lib
...@@ -193,6 +194,14 @@ context = ...@@ -193,6 +194,14 @@ context =
url = {{ ims_template }} url = {{ ims_template }}
output = ${directory:etc}/ims.cfg output = ${directory:etc}/ims.cfg
[ue-db-config]
<= config-base
url = {{ ue_db_template }}
output = ${directory:etc}/ue_db.cfg
context =
section slap_configuration slap-configuration
import json_module json
[mme-config] [mme-config]
<= config-base <= config-base
{% if slapparameter_dict.get("mme_config_link", None) %} {% if slapparameter_dict.get("mme_config_link", None) %}
......
...@@ -189,11 +189,11 @@ extra-context = ...@@ -189,11 +189,11 @@ extra-context =
raw mme_template ${mme.jinja2.cfg:target} raw mme_template ${mme.jinja2.cfg:target}
raw dnsmasq_template ${dnsmasq-core-network.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 ue_db_template ${ue_db.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 slave_instance_list slap-configuration:slave-instance-list key slave_instance_list slap-configuration:slave-instance-list
[dynamic-template-ue] [dynamic-template-ue]
...@@ -227,13 +227,3 @@ extra-context = ...@@ -227,13 +227,3 @@ extra-context =
raw dnsmasq_location ${dnsmasq:location} raw dnsmasq_location ${dnsmasq: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}
[ue-db-config]
recipe = slapos.recipe.template:jinja2
url = ${ue_db.jinja2.cfg:target}
filename = ue_db.cfg
extensions = jinja2.ext.do
output = $${directory:etc}/$${:filename}
context =
import json_module json
key slave_instance_list slap-configuration:slave-instance-list
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