mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
cicd changes with latest new files, ultiple client connectivity with WPA, WPA2, EAP auth across NAT and bridge mode with vlan
Signed-off-by: Syama <syama.devi@connectus.ai>
This commit is contained in:
65
py-scripts/tip-cicd-sanity/ap_ssh.py
Executable file
65
py-scripts/tip-cicd-sanity/ap_ssh.py
Executable file
@@ -0,0 +1,65 @@
|
||||
import paramiko
|
||||
from paramiko import SSHClient
|
||||
import socket
|
||||
|
||||
def ssh_cli_active_fw(ap_ip, username, password):
|
||||
try:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(ap_ip, username=username, password=password, timeout=5)
|
||||
stdin, stdout, stderr = client.exec_command('/usr/opensync/bin/ovsh s AWLAN_Node -c | grep FW_IMAGE_ACTIVE')
|
||||
|
||||
version_matrix = str(stdout.read())
|
||||
version_matrix_split = version_matrix.partition('FW_IMAGE_ACTIVE","')[2]
|
||||
cli_active_fw = version_matrix_split.partition('"],[')[0]
|
||||
#print("Active FW is",cli_active_fw)
|
||||
|
||||
stdin, stdout, stderr = client.exec_command('/usr/opensync/bin/ovsh s Manager -c | grep status')
|
||||
status = str(stdout.read())
|
||||
|
||||
if "ACTIVE" in status:
|
||||
#print("AP is in Active state")
|
||||
state = "active"
|
||||
elif "BACKOFF" in status:
|
||||
#print("AP is in Backoff state")
|
||||
state = "backoff"
|
||||
else:
|
||||
#print("AP is not in Active state")
|
||||
state = "unknown"
|
||||
|
||||
cli_info = {
|
||||
"state": state,
|
||||
"active_fw": cli_active_fw
|
||||
}
|
||||
|
||||
return(cli_info)
|
||||
|
||||
except paramiko.ssh_exception.AuthenticationException:
|
||||
print("Authentication Error, Check Credentials")
|
||||
return "ERROR"
|
||||
except paramiko.SSHException:
|
||||
print("Cannot SSH to the AP")
|
||||
return "ERROR"
|
||||
except socket.timeout:
|
||||
print("AP Unreachable")
|
||||
return "ERROR"
|
||||
|
||||
def iwinfo_status(ap_ip, username, password):
|
||||
try:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(ap_ip, username=username, password=password, timeout=5)
|
||||
stdin, stdout, stderr = client.exec_command('iwinfo | grep ESSID')
|
||||
|
||||
for line in stdout.read().splitlines():
|
||||
print(line)
|
||||
|
||||
except paramiko.ssh_exception.AuthenticationException:
|
||||
print("Authentication Error, Check Credentials")
|
||||
return "ERROR"
|
||||
except paramiko.SSHException:
|
||||
print("Cannot SSH to the AP")
|
||||
return "ERROR"
|
||||
except socket.timeout:
|
||||
print("AP Unreachable")
|
||||
return "ERROR"
|
||||
Reference in New Issue
Block a user