Skip to content

Commit

Permalink
Merged PR 8443959: 8111 Ares BGP template support
Browse files Browse the repository at this point in the history
BGP Neighbor relationship in Ares.

•	BackEndToRRouter <-> ToRRouter
•	BackEndToRRouter <-> BackEndLeafRouter

Support both IPv4 and IPv6 BGP templates
Add test code for each modified test cases

Review Doc:
https://microsoftapc-my.sharepoint.com/:w:/g/personal/jcai_microsoft_com/EewqtGRC28tPoL01AqV-u24BVKtTnl8ytUMHkBqGXfgeCQ?e=pYctIc
  • Loading branch information
Jie Cai authored and kevinskwang committed Jul 24, 2023
1 parent c5de9bb commit 08792d9
Show file tree
Hide file tree
Showing 61 changed files with 1,003 additions and 1 deletion.
16 changes: 16 additions & 0 deletions dockers/docker-fpm-frr/frr/bgpd/templates/msft.general/router.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
{% if is_storage_device is not defined or is_storage_device | length == 0 %}
{% set is_storage_device = "false" %}
{% endif %}
{% set is_ai_device = CONFIG_DB__DEVICE_METADATA['localhost']['ai_device'] %}
{% if is_ai_device is not defined or is_ai_device | length == 0 %}
{% set is_ai_device = "false" %}
{% endif %}
{% if neighbor_deployment_id is not defined or neighbor_deployment_id | length == 0 %}
{% set neighbor_deployment_id = 0 %}
{% endif %}
Expand All @@ -34,6 +38,8 @@
{% include path_template % "v4.tor.frontend" %}
{% elif neighbor_type == 'BackEndLeafRouter' and is_storage_device == 'true' and device_type == 'BackEndToRRouter' %}
{% include path_template % "v4.tor.storage.backend" %}
{% elif neighbor_type == 'BackEndLeafRouter' and is_ai_device == 'true' and device_type == 'BackEndToRRouter' %}
{% include path_template % "v4.tor.ai.backend" %}
{% elif neighbor_type == 'ToRRouter' %}
{% include path_template % "v4.tor.backend" %}
{% else %}
Expand All @@ -47,6 +53,8 @@
{% include path_template % "v4.leaf.tor.tycoon" %}
{% elif neighbor_type == 'BackEndToRRouter' and is_storage_device == 'true' and device_type == 'BackEndLeafRouter' %}
{% include path_template % "v4.leaf.storage.backend" %}
{% elif neighbor_type == 'BackEndToRRouter' and is_ai_device == 'true' and device_type == 'BackEndLeafRouter' %}
{% include path_template % "v4.leaf.ai.backend" %}
{% else %}
{% include path_template % "v4.leaf.tor.all" %}
{% endif %}
Expand Down Expand Up @@ -86,6 +94,12 @@
{% elif device_type in ['ToRRouter', 'BackEndToRRouter'] %}
{% if deployment_id is defined and deployment_id == '26' %}
{% include path_template % "v6.tor.rotterdam" %}
{% elif neighbor_type == 'BackEndToRRouter' and is_ai_device == 'true' %}
{% include path_template % "v6.tor.frontend" %}
{% elif neighbor_type == 'BackEndLeafRouter' and is_ai_device == 'true' and device_type == 'BackEndToRRouter' %}
{% include path_template % "v6.tor.ai.backend" %}
{% elif neighbor_type == 'ToRRouter' and is_ai_device == 'true' %}
{% include path_template % "v6.tor.backend" %}
{% else %}
{% include path_template % "v6.tor" %}
{% endif %}
Expand All @@ -99,6 +113,8 @@
{% include path_template % "v6.leaf.tor.dnsagg" %}
{% elif neighbor_deployment_id is defined and neighbor_deployment_id == '21' %}
{% include path_template % "v6.leaf.tor.dnsagg" %}
{% elif neighbor_type == 'BackEndToRRouter' and is_ai_device == 'true' and device_type == 'BackEndLeafRouter' %}
{% include path_template % "v6.leaf.ai.backend" %}
{% else %}
{% include path_template % "v6.leaf.tor.all" %}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
!
! template: bgpd/templates/msft.general/v4.leaf.ai.backend/instance.conf.j2
!
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
neighbor {{ neighbor_addr }} peer-group BE_TIER0_V4
!
{% if need_to_set_timers %}
{# neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} #}
{% endif %}
!
{% if need_to_shutdown %}
neighbor {{ neighbor_addr }} shutdown
{% endif %}
!
! end of template: bgpd/templates/msft.general/v4.leaf.ai.backend/instance.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!
! template: bgpd/templates/msft.general/v4.leaf.ai.backend/peer-group.conf.j2
!
neighbor BE_TIER0_V4 peer-group
address-family ipv4 unicast
neighbor BE_TIER0_V4 activate
neighbor BE_TIER0_V4 soft-reconfiguration inbound
neighbor BE_TIER0_V4 route-map FROM_BE_TIER0_V4 in
neighbor BE_TIER0_V4 route-map TO_BE_TIER0_V4 out
neighbor BE_TIER0_V4 send-community
neighbor BE_TIER0_V4 maximum-prefix 12000 90 warning-only
exit-address-family
!
! end of template: bgpd/templates/msft.general/v4.leaf.ai.backend/peer-group.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!
! template: bgpd/templates/msft.general/v4.leaf.ai.backend/policy.conf.j2
!
route-map TO_BE_TIER0_V4 permit 10
!
route-map FROM_BE_TIER0_V4 permit 10
!
! end of template: bgpd/templates/msft.general/v4.leaf.ai.backend/policy.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
!
! template: bgpd/templates/msft.general/v4.tor.ai.backend/instance.conf.j2
!
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
neighbor {{ neighbor_addr }} peer-group BE_TIER1_V4
!
{% if need_to_set_timers %}
{# neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} #}
{% endif %}
!
{% if need_to_shutdown %}
neighbor {{ neighbor_addr }} shutdown
{% endif %}
!
! end of template: bgpd/templates/msft.general/v4.tor.ai.backend/instance.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!
! template: bgpd/templates/msft.general/v4.tor.ai.backend/peer-group.conf.j2
!
neighbor BE_TIER1_V4 peer-group
address-family ipv4 unicast
neighbor BE_TIER1_V4 activate
neighbor BE_TIER1_V4 soft-reconfiguration inbound
neighbor BE_TIER1_V4 route-map FROM_BE_TIER1_V4 in
neighbor BE_TIER1_V4 route-map TO_BE_TIER1_V4 out
neighbor BE_TIER1_V4 send-community
neighbor BE_TIER1_V4 maximum-prefix 12000 90 warning-only
exit-address-family
!
! end of template: bgpd/templates/msft.general/v4.tor.ai.backend/peer-group.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!
! template: bgpd/templates/msft.general/v4.tor.ai.backend/policy.conf.j2
!
route-map TO_BE_TIER1_V4 permit 10
!
route-map FROM_BE_TIER1_V4 permit 10
!
! end of template: bgpd/templates/msft.general/v4.tor.ai.backend/policy.conf.j2
!
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
! template: bgpd/templates/msft.general/v4.tor.backend/policy.conf.j2
!
ip prefix-list DEFAULT_IPV4 permit 0.0.0.0/0
{% if is_ai_device == "true" %}
ip prefix-list BE_LOOPBACKS seq 5 deny 172.16.0.0/12 le 32
{% else %}
ip prefix-list BE_LOOPBACKS seq 5 deny 172.16.0.0/16 le 32
{% endif %}
ip prefix-list BE_LOOPBACKS seq 15 permit 0.0.0.0/0 ge 32
!
route-map FROM_FE_TIER0_V4 permit 10
Expand All @@ -16,4 +20,4 @@ route-map TO_FE_TIER0_V4 permit 10
route-map TO_FE_TIER0_V4 deny 100
!
! end of template: bgpd/templates/msft.general/v4.tor.backend/policy.conf.j2
!
!
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
! template: bgpd/templates/msft.general/v4.tor.frontend/policy.conf.j2
!
ip prefix-list DEFAULT_IPV4 permit 0.0.0.0/0
{% if is_ai_device == "true" %}
ip prefix-list BE_LOOPBACKS seq 5 deny 172.16.0.0/12 le 32
{% else %}
ip prefix-list BE_LOOPBACKS seq 5 deny 172.16.0.0/16 le 32
{% endif %}
ip prefix-list BE_LOOPBACKS seq 15 permit 0.0.0.0/0 ge 32
!
route-map TO_BE_TIER0_V4 permit 10
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
!
! template: bgpd/templates/msft.general/v6.leaf.ai.backend/instance.conf.j2
!
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
neighbor {{ neighbor_addr }} peer-group BE_TIER0_V6
!
{% if need_to_set_timers %}
{# neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} #}
{% endif %}
!
{% if need_to_shutdown %}
neighbor {{ neighbor_addr }} shutdown
{% endif %}
!
! end of template: bgpd/templates/msft.general/v6.leaf.ai.backend/instance.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!
! template: bgpd/templates/msft.general/v6.leaf.ai.backend/peer-group.conf.j2
!
neighbor BE_TIER0_V6 peer-group
address-family ipv6 unicast
neighbor BE_TIER0_V6 activate
neighbor BE_TIER0_V6 soft-reconfiguration inbound
neighbor BE_TIER0_V6 route-map FROM_BE_TIER0_V6 in
neighbor BE_TIER0_V6 route-map TO_BE_TIER0_V6 out
neighbor BE_TIER0_V6 send-community
neighbor BE_TIER0_V6 maximum-prefix 12000 90 warning-only
exit-address-family
!
! end of template: bgpd/templates/msft.general/v6.leaf.ai.backend/peer-group.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!
! template: bgpd/templates/msft.general/v6.leaf.ai.backend/policy.conf.j2
!
route-map TO_BE_TIER0_V6 permit 10
!
route-map FROM_BE_TIER0_V6 permit 10
!
! end of template: bgpd/templates/msft.general/v6.leaf.ai.backend/policy.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
!
! template: bgpd/templates/msft.general/v6.tor.ai.backend/instance.conf.j2
!
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
neighbor {{ neighbor_addr }} peer-group BE_TIER1_V6
!
{% if need_to_set_timers %}
{# neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} #}
{% endif %}
!
{% if need_to_shutdown %}
neighbor {{ neighbor_addr }} shutdown
{% endif %}
!
! end of template: bgpd/templates/msft.general/v6.tor.ai.backend/instance.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!
! template: bgpd/templates/msft.general/v6.tor.ai.backend/peer-group.conf.j2
!
neighbor BE_TIER1_V6 peer-group
address-family ipv6 unicast
neighbor BE_TIER1_V6 activate
neighbor BE_TIER1_V6 soft-reconfiguration inbound
neighbor BE_TIER1_V6 route-map FROM_BE_TIER1_V6 in
neighbor BE_TIER1_V6 route-map TO_BE_TIER1_V6 out
neighbor BE_TIER1_V6 send-community
neighbor BE_TIER1_V6 maximum-prefix 12000 90 warning-only
exit-address-family
!
! end of template: bgpd/templates/msft.general/v6.tor.ai.backend/peer-group.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!
! template: bgpd/templates/msft.general/v6.tor.ai.backend/policy.conf.j2
!
route-map TO_BE_TIER1_V6 permit 10
!
route-map FROM_BE_TIER1_V6 permit 10
!
! end of template: bgpd/templates/msft.general/v6.tor.ai.backend/policy.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
!
! template: bgpd/templates/msft.general/v6.tor.backend/instance.conf.j2
!
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
neighbor {{ neighbor_addr }} peer-group FE_TIER0_V6
!
{% if need_to_set_timers %}
{# neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} #}
{% endif %}
!
{% if need_to_shutdown %}
neighbor {{ neighbor_addr }} shutdown
{% endif %}
!
! end of template: bgpd/templates/msft.general/v6.tor.backend/instance.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!
! template: bgpd/templates/msft.general/v6.tor.backend/peer-group.conf.j2
!
neighbor FE_TIER0_V6 peer-group
address-family ipv6 unicast
neighbor FE_TIER0_V6 activate
neighbor FE_TIER0_V6 soft-reconfiguration inbound
neighbor FE_TIER0_V6 route-map FROM_FE_TIER0_V6 in
neighbor FE_TIER0_V6 route-map TO_FE_TIER0_V6 out
neighbor FE_TIER0_V6 send-community
neighbor FE_TIER0_V6 maximum-prefix 12000 90 warning-only
exit-address-family
!
! end of template: bgpd/templates/msft.general/v6.tor.backend/peer-group.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
!
! template: bgpd/templates/msft.general/v6.tor.backend/policy.conf.j2
!
ipv6 prefix-list DEFAULT_IPV6 permit any
ipv6 prefix-list BE_LOOPBACKS_V6 seq 5 deny ::1/128
ipv6 prefix-list BE_LOOPBACKS_V6 seq 15 permit ::/0 ge 128
!
route-map FROM_FE_TIER0_V6 permit 10
match ipv6 address prefix-list DEFAULT_IPV6
!
route-map FROM_FE_TIER0_V6 deny 100
!
route-map TO_FE_TIER0_V6 permit 10
match ipv6 address prefix-list BE_LOOPBACKS_V6
!
route-map TO_FE_TIER0_V6 deny 100
!
! end of template: bgpd/templates/msft.general/v6.tor.backend/policy.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
!
! template: bgpd/templates/msft.general/v6.tor.frontend/instance.conf.j2
!
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
neighbor {{ neighbor_addr }} peer-group BE_TIER0_V6
!
{% if need_to_set_timers %}
{# neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} #}
{% endif %}
!
{% if need_to_shutdown %}
neighbor {{ neighbor_addr }} shutdown
{% endif %}
!
! end of template: bgpd/templates/msft.general/v6.tor.frontend/instance.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!
! template: bgpd/templates/msft.general/v6.tor.frontend/peer-group.conf.j2
!
neighbor BE_TIER0_V6 peer-group
address-family ipv6 unicast
neighbor BE_TIER0_V6 activate
neighbor BE_TIER0_V6 soft-reconfiguration inbound
neighbor BE_TIER0_V6 route-map FROM_BE_TIER0_V6 in
neighbor BE_TIER0_V6 route-map TO_BE_TIER0_V6 out
neighbor BE_TIER0_V6 send-community
neighbor BE_TIER0_V6 maximum-prefix 12000 90 warning-only
exit-address-family
!
! end of template: bgpd/templates/msft.general/v6.tor.frontend/peer-group.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
!
! template: bgpd/templates/msft.general/v6.tor.frontend/policy.conf.j2
!
ipv6 prefix-list DEFAULT_IPV6 permit any
ipv6 prefix-list BE_LOOPBACKS_V6 seq 5 deny ::1/128
ipv6 prefix-list BE_LOOPBACKS_V6 seq 15 permit ::/0 ge 128
!
route-map TO_BE_TIER0_V6 permit 10
match ipv6 address prefix-list DEFAULT_IPV6
!
route-map TO_BE_TIER0_V6 deny 100
!
route-map FROM_BE_TIER0_V6 permit 10
match ipv6 address prefix-list BE_LOOPBACKS_V6
!
route-map FROM_BE_TIER0_V6 deny 100
!
! end of template: bgpd/templates/msft.general/v6.tor.frontend/policy.conf.j2
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {
"type": "BackEndLeafRouter",
"ai_device": "true"
}
},
"CONFIG_DB__DEVICE_NEIGHBOR_METADATA": {
"neig_device": {
"type": "BackEndToRRouter"
}
},
"bgp_session": {
"asn": "11111",
"name": "neig_device",
"admin_status": "down"
},
"neighbor_addr": "11.11.11.11"
}
Loading

0 comments on commit 08792d9

Please sign in to comment.