Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.2.1 #119

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Obtain file content from this site, then copy via SCP to the server. <br>
```sh
usage: sure.py [-h] [-q] [-v] [-d] -u USERNAME

SURE - SDWAN Uprade Readiness Engine - v3.2.0
SURE - SDWAN Uprade Readiness Engine - v3.2.1

optional arguments:
-h, --help show this help message and exit
Expand Down Expand Up @@ -111,7 +111,7 @@ CLI Output on executing the script in normal mode.
vmanage-cluster1:~$ python3 py3_sure.py -u <username>
vManage Password:
#########################################################
### SURE – Version 3.2.0 ###
### SURE – Version 3.2.1 ###
#########################################################
### Performing SD-WAN Upgrade Readiness Check ###
#########################################################
Expand All @@ -134,7 +134,7 @@ In the quiet execution mode it quietly performs all the checks and on completion
vmanage-cluster1:~$ python3 py3_sure.py -q -u <username>
vManage Password:
#########################################################
### SURE – Version 3.2.0 ###
### SURE – Version 3.2.1 ###
#########################################################
### Performing SD-WAN Upgrade Readiness Check ###
#########################################################
Expand All @@ -153,7 +153,7 @@ In this mode the progress of the checks being performed can be monitored from th
vmanage-cluster1:~$ python3 py3_sure.py -v -u <username>
vManage Password:
#########################################################
### SURE – Version 3.2.0 ###
### SURE – Version 3.2.1 ###
#########################################################
### Performing SD-WAN Upgrade Readiness Check ###
#########################################################
Expand All @@ -176,7 +176,7 @@ vManage Password:
vmanage-cluster1:~$ python3 py3_sure.py -d -u <username>
vManage Password:
#########################################################
### SURE – Version 3.2.0 ###
### SURE – Version 3.2.1 ###
#########################################################
### Performing SD-WAN Upgrade Readiness Check ###
#########################################################
Expand Down Expand Up @@ -256,16 +256,15 @@ criticalChecknine(es_indices_est, server_type, cluster_size, cpu_count, total_de
\#17:Check:Controllers:Verify if stale entry of vManage+vSmart UUID present on any one cEdge<br>
**_Checks with severity level: WARNING_**<br>
\#1:Check:vManage:CPU Speed<br>
\#2:Check:vManage:Network Card type<br>
\#3:Check:vManage:Backup status<br>
\#4:Check:vManage:Evaluate Neo4j performance<br>
\#5:Check:vManage:Confirm there are no pending tasks<br>
\#6:Check:vManage:Validate there are no empty password users<br>
\#7:Check:Controllers:Controller versions<br>
\#8:Check:Controllers:Confirm Certificate Expiration Dates<br>
\#9:Check:Controllers:vEdge list sync<br>
\#10:Check:Controllers: Confirm control connections<br>
\#1:Check:vManage:Network Card type<br>
\#2:Check:vManage:Backup status<br>
\#3:Check:vManage:Evaluate Neo4j performance<br>
\#4:Check:vManage:Confirm there are no pending tasks<br>
\#5:Check:vManage:Validate there are no empty password users<br>
\#6:Check:Controllers:Controller versions<br>
\#7:Check:Controllers:Confirm Certificate Expiration Dates<br>
\#8:Check:Controllers:vEdge list sync<br>
\#9:Check:Controllers: Confirm control connections<br>
**_Checks with severity level: INFORMATIONAL_**<br>
\#1:Check:vManage:Disk controller type<br>
Expand Down
10 changes: 10 additions & 0 deletions changeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
- v3.2.1 (10th November 2023)
- Total Issues Fixed: 3
- Server Type 'QEMU' Not known
https://github.com/CiscoDevNet/sure/issues/114
- Included Check Type in the JSON Summary of each check
https://github.com/CiscoDevNet/sure/issues/117
- Added -p argument for passing password as an argument
https://github.com/CiscoDevNet/sure/issues/116
- Removed Critical Check: CPU Clock Speed (Not required)

- v3.2.0 (4th October 2023)
- Total Checks Added: 1
- Critical Check - Verify if stale entry of vManage+vSmart UUID present on any one cEdge
Expand Down
174 changes: 88 additions & 86 deletions python2/py2_sure.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ def certificateInfo(certificate):
count += 1
return certificate_info

#CPU Clock Speed
def cpuSpeed():
cpu_speed = executeCommand('lscpu | grep CPU\ MHz\:')
cpu_speed = match(str(cpu_speed),'\d+')
cpu_speed = float(cpu_speed)/1000
return cpu_speed
# #CPU Clock Speed
# def cpuSpeed():
# cpu_speed = executeCommand('lscpu | grep CPU\ MHz\:')
# cpu_speed = match(str(cpu_speed),'\d+')
# cpu_speed = float(cpu_speed)/1000
# return cpu_speed

# CPU Count
def cpuCount():
Expand Down Expand Up @@ -414,6 +414,8 @@ def serverType():
return 'on-cloud', 'Amazon'
elif 'Microsoft' in server_type:
return 'on-cloud', 'Microsoft'
elif 'QEMU' in server_type:
return 'on-prem', 'QEMU'

#vManage: Validate server_configs.json
def validateServerConfigsUUID():
Expand Down Expand Up @@ -1628,21 +1630,21 @@ def criticalChecktwentythree(cedge_validvsmarts_info, controllers_info, cedge_ip
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#Warning Checks

#01:Check:vManage:CPU Speed
def warningCheckone(cpu_speed, server_company):
if server_company == 'Microsoft' and cpu_speed < 2.6:
check_result = 'Failed'
check_analysis = 'CPU clock speed is {}, it is below recommended range as per the hardware guide. CPU clock speed should be greater than 2.8.'.format(cpu_speed)
check_action = 'Upgrade the hardware type'
elif cpu_speed < 2.8:
check_result = 'Failed'
check_analysis = 'CPU clock speed is {}, it is below recommended range as per the hardware guide. CPU clock speed should be greater than 2.8.'.format(cpu_speed)
check_action = 'Upgrade the hardware type'
else:
check_result = 'SUCCESSFUL'
check_analysis = 'CPU Clock speed is {}, matches hardware recommendations'.format(cpu_speed)
check_action = None
return check_result,check_analysis,check_action
# #01:Check:vManage:CPU Speed
# def warningCheckone(cpu_speed, server_company):
# if server_company == 'Microsoft' and cpu_speed < 2.6:
# check_result = 'Failed'
# check_analysis = 'CPU clock speed is {}, it is below recommended range as per the hardware guide. CPU clock speed should be greater than 2.8.'.format(cpu_speed)
# check_action = 'Upgrade the hardware type'
# elif cpu_speed < 2.8:
# check_result = 'Failed'
# check_analysis = 'CPU clock speed is {}, it is below recommended range as per the hardware guide. CPU clock speed should be greater than 2.8.'.format(cpu_speed)
# check_action = 'Upgrade the hardware type'
# else:
# check_result = 'SUCCESSFUL'
# check_analysis = 'CPU Clock speed is {}, matches hardware recommendations'.format(cpu_speed)
# check_action = None
# return check_result,check_analysis,check_action

#02:Check:vManage:Network Card type
def warningChecktwo():
Expand Down Expand Up @@ -2701,39 +2703,39 @@ def check_info_logger(log_file_logger, check_result, check_analysis, check_count
warning_checks = {}
log_file_logger.info('*** Performing Warning Checks')

#Check:vManage:CPU Speed
check_count += 1
check_count_zfill = zfill_converter(check_count)
if args.quiet == False and args.debug == False and args.verbose == False:
print(' Warning Check:#{}'.format(check_count_zfill))
if args.debug == True or args.verbose == True:
print(' #{}:Checking:vManage:CPU Speed'.format(check_count_zfill))
check_name = '#{}:Check:vManage:CPU Speed'.format(check_count_zfill)
pre_check(log_file_logger, check_name)
try:
check_result,check_analysis,check_action = warningCheckone(cpu_speed, server_company)
if check_result == 'Failed':
warning_checks[check_name] = [ check_analysis, check_action]
check_error_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
log_file_logger.error('#{}: CPU clock speed: {}\n'.format(check_count_zfill, cpu_speed))
report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
if args.debug == True:
print('\033[1;31m WARNING: {} \033[0;0m \n\n'.format(check_analysis))
else:
check_info_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
if args.debug == True:
print(' INFO:{}\n\n'.format(check_analysis))
json_final_result['json_data_pdf']['description']['vManage'].append({'analysis type': '{}'.format(check_name.split(':')[-1]),
'log type': '{}'.format(result_log['Warning'][check_result]),
'result': '{}'.format(check_analysis),
'action': '{}'.format(check_action),
'status': '{}'.format(check_result),
'document': ''})

except Exception as e:
print('\033[1;31m ERROR: Error performing {}. \n Please check error details in log file: {}.\n If needed, please reach out to tool support at: [email protected], with your report and log file. \033[0;0m \n\n'.format(check_name, log_file_path))
log_file_logger.exception('{}\n'.format(e))
# #Check:vManage:CPU Speed
# check_count += 1
# check_count_zfill = zfill_converter(check_count)
# if args.quiet == False and args.debug == False and args.verbose == False:
# print(' Warning Check:#{}'.format(check_count_zfill))
# if args.debug == True or args.verbose == True:
# print(' #{}:Checking:vManage:CPU Speed'.format(check_count_zfill))
# check_name = '#{}:Check:vManage:CPU Speed'.format(check_count_zfill)
# pre_check(log_file_logger, check_name)
# try:
# check_result,check_analysis,check_action = warningCheckone(cpu_speed, server_company)
# if check_result == 'Failed':
# warning_checks[check_name] = [ check_analysis, check_action]
# check_error_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
# log_file_logger.error('#{}: CPU clock speed: {}\n'.format(check_count_zfill, cpu_speed))
# report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
# if args.debug == True:
# print('\033[1;31m WARNING: {} \033[0;0m \n\n'.format(check_analysis))
# else:
# check_info_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
# report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
# if args.debug == True:
# print(' INFO:{}\n\n'.format(check_analysis))
# json_final_result['json_data_pdf']['description']['vManage'].append({'analysis type': '{}'.format(check_name.split(':')[-1]),
# 'log type': '{}'.format(result_log['Warning'][check_result]),
# 'result': '{}'.format(check_analysis),
# 'action': '{}'.format(check_action),
# 'status': '{}'.format(check_result),
# 'document': ''})

# except Exception as e:
# print('\033[1;31m ERROR: Error performing {}. \n Please check error details in log file: {}.\n If needed, please reach out to tool support at: [email protected], with your report and log file. \033[0;0m \n\n'.format(check_name, log_file_path))
# log_file_logger.exception('{}\n'.format(e))

#Check:vManage:Network Card type
check_count += 1
Expand Down Expand Up @@ -4135,38 +4137,38 @@ def check_info_logger(log_file_logger, check_result, check_analysis, check_count
warning_checks = {}
log_file_logger.info('*** Performing Warning Checks')

#Check:vManage:CPU Speed
check_count += 1
check_count_zfill = zfill_converter(check_count)
if args.quiet == False and args.debug == False and args.verbose == False:
print(' Warning Check:#{}'.format(check_count_zfill))
if args.debug == True or args.verbose == True:
print(' #{}:Checking:vManage:CPU Speed'.format(check_count_zfill))
check_name = '#{}:Check:vManage:CPU Speed'.format(check_count_zfill)
pre_check(log_file_logger, check_name)
try:
check_result,check_analysis,check_action = warningCheckone(cpu_speed, server_company)
if check_result == 'Failed':
warning_checks[check_name] = [ check_analysis, check_action]
check_error_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
log_file_logger.error('#{}: CPU clock speed: {}\n'.format(check_count_zfill, cpu_speed))
report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
if args.debug == True:
print('\033[1;31m WARNING: {} \033[0;0m \n\n'.format(check_analysis))
else:
check_info_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
if args.debug == True:
print(' INFO:{}\n\n'.format(check_analysis))
json_final_result['json_data_pdf']['description']['vManage'].append({'analysis type': '{}'.format(check_name.split(':')[-1]),
'log type': '{}'.format(result_log['Warning'][check_result]),
'result': '{}'.format(check_analysis),
'action': '{}'.format(check_action),
'status': '{}'.format(check_result),
'document': ''})
except Exception as e:
print('\033[1;31m ERROR: Error performing {}. \n Please check error details in log file: {}.\n If needed, please reach out to tool support at: [email protected], with your report and log file. \033[0;0m \n\n'.format(check_name, log_file_path))
log_file_logger.exception('{}\n'.format(e))
# #Check:vManage:CPU Speed
# check_count += 1
# check_count_zfill = zfill_converter(check_count)
# if args.quiet == False and args.debug == False and args.verbose == False:
# print(' Warning Check:#{}'.format(check_count_zfill))
# if args.debug == True or args.verbose == True:
# print(' #{}:Checking:vManage:CPU Speed'.format(check_count_zfill))
# check_name = '#{}:Check:vManage:CPU Speed'.format(check_count_zfill)
# pre_check(log_file_logger, check_name)
# try:
# check_result,check_analysis,check_action = warningCheckone(cpu_speed, server_company)
# if check_result == 'Failed':
# warning_checks[check_name] = [ check_analysis, check_action]
# check_error_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
# log_file_logger.error('#{}: CPU clock speed: {}\n'.format(check_count_zfill, cpu_speed))
# report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
# if args.debug == True:
# print('\033[1;31m WARNING: {} \033[0;0m \n\n'.format(check_analysis))
# else:
# check_info_logger(log_file_logger, check_result, check_analysis, check_count_zfill)
# report_data.append([str(check_count),check_name.split(':')[-1],check_result,check_analysis,str(check_action)])
# if args.debug == True:
# print(' INFO:{}\n\n'.format(check_analysis))
# json_final_result['json_data_pdf']['description']['vManage'].append({'analysis type': '{}'.format(check_name.split(':')[-1]),
# 'log type': '{}'.format(result_log['Warning'][check_result]),
# 'result': '{}'.format(check_analysis),
# 'action': '{}'.format(check_action),
# 'status': '{}'.format(check_result),
# 'document': ''})
# except Exception as e:
# print('\033[1;31m ERROR: Error performing {}. \n Please check error details in log file: {}.\n If needed, please reach out to tool support at: [email protected], with your report and log file. \033[0;0m \n\n'.format(check_name, log_file_path))
# log_file_logger.exception('{}\n'.format(e))


#Check:vManage:Network Card type
Expand Down
Loading