diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2dbf1319d4d0..ababa568fe7e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -64,8 +64,6 @@ def parse_device(device): hwsku = None name = None deployment_id = None - if str(QName(ns3, "type")) in device.attrib: - d_type = device.attrib[str(QName(ns3, "type"))] for node in device: if node.tag == str(QName(ns, "Address")): @@ -78,6 +76,12 @@ def parse_device(device): hwsku = node.text elif node.tag == str(QName(ns, "DeploymentId")): deployment_id = node.text + elif node.tag == str(QName(ns, "ElementType")): + d_type = node.text + + if d_type is None and str(QName(ns3, "type")) in device.attrib: + d_type = device.attrib[str(QName(ns3, "type"))] + return (lo_prefix, mgmt_prefix, name, hwsku, d_type, deployment_id) def parse_png(png, hname): 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 0c0799ea7d19..880d5297aec8 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -211,7 +211,8 @@ - + + ToRRouter switch-t0 Force10-S6000 AAA00PrdStr00