Skip vnet-vxlan interfaces from generating networks (#5251)
* Skip Vnet interface from generating networks
This commit is contained in:
parent
b31050d60e
commit
4338d8293f
@ -1,4 +1,4 @@
|
||||
{% from "common/functions.conf.j2" import get_ipv4_loopback_address, get_ipv6_loopback_address %}
|
||||
{% from "common/functions.conf.j2" import get_ipv4_loopback_address, get_ipv6_loopback_address, get_vnet_interfaces %}
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
@ -14,14 +14,17 @@ ip prefix-list PL_LoopbackV4 permit {{ get_ipv4_loopback_address(LOOPBACK_INTERF
|
||||
ipv6 prefix-list PL_LoopbackV6 permit {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | replace('/128', '/64') | ip_network }}/64
|
||||
{% endif %}
|
||||
!
|
||||
{% if VLAN_INTERFACE is defined %}
|
||||
{% set vnet_intfs = get_vnet_interfaces(VLAN_INTERFACE) %}
|
||||
{% endif %}
|
||||
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 %}
|
||||
{% if prefix | ipv4 and name not in vnet_intfs %}
|
||||
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq {{ loop.index * 5 }} permit {{ prefix }}
|
||||
!
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv6 %}
|
||||
{% if prefix | ipv6 and name not in vnet_intfs %}
|
||||
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefix }}
|
||||
!
|
||||
{% endif %}
|
||||
@ -78,9 +81,9 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
!
|
||||
{% block vlan_advertisement %}
|
||||
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 %}
|
||||
{% if prefix | ipv4 and name not in vnet_intfs %}
|
||||
network {{ prefix }}
|
||||
{% elif prefix | ipv6 %}
|
||||
{% elif prefix | ipv6 and name not in vnet_intfs %}
|
||||
address-family ipv6
|
||||
network {{ prefix }}
|
||||
exit-address-family
|
||||
|
@ -21,3 +21,15 @@
|
||||
{% endfor %}
|
||||
{{ L.ip }}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro get_vnet_interfaces(interfaces) -%}
|
||||
{% set L = namespace(intfs=[]) %}
|
||||
{% set vnet_intfs = [] %}
|
||||
{% for (key, metadata) in interfaces.iteritems() %}
|
||||
{% if metadata.has_key("vnet_name") %}
|
||||
{% set vnet_intfs = vnet_intfs.append(key) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% set L.intfs = vnet_intfs %}
|
||||
{{ L.intfs }}
|
||||
{%- endmacro %}
|
||||
|
@ -11,7 +11,10 @@
|
||||
},
|
||||
"VLAN_INTERFACE": {
|
||||
"Vlan10|10.10.10.1/24": {},
|
||||
"Vlan10|fc01::1/64": {}
|
||||
"Vlan10|fc01::1/64": {},
|
||||
"Vlan20": {"vnet_name": "Vnet1"},
|
||||
"Vlan20|20.20.20.1/24": {},
|
||||
"Vlan20|fd01::1/64": {}
|
||||
},
|
||||
"constants": {
|
||||
"bgp": {
|
||||
|
@ -11,7 +11,10 @@
|
||||
},
|
||||
"VLAN_INTERFACE": {
|
||||
"Vlan10|10.10.10.1/24": {},
|
||||
"Vlan10|fc01::1/64": {}
|
||||
"Vlan10|fc01::1/64": {},
|
||||
"Vlan20": {"vnet_name": "Vnet1"},
|
||||
"Vlan20|20.20.20.1/24": {},
|
||||
"Vlan20|fd01::1/64": {}
|
||||
},
|
||||
"constants": {
|
||||
"bgp": {
|
||||
|
Loading…
Reference in New Issue
Block a user