Skip to content
Snippets Groups Projects
Commit 1b98527a authored by skorpy's avatar skorpy :construction_worker:
Browse files

kea6: update interfaces-config

parent 6d9633e2
No related branches found
No related tags found
No related merge requests found
Pipeline #33671 passed
......@@ -17,10 +17,14 @@ def rfc3397(domains):
def v6_interfaces():
interfaces = []
for domain_key, domain in __salt__['pillar.get']('domains').items():
for domain_key, domain in __salt__['pillar.get']('domains', {}).items():
if 'IPv6' in domain:
interfaces.append(domain_key + "-br")
for subnet in __salt__['pillar.get']('kea-dhcp:v6:subnets'):
if 'interface' in subnet:
interfaces.append(subnet.interface)
return list(set((__salt__['pillar.get']('kea-dhcp:v6:interfaces', []) + interfaces).sort()))
for subnet in __salt__['pillar.get']('kea_dhcp:v6:subnets', []):
interfaces.append(subnet.get('interface'))
if __salt__['pillar.get']('kea_dhcp:v6:interfaces', []):
interfaces.extend(__salt__['pillar.get']('kea_dhcp:v6:interfaces', []))
return interfaces
Example Pillar:
```yaml
kea-dhcp:
kea_dhcp:
IPv4:
interfaces:
......
{%- set interfaces = salt['pillar.get']('kea-dhcp:v4:interfaces', []) -%}
{%- set interfaces = salt['pillar.get']('kea_dhcp:v4:interfaces', []) -%}
{%- for domain, domainData in salt['pillar.get']('domains', {}).items()|sort -%}
{%- do interfaces.append(domain ~ '-br') -%}
{%- endfor -%}
......@@ -25,7 +25,7 @@
"valid-lifetime": 4000,
"subnet4": [
{%- for subnet in salt['pillar.get']('kea-dhcp:v4:subnets', [])|sort %}
{%- for subnet in salt['pillar.get']('kea_dhcp:v4:subnets', [])|sort %}
{
"subnet": "{{ subnet.subnet }}",
"pools": [
......@@ -42,7 +42,7 @@
{% for domain, domainData in salt['pillar.get']('domains', {}).items()|sort if 'IPv4' in domainData %}
{%- set instance = domainData.IPv4 %}
{%- if salt['pillar.get']('kea-dhcp:v4:subnets', []) and instance.subnets %},{%- endif %}
{%- if salt['pillar.get']('kea_dhcp:v4:subnets', []) and instance.subnets %},{%- endif %}
{%- for cidr, subnet in instance.subnets.items()|sort %}
{
"subnet": "{{ cidr }}",
......@@ -84,8 +84,8 @@
{%- endfor %}
]
{%- if salt['pillar.get']('kea-dhcp:v4:options', []) %}
,"option-data": {{ salt['pillar.get']('kea-dhcp:v4:options', [])|json }}
{%- if salt['pillar.get']('kea_dhcp:v4:options', []) %}
,"option-data": {{ salt['pillar.get']('kea_dhcp:v4:options', [])|json }}
{%- endif %}
,"loggers": [
......
......@@ -2,7 +2,7 @@
"Dhcp6":
{
"interfaces-config": {
"interfaces": {{ salt['pillar.get']('kea-dhcp:v6:interfaces', [])|json }}
"interfaces": {{ salt['kea.v6_interfaces']()|json }}
},
"lease-database": {
"type": "memfile",
......@@ -37,7 +37,7 @@
"rebind-timer": 2000,
"subnet6": [
{%- for subnet in salt['pillar.get']('kea-dhcp:v6:subnets', [])|sort(attribute='subnet') %}
{%- for subnet in salt['pillar.get']('kea_dhcp:v6:subnets', [])|sort(attribute='subnet') %}
{
"subnet": "{{- subnet.subnet -}}",
"rapid-commit": true,
......@@ -60,7 +60,7 @@
{%- for domain, domainData in salt['pillar.get']('domains', {}).items()|sort if 'IPv6' in domainData %}
{%- set instance = domainData.IPv6 %}
{%- if salt['pillar.get']('kea-dhcp:v6:subnets', []) and instance.subnets %},{%- endif %}
{%- if salt['pillar.get']('kea_dhcp:v6:subnets', []) and instance.subnets %},{%- endif %}
{%- for cidr, subnet in instance.subnets.items()|sort %}
{
......@@ -81,8 +81,8 @@
{%- endfor %}
]
{%- if salt['pillar.get']('kea-dhcp:v6:options', []) %}
,"option-data": {{ salt['pillar.get']('kea-dhcp:v6:options', [])|json }}
{%- if salt['pillar.get']('kea_dhcp:v6:options', []) %}
,"option-data": {{ salt['pillar.get']('kea_dhcp:v6:options', [])|json }}
{%- endif %}
,"loggers": [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment