From 8a0b44094edd23d6020c815b9871ff5d322a7a7d Mon Sep 17 00:00:00 2001 From: Neetha John Date: Fri, 30 Sep 2022 13:55:33 -0700 Subject: [PATCH 1/2] Remove SLB and bgp monitor peers for storage backend Signed-off-by: Neetha John --- src/sonic-config-engine/minigraph.py | 5 +++++ src/sonic-config-engine/tests/test_cfggen.py | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 85d9a91030ca..e677981b5d63 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1790,6 +1790,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw if is_storage_device: results['DEVICE_METADATA']['localhost']['storage_device'] = "true" + # remove bgp monitor and slb peers for storage backend + if is_storage_device and 'BackEnd' in current_device['type']: + results['BGP_MONITORS'] = {} + results['BGP_PEER_RANGE'] = {} + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 1190ef9680e5..d5e8ae2b5c7e 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -804,6 +804,14 @@ def verify_sub_intf(self, **kwargs): output = self.run_script(argument) self.assertEqual(output.strip(), "") + # SLB and BGP Monitor table does not exist + argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_PEER_RANGE"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "") + argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_MONITORS"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "") + # ACL_TABLE should not contain EVERFLOW related entries argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "ACL_TABLE"' output = self.run_script(argument) @@ -1021,4 +1029,4 @@ def test_minigraph_packet_chassis_400g_zr_port_config(self): output = self.run_script(argument) output_dict = utils.to_dict(output.strip()) self.assertEqual(output_dict['tx_power'], '7.5') - self.assertEqual(output_dict['laser_freq'], 131000) \ No newline at end of file + self.assertEqual(output_dict['laser_freq'], 131000) From fe4a3ddab1e19e83eb6d7aa893a0231377d0d1e5 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Mon, 3 Oct 2022 11:00:18 -0700 Subject: [PATCH 2/2] Address unit test failures Signed-off-by: Neetha John --- src/sonic-config-engine/tests/test_cfggen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index d5e8ae2b5c7e..ca5c83e88c79 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -807,10 +807,10 @@ def verify_sub_intf(self, **kwargs): # SLB and BGP Monitor table does not exist argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_PEER_RANGE"' output = self.run_script(argument) - self.assertEqual(output.strip(), "") + self.assertEqual(output.strip(), "{}") argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "BGP_MONITORS"' output = self.run_script(argument) - self.assertEqual(output.strip(), "") + self.assertEqual(output.strip(), "{}") # ACL_TABLE should not contain EVERFLOW related entries argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "ACL_TABLE"'