Commit 405de400 by Sunil Kumar Veerappa

Added code for accessing FPGA

parent 2f4d6b4d
......@@ -153,34 +153,24 @@ def discover_boards():
#feed to the agent service ussing the extracted IP
for item, ip_item in zip(list_fpga_id1, list_fpga_ip1):
# This step is for test as connection to fpga is not established
Data = subprocess.check_output(str("cat /home/sunil/Desktop/Data.txt"),
stdin=subprocess.PIPE, shell=True)
#This line will be removed and put SSH connection to the IP as well as aocl diagnose command execution
#Following line should get added
#login = ["ssh -oCiphers=aes256-ctr root@192.168.1.155"] #Put IP here
#p_login = subprocess.Popen(login, stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
#out, err = p_login.communicate()
#cmd = ["aocl diagonse"]
#p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
# out, err = p.communicate()
# for ssh using ip
SSH_ADDRESS = "192.168.1.155"
SSH_USERNAME = "root"
SSH_COMMAND = "aocl diagnose"
SSH_PASSWORD = ''
SSH_COMMAND = "source /home/root/init_opencl.sh ; aocl diagnose"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_stdin = ssh_stdout = ssh_stderr = None
try:
ssh.connect(ip_item, username=SSH_USERNAME)
ssh.connect(SSH_ADDRESS, username=SSH_USERNAME, password=SSH_PASSWORD)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(SSH_COMMAND)
except Exception as e:
sys.stderr.write("SSH connection error: {0}".format(e))
if ssh_stdout:
data_1 = str(ssh_stdout.read())
print("ssh output " + data_1)
Data = str(ssh_stdout.read())
LOG.error(str(Data))
ssh.close()
device_data = extractData(Data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment