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.
Merged PR 7338307: [202211][bgp-cfgd] BGP template for OLT mgmt ToR
Why I did it For mgmt ToR which is connected to OLT, need to have bgp allow-prefix list to control the routes advertisement between OLT and mgmt ToR. How I did it To add new template for this Scenario, which is based on common mgmt ToR BGP template. below is the doc for detailed design. https://microsoft.sharepoint.com/:w:/t/Aznet/EUXF5cffHVtDspT4W0o3ni8Bax5uGLwe5_hRGQnERDYrbg?e=rtmE9c The changes in managers_allow_list.py is a common one and PR in public repo. sonic-net#11586 How to verify it 1. Unit Test Add new unit test cases for new templates. 2. Integration Test To simulate the Scenario in physical TB, and verify the run bgp configuration. WIP, to verify with Optical team. Others Need to port back to 202012 and 202205 branch. Cherry picked from !6446272
- Loading branch information
Showing
23 changed files
with
430 additions
and
21 deletions.
There are no files selected for viewing
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: 15 additions & 7 deletions
22
dockers/docker-fpm-frr/frr/bgpd/templates/msft.general/v4.mgmttor/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
32 changes: 30 additions & 2 deletions
32
dockers/docker-fpm-frr/frr/bgpd/templates/msft.general/v4.mgmttor/policy.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 |
---|---|---|
@@ -1,9 +1,37 @@ | ||
! | ||
! template: bgpd/templates/msft.general/v4.mgmttor/policy.conf.j2 | ||
! | ||
route-map FROM_TIER1_V4 permit 100 | ||
{% if neighbor_type == 'OpticalLonghaulTerminal' %} | ||
ip prefix-list DEFAULT_IPV4 permit 0.0.0.0/0 | ||
! | ||
route-map TO_TIER1_V4 permit 100 | ||
route-map ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V4 deny 60000 | ||
! | ||
{% if constants.bgp.allow_list is defined and constants.bgp.allow_list.enabled is defined and constants.bgp.allow_list.enabled and constants.bgp.allow_list.drop_community is defined %} | ||
{% if allow_list_default_action == 'deny' %} | ||
route-map ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V4 permit 65535 | ||
set community no-export additive | ||
! | ||
{% else %} | ||
route-map ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V4 permit 65535 | ||
set community {{ constants.bgp.allow_list.drop_community }} additive | ||
! | ||
{% endif %} | ||
route-map FROM_{{ peer_group_type }}_DEPLOYMENT_ID_{{ neighbor_deployment_id }} permit 100 | ||
call ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V4 | ||
! | ||
{% endif %} | ||
route-map FROM_{{ peer_group_type }}_DEPLOYMENT_ID_{{ neighbor_deployment_id }} deny 1000 | ||
! | ||
route-map TO_{{ peer_group_type }} permit 100 | ||
match ip address prefix-list DEFAULT_IPV4 | ||
! | ||
route-map TO_{{ peer_group_type }} deny 1000 | ||
! | ||
{% else %} | ||
route-map FROM_{{ peer_group_type }} permit 100 | ||
! | ||
route-map TO_{{ peer_group_type }} permit 100 | ||
! | ||
{% endif %} | ||
! end of template: bgpd/templates/msft.general/v4.mgmttor/policy.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
22 changes: 15 additions & 7 deletions
22
dockers/docker-fpm-frr/frr/bgpd/templates/msft.general/v6.mgmttor/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
28 changes: 25 additions & 3 deletions
28
dockers/docker-fpm-frr/frr/bgpd/templates/msft.general/v6.mgmttor/policy.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 |
---|---|---|
@@ -1,13 +1,35 @@ | ||
! | ||
! template: bgpd/templates/msft.general/v6.mgmttor/policy.conf.j2 | ||
! | ||
{% if neighbor_type == 'OpticalLonghaulTerminal' %} | ||
route-map ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V6 deny 60000 | ||
! | ||
route-map FROM_TIER1_V6 permit 100 | ||
{% if constants.bgp.allow_list is defined and constants.bgp.allow_list.enabled is defined and constants.bgp.allow_list.enabled and constants.bgp.allow_list.drop_community is defined %} | ||
{% if allow_list_default_action == 'deny' %} | ||
route-map ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V6 permit 65535 | ||
set community no-export additive | ||
! | ||
{% else %} | ||
route-map ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V6 permit 65535 | ||
set community {{ constants.bgp.allow_list.drop_community }} additive | ||
! | ||
{% endif %} | ||
route-map FROM_{{ peer_group_type }}_DEPLOYMENT_ID_{{ neighbor_deployment_id }} permit 100 | ||
call ALLOW_LIST_DEPLOYMENT_ID_{{ neighbor_deployment_id}}_NEIGHBOR_{{ neighbor_type }}_V6 | ||
! | ||
{% endif %} | ||
route-map FROM_{{ peer_group_type }}_DEPLOYMENT_ID_{{ neighbor_deployment_id }} deny 1000 | ||
! | ||
route-map TO_{{ peer_group_type }} deny 1000 | ||
! | ||
{% else %} | ||
route-map FROM_{{ peer_group_type }} permit 100 | ||
set ipv6 next-hop prefer-global | ||
on-match next | ||
route-map FROM_TIER1_V6 permit 200 | ||
route-map FROM_{{ peer_group_type }} permit 200 | ||
! | ||
route-map TO_TIER1_V6 permit 100 | ||
route-map TO_{{ peer_group_type }} permit 100 | ||
! | ||
{% endif %} | ||
! end of template: bgpd/templates/msft.general/v6.mgmttor/policy.conf.j2 | ||
! |
21 changes: 21 additions & 0 deletions
21
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/param_v4.mgmttorolt_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,21 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"type": "MgmtToRRouter" | ||
} | ||
}, | ||
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": { | ||
"neig_device": { | ||
"type": "OpticalLonghaulTerminal" | ||
} | ||
}, | ||
"CONFIG_DB__BGP_BBR": { | ||
"status": "enabled" | ||
}, | ||
"bgp_session": { | ||
"asn": "11111", | ||
"name": "neig_device", | ||
"admin_status": "down" | ||
}, | ||
"neighbor_addr": "11.11.11.11" | ||
} |
20 changes: 20 additions & 0 deletions
20
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/param_v4.mgmttorolt_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,20 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"type": "MgmtToRRouter" | ||
} | ||
}, | ||
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": { | ||
"neig_device": { | ||
"type": "OpticalLonghaulTerminal" | ||
} | ||
}, | ||
"CONFIG_DB__BGP_BBR": { | ||
"status": "enabled" | ||
}, | ||
"bgp_session": { | ||
"asn": "11111", | ||
"name": "neig_device" | ||
}, | ||
"neighbor_addr": "11.11.11.11" | ||
} |
21 changes: 21 additions & 0 deletions
21
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/param_v6.mgmttorolt_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,21 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"type": "MgmtToRRouter" | ||
} | ||
}, | ||
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": { | ||
"neig_device": { | ||
"type": "OpticalLonghaulTerminal" | ||
} | ||
}, | ||
"CONFIG_DB__BGP_BBR": { | ||
"status": "enabled" | ||
}, | ||
"bgp_session": { | ||
"asn": "11111", | ||
"name": "neig_device", | ||
"admin_status": "down" | ||
}, | ||
"neighbor_addr": "fc00::15" | ||
} |
20 changes: 20 additions & 0 deletions
20
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/param_v6.mgmttorolt_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,20 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"type": "MgmtToRRouter" | ||
} | ||
}, | ||
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": { | ||
"neig_device": { | ||
"type": "OpticalLonghaulTerminal" | ||
} | ||
}, | ||
"CONFIG_DB__BGP_BBR": { | ||
"status": "enabled" | ||
}, | ||
"bgp_session": { | ||
"asn": "11111", | ||
"name": "neig_device" | ||
}, | ||
"neighbor_addr": "fc00::15" | ||
} |
19 changes: 19 additions & 0 deletions
19
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/result_v4.mgmttorolt_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/general/instance.conf.j2 | ||
! | ||
! template: bgpd/templates/msft.general/v4.mgmttor/instance.conf.j2 | ||
! | ||
neighbor 11.11.11.11 remote-as 11111 | ||
neighbor 11.11.11.11 description neig_device | ||
neighbor 11.11.11.11 peer-group OLT_V4 | ||
! | ||
address-family ipv4 unicast | ||
neighbor 11.11.11.11 allowas-in 1 | ||
exit-address-family | ||
! | ||
neighbor 11.11.11.11 shutdown | ||
! | ||
! end of template: bgpd/templates/msft.general/v4.mgmttor/instance.conf.j2 | ||
! | ||
! end of template: bgpd/templates/general/instance.conf.j2 | ||
! |
17 changes: 17 additions & 0 deletions
17
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/result_v4.mgmttorolt_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,17 @@ | ||
! | ||
! template: bgpd/templates/general/instance.conf.j2 | ||
! | ||
! template: bgpd/templates/msft.general/v4.mgmttor/instance.conf.j2 | ||
! | ||
neighbor 11.11.11.11 remote-as 11111 | ||
neighbor 11.11.11.11 description neig_device | ||
neighbor 11.11.11.11 peer-group OLT_V4 | ||
! | ||
address-family ipv4 unicast | ||
neighbor 11.11.11.11 allowas-in 1 | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/msft.general/v4.mgmttor/instance.conf.j2 | ||
! | ||
! end of template: bgpd/templates/general/instance.conf.j2 | ||
! |
19 changes: 19 additions & 0 deletions
19
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/result_v6.mgmttorolt_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/general/instance.conf.j2 | ||
! | ||
! template: bgpd/templates/msft.general/v6.mgmttor/instance.conf.j2 | ||
! | ||
neighbor fc00::15 remote-as 11111 | ||
neighbor fc00::15 description neig_device | ||
neighbor fc00::15 peer-group OLT_V6 | ||
! | ||
address-family ipv6 unicast | ||
neighbor fc00::15 allowas-in 1 | ||
exit-address-family | ||
! | ||
neighbor fc00::15 shutdown | ||
! | ||
! end of template: bgpd/templates/msft.general/v6.mgmttor/instance.conf.j2 | ||
! | ||
! end of template: bgpd/templates/general/instance.conf.j2 | ||
! |
17 changes: 17 additions & 0 deletions
17
src/sonic-bgpcfgd/tests/data/msft.general/instance.conf/result_v6.mgmttorolt_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,17 @@ | ||
! | ||
! template: bgpd/templates/general/instance.conf.j2 | ||
! | ||
! template: bgpd/templates/msft.general/v6.mgmttor/instance.conf.j2 | ||
! | ||
neighbor fc00::15 remote-as 11111 | ||
neighbor fc00::15 description neig_device | ||
neighbor fc00::15 peer-group OLT_V6 | ||
! | ||
address-family ipv6 unicast | ||
neighbor fc00::15 allowas-in 1 | ||
exit-address-family | ||
! | ||
! end of template: bgpd/templates/msft.general/v6.mgmttor/instance.conf.j2 | ||
! | ||
! end of template: bgpd/templates/general/instance.conf.j2 | ||
! |
21 changes: 21 additions & 0 deletions
21
src/sonic-bgpcfgd/tests/data/msft.general/peer-group.conf/param_v4.mgmttorolt_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,21 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"type": "MgmtToRRouter" | ||
} | ||
}, | ||
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": { | ||
"neig_device": { | ||
"type": "OpticalLonghaulTerminal", | ||
"deployment_id": "3" | ||
} | ||
}, | ||
"constants": { | ||
"bgp": {} | ||
}, | ||
"bgp_session": { | ||
"asn": "11111", | ||
"name": "neig_device" | ||
}, | ||
"neighbor_addr": "11.11.11.11" | ||
} |
21 changes: 21 additions & 0 deletions
21
src/sonic-bgpcfgd/tests/data/msft.general/peer-group.conf/param_v6.mgmttorolt_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,21 @@ | ||
{ | ||
"CONFIG_DB__DEVICE_METADATA": { | ||
"localhost": { | ||
"type": "MgmtToRRouter" | ||
} | ||
}, | ||
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": { | ||
"neig_device": { | ||
"type": "OpticalLonghaulTerminal", | ||
"deployment_id": "3" | ||
} | ||
}, | ||
"constants": { | ||
"bgp": {} | ||
}, | ||
"bgp_session": { | ||
"asn": "11111", | ||
"name": "neig_device" | ||
}, | ||
"neighbor_addr": "fc00::15" | ||
} |
Oops, something went wrong.