Add support to parse bandwidth for DeviceMgmtLinks (#7883)

Add support to parse bandwidth for DeviceMgmtLinks
This commit is contained in:
Neetha John 2021-06-15 15:02:16 -07:00 committed by GitHub
parent 86c2f4248c
commit 27fe654388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 4 deletions

View File

@ -119,7 +119,7 @@ def parse_png(png, hname):
}
continue
if linktype != "DeviceInterfaceLink" and linktype != "UnderlayInterfaceLink":
if linktype != "DeviceInterfaceLink" and linktype != "UnderlayInterfaceLink" and linktype != "DeviceMgmtLink":
continue
enddevice = link.find(str(QName(ns, "EndDevice"))).text
@ -131,13 +131,15 @@ def parse_png(png, hname):
if enddevice.lower() == hname.lower():
if port_alias_map.has_key(endport):
endport = port_alias_map[endport]
neighbors[endport] = {'name': startdevice, 'port': startport}
if linktype != "DeviceMgmtLink":
neighbors[endport] = {'name': startdevice, 'port': startport}
if bandwidth:
port_speeds[endport] = bandwidth
elif startdevice.lower() == hname.lower():
if port_alias_map.has_key(startport):
startport = port_alias_map[startport]
neighbors[startport] = {'name': enddevice, 'port': endport}
if linktype != "DeviceMgmtLink":
neighbors[startport] = {'name': enddevice, 'port': endport}
if bandwidth:
port_speeds[startport] = bandwidth
@ -1066,6 +1068,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None):
print >> sys.stderr, "Warning: ignore interface '%s' as it is not in the port_config.ini" % port_name
continue
# skip management ports
if port_name in mgmt_alias_reverse_mapping.keys():
continue
ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name]
for port_name, port in ports.items():

View File

@ -20,6 +20,13 @@
},
"OP": "SET"
},
{
"PORT_TABLE:Ethernet16": {
"speed": "1000",
"description": "fortyGigE0/16"
},
"OP": "SET"
},
{
"PORT_TABLE:Ethernet12": {
"speed": "100000",

View File

@ -267,6 +267,25 @@
<StartPort>Ethernet1/33</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceMgmtLink">
<ElementType>DeviceMgmtLink</ElementType>
<Bandwidth>1000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>fortyGigE0/16</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ChassisMTS1</StartDevice>
<StartPort>mgmt0</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceMgmtLink">
<ElementType>DeviceMgmtLink</ElementType>
<Bandwidth>1000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>Management1</EndPort>
<StartDevice>switch-m0</StartDevice>
<StartPort>Management1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="ToRRouter">
@ -369,6 +388,18 @@
<Speed>100000</Speed>
<Description>Interface description</Description>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/16</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
</EthernetInterfaces>
<FlowControl>true</FlowControl>
<Height>0</Height>

View File

@ -478,7 +478,7 @@ class TestCfgGen(TestCase):
"'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000'}, "
"'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, "
"'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '100000', 'description': 'Interface description'}, "
"'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, "
"'Ethernet16': {'lanes': '41,42,43,44', 'pfc_asym': 'off', 'description': 'fortyGigE0/16', 'mtu': '9100', 'alias': 'fortyGigE0/16', 'speed': '1000'}, "
"'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, "
"'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}, "
"'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, "