[sonic-config-engine/minigraph] Enable console mgmt feature for console device (#6166)

* Introduced a list console_device_types which contains the device types that support console management feature
* Inject CONSOLE_SWITCH:console_mgmt table with enabled:yes or enabled:no

Signed-off-by: Jing Kan jika@microsoft.com
This commit is contained in:
Blueve 2020-12-10 15:42:11 +08:00 committed by GitHub
parent 6762f526d9
commit 3d22019802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -36,6 +36,7 @@ spine_chassis_frontend_role = 'SpineChassisFrontendRouter'
chassis_backend_role = 'ChassisBackendRouter'
backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter']
console_device_types = ['MgmtTsToR']
VLAN_SUB_INTERFACE_SEPARATOR = '.'
VLAN_SUB_INTERFACE_VLAN_ID = '10'
@ -1317,6 +1318,13 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if current_device['type'] == spine_chassis_frontend_role:
parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_members, devices)
# Enable console management feature for console swtich
results['CONSOLE_SWITCH'] = {
'console_mgmt' : {
'enabled' : 'yes' if current_device['type'] in console_device_types else 'no'
}
}
return results
def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname):

View File

@ -121,6 +121,13 @@ class TestCfgGenCaseInsensitive(TestCase):
utils.to_dict("{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}")
)
def test_minigraph_console_mgmt_feature(self):
argument = '-m "' + self.sample_graph + '" -v CONSOLE_SWITCH'
output = self.run_script(argument)
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict("{'console_mgmt': {'enabled': 'no'}}"))
def test_minigraph_console_port(self):
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v CONSOLE_PORT'
output = self.run_script(argument)