[sonic-cfggen]: Fix for management port speed issue (#2945)
This commit is contained in:
parent
f40795a5be
commit
2e9b18db10
@ -402,8 +402,9 @@ def parse_deviceinfo(meta, hwsku):
|
||||
for device_info in meta.findall(str(QName(ns, "DeviceInfo"))):
|
||||
dev_sku = device_info.find(str(QName(ns, "HwSku"))).text
|
||||
if dev_sku == hwsku:
|
||||
interfaces = device_info.find(str(QName(ns, "EthernetInterfaces")))
|
||||
for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))):
|
||||
interfaces = device_info.find(str(QName(ns, "EthernetInterfaces"))).findall(str(QName(ns1, "EthernetInterface")))
|
||||
interfaces = interfaces + device_info.find(str(QName(ns, "ManagementInterfaces"))).findall(str(QName(ns1, "ManagementInterface")))
|
||||
for interface in interfaces:
|
||||
alias = interface.find(str(QName(ns, "InterfaceName"))).text
|
||||
speed = interface.find(str(QName(ns, "Speed"))).text
|
||||
desc = interface.find(str(QName(ns, "Description")))
|
||||
@ -501,6 +502,8 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
mgmt_intf_count += 1
|
||||
mgmt_alias_reverse_mapping[alias] = name
|
||||
results['MGMT_PORT'][name] = {'alias': alias, 'admin_status': 'up'}
|
||||
if alias in port_speeds_default:
|
||||
results['MGMT_PORT'][name]['speed'] = port_speeds_default[alias]
|
||||
results['MGMT_INTERFACE'][(name, key[1])] = mgmt_intf[key]
|
||||
results['LOOPBACK_INTERFACE'] = lo_intfs
|
||||
|
||||
|
@ -325,6 +325,19 @@
|
||||
<FlowControl>true</FlowControl>
|
||||
<Height>0</Height>
|
||||
<HwSku>Force10-S6000</HwSku>
|
||||
<ManagementInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:ManagementInterface>
|
||||
<ElementType>DeviceInterface</ElementType>
|
||||
<AlternateSpeeds i:nil="true"/>
|
||||
<EnableAutoNegotiation>true</EnableAutoNegotiation>
|
||||
<EnableFlowControl>true</EnableFlowControl>
|
||||
<Index>1</Index>
|
||||
<InterfaceName>eth0</InterfaceName>
|
||||
<MultiPortsInterface>false</MultiPortsInterface>
|
||||
<PortName>eth0</PortName>
|
||||
<Speed>1000</Speed>
|
||||
</a:ManagementInterface>
|
||||
</ManagementInterfaces>
|
||||
</DeviceInfo>
|
||||
</DeviceInfos>
|
||||
<Hostname>switch-T0</Hostname>
|
||||
|
@ -310,6 +310,19 @@
|
||||
<FlowControl>true</FlowControl>
|
||||
<Height>0</Height>
|
||||
<HwSku>Force10-S6000</HwSku>
|
||||
<ManagementInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:ManagementInterface>
|
||||
<ElementType>DeviceInterface</ElementType>
|
||||
<AlternateSpeeds i:nil="true"/>
|
||||
<EnableAutoNegotiation>true</EnableAutoNegotiation>
|
||||
<EnableFlowControl>true</EnableFlowControl>
|
||||
<Index>1</Index>
|
||||
<InterfaceName>Management1</InterfaceName>
|
||||
<MultiPortsInterface>false</MultiPortsInterface>
|
||||
<PortName>mgmt1</PortName>
|
||||
<Speed>1000</Speed>
|
||||
</a:ManagementInterface>
|
||||
</ManagementInterfaces>
|
||||
</DeviceInfo>
|
||||
</DeviceInfos>
|
||||
<Hostname>switch-t0</Hostname>
|
||||
|
@ -342,6 +342,18 @@
|
||||
<FlowControl>true</FlowControl>
|
||||
<Height>0</Height>
|
||||
<HwSku>Force10-S6000</HwSku>
|
||||
<ManagementInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:ManagementInterface>
|
||||
<ElementType>DeviceInterface</ElementType>
|
||||
<AlternateSpeeds i:nil="true"/>
|
||||
<EnableAutoNegotiation>true</EnableAutoNegotiation>
|
||||
<Index>1</Index>
|
||||
<InterfaceName>Management1</InterfaceName>
|
||||
<MultiPortsInterface>false</MultiPortsInterface>
|
||||
<PortName>mgmt1</PortName>
|
||||
<Speed>1000</Speed>
|
||||
</a:ManagementInterface>
|
||||
</ManagementInterfaces>
|
||||
</DeviceInfo>
|
||||
</DeviceInfos>
|
||||
<Hostname>switch-t0</Hostname>
|
||||
|
@ -114,8 +114,12 @@ class TestCfgGenCaseInsensitive(TestCase):
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "{'10.0.10.7': {'priority': '1', 'tcp_port': '49'}, '10.0.10.8': {'priority': '1', 'tcp_port': '49'}}")
|
||||
|
||||
def test_minigraph_mgmt_port(self):
|
||||
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "MGMT_PORT"'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "{'eth0': {'alias': 'eth0', 'admin_status': 'up', 'speed': '1000'}}")
|
||||
|
||||
def test_metadata_ntp(self):
|
||||
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "NTP_SERVER"'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "{'10.0.10.1': {}, '10.0.10.2': {}}")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user