def ssh_connection(ip_address): # Defining device variables # param: ip # param: username # param: password # param: verbose - default is set to False. This will stdout to shell # param: debug_level - default is DEBUG. Typical python logging levls my_device = { "ip": ip_address, "username": "******", "password": "******", } # Creating connection to device with ftd_connection(**my_device) as device: # Sending and storing command via clish # output = device.send_command_clish("config manager add 10.91.52.247 cisco") output = device.send_command_expert('md5sum /mnt/disk0/.private/startup-config') logger.info("TEST MESSAHE") # device.disconnect() print(output)
# param: debug_level - default is DEBUG. Typical python logging levls my_device = { "ip": "10.0.0.1", "username": "******", "password": "******", "remote_server": "10.0.0.2", "remote_path": "/var/files/", "remote_username": "******", "remote_password": "******", "image_name": "Cisco_FTD_Patch-6.2.0.5-38.sh", "image_hash": "d906de5be2a19dd7a1c21282aa84636b", "snort_level": "2.9.12", } # Creating connection to device device = ftd_connection(**my_device) # Get image from scp server if does not exist if not device.image_exist(): device.get_image_from_server() # Check image md5 hash compared to servers. If it does not match quit if not device.check_image(): quit() # Checking Snort level if not device.check_snort_verison(): quit() # Start upgrade in detach mode device.start_upgrade()