[sonic-config-engine]: Update minigraph parser to support enable DHCP server for BmcMgmtToRRouter (#9938)
Signed-off-by: Jing Kan jika@microsoft.com
This commit is contained in:
parent
2133808ae2
commit
5055c6df43
src/sonic-config-engine
@ -38,6 +38,7 @@ chassis_backend_role = 'ChassisBackendRouter'
|
||||
|
||||
backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter']
|
||||
console_device_types = ['MgmtTsToR']
|
||||
dhcp_server_enabled_device_types = ['BmcMgmtToRRouter']
|
||||
VLAN_SUB_INTERFACE_SEPARATOR = '.'
|
||||
VLAN_SUB_INTERFACE_VLAN_ID = '10'
|
||||
|
||||
@ -1582,6 +1583,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
|
||||
}
|
||||
}
|
||||
|
||||
# Enable DHCP Server feature for specific device type
|
||||
if current_device['type'] in dhcp_server_enabled_device_types:
|
||||
results['DEVICE_METADATA']['localhost']['dhcp_server'] = 'enabled'
|
||||
|
||||
return results
|
||||
|
||||
def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname):
|
||||
|
@ -9,6 +9,7 @@ from unittest import TestCase
|
||||
|
||||
TOR_ROUTER = 'ToRRouter'
|
||||
BACKEND_TOR_ROUTER = 'BackEndToRRouter'
|
||||
BMC_MGMT_TOR_ROUTER = 'BmcMgmtToRRouter'
|
||||
|
||||
class TestCfgGenCaseInsensitive(TestCase):
|
||||
|
||||
@ -171,6 +172,19 @@ class TestCfgGenCaseInsensitive(TestCase):
|
||||
utils.to_dict(output.strip()),
|
||||
utils.to_dict("{'1': {'baud_rate': '9600', 'remote_device': 'managed_device', 'flow_control': 1}}"))
|
||||
|
||||
def test_minigraph_dhcp_server_feature(self):
|
||||
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'dhcp_server\']"'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), '')
|
||||
|
||||
try:
|
||||
# For DHCP server enabled device type
|
||||
output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (TOR_ROUTER, BMC_MGMT_TOR_ROUTER, self.sample_graph), shell=True)
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), 'enabled')
|
||||
finally:
|
||||
output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BMC_MGMT_TOR_ROUTER, TOR_ROUTER, self.sample_graph), shell=True)
|
||||
|
||||
def test_minigraph_deployment_id(self):
|
||||
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"'
|
||||
output = self.run_script(argument)
|
||||
|
Reference in New Issue
Block a user