3535import os
3636import re
3737
38- SCRIPT_VERSION = "v2.6 .0"
38+ SCRIPT_VERSION = "v3.0 .0"
3939# result constants
4040DONE = 'DONE'
4141PASS = 'PASS'
@@ -951,13 +951,14 @@ def craftData(column, rows):
951951 if not (isinstance (rows , list ) and isinstance (column , list )):
952952 raise TypeError ("Rows and column must be lists." )
953953 data = []
954- for i in range (len (rows )):
954+ c_len = len (column )
955+ for row_entry in range (len (rows )):
956+ r_len = len (rows [row_entry ])
957+ if r_len != c_len :
958+ raise ValueError ("Row length ({}), data: {} does not match column length ({})." .format (r_len , rows [row_entry ], c_len ))
955959 entry = {}
956- for j in range (len (column )):
957- if j < len (rows [i ]):
958- entry [column [j ]] = rows [i ][j ]
959- else :
960- entry [column [j ]] = None
960+ for col_pos in range (c_len ):
961+ entry [column [col_pos ]] = rows [row_entry ][col_pos ]
961962 data .append (entry )
962963 return data
963964
@@ -1648,7 +1649,7 @@ def switch_group_guideline_check(**kwargs):
16481649def switch_bootflash_usage_check (tversion , ** kwargs ):
16491650 result = FAIL_UF
16501651 msg = ''
1651- headers = ["Pod-ID" , "Node-ID" , "Utilization" , "Alert" ]
1652+ headers = ["Pod-ID" , "Node-ID" , "Utilization" ]
16521653 data = []
16531654 recommended_action = "Over 50% usage! Contact Cisco TAC for Support"
16541655 doc_url = "https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#switch-node-bootflash-usage"
@@ -1746,9 +1747,9 @@ def l3out_mtu_check(**kwargs):
17461747@check_wrapper (check_title = "L3 Port Config (F0467 port-configured-as-l2)" )
17471748def port_configured_as_l2_check (** kwargs ):
17481749 result = FAIL_O
1749- headers = ['Fault' , 'Tenant' , 'L3Out' , 'Node' , 'Path' , 'Recommended Action' ]
1750+ headers = ['Fault' , 'Tenant' , 'L3Out' , 'Node' , 'Path' ]
17501751 data = []
1751- unformatted_headers = ['Fault' , 'Fault DN' , 'Recommended Action' ]
1752+ unformatted_headers = ['Fault' , 'Fault DN' ]
17521753 unformatted_data = []
17531754 recommended_action = 'Resolve the conflict by removing this config or other configs using this port as L2'
17541755 doc_url = "https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#l2l3-port-config"
@@ -2005,7 +2006,7 @@ def bd_subnet_overlap_check(**kwargs):
20052006 result = FAIL_O
20062007 headers = ["Fault" , "Pod" , "Node" , "VRF" , "Interface" , "Address" ]
20072008 data = []
2008- unformatted_headers = ['Fault' , 'Fault DN' , 'Recommended Action' ]
2009+ unformatted_headers = ['Fault' , 'Fault DN' ]
20092010 unformatted_data = []
20102011 recommended_action = 'Resolve the conflict by removing BD subnets causing the overlap'
20112012 doc_url = "https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#bd-subnets"
@@ -2167,7 +2168,7 @@ def apic_ssd_check(cversion, username, password, **kwargs):
21672168 result = FAIL_UF
21682169 headers = ["Pod" , "Node" , "Storage Unit" , "% lifetime remaining" , "Recommended Action" ]
21692170 data = []
2170- unformatted_headers = ["Pod " , "Node" , "Storage Unit " , "% lifetime remaining" , "Recommended Action" ]
2171+ unformatted_headers = ["Fault " , "Fault DN " , "% lifetime remaining" , "Recommended Action" ]
21712172 unformatted_data = []
21722173 recommended_action = "Contact TAC for replacement"
21732174 doc_url = "https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#apic-ssd-health"
@@ -2200,15 +2201,15 @@ def apic_ssd_check(cversion, username, password, **kwargs):
22002201 c .log = LOG_FILE
22012202 c .connect ()
22022203 except Exception as e :
2203- data .append ([attr ['id' ], attr ['name' ], '-' , '-' , '-' , str (e )])
2204+ data .append ([attr ['id' ], attr ['name' ], '-' , '-' , str (e )])
22042205 print_result (node_title , ERROR )
22052206 has_error = True
22062207 continue
22072208 try :
22082209 c .cmd (
22092210 'grep -oE "SSD Wearout Indicator is [0-9]+" /var/log/dme/log/svc_ifc_ae.bin.log | tail -1' )
22102211 except Exception as e :
2211- data .append ([attr ['id' ], attr ['name' ], '-' , '-' , '-' , str (e )])
2212+ data .append ([attr ['id' ], attr ['name' ], '-' , '-' , str (e )])
22122213 print_result (node_title , ERROR )
22132214 has_error = True
22142215 continue
@@ -2226,7 +2227,6 @@ def apic_ssd_check(cversion, username, password, **kwargs):
22262227 print_result (node_title , DONE )
22272228 else :
22282229 headers = ["Fault" , "Pod" , "Node" , "Storage Unit" , "% lifetime remaining" , "Recommended Action" ]
2229- unformatted_headers = ["Fault" , "Fault DN" , "% lifetime remaining" , "Recommended Action" ]
22302230 for faultInst in faultInsts :
22312231 dn_array = re .search (dn_regex , faultInst ['faultInst' ]['attributes' ]['dn' ])
22322232 lifetime_remaining = "<5%"
@@ -2860,7 +2860,7 @@ def apic_version_md5_check(tversion, username, password, **kwargs):
28602860 c .log = LOG_FILE
28612861 c .connect ()
28622862 except Exception as e :
2863- data .append ([apic_name , '-' , '-' , str (e ), '-' ])
2863+ data .append ([apic_name , '-' , '-' , str (e )])
28642864 print_result (node_title , ERROR )
28652865 has_error = True
28662866 continue
@@ -2870,7 +2870,7 @@ def apic_version_md5_check(tversion, username, password, **kwargs):
28702870 tversion .dot_version )
28712871 except Exception as e :
28722872 data .append ([apic_name , '-' , '-' ,
2873- 'ls command via ssh failed due to:{}' .format (str (e )), '-' ])
2873+ 'ls command via ssh failed due to:{}' .format (str (e ))])
28742874 print_result (node_title , ERROR )
28752875 has_error = True
28762876 continue
@@ -2884,7 +2884,7 @@ def apic_version_md5_check(tversion, username, password, **kwargs):
28842884 tversion .dot_version )
28852885 except Exception as e :
28862886 data .append ([apic_name , str (tversion ), '-' ,
2887- 'failed to check md5sum via ssh due to:{}' .format (str (e )), '-' ])
2887+ 'failed to check md5sum via ssh due to:{}' .format (str (e ))])
28882888 print_result (node_title , ERROR )
28892889 has_error = True
28902890 continue
@@ -2923,7 +2923,7 @@ def apic_version_md5_check(tversion, username, password, **kwargs):
29232923def standby_apic_disk_space_check (** kwargs ):
29242924 result = FAIL_UF
29252925 msg = ''
2926- headers = ['SN' , 'OOB' , 'Mount Point' , 'Current Usage %' ]
2926+ headers = ['SN' , 'OOB' , 'Mount Point' , 'Current Usage %' , 'Details' ]
29272927 data = []
29282928 recommended_action = 'Contact Cisco TAC'
29292929 doc_url = "https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#standby-apic-disk-space-usage"
@@ -2962,7 +2962,7 @@ def standby_apic_disk_space_check(**kwargs):
29622962 directory = fs .group (1 )
29632963 usage = fs .group (5 )
29642964 if int (usage ) >= threshold :
2965- data .append ([stb ['mbSn' ], stb ['oobIpAddr' ], directory , usage ])
2965+ data .append ([stb ['mbSn' ], stb ['oobIpAddr' ], directory , usage , '-' ])
29662966 if not infraSnNodes :
29672967 result = NA
29682968 msg = 'No standby APIC found'
@@ -3143,6 +3143,9 @@ def cimc_compatibilty_check(tversion, **kwargs):
31433143 compat_lookup_dn = "uni/fabric/compcat-default/ctlrfw-apic-" + tversion .simple_version + \
31443144 "/rssuppHw-[uni/fabric/compcat-default/ctlrhw-" + model + "].json"
31453145 compatMo = icurl ('mo' , compat_lookup_dn )
3146+ if not compatMo :
3147+ msg = "No compatibility information found for {}/{}" .format (model , tversion .simple_version )
3148+ return Result (result = MANUAL , msg = msg , headers = headers , data = data , recommended_action = recommended_action , doc_url = doc_url )
31463149 recommended_cimc = compatMo [0 ]['compatRsSuppHw' ]['attributes' ]['cimcVersion' ]
31473150 warning = ""
31483151 if compatMo and recommended_cimc :
@@ -4905,7 +4908,7 @@ def standby_sup_sync_check(cversion, tversion, **kwargs):
49054908@check_wrapper (check_title = 'Equipment Disk Limits Exceeded' )
49064909def equipment_disk_limits_exceeded (** kwargs ):
49074910 result = PASS
4908- headers = ['Pod' , 'Node' , 'Code' , '%' , 'Description' , ]
4911+ headers = ['Pod' , 'Node' , 'Code' , '%' , 'Description' ]
49094912 data = []
49104913 unformatted_headers = ['Fault DN' , '%' , 'Recommended Action' ]
49114914 unformatted_data = []
0 commit comments