Guest User

Untitled

a guest
Nov 15th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. class Device_optimiser():
  2. @staticmethod
  3. def connector(**args):
  4. ssh_client = paramiko.SSHClient()
  5. for i in args["devices"]:
  6. try:
  7. ssh_client.connect(hostname= i['host'],
  8. username=args['username'],
  9. password=args['password'],
  10. port = 22)
  11. except Exception:
  12. ll.error("bad device")
  13. stdin, stdout, stderr = ssh_client.exec_command(i['command'])
  14. return stdout.read()
  15.  
  16. @staticmethod
  17. def parser(msg):
  18. parsed_msg = msg + "some work"
  19. return parsed_msg
  20.  
  21. @staticmethod
  22. def algorithm(parsed_msg):
  23. sort_selected_msg = parsed_msg + "some work"
  24. return sort_selected_msg
  25.  
  26. @classmethod
  27. def main(cls, info):
  28. ssh_output = Device_optimiser.connector(**info)
  29. parsed_output = Device_optimiser.parser(ssh_output)
  30. Device_optimiser.algorithm(parsed_output)
  31. Device_optimiser.connector(**info)
Add Comment
Please, Sign In to add comment