-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtsnqbv.py
More file actions
executable file
·83 lines (76 loc) · 2.87 KB
/
Copy pathtsnqbv.py
File metadata and controls
executable file
·83 lines (76 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""
Copyright 2023-2024 NXP
SPDX-License-Identifier: BSD-3-Clause
This script calls the respective files for running the
processes of starting, stopping traffics and applying
TSN configurations based on the buttons in the UI.
"""
import paramiko
import time
import sys
import os
if len(sys.argv) == 4:
hostUserName = sys.argv[2]
hostIP = sys.argv[3]
hostPwd = "null"
try:
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(
hostIP,
port=22,
username=hostUserName,
password=hostPwd,
timeout=10.0,
pkey=None,
)
print("true")
except:
print("false")
exit()
if sys.argv[1] == "start":
os.system("rm /opt/gopoint-apps/scripts/TSN/qbv/iperf.txt")
os.system("rm /opt/gopoint-apps/scripts/TSN/qbv/iperf1.txt")
os.system("rm /opt/gopoint-apps/scripts/TSN/qbv/FPS.txt")
ssh.exec_command("sh /opt/gopoint-apps/scripts/TSN/qbv/start_qbv_priority.sh &")
time.sleep(3)
os.system("iperf -s -i 1 -u >> /opt/gopoint-apps/scripts/TSN/qbv/iperf.txt &")
time.sleep(3)
ssh.exec_command("iperf -c 172.15.0.5 -i 1 -t 100000 -b 900M -u > /dev/null &")
time.sleep(2)
os.system(
"cat /opt/gopoint-apps/scripts/TSN/qbv/video.txt | tail -n 1 | awk '{print $0}'> /opt/gopoint-apps/scripts/TSN/qbv/video1.txt"
)
f = open("/opt/gopoint-apps/scripts/TSN/qbv/video1.txt", "r")
f = f.read()
y = f.replace("\n", "")
ssh.exec_command(
"python3 /opt/gopoint-apps/scripts/TSN/qbv/camera_server.py " + y
)
time.sleep(2)
os.system(
"python3 /opt/gopoint-apps/scripts/TSN/qbv/camera_client.py > /dev/null &"
)
time.sleep(2)
os.system("chmod 777 /opt/gopoint-apps/scripts/TSN/qbv/iperf.txt")
os.system("python3 /opt/gopoint-apps/scripts/TSN/qbv/tsn_config_graph.py")
elif sys.argv[1] == "no_qbv":
ssh.exec_command("sh /opt/gopoint-apps/scripts/TSN/qbv/no_qbv.sh")
time.sleep(2)
elif sys.argv[1] == "qbv1":
ssh.exec_command("sh /opt/gopoint-apps/scripts/TSN/qbv/qbv1.sh")
time.sleep(2)
elif sys.argv[1] == "qbv2":
ssh.exec_command("sh /opt/gopoint-apps/scripts/TSN/qbv/qbv2.sh")
time.sleep(2)
elif sys.argv[1] == "stop":
ssh.exec_command("sh /opt/gopoint-apps/scripts/TSN/qbv/stop_qbv_priority.sh")
ssh.exec_command("sh /opt/gopoint-apps/scripts/TSN/qbv/kill_server_process.sh")
os.system("sh /opt/gopoint-apps/scripts/TSN/qbv/kill_client_process.sh")
else:
print("Wrong arguments")
else:
print("Usage:")
print("\t start/stop host_name host_ip_address host_password")
print("\t Eg: python tsnqbv.py start xxx IP xxx123")