From 4e60f0d5635a64ef12194741ff52ac719cd2cf5b Mon Sep 17 00:00:00 2001 From: Tejaswini Chadaga <85581939+tjchadaga@users.noreply.github.com> Date: Tue, 9 May 2023 13:40:00 -0700 Subject: [PATCH] Template change for BGP monitors on T2 (#14844) Why I did it To support BGPMon sessions from each T2 linecard ASIC Work item tracking Microsoft ADO (number only): 17873174 How I did it Added change in BGPMon configuration to use Loopback4096 as source interface, since this has a unique IP per ASIC. How to verify it Tested by manually setting up BGPMon session on T2 LC and verified that Loopback4096 could be used as source --- .../templates/monitors/peer-group.conf.j2 | 27 ++++++++++++++++--- .../frr/zebra/zebra.interfaces.conf.j2 | 1 + .../monitors/peer-group.conf/param_all.json | 7 ++++- .../peer-group.conf/param_chassis.json | 7 +++++ .../monitors/peer-group.conf/result_all.conf | 12 ++++++--- .../peer-group.conf/result_chassis.conf | 22 +++++++++++++++ .../data/sonic-cfggen/frr.conf.j2/all.conf | 1 + .../data/sonic-cfggen/zebra/interfaces.conf | 1 + .../tests/data/sonic-cfggen/zebra/zebra.conf | 1 + .../tests/sample_output/py2/frr.conf | 1 + .../py2/t2-chassis-fe-vni-zebra.conf | 1 + .../py2/t2-chassis-fe-zebra.conf | 1 + .../tests/sample_output/py2/zebra_frr.conf | 1 + .../tests/sample_output/py3/frr.conf | 1 + .../py3/t2-chassis-fe-vni-zebra.conf | 1 + .../py3/t2-chassis-fe-zebra.conf | 1 + .../tests/sample_output/py3/zebra_frr.conf | 1 + 17 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_chassis.json create mode 100644 src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_chassis.conf diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/monitors/peer-group.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/monitors/peer-group.conf.j2 index a362786190..08df8adf75 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/monitors/peer-group.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/monitors/peer-group.conf.j2 @@ -2,11 +2,30 @@ ! template: bgpd/templates/BGPMON/peer-group.conf.j2 ! neighbor BGPMON peer-group +{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'SpineRouter' %} + neighbor BGPMON update-source Loopback4096 +{% else %} neighbor BGPMON update-source {{ loopback0_ipv4 | ip }} - neighbor BGPMON route-map FROM_BGPMON in - neighbor BGPMON route-map TO_BGPMON out - neighbor BGPMON send-community - neighbor BGPMON maximum-prefix 1 +{% endif %} + + address-family ipv4 + neighbor BGPMON activate + neighbor BGPMON route-map FROM_BGPMON in + neighbor BGPMON route-map TO_BGPMON out + neighbor BGPMON send-community + neighbor BGPMON maximum-prefix 1 + exit-address-family + +{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'SpineRouter' %} + address-family ipv6 + neighbor BGPMON activate + neighbor BGPMON route-map FROM_BGPMON in + neighbor BGPMON route-map TO_BGPMON out + neighbor BGPMON send-community + neighbor BGPMON maximum-prefix 1 + exit-address-family +{% endif %} ! ! end of template: bgpd/templates/BGPMON/peer-group.conf.j2 ! + diff --git a/dockers/docker-fpm-frr/frr/zebra/zebra.interfaces.conf.j2 b/dockers/docker-fpm-frr/frr/zebra/zebra.interfaces.conf.j2 index 57d83163d6..44e8bca8b9 100644 --- a/dockers/docker-fpm-frr/frr/zebra/zebra.interfaces.conf.j2 +++ b/dockers/docker-fpm-frr/frr/zebra/zebra.interfaces.conf.j2 @@ -12,6 +12,7 @@ vni {{ vnet_metadata['vni'] }} {% block interfaces %} ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) {% for (name, prefix) in INTERFACE|pfx_filter %} interface {{ name }} diff --git a/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_all.json b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_all.json index 4f45f8a0f3..355e4b6b58 100644 --- a/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_all.json +++ b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_all.json @@ -1,3 +1,8 @@ { + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "type": "LeafRouter" + } + }, "loopback0_ipv4": "1.1.1.1/32" -} \ No newline at end of file +} diff --git a/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_chassis.json b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_chassis.json new file mode 100644 index 0000000000..a09a731b1e --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/param_chassis.json @@ -0,0 +1,7 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "type": "SpineRouter" + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_all.conf b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_all.conf index d5e9624ff1..4bceb7cf33 100644 --- a/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_all.conf +++ b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_all.conf @@ -3,10 +3,14 @@ ! neighbor BGPMON peer-group neighbor BGPMON update-source 1.1.1.1 - neighbor BGPMON route-map FROM_BGPMON in - neighbor BGPMON route-map TO_BGPMON out - neighbor BGPMON send-community - neighbor BGPMON maximum-prefix 1 + address-family ipv4 + neighbor BGPMON activate + neighbor BGPMON route-map FROM_BGPMON in + neighbor BGPMON route-map TO_BGPMON out + neighbor BGPMON send-community + neighbor BGPMON maximum-prefix 1 + exit-address-family ! ! end of template: bgpd/templates/BGPMON/peer-group.conf.j2 ! + diff --git a/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_chassis.conf b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_chassis.conf new file mode 100644 index 0000000000..f0050367b8 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/monitors/peer-group.conf/result_chassis.conf @@ -0,0 +1,22 @@ +! +! template: bgpd/templates/BGPMON/peer-group.conf.j2 +! + neighbor BGPMON peer-group + neighbor BGPMON update-source Loopback4096 + address-family ipv4 + neighbor BGPMON activate + neighbor BGPMON route-map FROM_BGPMON in + neighbor BGPMON route-map TO_BGPMON out + neighbor BGPMON send-community + neighbor BGPMON maximum-prefix 1 + exit-address-family + address-family ipv6 + neighbor BGPMON activate + neighbor BGPMON route-map FROM_BGPMON in + neighbor BGPMON route-map TO_BGPMON out + neighbor BGPMON send-community + neighbor BGPMON maximum-prefix 1 + exit-address-family +! +! end of template: bgpd/templates/BGPMON/peer-group.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index 04040c722c..8856e58db6 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -17,6 +17,7 @@ agentx ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface Ethernet0 link-detect diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf index ddd129bcd1..d185af6f9b 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf @@ -1,6 +1,7 @@ ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface Ethernet0 link-detect diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf index 797b9c2982..6b7e1feff0 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf @@ -28,6 +28,7 @@ vni 20 ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface Ethernet0 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py2/frr.conf b/src/sonic-config-engine/tests/sample_output/py2/frr.conf index 9a9fc5ef89..032adb8c51 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/frr.conf @@ -20,6 +20,7 @@ agentx ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface PortChannel03 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf index b806cf44bb..8bb4834568 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf @@ -26,6 +26,7 @@ vni 9000 ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface Ethernet8 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf index 5952bc836a..402230348a 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf @@ -26,6 +26,7 @@ vni 8000 ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface Ethernet8 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf index 3643bcb8b1..9d0ab16ee3 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf @@ -23,6 +23,7 @@ log facility local4 ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface PortChannel03 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py3/frr.conf b/src/sonic-config-engine/tests/sample_output/py3/frr.conf index 3c728cca38..d0821f1b11 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/frr.conf @@ -20,6 +20,7 @@ agentx ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface PortChannel01 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf index 1b1aa992e2..b559060566 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf @@ -26,6 +26,7 @@ vni 9000 ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface Ethernet0 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf index 65c43fd706..19e303639a 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf @@ -26,6 +26,7 @@ vni 8000 ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface Ethernet0 link-detect diff --git a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf index 5661b25dac..a5fb8b1ca1 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf @@ -23,6 +23,7 @@ log facility local4 ! ! Enable nht through default route ip nht resolve-via-default +ipv6 nht resolve-via-default ! Enable link-detect (default disabled) interface PortChannel01 link-detect