[minigraph.py]: Prefer parsing device type from <ElementType> (#6184)
* Parse device type from <ElementType> first in <PngDec> * Fall back to <Device> type attribute if no <ElementType> is found Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
This commit is contained in:
parent
a6aaffd2ad
commit
290f66bbb8
@ -83,8 +83,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")):
|
||||
@ -99,6 +97,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, lo_prefix_v6, mgmt_prefix, name, hwsku, d_type, deployment_id)
|
||||
|
||||
def parse_png(png, hname):
|
||||
|
@ -266,7 +266,8 @@
|
||||
</DeviceLinkBase>
|
||||
</DeviceInterfaceLinks>
|
||||
<Devices>
|
||||
<Device i:type="ToRRouter">
|
||||
<Device xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" i:type="a:ToRRouter">
|
||||
<ElementType>ToRRouter</ElementType>
|
||||
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
|
||||
<d5p1:IPPrefix>26.1.1.10/32</d5p1:IPPrefix>
|
||||
</Address>
|
||||
|
Loading…
Reference in New Issue
Block a user