diff --git a/vyos.conf.j2 b/vyos.conf.j2 index ebcd6d9..566bd29 100644 --- a/vyos.conf.j2 +++ b/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') %}