forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chassis] Add templates and code to support VoQ chassis iBGP peers (s…
…onic-net#5622) This commit has following changes: * Add templates and code to support VoQ chassis iBGP peers * Add support to convert a new VoQChassisInternal element in the BGPSession element of the minigraph to a new BGP_VOQ_CHASSIS_NEIGHBOR table in CONFIG_DB. * Add a new set of "voq_chassis" templates to docker-fpm-frr * Add a new BGP peer manager to bgpcfgd to add neighbors from the BGP_VOQ_CHASSIS_NEIGHBOR table using the voq_chassis templates. * Add a test case for minigraph.py, making sure the VoQChassisInternal element creates a BGP_VOQ_CHASSIS_NEIGHBOR entry, but not if its value is "false". * Add a set of test cases for the new voq_chassis templates in sonic-bgpcfgd tests. Note that the templates expect the new "bgp bestpath peer-type multipath-relax" bgpd configuration to be available. Signed-off-by: Joanne Mikkelson <jmmikkel@arista.com>
- Loading branch information
1 parent
a89a74b
commit 3505980
Showing
27 changed files
with
478 additions
and
43 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/instance.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! | ||
bgp bestpath as-path multipath-relax | ||
bgp bestpath peer-type multipath-relax | ||
! | ||
neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_PEER | ||
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} | ||
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} | ||
{# set the bgp neighbor timers if they have not default values #} | ||
{% if (bgp_session['keepalive'] is defined and bgp_session['keepalive'] | int != 60) | ||
or (bgp_session['holdtime'] is defined and bgp_session['holdtime'] | int != 180) %} | ||
neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] | default("60") }} {{ bgp_session['holdtime'] | default("180") }} | ||
{% endif %} | ||
! | ||
{% if 'admin_status' in bgp_session and bgp_session['admin_status'] == 'down' or 'admin_status' not in bgp_session and 'default_bgp_status' in CONFIG_DB__DEVICE_METADATA['localhost'] and CONFIG_DB__DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} | ||
neighbor {{ neighbor_addr }} shutdown | ||
{% endif %} | ||
! | ||
address-family ipv4 | ||
{% if constants.bgp.maximum_paths.enabled is defined and constants.bgp.maximum_paths.enabled %} | ||
maximum-paths ibgp {{ constants.bgp.maximum_paths.ipv4 | default(64) }} | ||
{% endif %} | ||
! | ||
exit-address-family | ||
! | ||
address-family ipv6 | ||
{% if constants.bgp.maximum_paths.enabled is defined and constants.bgp.maximum_paths.enabled %} | ||
maximum-paths ibgp {{ constants.bgp.maximum_paths.ipv6 | default(64) }} | ||
{% endif %} | ||
! | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! |
23 changes: 23 additions & 0 deletions
23
dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/peer-group.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/peer-group.conf.j2 | ||
! | ||
neighbor VOQ_CHASSIS_PEER peer-group | ||
address-family ipv4 | ||
{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} | ||
neighbor VOQ_CHASSIS_PEER allowas-in 1 | ||
{% endif %} | ||
neighbor VOQ_CHASSIS_PEER activate | ||
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths | ||
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound | ||
exit-address-family | ||
address-family ipv6 | ||
{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} | ||
neighbor VOQ_CHASSIS_PEER allowas-in 1 | ||
{% endif %} | ||
neighbor VOQ_CHASSIS_PEER activate | ||
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths | ||
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 | ||
! |
7 changes: 7 additions & 0 deletions
7
dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/policies.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/policies.conf.j2 | ||
! | ||
! | ||
! | ||
! end of template: bgpd/templates/voq_chassis/policies.conf.j2 | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": {} | ||
}, | ||
"neighbor_addr": "10.10.10.10", | ||
"bgp_session": { | ||
"asn": "555", | ||
"name": "internal1", | ||
"keepalive": "5", | ||
"holdtime": "30", | ||
"admin_status": "down" | ||
}, | ||
"constants": { | ||
"bgp": { | ||
"maximum_paths": { | ||
"enabled": "true", | ||
"ipv4": "32", | ||
"ipv6": "24" | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": {} | ||
}, | ||
"neighbor_addr": "10.10.10.10", | ||
"bgp_session": { | ||
"asn": "555", | ||
"name": "internal1" | ||
}, | ||
"constants": { | ||
"bgp": { | ||
"maximum_paths": { | ||
"enabled": "true" | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"default_bgp_status": "down" | ||
} | ||
}, | ||
"neighbor_addr": "10.10.10.10", | ||
"bgp_session": { | ||
"asn": "555", | ||
"name": "internal1" | ||
}, | ||
"constants": { | ||
"bgp": { | ||
"maximum_paths": { | ||
"enabled": "true" | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"default_bgp_status": "up" | ||
} | ||
}, | ||
"neighbor_addr": "10.10.10.10", | ||
"bgp_session": { | ||
"asn": "555", | ||
"name": "internal1" | ||
}, | ||
"constants": { | ||
"bgp": { | ||
"maximum_paths": { | ||
"enabled": "true" | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": {} | ||
}, | ||
"neighbor_addr": "10.10.10.10", | ||
"bgp_session": { | ||
"asn": "555", | ||
"name": "internal1", | ||
"keepalive": "5" | ||
}, | ||
"constants": { | ||
"bgp": { | ||
"maximum_paths": { | ||
"enabled": "true" | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": {} | ||
}, | ||
"neighbor_addr": "10.10.10.10", | ||
"bgp_session": { | ||
"asn": "555", | ||
"name": "internal1", | ||
"holdtime": "240" | ||
}, | ||
"constants": { | ||
"bgp": { | ||
"maximum_paths": { | ||
"enabled": "true" | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! | ||
bgp bestpath as-path multipath-relax | ||
bgp bestpath peer-type multipath-relax | ||
! | ||
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER | ||
neighbor 10.10.10.10 remote-as 555 | ||
neighbor 10.10.10.10 description internal1 | ||
neighbor 10.10.10.10 timers 5 30 | ||
neighbor 10.10.10.10 shutdown | ||
address-family ipv4 | ||
maximum-paths ibgp 32 | ||
! | ||
exit-address-family | ||
! | ||
address-family ipv6 | ||
maximum-paths ibgp 24 | ||
! | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! |
21 changes: 21 additions & 0 deletions
21
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! | ||
bgp bestpath as-path multipath-relax | ||
bgp bestpath peer-type multipath-relax | ||
! | ||
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER | ||
neighbor 10.10.10.10 remote-as 555 | ||
neighbor 10.10.10.10 description internal1 | ||
address-family ipv4 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
address-family ipv6 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! |
22 changes: 22 additions & 0 deletions
22
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_1.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! | ||
bgp bestpath as-path multipath-relax | ||
bgp bestpath peer-type multipath-relax | ||
! | ||
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER | ||
neighbor 10.10.10.10 remote-as 555 | ||
neighbor 10.10.10.10 description internal1 | ||
neighbor 10.10.10.10 shutdown | ||
address-family ipv4 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
address-family ipv6 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! |
21 changes: 21 additions & 0 deletions
21
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_2.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! | ||
bgp bestpath as-path multipath-relax | ||
bgp bestpath peer-type multipath-relax | ||
! | ||
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER | ||
neighbor 10.10.10.10 remote-as 555 | ||
neighbor 10.10.10.10 description internal1 | ||
address-family ipv4 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
address-family ipv6 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! |
22 changes: 22 additions & 0 deletions
22
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_1.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! | ||
bgp bestpath as-path multipath-relax | ||
bgp bestpath peer-type multipath-relax | ||
! | ||
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER | ||
neighbor 10.10.10.10 remote-as 555 | ||
neighbor 10.10.10.10 description internal1 | ||
neighbor 10.10.10.10 timers 5 180 | ||
address-family ipv4 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
address-family ipv6 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! |
22 changes: 22 additions & 0 deletions
22
src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_2.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! | ||
bgp bestpath as-path multipath-relax | ||
bgp bestpath peer-type multipath-relax | ||
! | ||
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER | ||
neighbor 10.10.10.10 remote-as 555 | ||
neighbor 10.10.10.10 description internal1 | ||
neighbor 10.10.10.10 timers 60 240 | ||
address-family ipv4 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
address-family ipv6 | ||
maximum-paths ibgp 64 | ||
! | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/instance.conf.j2 | ||
! |
7 changes: 7 additions & 0 deletions
7
src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/param_all.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"type": "ToRRouter" | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/param_base.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": {} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_all.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
! | ||
! template: bgpd/templates/voq_chassis/peer-group.conf.j2 | ||
! | ||
neighbor VOQ_CHASSIS_PEER peer-group | ||
address-family ipv4 | ||
neighbor VOQ_CHASSIS_PEER allowas-in 1 | ||
neighbor VOQ_CHASSIS_PEER activate | ||
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths | ||
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound | ||
exit-address-family | ||
address-family ipv6 | ||
neighbor VOQ_CHASSIS_PEER allowas-in 1 | ||
neighbor VOQ_CHASSIS_PEER activate | ||
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths | ||
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 | ||
! |
Oops, something went wrong.