Commit a7f2040b authored by Joanne Hugé's avatar Joanne Hugé

WIP: dnsmasq

parent d4386fe6
......@@ -44,7 +44,7 @@ md5sum = b2a1816ceb8e7f475e71454e5389d091
[template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = b4af66e7cdb3be1d48eabd14488bea24
md5sum = d39aa3cda900b31cb57f29bd10592102
[template-ue-lte]
_update_hash_filename_ = instance-ue-lte.jinja2.cfg
......@@ -80,11 +80,11 @@ md5sum = 1ba2e065bdf14a6411e95e80db17dcfd
[mme.jinja2.cfg]
filename = config/mme.jinja2.cfg
md5sum = c153d191c91a3bf28bae8724b0deb616
md5sum = 48b577daa5b53c2cf7fe2d30ea9c0235
[dnsmasq.jinja2.cfg]
filename = config/dnsmasq.jinja2.cfg
md5sum = 159942a0ffd9f73a5af6fb578037cd4b
md5sum = 05a983d97898813d5953fef4d03333a1
[ims.jinja2.cfg]
filename = config/ims.jinja2.cfg
......
......@@ -8,11 +8,11 @@ port=5353
{%- else %}
{%- set slave = slave_instance %}
{%- endif %}
{%- if slave.get('domain', '') != '' %}
{%- if slave.get('subdomain', '') != '' %}
{%- do filtered_slave_instance_list.append(slave) %}
{%- endif %}
{%- endfor %}
{% for i, slave in enumerate(filtered_slave_instance_list) -%}
address=/{{ slave['domain'] }}/{{ slave.get('ip', '') }}
address=/{{ slave['subdomain'] }}.{{ slap_configuration.get('local_domain', '') }}/{{ slave.get('ip', '') }}
{% endfor -%}
......@@ -55,7 +55,7 @@
pdn_type: "ipv4v6",
first_ipv6_prefix: "{{ netaddr.IPAddress(slap_configuration.get('tun-ipv6-addr', '')) + 1 }}",
last_ipv6_prefix: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration.get('tun-ipv6-network', '')).last) - 1 }}",
{% if slapparameter_dict.get('dnsmasq', False) %}
{% if slapparameter_dict.get('local_domain', '') %}
dns_addr: ["{{ slap_configuration.get('tun-ipv4-addr', '') }}"],
{% else %}
dns_addr: ["8.8.8.8", "2001:4860:4860::8888"],
......
......@@ -21,11 +21,11 @@
"description": "Activate iperf3 UDP server",
"type": "boolean"
},
"dnsmasq": {
"default": false,
"title": "dnsmasq",
"description": "dnsmasq",
"type": "boolean"
"local_domain": {
"default": "",
"title": "Local Domain",
"description": "Activates local DNS server serving the given domain name",
"type": "string"
},
"use_ipv4": {
"default": false,
......
{%- set dns_slave_instance_list = [] %}
{%- set sim_slave_instance_list = [] %}
{%- for slave in slave_instance_list %}
{%- set slave_parameters = json_module.loads(slave['_']) %}
{%- if slave_parameters.get('subdomain', '') != '' %}
{%- do dns_slave_instance_list.append(slave) %}
{%- elif slave_parameters.get('imsi', '') != '' %}
{%- do sim_slave_instance_list.append(slave) %}
{%- endif %}
{%- endfor %}
{% set part_list = [] -%}
{%- for i, slave in enumerate(slave_instance_list) %}
{%- for slave in sim_slave_instance_list %}
{%- set slave_parameters = json_module.loads(slave['_']) %}
{% set slave_reference = slave.get('slave_reference', '') %}
{% set publish_section_title = 'publish-%s' % slave_reference %}
......@@ -10,6 +21,19 @@ recipe = slapos.cookbook:publish.serialised
info = Your SIM card with IMSI {{ slave_parameters.get('imsi', '') }} has been attached to service ${slap-configuration:instance-title}.
{%- endfor %}
{%- for slave in dns_slave_instance_list %}
{%- set slave_parameters = json_module.loads(slave['_']) %}
{% set slave_reference = slave.get('slave_reference', '') %}
{% set publish_section_title = 'publish-%s' % slave_reference %}
{% do part_list.append(publish_section_title) %}
[{{ publish_section_title }}]
recipe = slapos.cookbook:publish.serialised
-slave-reference = {{ slave_reference }}
domain = {{ slave_parameters['subdomain'] }}.{{ slapparameter_dict.get('local_domain', '') }}
ip = {{ slave_parameters.get('ip', '') }}
info = DNS entry with has been attached to service ${slap-configuration:instance-title}.
{%- endfor %}
[buildout]
parts =
directory
......@@ -24,7 +48,7 @@ parts =
iperf-service
iperf-listen-promise
{% endif %}
{% if slapparameter_dict.get("dnsmasq", None) %}
{% if slapparameter_dict.get("local_domain", '') %}
dnsmasq-service
{% endif %}
{% for part in part_list -%}
......@@ -207,7 +231,7 @@ url = {{ mme_template }}
{% endif %}
output = ${directory:etc}/mme.cfg
{% if slapparameter_dict.get("dnsmasq", None) %}
{% if slapparameter_dict.get("local_domain", '') %}
[dnsmasq-service]
recipe = slapos.cookbook:wrapper
port = 5353
......
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