@@ -470,6 +470,7 @@ def parse_device(device):
470470 deployment_id = None
471471 cluster = None
472472 d_subtype = None
473+ slice_type = None
473474
474475 for node in device :
475476 if node .tag == str (QName (ns , "Address" )):
@@ -492,11 +493,13 @@ def parse_device(device):
492493 cluster = node .text
493494 elif node .tag == str (QName (ns , "SubType" )):
494495 d_subtype = node .text
496+ elif node .tag == str (QName (ns , "AssociatedSliceStr" )) and node .text and "AZNG_Production" in node .text :
497+ slice_type = "AZNG_Production"
495498
496499 if d_type is None and str (QName (ns3 , "type" )) in device .attrib :
497500 d_type = device .attrib [str (QName (ns3 , "type" ))]
498501
499- return (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , name , hwsku , d_type , deployment_id , cluster , d_subtype )
502+ return (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , name , hwsku , d_type , deployment_id , cluster , d_subtype , slice_type )
500503
501504
502505def calculate_lcm_for_ecmp (nhdevices_bank_map , nhip_bank_map ):
@@ -634,7 +637,8 @@ def parse_png(png, hname, dpg_ecmp_content = None):
634637
635638 if child .tag == str (QName (ns , "Devices" )):
636639 for device in child .findall (str (QName (ns , "Device" ))):
637- (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , name , hwsku , d_type , deployment_id , cluster , d_subtype ) = parse_device (device )
640+ (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , name , hwsku , d_type , deployment_id , cluster , d_subtype , slice_type ) = \
641+ parse_device (device )
638642 device_data = {}
639643 if hwsku != None :
640644 device_data ['hwsku' ] = hwsku
@@ -654,6 +658,8 @@ def parse_png(png, hname, dpg_ecmp_content = None):
654658 device_data ['type' ] = d_type
655659 if d_subtype != None :
656660 device_data ['subtype' ] = d_subtype
661+ if slice_type != None :
662+ device_data ['slice_type' ] = slice_type
657663 devices [name ] = device_data
658664
659665 if child .tag == str (QName (ns , "DeviceInterfaceLinks" )):
@@ -775,7 +781,7 @@ def parse_asic_png(png, asic_name, hostname):
775781
776782 if child .tag == str (QName (ns , "Devices" )):
777783 for device in child .findall (str (QName (ns , "Device" ))):
778- (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , name , hwsku , d_type , deployment_id , cluster , _ ) = parse_device (device )
784+ (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , name , hwsku , d_type , deployment_id , cluster , _ , slice_type ) = parse_device (device )
779785 device_data = {}
780786 if hwsku != None :
781787 device_data ['hwsku' ] = hwsku
@@ -793,6 +799,8 @@ def parse_asic_png(png, asic_name, hostname):
793799 device_data ['mgmt_addr_v6' ] = mgmt_prefix_v6
794800 if d_type != None :
795801 device_data ['type' ] = d_type
802+ if slice_type != None :
803+ device_data ['slice_type' ] = slice_type
796804 devices [name ] = device_data
797805
798806 return (neighbors , devices , port_speeds )
@@ -2137,6 +2145,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
21372145 if cluster :
21382146 results ['DEVICE_METADATA' ]['localhost' ]['cluster' ] = cluster
21392147
2148+ if current_device and 'slice_type' in current_device and current_device ['slice_type' ]:
2149+ results ['DEVICE_METADATA' ]['localhost' ]['slice_type' ] = current_device ['slice_type' ]
2150+
21402151 if kube_data :
21412152 results ['KUBERNETES_MASTER' ] = {
21422153 'SERVER' : {
@@ -2809,7 +2820,7 @@ def get_mux_cable_entries(ports, mux_cable_ports, active_active_ports, neighbors
28092820
28102821def parse_device_desc_xml (filename ):
28112822 root = ET .parse (filename ).getroot ()
2812- (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , hostname , hwsku , d_type , _ , _ , _ ) = parse_device (root )
2823+ (lo_prefix , lo_prefix_v6 , mgmt_prefix , mgmt_prefix_v6 , hostname , hwsku , d_type , _ , _ , _ , _ ) = parse_device (root )
28132824
28142825 results = {}
28152826 results ['DEVICE_METADATA' ] = {'localhost' : {
0 commit comments