Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add templates and code to support VoQ chassis iBGP peers #5622

Merged
merged 6 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %}
!
jmmikkel marked this conversation as resolved.
Show resolved Hide resolved
{% 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
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
{% 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' %}
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -42,13 +42,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"
jmmikkel marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
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