Parse bandwidth for DeviceMgmtLinks (#7749)
Why I did it Backport #7744 How to verify it Ran sonic-cfggen on a minigraph and verified that interface of type DeviceMgmtLink has speed set in the PORT table from the bandwidth attribute in the minigraph Signed-off-by: Neetha John <nejo@microsoft.com>
This commit is contained in:
parent
7c4aeb694c
commit
d4b4257915
@ -98,7 +98,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
|
||||
@ -111,13 +111,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
|
||||
else:
|
||||
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
|
||||
|
||||
@ -633,6 +635,10 @@ def parse_xml(filename, platform=None, port_config_file=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():
|
||||
|
@ -26,5 +26,12 @@
|
||||
"description": "Interface description"
|
||||
},
|
||||
"OP": "SET"
|
||||
},
|
||||
{
|
||||
"PORT_TABLE:Ethernet16": {
|
||||
"speed": "1000",
|
||||
"description": "fortyGigE0/16"
|
||||
},
|
||||
"OP": "SET"
|
||||
}
|
||||
]
|
||||
|
@ -251,6 +251,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">
|
||||
@ -352,6 +371,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>
|
||||
|
@ -297,7 +297,7 @@ class TestCfgGen(TestCase):
|
||||
"'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, "
|
||||
"'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, "
|
||||
"'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, "
|
||||
"'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'}, "
|
||||
"'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, "
|
||||
"'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}, "
|
||||
"'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, "
|
||||
|
Loading…
Reference in New Issue
Block a user