diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 988b1214e7..f1a54c1796 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -198,18 +198,18 @@ def parse_png(png, hname, dpg_ecmp_content = None): startport = link.find(str(QName(ns, "StartPort"))).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 - if enddevice.lower() == hname.lower(): + if enddevice.lower() == hname.lower() and endport.isdigit(): console_ports[endport] = { 'remote_device': startdevice, 'baud_rate': baudrate, 'flow_control': flowcontrol - } - else: + } + elif startport.isdigit(): console_ports[startport] = { 'remote_device': enddevice, 'baud_rate': baudrate, 'flow_control': flowcontrol - } + } continue if linktype == "DeviceInterfaceLink": diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index ae7bd50a6f..7717157f18 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -194,6 +194,15 @@ + + DeviceSerialLink + 9600 + switch-t0 + console + true + switch-t1 + 1 + DeviceSerialLink 9600