[minigraph] Remove SLB and bgp monitor peers for storage backend (#12251)

Signed-off-by: Neetha John nejo@microsoft.com

Why I did it
slb and bgp mon peers are not needed for storage backend. These neighbor are present in the minigraph.

How I did it
After minigraph parsing, remove these neighbors if it is a storage backend device

How to verify it
Unit tests
Verified on the device that once these tables are removed, these peers don't show up in "show runningconfig bgp" output
This commit is contained in:
Neetha John 2022-10-07 09:37:53 -07:00 committed by GitHub
parent 3cd9b2e1b5
commit 615f277701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -804,6 +804,14 @@ class TestCfgGen(TestCase):
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 @@ class TestCfgGen(TestCase):
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)
self.assertEqual(output_dict['laser_freq'], 131000)