diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py
index 68f20b4677..fdc8463e23 100644
--- a/src/sonic-config-engine/minigraph.py
+++ b/src/sonic-config-engine/minigraph.py
@@ -955,6 +955,7 @@ def parse_meta(meta, hname):
redundancy_type = None
downstream_redundancy_types = None
qos_profile = None
+ rack_mgmt_map = None
device_metas = meta.find(str(QName(ns, "Devices")))
for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))):
@@ -1004,7 +1005,9 @@ def parse_meta(meta, hname):
downstream_redundancy_types = value
elif name == "SonicQosProfile":
qos_profile = value
- return syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile
+ elif name == "RackMgmtMap":
+ rack_mgmt_map = value
+ return syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile, rack_mgmt_map
def parse_linkmeta(meta, hname):
@@ -1421,6 +1424,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
downstream_redundancy_types = None
redundancy_type = None
qos_profile = None
+ rack_mgmt_map = None
hwsku_qn = QName(ns, "HwSku")
hostname_qn = QName(ns, "Hostname")
@@ -1453,7 +1457,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
elif child.tag == str(QName(ns, "UngDec")):
(u_neighbors, u_devices, _, _, _, _, _, _) = parse_png(child, hostname, None)
elif child.tag == str(QName(ns, "MetadataDeclaration")):
- (syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile) = parse_meta(child, hostname)
+ (syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile, rack_mgmt_map) = parse_meta(child, hostname)
elif child.tag == str(QName(ns, "LinkMetadataDeclaration")):
linkmetas = parse_linkmeta(child, hostname)
elif child.tag == str(QName(ns, "DeviceInfos")):
@@ -1498,6 +1502,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if deployment_id is not None:
results['DEVICE_METADATA']['localhost']['deployment_id'] = deployment_id
+ if rack_mgmt_map is not None:
+ results['DEVICE_METADATA']['localhost']['rack_mgmt_map'] = rack_mgmt_map
+
cluster = [devices[key] for key in devices if key.lower() == hostname.lower()][0].get('cluster', "")
if cluster:
results['DEVICE_METADATA']['localhost']['cluster'] = cluster
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 89b0ca9e0d..aaade89d5d 100644
--- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml
+++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml
@@ -537,6 +537,11 @@
Mixed
+
+ RackMgmtMap
+
+ dummy_value
+
diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py
index 7f0319fa34..60b732b286 100644
--- a/src/sonic-config-engine/tests/test_minigraph_case.py
+++ b/src/sonic-config-engine/tests/test_minigraph_case.py
@@ -193,6 +193,11 @@ class TestCfgGenCaseInsensitive(TestCase):
output = self.run_script(argument)
self.assertEqual(output.strip(), "1")
+ def test_minigraph_rack_mgmt_map(self):
+ argument = ['-m', self.sample_graph, '-p', self.port_config, '-v', "DEVICE_METADATA[\'localhost\'][\'rack_mgmt_map\']"]
+ output = self.run_script(argument)
+ self.assertEqual(output.strip(), "dummy_value")
+
def test_minigraph_cluster(self):
argument = ['-m', self.sample_graph, '-p', self.port_config, '-v', "DEVICE_METADATA[\'localhost\'][\'cluster\']"]
output = self.run_script(argument)