diff --git a/netsim/ansible/templates/bgp/eos.j2 b/netsim/ansible/templates/bgp/eos.j2 index d62e3755d6..4daf0d553e 100644 --- a/netsim/ansible/templates/bgp/eos.j2 +++ b/netsim/ansible/templates/bgp/eos.j2 @@ -80,15 +80,11 @@ router bgp {{ bgp.as }} {% for n in bgp.neighbors if n[af] is defined and n.activate[af] is defined and n.activate[af] %} {% set peer = 'ebgp_intf_' + n.local_if if n.local_if is defined else n[af] %} neighbor {{ peer }} activate -{% if n.type == 'ibgp' and bgp.next_hop_self|default(False) %} +{% set nhs = n.next_hop_self|default(False) %} +{% if nhs == 'ebgp' %} neighbor {{ peer }} route-map next-hop-self-{{ af }} out -{% endif %} -{% if n.type == 'confed_ebgp' and bgp.next_hop_self|default(False) %} - neighbor {{ peer }} next-hop-self -{% endif %} -{% if n.type == 'localas_ibgp' %} +{% else %} neighbor {{ peer }} next-hop-self - neighbor {{ peer }} route-reflector-client {% endif %} {% if n.local_if is defined and af == 'ipv4' %} neighbor {{ peer }} next-hop address-family ipv6 originate diff --git a/netsim/ansible/templates/bgp/eos.macro.j2 b/netsim/ansible/templates/bgp/eos.macro.j2 index 1cadf892c3..6a005b54c8 100644 --- a/netsim/ansible/templates/bgp/eos.macro.j2 +++ b/netsim/ansible/templates/bgp/eos.macro.j2 @@ -16,13 +16,8 @@ {% if n._source_intf is defined %} neighbor {{ peer }} update-source {{ n._source_intf.ifname }} {% endif %} -{% if n.type == 'localas_ibgp' %} - neighbor {{ peer }} next-hop-peer -{% endif %} -{% if 'ibgp' in n.type %} -{% if bgp.rr|default('') and not n.rr|default('') %} +{% if n.rr_client|default(False) %} neighbor {{ peer }} route-reflector-client -{% endif %} {% endif %} {% if n.type in bgp.community|default({}) %} neighbor {{ peer }} send-community {% diff --git a/netsim/ansible/templates/bgp/frr.j2 b/netsim/ansible/templates/bgp/frr.j2 index 6eb2d17264..f2967b6d5a 100644 --- a/netsim/ansible/templates/bgp/frr.j2 +++ b/netsim/ansible/templates/bgp/frr.j2 @@ -68,16 +68,12 @@ router bgp {{ bgp.as }} else False %} {% if peer %} neighbor {{ peer }} activate -{% if n.type in ['ibgp','confed_ebgp'] and bgp.next_hop_self|default(False) %} - neighbor {{ peer }} next-hop-self +{% if n.next_hop_self|default(False) %} + neighbor {{ peer }} next-hop-self{% if n.next_hop_self == 'all' %} force{% endif +%} {% endif %} -{% if n.type == 'ibgp' and bgp.rr|default('') and not n.rr|default('') %} +{% if n.rr_client|default(False) %} neighbor {{ peer }} route-reflector-client {% endif %} -{% if n.type == 'localas_ibgp' %} - neighbor {{ peer }} route-reflector-client - neighbor {{ peer }} next-hop-self force -{% endif %} {% if n.type in bgp.community|default({}) %} no neighbor {{ peer }} send-community all {% for c_type in bgp.community[n.type] %} diff --git a/netsim/ansible/templates/bgp/ios.macro.j2 b/netsim/ansible/templates/bgp/ios.macro.j2 index 617ca4d3de..db3f6b8f2c 100644 --- a/netsim/ansible/templates/bgp/ios.macro.j2 +++ b/netsim/ansible/templates/bgp/ios.macro.j2 @@ -19,16 +19,12 @@ {% macro neighbor_af(n,ip,bgp) %} neighbor {{ ip }} activate neighbor {{ ip }} advertisement-interval 0 -{% if n.type in ['ibgp','confed_ebgp'] and bgp.next_hop_self|default(False) %} - neighbor {{ ip }} next-hop-self +{% if n.next_hop_self|default(False) %} + neighbor {{ ip }} next-hop-self{% if n.next_hop_self == 'all' %} all{% endif +%} {% endif %} -{% if n.type == 'ibgp' and bgp.rr|default('') and not n.rr|default('') %} +{% if n.rr_client|default(False) %} neighbor {{ ip }} route-reflector-client {% endif %} -{% if n.type == 'localas_ibgp' %} - neighbor {{ ip }} route-reflector-client - neighbor {{ ip }} next-hop-self all -{% endif %} {% if n.type in bgp.community|default({}) %} {% for c_type in bgp.community[n.type] %} neighbor {{ ip }} send-community {{ c_type }}