moved everything to a new module called backend
This commit is contained in:
65
backend/tests/extron_smp_testing.py
Normal file
65
backend/tests/extron_smp_testing.py
Normal file
@@ -0,0 +1,65 @@
|
||||
import getpass
|
||||
import sys
|
||||
from abc import ABC, abstractmethod
|
||||
from backend.recorder_adapters import telnetlib
|
||||
|
||||
# HOST = "localhost"
|
||||
# HOST = "129.13.51.102" # Audimax SMP 351
|
||||
# HOST = "129.13.51.106" # Tulla SMP 351
|
||||
HOST = "172.22.246.207" # Test SMP MZ
|
||||
|
||||
user = "admin"
|
||||
pw = "123mzsmp"
|
||||
|
||||
|
||||
def print_tn(tn_response):
|
||||
if isinstance(tn_response, bytes):
|
||||
print(tn_response.decode("ascii").rstrip())
|
||||
else:
|
||||
print(str(tn_response).rstrip())
|
||||
|
||||
|
||||
def run_cmd(tn, cmd, timeout=1):
|
||||
tn.write(cmd)
|
||||
out = tn.read_until_non_empty_line()
|
||||
res = out
|
||||
while out is not None and out != "":
|
||||
out = tn.read_until_non_empty_line()
|
||||
print(out)
|
||||
res += out
|
||||
return res
|
||||
|
||||
|
||||
tn = telnetlib.Telnet(HOST)
|
||||
tn.read_until("\r\nPassword:")
|
||||
# password = getpass.getpass()
|
||||
password = pw
|
||||
tn.write(password + "\n\r")
|
||||
|
||||
if not tn.assert_string_in_output("Login Administrator")[0]:
|
||||
print("WRONG (admin) password!! Exiting!")
|
||||
exit(1)
|
||||
|
||||
print("OK, we have admin rights!")
|
||||
|
||||
tn.write("1Q\n")
|
||||
|
||||
# print_tn(read_line(tn))
|
||||
print_tn(tn.read_until_non_empty_line())
|
||||
print("test")
|
||||
|
||||
|
||||
# print(run_cmd(tn, "I\n"))
|
||||
# run_cmd(tn, "X1CERT\n")
|
||||
# tn.write(chr(27)+"X1CERT")
|
||||
# tn.write("WX1CERT\n")
|
||||
# tn.write(chr(27)+"1BOOT")
|
||||
# tn.write("W1BOOT\n")
|
||||
# print_tn(tn.read_until_non_empty_line())
|
||||
# tn.write("I\n")
|
||||
# print_tn(tn.read_some())
|
||||
|
||||
# tn.write("exit\n\r".encode("ascii"))
|
||||
|
||||
# print_tn(tn.read_eager())
|
||||
|
||||
Reference in New Issue
Block a user