ap_tools.py fix for serial number and running generic command

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-08-30 16:36:48 +05:30
parent 3ad33a9c92
commit a39c14f1df
2 changed files with 8 additions and 5 deletions

View File

@@ -307,11 +307,13 @@ class APNOS:
output = stdout.read()
print(output, stderr.read())
status = output.decode('utf-8').splitlines()
error = stderr
stdin = stdin
client.close()
except Exception as e:
print(e)
status = "Error"
return status
stdin, status, error = "Error", "Error", "Error"
return stdin, status, error
def get_ucentral_status(self):
try:
@@ -571,7 +573,7 @@ if __name__ == '__main__':
'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/edgecore_eap102/20210625-edgecore_eap102-uCentral-trunk-4225122-upgrade.bin"
}
var = APNOS(credentials=obj, sdk="2.x")
tx_power, name = var.gettxpower()
tx_power, name = var.iwinfo()
allure.attach(name="interface name: ", body=str(name))
allure.attach(name="tx power: ", body=str(tx_power))
print(tx_power, name)

View File

@@ -28,7 +28,7 @@ class APTools:
self.credentials = {
'jumphost': jumphost,
'ip': host,
'serial': serial
'serial': serial,
'username': username,
'password': password,
'port': port,
@@ -61,7 +61,7 @@ def main():
parser.add_argument('--host', type=str, help=' --host : IP Address f LAB Controller / '
'Access Point System', default="localhost")
parser.add_argument('--jumphost', type=bool, help=' --host : IP Address f Access Point System', default=True)
parser.add_argument('--tty', type=bool, help=' --tty : /dev/ttyAP1', default="/dev/ttyAP1")
parser.add_argument('--tty', type=str, help=' --tty : /dev/ttyAP1', default="/dev/ttyAP1")
parser.add_argument('--port', type=int, help='--passwd of dut', default=22)
parser.add_argument('--username', type=str, help='--username to use on Access Point', default="root")
parser.add_argument('--password', type=str, help='--password to the given username', default="openwifi")
@@ -71,6 +71,7 @@ def main():
'reboot | run_cmd', default="run_cmd")
parser.add_argument('--cmd', type=str, help='--cmd : used when action is "run_cmd"', default="pwd")
args = parser.parse_args()
print(args.tty)
lf_tools = APTools(host=args.host, port=args.port, tty=args.tty,
username=args.username, jumphost=args.jumphost, password=args.password)
lf_tools.run_action(args.action, args.cmd)