From ffd062afae33e308b75345697bc45e12cce50d5c Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Thu, 8 Jun 2023 03:40:23 +0800 Subject: [PATCH] updated internal route policy for chassis-packet (#15349) (#15378) --- .../bgpd/templates/internal/instance.conf.j2 | 6 ++--- .../instance.conf/chassis_packet_v4.conf | 15 ++++++++++++ .../instance.conf/chassis_packet_v4.json | 23 +++++++++++++++++++ .../instance.conf/chassis_packet_v6.conf | 15 ++++++++++++ .../instance.conf/chassis_packet_v6.json | 23 +++++++++++++++++++ .../instance.conf/result_back_v4.conf | 1 - .../instance.conf/result_back_v6.conf | 1 - 7 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.conf create mode 100644 src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.json create mode 100644 src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.conf create mode 100644 src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.json diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 index 44c70f49bd..06eabb5fc7 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/instance.conf.j2 @@ -10,18 +10,16 @@ address-family ipv4 neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V4 ! -{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} +{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} neighbor {{ neighbor_addr }} next-hop-self force - neighbor {{ neighbor_addr }} route-map FROM_BGP_INTERNAL_PEER_V4 in {% endif %} ! {% elif neighbor_addr | ipv6 %} address-family ipv6 neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V6 ! -{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} +{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} neighbor {{ neighbor_addr }} next-hop-self force - neighbor {{ neighbor_addr }} route-map FROM_BGP_INTERNAL_PEER_V6 in {% endif %} {% endif %} ! diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.conf new file mode 100644 index 0000000000..f848ebd457 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.conf @@ -0,0 +1,15 @@ +! +! template: bgpd/templates/internal/instance.conf.j2 +! + neighbor 10.10.10.10 remote-as 555 + neighbor 10.10.10.10 description remote_peer + neighbor 10.10.10.10 timers 3 10 + neighbor 10.10.10.10 timers connect 10 + address-family ipv4 + neighbor 10.10.10.10 peer-group INTERNAL_PEER_V4 + neighbor 10.10.10.10 next-hop-self force + neighbor 10.10.10.10 activate + exit-address-family +! +! end of template: bgpd/templates/internal/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.json b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.json new file mode 100644 index 0000000000..41f4aab4f8 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v4.json @@ -0,0 +1,23 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "sub_role": "FrontEnd", + "type": "SpineRouter", + "switch_type": "chassis-packet" + } + }, + "neighbor_addr": "10.10.10.10", + "bgp_session": { + "asn": "555", + "name": "remote_peer", + "keepalive": "5", + "holdtime": "30", + "admin_status": "down", + "ASIC": "something" + }, + "constants": { + "deployment_id_asn_map": { + "5": "51111" + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.conf new file mode 100644 index 0000000000..09c021b919 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.conf @@ -0,0 +1,15 @@ +! +! template: bgpd/templates/internal/instance.conf.j2 +! + neighbor fc::10 remote-as 555 + neighbor fc::10 description remote_peer + neighbor fc::10 timers 3 10 + neighbor fc::10 timers connect 10 + address-family ipv6 + neighbor fc::10 peer-group INTERNAL_PEER_V6 + neighbor fc::10 next-hop-self force + neighbor fc::10 activate + exit-address-family +! +! end of template: bgpd/templates/internal/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.json b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.json new file mode 100644 index 0000000000..eb25b37c32 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/chassis_packet_v6.json @@ -0,0 +1,23 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "sub_role": "FrontEnd", + "type": "SpineRouter", + "switch_type": "chassis-packet" + } + }, + "neighbor_addr": "fc::10", + "bgp_session": { + "asn": "555", + "name": "remote_peer", + "keepalive": "5", + "holdtime": "30", + "admin_status": "down", + "ASIC": "something" + }, + "constants": { + "deployment_id_asn_map": { + "5": "51111" + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf index 43fdc12921..90e0e13158 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v4.conf @@ -8,7 +8,6 @@ address-family ipv4 neighbor 10.10.10.10 peer-group INTERNAL_PEER_V4 neighbor 10.10.10.10 next-hop-self force - neighbor 10.10.10.10 route-map FROM_BGP_INTERNAL_PEER_V4 in neighbor 10.10.10.10 route-reflector-client neighbor 10.10.10.10 activate exit-address-family diff --git a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf index 811f7b8084..75f8fd0d13 100644 --- a/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf +++ b/src/sonic-bgpcfgd/tests/data/internal/instance.conf/result_back_v6.conf @@ -8,7 +8,6 @@ address-family ipv6 neighbor fc::10 peer-group INTERNAL_PEER_V6 neighbor fc::10 next-hop-self force - neighbor fc::10 route-map FROM_BGP_INTERNAL_PEER_V6 in neighbor fc::10 route-reflector-client neighbor fc::10 activate exit-address-family