{# Model: InterfaceModel #}
{% if interface is defined %}
{%   set name, params = interface.name, interface %}
{% elif interface is undefined %}
{%   set name, params = name, params %}
{% endif %}
interface {{ name }}
{% include 'ios_interface_mode.j2' %}
{% if params.description | default(none) is not none %}
 description {{ params.description }}
{% endif %}
{% include 'ios_interface_shutdown.j2' %}
{% if params.discovery_protocols | default(none) is not none %}
{%   if params.discovery_protocols.cdp | default(none) is not none %}
{%     with params = params.discovery_protocols.cdp %}
{%       include 'ios_interface_discovery_cdp.j2' %}
{%     endwith %}
{%   endif %}
{% endif %}
{% if params.mtu | default(none) is not none %}
 mtu {{ params.mtu }}
{% endif %}
{% if params.l2_port | default(none) is not none and 'lag-member' not in params.tags | default([]) %}
{%   with params = params.l2_port %}
{%     include 'ios_interface_l2_port.j2' %}
{%   endwith %}
{% endif %}
{% if params.l3_port | default(none) is not none %}
{%   with params = params.l3_port %}
{%     include 'ios_interface_l3_port.j2' %}
{%   endwith %}
{% endif %}
{% if params.lag_member | default(none) is not none %}
{%   with params = params.lag_member %}
{%     include 'ios_interface_lag_member.j2' %}
{%   endwith %}
{% endif %}
{% if params.service_policy | default(none) is not none %}
{%   with params = params.service_policy %}
{%     include 'ios_interface_service_policy.j2' %}
{%   endwith %}
{% endif %}
{% if params.service_instances | default(none) is not none %}
{%   for params in params.service_instances %}
{%     include 'ios_interface_service_instance.j2' %}
{%   endfor %}
{% endif %}
{% if params.extra_config | default(none) is not none %}
{%   with extra_config = params.extra_config, indent = 1 %}
{%   include 'ios_common_extra_config.j2' %}
{%   endwith %}
{% endif %}