apiVersion: fabrics.eda.nokia.com/v1alpha1
kind: Fabric
metadata:
  name: {{ name }}
  namespace: {{ namespace }}
{% if labels is defined and labels %}
  labels:
{% for k, v in labels.items() %}
    {{ k }}: {{ v | default('') }}
{% endfor %}
{% endif %}
spec:
{% if borderLeafs is defined and borderLeafs %}
  borderLeafs:
{% if borderLeafs.asnPool is defined and borderLeafs.asnPool is not none %}
    asnPool: {{ borderLeafs.asnPool }}
{% endif %}
{% if borderLeafs.borderLeafNodeSelector is defined and borderLeafs.borderLeafNodeSelector %}
    borderLeafNodeSelector:
{% for s in borderLeafs.borderLeafNodeSelector %}
    - {{ s }}
{% endfor %}
{% endif %}
{% endif %}
{% if fabricSelector is defined and fabricSelector %}
  fabricSelector:
{% for s in fabricSelector %}
  - {{ s }}
{% endfor %}
{% endif %}
{% if interSwitchLinks is defined and interSwitchLinks %}
  interSwitchLinks:
{% if interSwitchLinks.linkSelector is defined and interSwitchLinks.linkSelector %}
    linkSelector:
{% for s in interSwitchLinks.linkSelector %}
    - {{ s }}
{% endfor %}
{% endif %}
{% if interSwitchLinks.poolIPV4 is defined and interSwitchLinks.poolIPV4 is not none %}
    poolIPV4: {{ interSwitchLinks.poolIPV4 }}
{% endif %}
{% if interSwitchLinks.qos is defined and interSwitchLinks.qos %}
    qos: {}
{% endif %}
{% endif %}
{% if leafs is defined and leafs %}
  leafs:
{% if leafs.asnPool is defined and leafs.asnPool is not none %}
    asnPool: {{ leafs.asnPool }}
{% endif %}
{% if leafs.leafNodeSelector is defined and leafs.leafNodeSelector %}
    leafNodeSelector:
{% for s in leafs.leafNodeSelector %}
    - {{ s }}
{% endfor %}
{% endif %}
{% endif %}
{% if overlayProtocol is defined and overlayProtocol %}
  overlayProtocol:
{% if overlayProtocol.protocol is defined and overlayProtocol.protocol is not none %}
    protocol: {{ overlayProtocol.protocol }}
{% endif %}
{% if overlayProtocol.bfd is defined and overlayProtocol.bfd %}
    bfd:
      desiredMinTransmitInt: {{ overlayProtocol.bfd.desiredMinTransmitInt | default(1000000) }}
      detectionMultiplier: {{ overlayProtocol.bfd.detectionMultiplier | default(3) }}
      enabled: {{ overlayProtocol.bfd.enabled | default(true) }}
      minEchoReceiveInterval: {{ overlayProtocol.bfd.minEchoReceiveInterval | default(1000000) }}
      requiredMinReceive: {{ overlayProtocol.bfd.requiredMinReceive | default(1000000) }}
{% endif %}
{% if overlayProtocol.bgp is defined and overlayProtocol.bgp %}
    bgp:
{% if overlayProtocol.bgp.autonomousSystem is defined and overlayProtocol.bgp.autonomousSystem is not none %}
      autonomousSystem: {{ overlayProtocol.bgp.autonomousSystem }}
{% endif %}
{% if overlayProtocol.bgp.clusterID is defined and overlayProtocol.bgp.clusterID is not none %}
      clusterID: {{ overlayProtocol.bgp.clusterID }}
{% endif %}
{% if overlayProtocol.bgp.rrNodeSelector is defined and overlayProtocol.bgp.rrNodeSelector %}
      rrNodeSelector:
{% for s in overlayProtocol.bgp.rrNodeSelector %}
      - {{ s }}
{% endfor %}
{% endif %}
{% if overlayProtocol.bgp.rrClientNodeSelector is defined and overlayProtocol.bgp.rrClientNodeSelector %}
      rrClientNodeSelector:
{% for s in overlayProtocol.bgp.rrClientNodeSelector %}
      - {{ s }}
{% endfor %}
{% endif %}
{% if overlayProtocol.bgp.timers is defined and overlayProtocol.bgp.timers %}
      timers: {}
{% endif %}
{% endif %}
{% endif %}
{% if spines is defined and spines %}
  spines:
{% if spines.asnPool is defined and spines.asnPool is not none %}
    asnPool: {{ spines.asnPool }}
{% endif %}
{% if spines.spineNodeSelector is defined and spines.spineNodeSelector %}
    spineNodeSelector:
{% for s in spines.spineNodeSelector %}
    - {{ s }}
{% endfor %}
{% endif %}
{% endif %}
{% if superSpines is defined and superSpines %}
  superSpines:
{% if superSpines.asnPool is defined and superSpines.asnPool is not none %}
    asnPool: {{ superSpines.asnPool }}
{% endif %}
{% if superSpines.superSpineNodeSelector is defined and superSpines.superSpineNodeSelector %}
    superSpineNodeSelector:
{% for s in superSpines.superSpineNodeSelector %}
    - {{ s }}
{% endfor %}
{% endif %}
{% endif %}
{% if systemPoolIPV4 is defined and systemPoolIPV4 is not none %}
  systemPoolIPV4: {{ systemPoolIPV4 }}
{% endif %}
{% if systemPoolIPV6 is defined and systemPoolIPV6 is not none %}
  systemPoolIPV6: {{ systemPoolIPV6 }}
{% endif %}
{% if underlayProtocol is defined and underlayProtocol %}
  underlayProtocol:
{% if underlayProtocol.protocol is defined and underlayProtocol.protocol %}
    protocol:
{% for p in underlayProtocol.protocol %}
    - {{ p }}
{% endfor %}
{% endif %}
{% if underlayProtocol.bfd is defined and underlayProtocol.bfd %}
    bfd:
      desiredMinTransmitInt: {{ underlayProtocol.bfd.desiredMinTransmitInt | default(1000000) }}
      detectionMultiplier: {{ underlayProtocol.bfd.detectionMultiplier | default(3) }}
      enabled: {{ underlayProtocol.bfd.enabled | default(true) }}
      minEchoReceiveInterval: {{ underlayProtocol.bfd.minEchoReceiveInterval | default(1000000) }}
      requiredMinReceive: {{ underlayProtocol.bfd.requiredMinReceive | default(1000000) }}
{% endif %}
{% if underlayProtocol.bgp is defined and underlayProtocol.bgp %}
    bgp:
{% if underlayProtocol.bgp.asnPool is defined and underlayProtocol.bgp.asnPool is not none %}
      asnPool: {{ underlayProtocol.bgp.asnPool }}
{% endif %}
{% if underlayProtocol.bgp.timers is defined and underlayProtocol.bgp.timers %}
      timers: {}
{% endif %}
{% endif %}
{% endif %}
