I am new to Robot Framework - I have tried to call this code to robot framework, but to no avail. I just need some help in order to run my python script in robot framework and return PASS and FAIL within that application. Any help on this would be greatly appreciated.
# -*- coding: utf-8 -*-
import paramiko
import time,sys
from datetime import datetime
from time import sleep
prompt = "#"
datetime = datetime.now()
ssh_pre = paramiko.SSHClient()
ssh_pre.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_pre.connect("192.168.0.1",22, "admin", "admin")
output=""
ssh = ssh_pre.invoke_shell()
sys.stdout=open("ssh_session_dump.txt","w")
print("Script Start Date and Time: ", '%s/%s/%s' % (datetime.month, datetime.day, datetime.year), '%s:%s:%s' % (datetime.hour, datetime.minute, datetime.second))
model="XV4-17034"
ssh.send("more off\n")
if ssh.recv_ready():
output = ssh.recv(1000)
ssh.send("show system-info\n")
sleep(5)
output = ssh.recv(5000)
output=output.decode('utf-8')
lines=output.split("\n")
for item in lines:
if "Model:" in item:
line=item.split()
if line[1]==model+',':
print("Test Case 1.1 - PASS - Model is an " + model)
else:
print("Test Case 1.1 - FAIL - Model is not an " + model)
ssh.send( "quit\n" )
ssh.close()
datetime = datetime.now()
print("")
print("Script End Date and Time: ", '%s/%s/%s' % (datetime.month, datetime.day, datetime.year), '%s:%s:%s' % (datetime.hour, datetime.minute, datetime.second))
print("")
sys.stdout.close()