Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,23 +260,15 @@ def parse_png(png, hname, dpg_ecmp_content = None):
if child.tag == str(QName(ns, "Devices")):
for device in child.findall(str(QName(ns, "Device"))):
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype) = parse_device(device)
device_data = {}
if hwsku != None:
device_data['hwsku'] = hwsku
device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku}
if cluster != None:
device_data['cluster'] = cluster
if deployment_id != None:
device_data['deployment_id'] = deployment_id
if lo_prefix != None:
device_data['lo_addr'] = lo_prefix
if lo_prefix_v6 != None:
device_data['lo_addr_v6'] = lo_prefix_v6
if mgmt_prefix != None:
device_data['mgmt_addr'] = mgmt_prefix
if mgmt_prefix_v6 != None:
device_data['mgmt_addr_v6'] = mgmt_prefix_v6
if d_type != None:
device_data['type'] = d_type
if d_subtype != None:
device_data['subtype'] = d_subtype
devices[name] = device_data
Expand Down Expand Up @@ -403,23 +395,15 @@ def parse_asic_png(png, asic_name, hostname):
if child.tag == str(QName(ns, "Devices")):
for device in child.findall(str(QName(ns, "Device"))):
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, _) = parse_device(device)
device_data = {}
if hwsku != None:
device_data['hwsku'] = hwsku
device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku}
if cluster != None:
device_data['cluster'] = cluster
if deployment_id != None:
device_data['deployment_id'] = deployment_id
if lo_prefix != None:
device_data['lo_addr'] = lo_prefix
if lo_prefix_v6 != None:
device_data['lo_addr_v6'] = lo_prefix_v6
if mgmt_prefix != None:
device_data['mgmt_addr'] = mgmt_prefix
if mgmt_prefix_v6 != None:
device_data['mgmt_addr_v6'] = mgmt_prefix_v6
if d_type != None:
device_data['type'] = d_type
devices[name] = device_data

return (neighbors, devices, port_speeds)
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-config-engine/tests/test_multinpu_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def test_frontend_asic_device_neigh_metadata(self):
output = json.loads(self.run_script(argument))
print(output)
self.assertDictEqual(output, \
{'01T2': {'mgmt_addr': '89.139.132.40', 'hwsku': 'VM', 'type': 'SpineRouter'},
{'01T2': {'lo_addr': None, 'type': 'SpineRouter', 'mgmt_addr': '89.139.132.40', 'hwsku': 'VM'},
'ASIC3': {'lo_addr_v6': '::/0', 'mgmt_addr': '0.0.0.0/0', 'hwsku': 'multi-npu-asic', 'lo_addr': '0.0.0.0/0', 'type': 'Asic', 'mgmt_addr_v6': '::/0'},
'ASIC2': {'lo_addr_v6': '::/0', 'mgmt_addr': '0.0.0.0/0', 'hwsku': 'multi-npu-asic', 'lo_addr': '0.0.0.0/0', 'type': 'Asic', 'mgmt_addr_v6': '::/0'}})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ module sonic-device_neighbor_metadata {
type union {
type inet:ipv4-prefix;
type inet:ipv4-address;
type string {
pattern "None";
}
}
}

Expand All @@ -68,6 +71,9 @@ module sonic-device_neighbor_metadata {
type union {
type inet:ipv4-prefix;
type inet:ipv4-address;
type string {
pattern "None";
}
}
}

Expand Down