use netbox's tagged_vlans on an interface to create sub-interfaces
This commit is contained in:
parent
9cb533f71d
commit
ad775bffe9
10
vyos.conf.j2
10
vyos.conf.j2
@ -69,14 +69,18 @@ interfaces {
|
||||
{% if not iface_data['enabled'] %}disable{% endif %}
|
||||
{% if iface_data['lag'] %}bond-group {{ iface_data['lag']['name'] }}{% endif %}
|
||||
|
||||
{% for subiface_name, subiface_data in pillar['netbox']['interfaces'].items() %}{% if subiface_data['form_factor']['label'] == 'Virtual' and subiface_name.startswith( iface_name + "." ) %}
|
||||
vif {{ subiface_name.split( "." )[ 1 ] }} {
|
||||
description "{{ subiface_data['description'].replace('"','\\"') or "-" }}"
|
||||
{% for tagged_vlan in iface_data['tagged_vlans'] %}
|
||||
{% set subiface_data = salt['pillar.get']('netbox:interfaces:%s.%04d'%(iface_name,tagged_vlan['vid']),{'description':'','addresses':[],'enabled':False}) %}
|
||||
vif {{ tagged_vlan['vid'] }} {
|
||||
description "{{ tagged_vlan['name'].replace('"','\\"') or "-" }} => {{ subiface_data['description'].replace('"','\\"') or "-" }}"
|
||||
{% for address in subiface_data['addresses'] %}
|
||||
address {{ address['address'] }}
|
||||
{% endfor %}
|
||||
{% if not subiface_data['enabled'] %}disable{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
|
||||
{% for subiface_name, subiface_data in pillar['netbox']['interfaces'].items() %}{% if subiface_data['form_factor']['label'] == 'Virtual' and subiface_name.startswith( iface_name + "." ) %}
|
||||
{% endif %}{% endfor %}
|
||||
|
||||
{% if salt['pillar.get']('interfaces:'+iface_name+':ip') %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user