Changes in FRR temapltes for multi-asic (#6901)
1. Made the command next-hop-self force only applicable on back-end asic bgp. This is done so that BGPL iBGP session running on backend can send e-BGP learn nexthop. Back end asic FRR is able to recursively resolve the eBGP nexthop in its routing table since it knows about all the connected routes advertise from front end asic. 2. Made all front-end asic bgp use global loopback ip (Loopback0) as router id and back end asic bgp use Loopbacl4096 as ruter-id and originator id for Route-Reflector. This is done so that routes learnt by external peer do not see Loopback4096 as router id in show ip bgp <route-prerfix> output. 3. To handle above change need to pass Loopback4096 from BGP manager for jinja2 template generation. This was missing and this change/fix is needed for this also https://github.com/Azure/sonic-buildimage/blob/master/dockers/docker-fpm-frr/frr/bgpd/templates/dynamic/instance.conf.j2#L27 4. Enhancement to add mult_asic specific bgpd template generation unit test cases.
This commit is contained in:
parent
833584eff9
commit
30b6668b7d
@ -33,6 +33,7 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi
|
||||
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
|
||||
route-map HIDE_INTERNAL permit 10
|
||||
set community local-AS
|
||||
{% set multi_asic = True %}
|
||||
!
|
||||
{% endif %}
|
||||
!
|
||||
@ -54,7 +55,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
{% endif %}
|
||||
!
|
||||
{# set router-id #}
|
||||
{% if multi_asic() %}
|
||||
{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
|
||||
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}
|
||||
{% else %}
|
||||
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}
|
||||
@ -62,7 +63,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
!
|
||||
{# advertise loopback #}
|
||||
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
|
||||
{% if multi_asic() %}
|
||||
{% if multi_asic is defined %}
|
||||
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
|
||||
{% endif %}
|
||||
!
|
||||
@ -71,7 +72,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% if multi_asic() %}
|
||||
{% if multi_asic is defined %}
|
||||
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %}
|
||||
address-family ipv6
|
||||
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/64 route-map HIDE_INTERNAL
|
||||
|
@ -10,6 +10,7 @@
|
||||
neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V4
|
||||
!
|
||||
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
|
||||
neighbor {{ neighbor_addr }} next-hop-self force
|
||||
neighbor {{ neighbor_addr }} route-map FROM_BGP_INTERNAL_PEER_V4 in
|
||||
{% endif %}
|
||||
!
|
||||
@ -18,6 +19,7 @@
|
||||
neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V6
|
||||
!
|
||||
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
|
||||
neighbor {{ neighbor_addr }} next-hop-self force
|
||||
neighbor {{ neighbor_addr }} route-map FROM_BGP_INTERNAL_PEER_V6 in
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@ -26,7 +28,6 @@
|
||||
neighbor {{ neighbor_addr }} route-reflector-client
|
||||
{% endif %}
|
||||
!
|
||||
neighbor {{ neighbor_addr }} next-hop-self force
|
||||
!
|
||||
neighbor {{ neighbor_addr }} activate
|
||||
exit-address-family
|
||||
|
@ -2,6 +2,7 @@
|
||||
! template: bgpd/templates/internal/policies.conf.j2
|
||||
!
|
||||
!
|
||||
{% from "common/functions.conf.j2" import get_ipv4_loopback_address %}
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V4 permit 100
|
||||
!
|
||||
@ -9,8 +10,8 @@ route-map TO_BGP_INTERNAL_PEER_V4 permit 100
|
||||
!
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V6 permit 1
|
||||
on-match next
|
||||
set ipv6 next-hop prefer-global
|
||||
on-match next
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V6 permit 100
|
||||
!
|
||||
@ -18,10 +19,10 @@ route-map TO_BGP_INTERNAL_PEER_V6 permit 100
|
||||
!
|
||||
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
|
||||
route-map FROM_BGP_INTERNAL_PEER_V4 permit 2
|
||||
set originator-id {{ loopback0_ipv4 | ip }}
|
||||
set originator-id {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }}
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V6 permit 2
|
||||
set originator-id {{ loopback0_ipv4 | ip }}
|
||||
set originator-id {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }}
|
||||
{% endif %}
|
||||
!
|
||||
! end of template: bgpd/templates/internal/policies.conf.j2
|
||||
|
@ -191,6 +191,8 @@ class BGPPeerMgrBase(Manager):
|
||||
'neighbor_addr': nbr,
|
||||
'bgp_session': data,
|
||||
'loopback0_ipv4': lo0_ipv4,
|
||||
'CONFIG_DB__LOOPBACK_INTERFACE':{ tuple(key.split('|')) : {} for key in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME)
|
||||
if '|' in key }
|
||||
}
|
||||
if self.check_neig_meta:
|
||||
neigmeta = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_NEIGHBOR_METADATA_TABLE_NAME)
|
||||
@ -384,4 +386,4 @@ class BGPPeerMgrBase(Manager):
|
||||
log_crit("Can't read vrf '%s' neighbors: %s" % (vrf, str(err)))
|
||||
raise Exception("Can't read vrf '%s' neighbors: %s" % (vrf, str(err)))
|
||||
|
||||
return peers
|
||||
return peers
|
||||
|
@ -6,9 +6,9 @@
|
||||
neighbor 10.10.10.10 timers 3 10
|
||||
address-family ipv4
|
||||
neighbor 10.10.10.10 peer-group INTERNAL_PEER_V4
|
||||
neighbor 10.10.10.10 next-hop-self force
|
||||
neighbor 10.10.10.10 route-map FROM_BGP_INTERNAL_PEER_V4 in
|
||||
neighbor 10.10.10.10 route-reflector-client
|
||||
neighbor 10.10.10.10 next-hop-self force
|
||||
neighbor 10.10.10.10 activate
|
||||
exit-address-family
|
||||
!
|
||||
|
@ -6,9 +6,9 @@
|
||||
neighbor fc::10 timers 3 10
|
||||
address-family ipv6
|
||||
neighbor fc::10 peer-group INTERNAL_PEER_V6
|
||||
neighbor fc::10 next-hop-self force
|
||||
neighbor fc::10 route-map FROM_BGP_INTERNAL_PEER_V6 in
|
||||
neighbor fc::10 route-reflector-client
|
||||
neighbor fc::10 next-hop-self force
|
||||
neighbor fc::10 activate
|
||||
exit-address-family
|
||||
!
|
||||
|
@ -6,7 +6,6 @@
|
||||
neighbor 10.10.10.10 timers 3 10
|
||||
address-family ipv4
|
||||
neighbor 10.10.10.10 peer-group INTERNAL_PEER_V4
|
||||
neighbor 10.10.10.10 next-hop-self force
|
||||
neighbor 10.10.10.10 activate
|
||||
exit-address-family
|
||||
!
|
||||
|
@ -6,7 +6,6 @@
|
||||
neighbor fc::10 timers 3 10
|
||||
address-family ipv6
|
||||
neighbor fc::10 peer-group INTERNAL_PEER_V6
|
||||
neighbor fc::10 next-hop-self force
|
||||
neighbor fc::10 activate
|
||||
exit-address-family
|
||||
!
|
||||
|
@ -4,5 +4,7 @@
|
||||
"sub_role": "BackEnd"
|
||||
}
|
||||
},
|
||||
"loopback0_ipv4": "10.10.10.10/32"
|
||||
}
|
||||
"CONFIG_DB__LOOPBACK_INTERFACE": {
|
||||
"Loopback4096|10.10.10.10/32": {}
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ route-map FROM_BGP_INTERNAL_PEER_V4 permit 100
|
||||
route-map TO_BGP_INTERNAL_PEER_V4 permit 100
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V6 permit 1
|
||||
on-match next
|
||||
set ipv6 next-hop prefer-global
|
||||
on-match next
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V6 permit 100
|
||||
!
|
||||
|
@ -6,8 +6,8 @@ route-map FROM_BGP_INTERNAL_PEER_V4 permit 100
|
||||
route-map TO_BGP_INTERNAL_PEER_V4 permit 100
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V6 permit 1
|
||||
on-match next
|
||||
set ipv6 next-hop prefer-global
|
||||
on-match next
|
||||
!
|
||||
route-map FROM_BGP_INTERNAL_PEER_V6 permit 100
|
||||
!
|
||||
|
@ -51,10 +51,14 @@ router bgp 55555
|
||||
bgp router-id 55.55.55.55
|
||||
!
|
||||
network 55.55.55.55/32
|
||||
network 55.55.55.56/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00::1/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fc00::2/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
network 10.10.10.1/24
|
||||
address-family ipv6
|
||||
|
@ -8,7 +8,9 @@
|
||||
},
|
||||
"LOOPBACK_INTERFACE": {
|
||||
"Loopback0|55.55.55.55/32": {},
|
||||
"Loopback0|fc00::1/128": {}
|
||||
"Loopback0|fc00::1/128": {},
|
||||
"Loopback4096|55.55.55.56/32": {},
|
||||
"Loopback4096|fc00::2/128": {}
|
||||
},
|
||||
"VLAN_INTERFACE": {
|
||||
"Vlan10|10.10.10.1/24": {},
|
||||
|
@ -33,10 +33,14 @@ router bgp 55555
|
||||
bgp router-id 55.55.55.55
|
||||
!
|
||||
network 55.55.55.55/32
|
||||
network 55.55.55.56/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00::1/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fc00::2/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
network 10.10.10.1/24
|
||||
address-family ipv6
|
||||
|
@ -7,7 +7,9 @@
|
||||
},
|
||||
"LOOPBACK_INTERFACE": {
|
||||
"Loopback0|55.55.55.55/32": {},
|
||||
"Loopback0|fc00::1/128": {}
|
||||
"Loopback0|fc00::1/128": {},
|
||||
"Loopback4096|55.55.55.56/32": {},
|
||||
"Loopback4096|fc00::2/128": {}
|
||||
},
|
||||
"VLAN_INTERFACE": {
|
||||
"Vlan10|10.10.10.1/24": {},
|
||||
|
@ -33,10 +33,14 @@ router bgp 55555
|
||||
bgp router-id 55.55.55.55
|
||||
!
|
||||
network 55.55.55.55/32
|
||||
network 55.55.55.56/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00::1/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fc00::2/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
network 10.10.10.1/24
|
||||
address-family ipv6
|
||||
|
@ -7,7 +7,9 @@
|
||||
},
|
||||
"LOOPBACK_INTERFACE": {
|
||||
"Loopback0|55.55.55.55/32": {},
|
||||
"Loopback0|fc00::1/128": {}
|
||||
"Loopback0|fc00::1/128": {},
|
||||
"Loopback4096|55.55.55.56/32": {},
|
||||
"Loopback4096|fc00::2/128": {}
|
||||
},
|
||||
"VLAN_INTERFACE": {
|
||||
"Vlan10|10.10.10.1/24": {},
|
||||
|
@ -36,11 +36,10 @@ link-detect
|
||||
ip route 0.0.0.0/0 10.10.10.1 200
|
||||
!!
|
||||
!
|
||||
!
|
||||
! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix
|
||||
ipv6 route fc00::/64 Loopback0
|
||||
!
|
||||
!!
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
@ -75,10 +74,14 @@ router bgp 55555
|
||||
bgp router-id 55.55.55.55
|
||||
!
|
||||
network 55.55.55.55/32
|
||||
network 55.55.55.56/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00::1/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fc00::2/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
network 10.10.10.1/24
|
||||
address-family ipv6
|
||||
|
@ -21,7 +21,9 @@
|
||||
},
|
||||
"LOOPBACK_INTERFACE": {
|
||||
"Loopback0|55.55.55.55/32": {},
|
||||
"Loopback0|fc00::1/128": {}
|
||||
"Loopback0|fc00::1/128": {},
|
||||
"Loopback4096|55.55.55.56/32": {},
|
||||
"Loopback4096|fc00::2/128": {}
|
||||
},
|
||||
"VLAN_INTERFACE": {
|
||||
"Vlan10|10.10.10.1/24": {},
|
||||
@ -43,4 +45,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ from functools import partial
|
||||
from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role
|
||||
from portconfig import get_port_config, get_breakout_mode
|
||||
from redis_bcc import RedisBytecodeCache
|
||||
from sonic_py_common.multi_asic import get_asic_id_from_name, is_multi_asic
|
||||
from sonic_py_common.multi_asic import get_asic_id_from_name
|
||||
from sonic_py_common import device_info
|
||||
from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector
|
||||
|
||||
@ -251,8 +251,6 @@ def _get_jinja2_env(paths):
|
||||
env.filters['ip_network'] = ip_network
|
||||
for attr in ['ip', 'network', 'prefixlen', 'netmask', 'broadcast']:
|
||||
env.filters[attr] = partial(prefix_attr, attr)
|
||||
# Pass the is_multi_asic function as global
|
||||
env.globals['multi_asic'] = is_multi_asic
|
||||
|
||||
return env
|
||||
|
||||
|
@ -0,0 +1,78 @@
|
||||
!
|
||||
! template: bgpd/bgpd.conf.j2
|
||||
!
|
||||
!
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
||||
! file: bgpd.conf
|
||||
!
|
||||
!
|
||||
! template: common/daemons.common.conf.j2
|
||||
!
|
||||
hostname multi_npu_platform_01
|
||||
password zebra
|
||||
enable password zebra
|
||||
!
|
||||
log syslog informational
|
||||
log facility local4
|
||||
!
|
||||
! end of template: common/daemons.common.conf.j2!
|
||||
agentx
|
||||
!
|
||||
!
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
! BGP configuration
|
||||
!
|
||||
! TSA configuration
|
||||
!
|
||||
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
|
||||
!
|
||||
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
|
||||
!
|
||||
!
|
||||
route-map HIDE_INTERNAL permit 10
|
||||
set community local-AS
|
||||
!
|
||||
!
|
||||
router bgp 65100
|
||||
!
|
||||
bgp log-neighbor-changes
|
||||
no bgp default ipv4-unicast
|
||||
no bgp ebgp-requires-policy
|
||||
!
|
||||
bgp bestpath as-path multipath-relax
|
||||
!
|
||||
bgp graceful-restart restart-time 240
|
||||
bgp graceful-restart
|
||||
bgp graceful-restart preserve-fw-state
|
||||
!
|
||||
bgp router-id 8.0.0.5
|
||||
!
|
||||
network 10.1.0.32/32
|
||||
network 8.0.0.5/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00:1::32/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fd00:4::32/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
address-family ipv4
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
!
|
||||
! end of template: bgpd/bgpd.main.conf.j2
|
||||
!!
|
||||
! end of template: bgpd/bgpd.conf.j2
|
||||
!
|
@ -0,0 +1,84 @@
|
||||
!
|
||||
! template: bgpd/bgpd.conf.j2
|
||||
!
|
||||
!
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
||||
! file: bgpd.conf
|
||||
!
|
||||
!
|
||||
! template: common/daemons.common.conf.j2
|
||||
!
|
||||
hostname multi_npu_platform_01
|
||||
password zebra
|
||||
enable password zebra
|
||||
!
|
||||
log syslog informational
|
||||
log facility local4
|
||||
!
|
||||
! end of template: common/daemons.common.conf.j2!
|
||||
agentx
|
||||
!
|
||||
!
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
! BGP configuration
|
||||
!
|
||||
! TSA configuration
|
||||
!
|
||||
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
|
||||
!
|
||||
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
|
||||
!
|
||||
!
|
||||
route-map HIDE_INTERNAL permit 10
|
||||
set community local-AS
|
||||
!
|
||||
!
|
||||
router bgp 65100
|
||||
!
|
||||
bgp log-neighbor-changes
|
||||
no bgp default ipv4-unicast
|
||||
no bgp ebgp-requires-policy
|
||||
!
|
||||
bgp bestpath as-path multipath-relax
|
||||
!
|
||||
bgp graceful-restart restart-time 240
|
||||
bgp graceful-restart
|
||||
bgp graceful-restart preserve-fw-state
|
||||
!
|
||||
bgp router-id 10.1.0.32
|
||||
!
|
||||
network 10.1.0.32/32
|
||||
network 8.0.0.0/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00:1::32/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fd00:1::32/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
!
|
||||
!
|
||||
address-family ipv4
|
||||
redistribute connected route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
redistribute connected route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv4
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
!
|
||||
! end of template: bgpd/bgpd.main.conf.j2
|
||||
!!
|
||||
! end of template: bgpd/bgpd.conf.j2
|
||||
!
|
@ -0,0 +1,78 @@
|
||||
!
|
||||
! template: bgpd/bgpd.conf.j2
|
||||
!
|
||||
!
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
||||
! file: bgpd.conf
|
||||
!
|
||||
!
|
||||
! template: common/daemons.common.conf.j2
|
||||
!
|
||||
hostname multi_npu_platform_01
|
||||
password zebra
|
||||
enable password zebra
|
||||
!
|
||||
log syslog informational
|
||||
log facility local4
|
||||
!
|
||||
! end of template: common/daemons.common.conf.j2!
|
||||
agentx
|
||||
!
|
||||
!
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
! BGP configuration
|
||||
!
|
||||
! TSA configuration
|
||||
!
|
||||
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
|
||||
!
|
||||
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
|
||||
!
|
||||
!
|
||||
route-map HIDE_INTERNAL permit 10
|
||||
set community local-AS
|
||||
!
|
||||
!
|
||||
router bgp 65100
|
||||
!
|
||||
bgp log-neighbor-changes
|
||||
no bgp default ipv4-unicast
|
||||
no bgp ebgp-requires-policy
|
||||
!
|
||||
bgp bestpath as-path multipath-relax
|
||||
!
|
||||
bgp graceful-restart restart-time 240
|
||||
bgp graceful-restart
|
||||
bgp graceful-restart preserve-fw-state
|
||||
!
|
||||
bgp router-id 8.0.0.5
|
||||
!
|
||||
network 10.1.0.32/32
|
||||
network 8.0.0.5/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00:1::32/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fd00:4::32/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
address-family ipv4
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
!
|
||||
! end of template: bgpd/bgpd.main.conf.j2
|
||||
!!
|
||||
! end of template: bgpd/bgpd.conf.j2
|
||||
!
|
@ -0,0 +1,84 @@
|
||||
!
|
||||
! template: bgpd/bgpd.conf.j2
|
||||
!
|
||||
!
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
||||
! file: bgpd.conf
|
||||
!
|
||||
!
|
||||
! template: common/daemons.common.conf.j2
|
||||
!
|
||||
hostname multi_npu_platform_01
|
||||
password zebra
|
||||
enable password zebra
|
||||
!
|
||||
log syslog informational
|
||||
log facility local4
|
||||
!
|
||||
! end of template: common/daemons.common.conf.j2!
|
||||
agentx
|
||||
!
|
||||
!
|
||||
!
|
||||
! template: bgpd/bgpd.main.conf.j2
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
! BGP configuration
|
||||
!
|
||||
! TSA configuration
|
||||
!
|
||||
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
|
||||
!
|
||||
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
|
||||
!
|
||||
!
|
||||
route-map HIDE_INTERNAL permit 10
|
||||
set community local-AS
|
||||
!
|
||||
!
|
||||
router bgp 65100
|
||||
!
|
||||
bgp log-neighbor-changes
|
||||
no bgp default ipv4-unicast
|
||||
no bgp ebgp-requires-policy
|
||||
!
|
||||
bgp bestpath as-path multipath-relax
|
||||
!
|
||||
bgp graceful-restart restart-time 240
|
||||
bgp graceful-restart
|
||||
bgp graceful-restart preserve-fw-state
|
||||
!
|
||||
bgp router-id 10.1.0.32
|
||||
!
|
||||
network 10.1.0.32/32
|
||||
network 8.0.0.0/32 route-map HIDE_INTERNAL
|
||||
!
|
||||
address-family ipv6
|
||||
network fc00:1::32/64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
network fd00:1::32/64 route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
!
|
||||
!
|
||||
address-family ipv4
|
||||
redistribute connected route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
redistribute connected route-map HIDE_INTERNAL
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv4
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
!
|
||||
! end of template: bgpd/bgpd.main.conf.j2
|
||||
!!
|
||||
! end of template: bgpd/bgpd.conf.j2
|
||||
!
|
@ -1,3 +1,4 @@
|
||||
import filecmp
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
@ -26,6 +27,7 @@ class TestMultiNpuCfgGen(TestCase):
|
||||
self.port_config = []
|
||||
for asic in range(NUM_ASIC):
|
||||
self.port_config.append(os.path.join(self.test_data_dir, "sample_port_config-{}.ini".format(asic)))
|
||||
self.output_file = os.path.join(self.test_dir, 'output')
|
||||
|
||||
def run_script(self, argument, check_stderr=False):
|
||||
print('\n Running sonic-cfggen ' + argument)
|
||||
@ -47,6 +49,22 @@ class TestMultiNpuCfgGen(TestCase):
|
||||
def run_diff(self, file1, file2):
|
||||
return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True)
|
||||
|
||||
def run_frr_asic_case(self, template, target, asic, port_config):
|
||||
template_dir = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', "frr")
|
||||
conf_template = os.path.join(template_dir, template)
|
||||
constants = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'constants', 'constants.yml')
|
||||
cmd_args = asic, self.sample_graph, port_config, constants, conf_template, template_dir, self.output_file
|
||||
cmd = "-n %s -m %s -p %s -y %s -t %s -T %s > %s" % cmd_args
|
||||
self.run_script(cmd)
|
||||
|
||||
original_filename = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, target)
|
||||
r = filecmp.cmp(original_filename, self.output_file)
|
||||
diff_output = self.run_diff(original_filename, self.output_file) if not r else ""
|
||||
|
||||
return r, "Diff:\n" + diff_output
|
||||
|
||||
|
||||
|
||||
def run_script_for_asic(self,argument,asic, port_config=None):
|
||||
argument = "{} -n asic{} ".format(argument, asic)
|
||||
if port_config:
|
||||
@ -352,3 +370,8 @@ class TestMultiNpuCfgGen(TestCase):
|
||||
}
|
||||
}
|
||||
)
|
||||
def test_bgpd_frr_frontendasic(self):
|
||||
self.assertTrue(*self.run_frr_asic_case('bgpd/bgpd.conf.j2', 'bgpd_frr_frontend_asic.conf', "asic0", self.port_config[0]))
|
||||
|
||||
def test_bgpd_frr_backendasic(self):
|
||||
self.assertTrue(*self.run_frr_asic_case('bgpd/bgpd.conf.j2', 'bgpd_frr_backend_asic.conf', "asic3", self.port_config[3]))
|
||||
|
Reference in New Issue
Block a user