diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py
index 390410067feb..53ae6e940942 100644
--- a/src/sonic-config-engine/minigraph.py
+++ b/src/sonic-config-engine/minigraph.py
@@ -470,6 +470,7 @@ def parse_device(device):
deployment_id = None
cluster = None
d_subtype = None
+ slice_type = None
for node in device:
if node.tag == str(QName(ns, "Address")):
@@ -492,11 +493,13 @@ def parse_device(device):
cluster = node.text
elif node.tag == str(QName(ns, "SubType")):
d_subtype = node.text
+ elif node.tag == str(QName(ns, "AssociatedSliceStr")) and node.text and "AZNG_Production" in node.text:
+ slice_type = "AZNG_Production"
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, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype)
+ return (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype, slice_type)
def calculate_lcm_for_ecmp (nhdevices_bank_map, nhip_bank_map):
@@ -634,7 +637,8 @@ 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)
+ (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype, slice_type) = \
+ parse_device(device)
device_data = {}
if hwsku != None:
device_data['hwsku'] = hwsku
@@ -654,6 +658,8 @@ def parse_png(png, hname, dpg_ecmp_content = None):
device_data['type'] = d_type
if d_subtype != None:
device_data['subtype'] = d_subtype
+ if slice_type != None:
+ device_data['slice_type'] = slice_type
devices[name] = device_data
if child.tag == str(QName(ns, "DeviceInterfaceLinks")):
@@ -775,7 +781,7 @@ 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)
+ (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, _, slice_type) = parse_device(device)
device_data = {}
if hwsku != None:
device_data['hwsku'] = hwsku
@@ -793,6 +799,8 @@ def parse_asic_png(png, asic_name, hostname):
device_data['mgmt_addr_v6'] = mgmt_prefix_v6
if d_type != None:
device_data['type'] = d_type
+ if slice_type != None:
+ device_data['slice_type'] = slice_type
devices[name] = device_data
return (neighbors, devices, port_speeds)
@@ -2137,6 +2145,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if cluster:
results['DEVICE_METADATA']['localhost']['cluster'] = cluster
+ if current_device and 'slice_type' in current_device and current_device['slice_type']:
+ results['DEVICE_METADATA']['localhost']['slice_type'] = current_device['slice_type']
+
if kube_data:
results['KUBERNETES_MASTER'] = {
'SERVER': {
@@ -2809,7 +2820,7 @@ def get_mux_cable_entries(ports, mux_cable_ports, active_active_ports, neighbors
def parse_device_desc_xml(filename):
root = ET.parse(filename).getroot()
- (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, hostname, hwsku, d_type, _, _, _) = parse_device(root)
+ (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, hostname, hwsku, d_type, _, _, _, _) = parse_device(root)
results = {}
results['DEVICE_METADATA'] = {'localhost': {
diff --git a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml
index be3938f24bc4..bb5b5ff9a6f3 100644
--- a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml
+++ b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml
@@ -913,7 +913,7 @@
::/0
-
+ AZNG_Production
@@ -938,7 +938,7 @@
::/0
-
+ AZNG_Production
@@ -963,7 +963,7 @@
::/0
-
+ AZNG_Production
diff --git a/src/sonic-config-engine/tests/test_multinpu_cfggen.py b/src/sonic-config-engine/tests/test_multinpu_cfggen.py
index bba0adeae752..5c975ddce8be 100644
--- a/src/sonic-config-engine/tests/test_multinpu_cfggen.py
+++ b/src/sonic-config-engine/tests/test_multinpu_cfggen.py
@@ -342,6 +342,8 @@ def test_device_asic_metadata(self):
else:
self.assertEqual(output['localhost']['sub_role'], 'BackEnd')
self.assertEqual(output['localhost']['deployment_id'], "1")
+ if asic != 3:
+ self.assertEqual(output['localhost']['slice_type'], "AZNG_Production")
def test_global_asic_acl(self):
argument = ["-m", self.sample_graph, "-p", self.sample_port_config, "--var-json", "ACL_TABLE"]