[console][minigraph] Avoid generate config for self console port (#7817)

Signed-off-by: Jing Kan jika@microsoft.com
This commit is contained in:
Blueve 2021-06-16 16:07:07 +08:00 committed by Qi Luo
parent 74955f5301
commit 4cbf7e975b
2 changed files with 13 additions and 4 deletions

View File

@ -199,18 +199,18 @@ def parse_png(png, hname, dpg_ecmp_content = None):
startport = link.find(str(QName(ns, "StartPort"))).text startport = link.find(str(QName(ns, "StartPort"))).text
baudrate = link.find(str(QName(ns, "Bandwidth"))).text baudrate = link.find(str(QName(ns, "Bandwidth"))).text
flowcontrol = 1 if link.find(str(QName(ns, "FlowControl"))) is not None and link.find(str(QName(ns, "FlowControl"))).text == 'true' else 0 flowcontrol = 1 if link.find(str(QName(ns, "FlowControl"))) is not None and link.find(str(QName(ns, "FlowControl"))).text == 'true' else 0
if enddevice.lower() == hname.lower(): if enddevice.lower() == hname.lower() and endport.isdigit():
console_ports[endport] = { console_ports[endport] = {
'remote_device': startdevice, 'remote_device': startdevice,
'baud_rate': baudrate, 'baud_rate': baudrate,
'flow_control': flowcontrol 'flow_control': flowcontrol
} }
else: elif startport.isdigit():
console_ports[startport] = { console_ports[startport] = {
'remote_device': enddevice, 'remote_device': enddevice,
'baud_rate': baudrate, 'baud_rate': baudrate,
'flow_control': flowcontrol 'flow_control': flowcontrol
} }
continue continue
if linktype == "DeviceInterfaceLink": if linktype == "DeviceInterfaceLink":

View File

@ -194,6 +194,15 @@
</DpgDec> </DpgDec>
<PngDec> <PngDec>
<DeviceInterfaceLinks> <DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceSerialLink">
<ElementType>DeviceSerialLink</ElementType>
<Bandwidth>9600</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>console</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>switch-t1</StartDevice>
<StartPort>1</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceSerialLink"> <DeviceLinkBase i:type="DeviceSerialLink">
<ElementType>DeviceSerialLink</ElementType> <ElementType>DeviceSerialLink</ElementType>
<Bandwidth>9600</Bandwidth> <Bandwidth>9600</Bandwidth>