Skip to content

Commit

Permalink
[chassis] Add templates and code to support VoQ chassis iBGP peers (#…
Browse files Browse the repository at this point in the history
…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
jmmikkel authored Apr 16, 2021
1 parent 534a5b8 commit 43342b3
Show file tree
Hide file tree
Showing 27 changed files with 478 additions and 43 deletions.
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
!
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
!
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
!
4 changes: 4 additions & 0 deletions files/image_config/constants/constants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ constants:
db_table: "BGP_PEER_RANGE"
peer_group: "BGP_SPEAKER"
template_dir: "dynamic"
voq_chassis: # peer_type
enabled: true
db_table: "BGP_VOQ_CHASSIS_NEIGHBOR"
template_dir: "voq_chassis"
2 changes: 2 additions & 0 deletions src/sonic-bgpcfgd/bgpcfgd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ def do_work():
InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME),
InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_VLAN_INTF_TABLE_NAME),
InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_LAG_INTF_TABLE_NAME),
InterfaceMgr(common_objs, "CONFIG_DB", swsscommon.CFG_VOQ_INBAND_INTERFACE_TABLE_NAME),
# State DB managers
ZebraSetSrc(common_objs, "STATE_DB", swsscommon.STATE_INTERFACE_TABLE_NAME),
# Peer Managers
BGPPeerMgrBase(common_objs, "CONFIG_DB", swsscommon.CFG_BGP_NEIGHBOR_TABLE_NAME, "general", True),
BGPPeerMgrBase(common_objs, "CONFIG_DB", swsscommon.CFG_BGP_INTERNAL_NEIGHBOR_TABLE_NAME, "internal", False),
BGPPeerMgrBase(common_objs, "CONFIG_DB", "BGP_MONITORS", "monitors", False),
BGPPeerMgrBase(common_objs, "CONFIG_DB", "BGP_PEER_RANGE", "dynamic", False),
BGPPeerMgrBase(common_objs, "CONFIG_DB", "BGP_VOQ_CHASSIS_NEIGHBOR", "voq_chassis", False),
# AllowList Managers
BGPAllowListMgr(common_objs, "CONFIG_DB", "BGP_ALLOWED_PREFIXES"),
# BBR Manager
Expand Down
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"
}
}
}
}
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"
}
}
}
}
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"
}
}
}
}
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"
}
}
}
}
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"
}
}
}
}
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"
}
}
}
}
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
!
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
!
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
!
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
!
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
!
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
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {
"type": "ToRRouter"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {}
}
}
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
!
Loading

0 comments on commit 43342b3

Please sign in to comment.