Skip to content

Commit

Permalink
Tests of FRR templates which rendered by sonic-cfggen (#4875)
Browse files Browse the repository at this point in the history
* Tests of FRR templates which rendered by sonic-cfggen
  • Loading branch information
pavel-shirshov authored and abdosi committed Jul 5, 2020
1 parent 4869fa7 commit 9c62ce9
Show file tree
Hide file tree
Showing 37 changed files with 910 additions and 0 deletions.
1 change: 1 addition & 0 deletions dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "common/functions.conf.j2" import get_ipv4_loopback_address, get_ipv6_loopback_address %}
!
! template: bgpd/bgpd.main.conf.j2
!
Expand Down
76 changes: 76 additions & 0 deletions src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
!
! 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 new_hostname
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 55.55.55.55/32
!
ipv6 prefix-list PL_LoopbackV6 permit fc00::/64
!
route-map HIDE_INTERNAL permit 10
set community local-AS
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
!
bgp bestpath as-path multipath-relax
!
bgp graceful-restart restart-time 480
bgp graceful-restart
bgp graceful-restart preserve-fw-state
!
bgp router-id 55.55.55.55
!
network 55.55.55.55/32
!
address-family ipv6
network fc00::1/64
exit-address-family
!
network 10.10.10.1/24
address-family ipv6
network fc01::1/64
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 32
exit-address-family
address-family ipv6
maximum-paths 32
exit-address-family
!
! end of template: bgpd/bgpd.main.conf.j2
!!
! end of template: bgpd/bgpd.conf.j2
!
33 changes: 33 additions & 0 deletions src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"DEVICE_METADATA": {
"localhost": {
"hostname": "new_hostname",
"bgp_asn": "55555",
"sub_role": "FrontEnd"
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {},
"Loopback0|fc00::1/128": {}
},
"VLAN_INTERFACE": {
"Vlan10|10.10.10.1/24": {},
"Vlan10|fc01::1/64": {}
},
"constants": {
"bgp": {
"multipath_relax": {
"enabled": true
},
"graceful_restart": {
"enabled": true,
"restart_time": 480
},
"maximum_paths": {
"enabled": true,
"ipv4": 32,
"ipv6": 32
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
!
ipv6 prefix-list PL_LoopbackV6 permit fc00::/64
!
route-map HIDE_INTERNAL permit 10
set community local-AS
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
!
bgp bestpath as-path multipath-relax
!
bgp graceful-restart restart-time 480
bgp graceful-restart
bgp graceful-restart preserve-fw-state
!
bgp router-id 55.55.55.55
!
network 55.55.55.55/32
!
address-family ipv6
network fc00::1/64
exit-address-family
!
network 10.10.10.1/24
address-family ipv6
network fc01::1/64
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 32
exit-address-family
address-family ipv6
maximum-paths 32
exit-address-family
!
! end of template: bgpd/bgpd.main.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": "55555",
"sub_role": "FrontEnd"
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {},
"Loopback0|fc00::1/128": {}
},
"VLAN_INTERFACE": {
"Vlan10|10.10.10.1/24": {},
"Vlan10|fc01::1/64": {}
},
"constants": {
"bgp": {
"multipath_relax": {
"enabled": true
},
"graceful_restart": {
"enabled": true,
"restart_time": 480
},
"maximum_paths": {
"enabled": true,
"ipv4": 32,
"ipv6": 32
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
!
bgp router-id 55.55.55.55
!
network 55.55.55.55/32
!
! end of template: bgpd/bgpd.main.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": "55555",
"sub_role": ""
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {},
"Loopback1|fc00::1/128": {}
},
"constants": {
"bgp": {
"multipath_relax": {},
"graceful_restart": {},
"maximum_paths": {}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
!
ipv6 prefix-list PL_LoopbackV6 permit fc00::/64
!
route-map HIDE_INTERNAL permit 10
set community local-AS
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
!
bgp bestpath as-path multipath-relax
!
bgp graceful-restart restart-time 240
bgp graceful-restart
bgp graceful-restart preserve-fw-state
!
bgp router-id 55.55.55.55
!
network 55.55.55.55/32
!
address-family ipv6
network fc00::1/64
exit-address-family
!
network 10.10.10.1/24
address-family ipv6
network fc01::1/64
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
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": "55555",
"sub_role": "FrontEnd"
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {},
"Loopback0|fc00::1/128": {}
},
"VLAN_INTERFACE": {
"Vlan10|10.10.10.1/24": {},
"Vlan10|fc01::1/64": {}
},
"constants": {
"bgp": {
"multipath_relax": {
"enabled": true
},
"graceful_restart": {
"enabled": true
},
"maximum_paths": {
"enabled": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
!
! Vnet BGP instance
router bgp 555 vrf First
no bgp default ipv4-unicast
bgp log-neighbor-changes
bgp bestpath as-path multipath-relax
no bgp default ipv4-unicast
bgp graceful-restart restart-time 240
bgp graceful-restart
bgp router-id 10.20.30.40
neighbor 10.10.10.1 remote-as 10
neighbor 10.10.10.1 description session1
address-family ipv4 unicast
neighbor 10.10.10.1 activate
neighbor 10.10.10.1 soft-reconfiguration inbound
maximum-paths 64
exit-address-family
address-family l2vpn evpn
advertise ipv4 unicast
exit-address-family
router bgp 555 vrf Second
no bgp default ipv4-unicast
bgp log-neighbor-changes
bgp bestpath as-path multipath-relax
no bgp default ipv4-unicast
bgp graceful-restart restart-time 240
bgp graceful-restart
bgp router-id 10.20.30.40
neighbor 20.20.20.1 remote-as 20
neighbor 20.20.20.1 description session2
address-family ipv4 unicast
neighbor 20.20.20.1 activate
neighbor 20.20.20.1 soft-reconfiguration inbound
maximum-paths 64
exit-address-family
address-family l2vpn evpn
advertise ipv4 unicast
exit-address-family
!

0 comments on commit 9c62ce9

Please sign in to comment.