mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-10-29 10:02:26 +00:00
Wifi 15117 (#1072)
* Modify ASB Test Cases for Cybertan AP Models Signed-off-by: bhargavi-ct <bhargavimamidipaka@candelatech.com> * Update script to handle output after remove restrictions Signed-off-by: bhargavi-ct <bhargavimamidipaka@candelatech.com> --------- Signed-off-by: bhargavi-ct <bhargavimamidipaka@candelatech.com> Co-authored-by: bhargavi-ct <bhargavimamidipaka@candelatech.com>
This commit is contained in:
@@ -617,13 +617,85 @@ class APLIBS:
|
||||
# Please wait 1min after doing factory reset
|
||||
return output
|
||||
|
||||
def remove_restrictions(self):
|
||||
self.run_generic_command(cmd="rm /certificates/restrictions.json",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
self.run_generic_command(cmd="rm /etc/ucentral/restrictions.json",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
def remove_restrictions(self, ap_model):
|
||||
if "sonicfi_rap" in ap_model:
|
||||
logging.info(f"Yes it is cybertan AP:")
|
||||
output = self.run_generic_command(cmd="cd /certificates && fw_setenv cert_part 0",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of fw_setenv cert_part 0: {output}")
|
||||
output = self.run_generic_command(cmd="rm -f /certificates/restrictions.json",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of removing restrictions: {output}")
|
||||
output = self.run_generic_command(cmd="fw_setenv store_certs_disabled 0",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of fw_setenv store_certs_disabled 0: {output}")
|
||||
output = self.run_generic_command(cmd="cd /certificates && store_certs",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of store_certs: {output}")
|
||||
|
||||
output = self.run_generic_command(cmd="cd /certificates && fw_setenv cert_part 1",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of fw_setenv cert_part 0: {output}")
|
||||
output = self.run_generic_command(cmd="rm -f /certificates/restrictions.json",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of removing restrictions: {output}")
|
||||
output = self.run_generic_command(cmd="fw_setenv store_certs_disabled 0",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of fw_setenv store_certs_disabled 0: {output}")
|
||||
output = self.run_generic_command(cmd="cd /certificates && store_certs",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of store_certs: {output}")
|
||||
|
||||
# Verify the restriction file is removed from both partitions
|
||||
output = self.run_generic_command(cmd="cd /certificates && fw_setenv cert_part 0",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of fw_setenv cert_part 0: {output}")
|
||||
output = self.run_generic_command(
|
||||
cmd='[ -f /certificates/restrictions.json ] && echo "True" || echo "False"',
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
logging.info(f"Check for restrictions file in partition 0: {output}")
|
||||
result = output.strip().splitlines()[-1]
|
||||
if result == "True":
|
||||
logging.info("Unable to remove restrictions file from partition 0")
|
||||
#pytest.fail("Unable to remove restrictions file from partition 0")
|
||||
|
||||
output = self.run_generic_command(cmd="cd /certificates && fw_setenv cert_part 1",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
logging.info(f"output of fw_setenv cert_part 0: {output}")
|
||||
output = self.run_generic_command(
|
||||
cmd='[ -f /certificates/restrictions.json ] && echo "True" || echo "False"',
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
logging.info(f"Check for restrictions file in partition 1: {output}")
|
||||
result = output.strip().splitlines()[-1]
|
||||
if result == "True" :
|
||||
logging.info("Unable to remove restrictions file from partition 1")
|
||||
#pytest.fail("Unable to remove restrictions file from partition 1")
|
||||
|
||||
else:
|
||||
self.run_generic_command(cmd="rm /certificates/restrictions.json",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
self.run_generic_command(cmd="rm /etc/ucentral/restrictions.json",
|
||||
idx=0, print_log=True,
|
||||
attach_allure=False)
|
||||
|
||||
|
||||
self.factory_reset(print_log=False)
|
||||
time.sleep(120)
|
||||
output = self.run_generic_command(cmd='[ -f /etc/ucentral/restrictions.json ] && echo "True" || echo "False"',
|
||||
@@ -633,20 +705,92 @@ class APLIBS:
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
return output
|
||||
|
||||
def add_restrictions(self, restrictions_file, developer_mode):
|
||||
def add_restrictions(self, restrictions_file, developer_mode, ap_model):
|
||||
self.factory_reset(print_log=False)
|
||||
time.sleep(200)
|
||||
output = self.run_generic_command(cmd=developer_mode,
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
output = self.run_generic_command(cmd=restrictions_file,
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT,
|
||||
restrictions=True)
|
||||
|
||||
if "sonicfi_rap" in ap_model:
|
||||
logging.info(f"Yes it is cybertan AP:")
|
||||
restrictions_file = 'echo \"{\\"country\\":[\\"US\\", \\"CA\\"],\\"dfs\\": true,\\"rtty\\": true,\\"tty\\": ' \
|
||||
'true,\\"developer\\": true,\\"sysupgrade\\": true,\\"commands\\": true,\\"key_info\\": {' \
|
||||
'\\"vendor\\": \\"dummy\\",\\"algo\\": \\"static\\"}}\" > /certificates/restrictions.json ' \
|
||||
'&& echo "Partition 0 done"'
|
||||
restrictions_file1 = 'echo \"{\\"country\\":[\\"US\\", \\"CA\\"],\\"dfs\\": true,\\"rtty\\": true,\\"tty\\": ' \
|
||||
'true,\\"developer\\": true,\\"sysupgrade\\": true,\\"commands\\": true,\\"key_info\\": {' \
|
||||
'\\"vendor\\": \\"dummy\\",\\"algo\\": \\"static\\"}}\" > /certificates/restrictions.json ' \
|
||||
'&& echo "Partition 1 done"'
|
||||
output = self.run_generic_command(cmd=developer_mode,
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
logging.info(f"output of developer_mode::{output}")
|
||||
output = self.run_generic_command(cmd="fw_setenv cert_part 0",
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
logging.info(f"output of fw_setenv cert_part 0::{output}")
|
||||
output = self.run_generic_command(cmd=restrictions_file,
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT,
|
||||
restrictions=True)
|
||||
logging.info(f"output of adding restrictions_file::{output}")
|
||||
output = self.run_generic_command(cmd="fw_setenv store_certs_disabled 0",
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
logging.info(f"output of fw_setenv store_certs_disabled 0::{output}")
|
||||
cmd_output = self.run_generic_command(cmd="cd /certificates && store_certs",
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT,
|
||||
restrictions=True)
|
||||
logging.info(f"output of store_certs::{cmd_output}")
|
||||
output = self.run_generic_command(cmd="fw_setenv cert_part 1",
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
logging.info(f"output of fw_setenv cert_part 1::{output}")
|
||||
output = self.run_generic_command(cmd=restrictions_file1,
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT,
|
||||
restrictions=True)
|
||||
logging.info(f"output of adding restrictions_file1::{output}")
|
||||
cmd_output = self.run_generic_command(cmd="fw_setenv store_certs_disabled 0",
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
logging.info(f"output of fw_setenv store_certs_disabled 0::{cmd_output}")
|
||||
cmd_output = self.run_generic_command(cmd="cd /certificates && store_certs",
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT,
|
||||
restrictions=True)
|
||||
logging.info(f"output of store_certs::{cmd_output}")
|
||||
|
||||
else:
|
||||
output = self.run_generic_command(cmd=developer_mode,
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT)
|
||||
output = self.run_generic_command(cmd=restrictions_file,
|
||||
idx=0,
|
||||
print_log=True,
|
||||
attach_allure=False,
|
||||
expected_attachment_type=allure.attachment_type.TEXT,
|
||||
restrictions=True)
|
||||
|
||||
self.factory_reset(print_log=False)
|
||||
time.sleep(300)
|
||||
return output
|
||||
|
||||
@@ -1041,6 +1041,7 @@ class TestUcentralGatewayService(object):
|
||||
@pytest.mark.asb_tests
|
||||
def test_asb_on_non_restricted_ap(self, get_target_object, get_testbed_details):
|
||||
device_name = get_testbed_details['device_under_tests'][0]['identifier']
|
||||
ap_model = get_testbed_details['device_under_tests'][0]['model']
|
||||
payload = {
|
||||
"serialNumber": device_name,
|
||||
"timeout": 30,
|
||||
@@ -1060,7 +1061,7 @@ class TestUcentralGatewayService(object):
|
||||
assert resp.status_code == 200
|
||||
else:
|
||||
logging.info("AP is restricted, Removing Restrictions")
|
||||
output = get_target_object.get_dut_library_object().remove_restrictions()
|
||||
output = get_target_object.get_dut_library_object().remove_restrictions(ap_model=ap_model)
|
||||
resp = resp = get_target_object.controller_library_object.check_restrictions(device_name)
|
||||
if not resp:
|
||||
logging.info("Removed Restrictions")
|
||||
@@ -1078,6 +1079,7 @@ class TestUcentralGatewayService(object):
|
||||
@pytest.mark.asb_tests
|
||||
def test_asb_on_restricted_ap(self, get_target_object, get_testbed_details):
|
||||
device_name = get_testbed_details['device_under_tests'][0]['identifier']
|
||||
ap_model = get_testbed_details['device_under_tests'][0]['model']
|
||||
payload = {
|
||||
"serialNumber": device_name,
|
||||
"timeout": 30,
|
||||
@@ -1094,18 +1096,23 @@ class TestUcentralGatewayService(object):
|
||||
'\\"vendor\\": \\"dummy\\",\\"algo\\": \\"static\\"}}\" > /certificates/restrictions.json ' \
|
||||
'&& echo \"True\"'
|
||||
developer_mode = "fw_setenv developer 0"
|
||||
|
||||
|
||||
output = get_target_object.get_dut_library_object().add_restrictions(restrictions_file=restrictions_file,
|
||||
developer_mode=developer_mode)
|
||||
resp = resp = get_target_object.controller_library_object.check_restrictions(device_name)
|
||||
developer_mode=developer_mode, ap_model=ap_model)
|
||||
logging.info(f"output of adding restrictions:{output}")
|
||||
resp = get_target_object.controller_library_object.check_restrictions(device_name)
|
||||
logging.info(f"response of check_restrictions:{resp} ")
|
||||
if resp:
|
||||
logging.info("From GW it's confirmed that AP is restricted now")
|
||||
uuid = get_target_object.controller_library_object.asb_script(device_name, payload)
|
||||
resp = get_target_object.controller_library_object.get_file(device_name, uuid)
|
||||
assert resp.status_code == 200
|
||||
else:
|
||||
logging.info("Unable to add restrictions to the AP")
|
||||
assert False
|
||||
output = get_target_object.get_dut_library_object().remove_restrictions()
|
||||
resp = resp = get_target_object.controller_library_object.check_restrictions(device_name)
|
||||
output = get_target_object.get_dut_library_object().remove_restrictions(ap_model=ap_model)
|
||||
resp = get_target_object.controller_library_object.check_restrictions(device_name)
|
||||
if resp:
|
||||
logging.info("Unable to remove restrictions in the AP")
|
||||
assert False
|
||||
|
||||
@@ -275,13 +275,14 @@ class TestResources(object):
|
||||
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-12318", name="12318")
|
||||
def test_check_restrictions(self, get_target_object, get_testbed_details):
|
||||
device_name = get_testbed_details['device_under_tests'][0]['identifier']
|
||||
ap_model = get_testbed_details['device_under_tests'][0]['model']
|
||||
resp = resp = get_target_object.controller_library_object.check_restrictions(device_name)
|
||||
if not resp:
|
||||
logging.info("AP is not restricted")
|
||||
assert True, "AP is not in restricted mode we can continue testing"
|
||||
else:
|
||||
logging.info("AP is restricted, Removing Restrictions")
|
||||
output = get_target_object.get_dut_library_object().remove_restrictions()
|
||||
output = get_target_object.get_dut_library_object().remove_restrictions(ap_model=ap_model)
|
||||
resp = resp = get_target_object.controller_library_object.check_restrictions(device_name)
|
||||
if not resp:
|
||||
logging.info("Removed Restrictions")
|
||||
|
||||
Reference in New Issue
Block a user