apiVersion: interfaces.eda.nokia.com/v1alpha1
kind: Interface
metadata:
  name: {{ name }}
  namespace: {{ namespace }}
{% if labels is defined and labels %}
  labels:
{% for k, v in labels.items() %}
    {{ k }}: {{ v | default('') }}
{% endfor %}
{% endif %}
spec:
  members:
{% for m in members %}
  - node: {{ m.node }}
    interface: {{ m.interface }}
    enabled: {{ m.enabled | default(true) }}
    lacpPortPriority: {{ m.lacpPortPriority | default(32768) }}
{% endfor %}
  type: {{ type }}
{% if description is defined and description is not none %}
  description: {{ description }}
{% endif %}
{% if encapType is defined and encapType is not none %}
  encapType: {{ encapType }}
{% endif %}
{% if mtu is defined and mtu is not none %}
  mtu: {{ mtu }}
{% endif %}
{% if enabled is defined and enabled is not none %}
  enabled: {{ enabled }}
{% endif %}
{% if lldp is defined and lldp is not none %}
  lldp: {{ lldp }}
{% endif %}
{% if ethernet is defined and ethernet %}
  ethernet:
{% if ethernet.speed is defined and ethernet.speed is not none %}
    speed: {{ ethernet.speed }}
{% endif %}
{% endif %}
{% if lag is defined and lag %}
  lag:
{% if lag.type is defined and lag.type is not none %}
    type: {{ lag.type }}
{% endif %}
{% if lag.minLinks is defined and lag.minLinks is not none %}
    minLinks: {{ lag.minLinks }}
{% endif %}
{% if lag.lacp is defined and lag.lacp %}
    lacp: {}
{% endif %}
{% if lag.multihoming is defined and lag.multihoming %}
    multihoming:
{% if lag.multihoming.mode is defined and lag.multihoming.mode is not none %}
      mode: {{ lag.multihoming.mode }}
{% endif %}
{% endif %}
{% endif %}
