mirror of
https://github.com/Telecominfraproject/ols-nos.git
synced 2025-12-17 21:37:35 +00:00
[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:
@@ -37,6 +37,7 @@ chassis_backend_role = 'ChassisBackendRouter'
|
|||||||
|
|
||||||
backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter']
|
backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter']
|
||||||
console_device_types = ['MgmtTsToR']
|
console_device_types = ['MgmtTsToR']
|
||||||
|
dhcp_server_enabled_device_types = ['BmcMgmtToRRouter']
|
||||||
VLAN_SUB_INTERFACE_SEPARATOR = '.'
|
VLAN_SUB_INTERFACE_SEPARATOR = '.'
|
||||||
VLAN_SUB_INTERFACE_VLAN_ID = '10'
|
VLAN_SUB_INTERFACE_VLAN_ID = '10'
|
||||||
|
|
||||||
@@ -1684,6 +1685,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
|
return results
|
||||||
|
|
||||||
def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname):
|
def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname):
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from unittest import TestCase
|
|||||||
|
|
||||||
TOR_ROUTER = 'ToRRouter'
|
TOR_ROUTER = 'ToRRouter'
|
||||||
BACKEND_TOR_ROUTER = 'BackEndToRRouter'
|
BACKEND_TOR_ROUTER = 'BackEndToRRouter'
|
||||||
|
BMC_MGMT_TOR_ROUTER = 'BmcMgmtToRRouter'
|
||||||
|
|
||||||
class TestCfgGenCaseInsensitive(TestCase):
|
class TestCfgGenCaseInsensitive(TestCase):
|
||||||
|
|
||||||
@@ -169,6 +170,19 @@ class TestCfgGenCaseInsensitive(TestCase):
|
|||||||
utils.to_dict(output.strip()),
|
utils.to_dict(output.strip()),
|
||||||
utils.to_dict("{'1': {'baud_rate': '9600', 'remote_device': 'managed_device', 'flow_control': 1}}"))
|
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):
|
def test_minigraph_deployment_id(self):
|
||||||
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"'
|
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"'
|
||||||
output = self.run_script(argument)
|
output = self.run_script(argument)
|
||||||
|
|||||||
Reference in New Issue
Block a user