Lantronix SLC 8000 Series User Manual page 216

Advanced console manager
Hide thumbs Also See for SLC 8000 Series:
Table of Contents

Advertisement

print(now.strftime("%Y-%m-%d %H:%M"))
server = sys.argv[1]
secret = sys.argv[2]
proc = subprocess.Popen(['clisession', '-U', 'sysadmin'],
# wait for prompt
while True:
output_str = proc.stdout.readline()
if b'list of commands' in output_str:
proc.stdin.write(b'\n')
proc.stdin.flush()
if b']> ' in output_str:
break
if b'Invalid local user' in output_str:
print("Invalid local user passed to clisession.")
proc.stdin.close()
proc.terminate()
proc.wait()
sys.exit(1)
# Run the RADIUS command
s = "set radius server 1 host " + server + " secret " + secret + "\n"
b = bytearray(s.encode())
proc.stdin.write(b)
proc.stdin.flush()
while True:
output_str = proc.stdout.readline()
if b'RADIUS settings successfully updated' in output_str:
break
elif b'set radius' not in output_str:
# RADIUS command returned an error
s1 = str(output_str)
s2 = s1.split("\\r")[1]
print("RADIUS command returned: " + s2.split("\\n")[0])
proc.stdin.close()
proc.terminate()
proc.wait()
sys.exit(1)
proc.stdin.write(b'set radius state enable\n')
proc.stdin.flush()
while True:
output_str = proc.stdout.readline()
if b'RADIUS settings successfully updated' in output_str:
break
elif b'set radius' not in output_str:
# RADIUS command returned an error
s1 = str(output_str)
s2 = s1.split("\\r")[1]
SLC™ 8000 Advanced Console Manager User Guide
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
9: Device Ports
216

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Slc 8048Slc 8016

Table of Contents