Skip to content

Commit

Permalink
Maverick Testcase
Browse files Browse the repository at this point in the history
Signed-off-by: Jyothsna-setti <[email protected]>
  • Loading branch information
Jyothsna-setti committed May 20, 2022
1 parent b502eb2 commit 11812e1
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libs/apnos/apnos.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,19 @@ def iwinfo(self):
client.close()
return o

def set_maverick(self):
client = self.ssh_cli_connect()
cmd = "/etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh"
if self.mode:
cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read().replace(b":~# /etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh ", b"").decode('utf-8')
o = output
client.close()
return o


def gettxpower(self):
client = self.ssh_cli_connect()
cmd = "iw dev | grep txpower"
Expand Down
92 changes: 92 additions & 0 deletions tests/e2e/interOp/Maverick/android/test_maverick.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import time

import allure
import pytest


@pytest.mark.uc_sanity
@allure.feature("SDK REST API")
@pytest.mark.gateway_ap_api
class TestAP(object):
@pytest.mark.Namooo
def test_ap_reboot(self, setup_controller, get_configuration, get_apnos):
for ap in get_configuration['access_point']:
cmd = "uci show ucentral"
print(get_configuration['access_point'])
ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x")
gw = ap_ssh.run_generic_command(cmd)
print("Status:")
print(gw)
connected, latest, active = ap_ssh.get_ucentral_status()
print("Connected:")
print(connected)
iwinfo = ap_ssh.get_iwinfo()
print("iwinfo:")
print(iwinfo)
allure.attach(name="Status before reboot:", body=str(gw, connected, iwinfo))
device_name = get_configuration['access_point'][0]['serial']
payload = {
"serialNumber": device_name,
"when": 0
}
resp = setup_controller.ap_reboot(device_name, payload)
time.sleep(120)
print(resp.json())
allure.attach(name="Reboot", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
for ap in get_configuration['access_point']:
cmd = "uci show ucentral"
print(get_configuration['access_point'])
ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x")
gw1 = ap_ssh.run_generic_command(cmd)
print("Status:")
print(gw1)
connected1, latest1, active1 = ap_ssh.get_ucentral_status()
print("Connected1:")
print(connected1)
iwinfo1 = ap_ssh.get_iwinfo()
print("iwinfo1:")
print(iwinfo1)
allure.attach(name="Status after reboot:", body=str(gw1, connected1, iwinfo1))
assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1)

def test_ap_factory_reset(self, setup_controller, get_configuration, get_apnos):
for ap in get_configuration['access_point']:
cmd = "uci show ucentral"
print(get_configuration['access_point'])
ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x")
gw = ap_ssh.run_generic_command(cmd)
print("Status:")
print(gw)
connected, latest, active = ap_ssh.get_ucentral_status()
print("Connected:")
print(connected)
iwinfo = ap_ssh.get_iwinfo()
print("iwinfo:")
print(iwinfo)
allure.attach(name="Status before factory reset:", body=str(gw, connected, iwinfo))
device_name = get_configuration['access_point'][0]['serial']
payload = {
"serialNumber": device_name,
"when": 0,
"keepRedirector": True
}
resp = setup_controller.ap_factory_reset(device_name, payload)
time.sleep(150)
print(resp.json())
allure.attach(name="Factory Reset", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
for ap in get_configuration['access_point']:
cmd = "uci show ucentral"
print(get_configuration['access_point'])
ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x")
gw1 = ap_ssh.run_generic_command(cmd)
print("Status:")
print(gw1)
connected1, latest1, active1 = ap_ssh.get_ucentral_status()
print("Connected1:")
print(connected1)
iwinfo1 = ap_ssh.get_iwinfo()
print("iwinfo1:")
print(iwinfo1)
allure.attach(name="Status after factory reset:", body=str(gw1, connected1, iwinfo1))
assert (resp.status_code == 200) & (gw == gw1) & (connected == connected1) & (iwinfo == iwinfo1)

13 changes: 13 additions & 0 deletions tests/e2e/interOp/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ def get_vif_state(get_apnos, get_configuration, request, lf_tools, skip_lf):
yield lf_tools.ssid_list
else:
yield empty_get_vif_state_list
@pytest.fixture(scope="class")
def set_maverick(get_apnos, get_configuration, request, lf_tools, skip_lf, self):
client = self.ssh_cli_connect()
cmd = "/etc/init.d/ucentral stop && /usr/libexec/ucentral/maverick.sh"
if self.mode:
cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read().replace(b":~# iwinfo", b"").decode('utf-8')
o = output
client.close()
return o


@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures_2x.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ def setup_profiles(self, request, param, setup_controller, testbed, get_equipmen
mode = "BRIDGE"
instantiate_profile_obj.set_mode(mode=mode)
vlan_id = 1
if parameter['mode'] == "NONE":
mode = "NONE"
instantiate_profile_obj.set_mode(mode=mode)
vlan_id = 1
print("No Mode is selected!..")
if parameter['mode'] == "VLAN":
mode = "VLAN"
instantiate_profile_obj.set_mode(mode=mode)
Expand Down

0 comments on commit 11812e1

Please sign in to comment.