@@ -470,6 +470,7 @@ def parse_device(device):
470
470
deployment_id = None
471
471
cluster = None
472
472
d_subtype = None
473
+ slice_type = None
473
474
474
475
for node in device :
475
476
if node .tag == str (QName (ns , "Address" )):
@@ -492,11 +493,13 @@ def parse_device(device):
492
493
cluster = node .text
493
494
elif node .tag == str (QName (ns , "SubType" )):
494
495
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"
495
498
496
499
if d_type is None and str (QName (ns3 , "type" )) in device .attrib :
497
500
d_type = device .attrib [str (QName (ns3 , "type" ))]
498
501
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 )
500
503
501
504
502
505
def calculate_lcm_for_ecmp (nhdevices_bank_map , nhip_bank_map ):
@@ -634,7 +637,8 @@ def parse_png(png, hname, dpg_ecmp_content = None):
634
637
635
638
if child .tag == str (QName (ns , "Devices" )):
636
639
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 )
638
642
device_data = {}
639
643
if hwsku != None :
640
644
device_data ['hwsku' ] = hwsku
@@ -654,6 +658,8 @@ def parse_png(png, hname, dpg_ecmp_content = None):
654
658
device_data ['type' ] = d_type
655
659
if d_subtype != None :
656
660
device_data ['subtype' ] = d_subtype
661
+ if slice_type != None :
662
+ device_data ['slice_type' ] = slice_type
657
663
devices [name ] = device_data
658
664
659
665
if child .tag == str (QName (ns , "DeviceInterfaceLinks" )):
@@ -775,7 +781,7 @@ def parse_asic_png(png, asic_name, hostname):
775
781
776
782
if child .tag == str (QName (ns , "Devices" )):
777
783
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 )
779
785
device_data = {}
780
786
if hwsku != None :
781
787
device_data ['hwsku' ] = hwsku
@@ -793,6 +799,8 @@ def parse_asic_png(png, asic_name, hostname):
793
799
device_data ['mgmt_addr_v6' ] = mgmt_prefix_v6
794
800
if d_type != None :
795
801
device_data ['type' ] = d_type
802
+ if slice_type != None :
803
+ device_data ['slice_type' ] = slice_type
796
804
devices [name ] = device_data
797
805
798
806
return (neighbors , devices , port_speeds )
@@ -2137,6 +2145,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
2137
2145
if cluster :
2138
2146
results ['DEVICE_METADATA' ]['localhost' ]['cluster' ] = cluster
2139
2147
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
+
2140
2151
if kube_data :
2141
2152
results ['KUBERNETES_MASTER' ] = {
2142
2153
'SERVER' : {
@@ -2809,7 +2820,7 @@ def get_mux_cable_entries(ports, mux_cable_ports, active_active_ports, neighbors
2809
2820
2810
2821
def parse_device_desc_xml (filename ):
2811
2822
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 )
2813
2824
2814
2825
results = {}
2815
2826
results ['DEVICE_METADATA' ] = {'localhost' : {
0 commit comments