Skip to content

Commit

Permalink
CL NVUE: Postpone putting interfaces into VRFs until the VRF is creat…
Browse files Browse the repository at this point in the history
…ed (#1592)
  • Loading branch information
jbemmel authored Dec 1, 2024
1 parent f3d711f commit 5c8f749
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
33 changes: 6 additions & 27 deletions netsim/ansible/templates/initial/cumulus_nvue.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
{% endif %}
{% if i.ipv4 is defined or i.ipv6 is defined %}
ip:
{% if i.vrf is defined %}
vrf: {{ i.vrf }}
{% endif %}
{% if i.ipv4 is defined or i.ipv6|default(None) is string %}
address:
{% endif %}
{% if i.ipv4 is defined %}
{% if i.ipv4 == True %}
{{ loopback.ipv4 }}: {}
Expand Down Expand Up @@ -65,38 +60,22 @@
{{ decl_interface(l) }}
{% endfor %}

{% for lb in netlab_interfaces if lb.type=='loopback' %}
{% for lb in netlab_interfaces if lb.type=='loopback' and lb.vrf is not defined %}
- set:
{% if lb.vrf is not defined %}
interface:
lo:
type: loopback
ip:
address:
{% if 'ipv4' in lb %}
{% if 'ipv4' in lb %}
{{ lb.ipv4 }}: {}
{% else %}
{% else %}
127.0.0.1/8: {}
{% endif %}
{% if 'ipv6' in lb %}
{% endif %}
{% if 'ipv6' in lb %}
{{ lb.ipv6 }}: {}
{% else %}
{% else %}
ipv6:
enable: off
{% endif %}
{% else %}
vrf:
{{ lb.vrf }}:
loopback:
ip:
address:
{% if 'ipv4' in lb %}
{{ lb.ipv4 }}: {}
{% else %}
127.0.0.1/8: {}
{% endif %}
{% if 'ipv6' in lb %}
{{ lb.ipv6 }}: {}
{% endif %}
{% endif %}
{% endfor %}
22 changes: 22 additions & 0 deletions netsim/ansible/templates/vrf/cumulus_nvue.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,25 @@
{{ vrf_ospf(vname,vdata) }}
{% endif %}
{% endfor %}

{% for intf in netlab_interfaces if intf.vrf is defined %}
- set:
{% if intf.type=='loopback' %}
vrf:
{{ intf.vrf }}:
loopback:
ip:
address:
{% if 'ipv4' in intf %}
{{ intf.ipv4 }}: {}
{% endif %}
{% if 'ipv6' in intf %}
{{ intf.ipv6 }}: {}
{% endif %}
{% else %}
interface:
{{ intf.ifname }}:
ip:
vrf: {{ intf.vrf }}
{% endif %}
{% endfor %}

0 comments on commit 5c8f749

Please sign in to comment.