{% if vlans.0 %}
Connected swports:
{% for vlan in vlans %}
{% if vlan.interface.has_children %} {% else %} {% if forloop.last %} {% else %} {% endif %} {% endif %} {{ vlan.swport.module.netbox.sysname }} [{{ vlan.interface.ifname }}] {% if vlan.interface.connected_to_switch %} {% if vlan.interface.to_netbox %} {% if vlan.interface.trunk %} {% else %} {% endif %} {{ vlan.interface.to_netbox }} {% else %} {% if vlan.interface.to_interface %} {% if vlan.interface.trunk %} {% else %} {% endif %} {{ vlan.interface.to_interface.netbox }} [{{vlan.interface.to_interface.ifname}}] {% else %} ({{ vlan.interface.ifalias }}) {% if vlan.interface.trunk %} (trunk) {% endif %} {% endif %} {% endif %} {% else %} {% if vlan.interface.to_netbox %} {% if vlan.interface.trunk %} {% else %} {% endif %} {{ vlan.interface.to_netbox }} {% else %} {% if vlan.interface.to_interface %} {% if vlan.interface.trunk %} {% else %} {% endif %} {{ vlan.interface.to_interface.netbox }} [{{ vlan.interface.to_interface.ifname }}] {% else %} ({{ vlan.interface.ifalias }}) {% if vlan.interface.trunk %} (trunk) {% endif %} {% endif %} {% endif %} {% endif %}
{% endfor %}
{% endif %}