Added NAT test cases in Advanced Captive Portal Tests and Added test cases in regression suite (#991)

* Added NAT mode test cases and improved allure report

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added NAT mode test cases and improved allure report for external_captive_portal_tests

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added regression marker in the External Captive Portal tests

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Attached proper jira link to nat test cases

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

---------

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
Jitendrakumar Kushavah
2024-09-05 17:42:54 +05:30
committed by GitHub
parent 4f23f4109b
commit 91373d810c
14 changed files with 790 additions and 25 deletions

View File

@@ -45,7 +45,7 @@ setup_params_general = {
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="External Captive Portal")
@allure.sub_suite(sub_suite_name="Click-to-continue mode")
@allure.sub_suite(sub_suite_name="BRIDGE Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
@@ -62,6 +62,7 @@ class TestBridgeModeExternalCaptivePortal(object):
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.click_to_continue
@pytest.mark.ow_regression_lf
@allure.title("Click-to-continue mode with open encryption 2.4 GHz Band Bridge mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-11148", name="WIFI-11148")
def test_bridge_open_2g_click_to_continue(self, get_test_library, get_dut_logs_per_test_case,

View File

@@ -0,0 +1,220 @@
"""
External Captive Portal Test: NAT Mode
pytest -m "external_captive_portal_tests and NAT"
"""
import logging
import re
import time
import allure
import paramiko
import pytest
from tabulate import tabulate
pytestmark = [pytest.mark.external_captive_portal_tests, pytest.mark.NAT, pytest.mark.advanced_captive_portal_tests]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [
{"ssid_name": "ssid_ext_cap_portal_open_2g_ctc", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "uam",
"uam-port": 3990,
"uam-secret": "hotsys123",
"uam-server": "https://customer.hotspotsystem.com/customer/hotspotlogin.php",
"nasid": "AlmondLabs",
"auth-server": "radius.hotspotsystem.com",
"auth-port": 1812,
"auth-secret": "hotsys123",
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com",
"customer.hotspotsystem.com",
"youtube.com"
]
}
}
]},
"rf": {},
"radius": False
}
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="External Captive Portal")
@allure.sub_suite(sub_suite_name="NAT Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestNatModeExternalCaptivePortal(object):
"""
External Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and NAT and external_captive_portal_tests"
"""
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.click_to_continue
@pytest.mark.ow_regression_lf
@allure.title("Click-to-continue mode with open encryption 2.4 GHz Band NAT mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-14124", name="WIFI-14124")
def test_nat_open_2g_click_to_continue(self, get_test_library, get_dut_logs_per_test_case,
get_test_device_logs, check_connectivity, setup_configuration,
get_testbed_details, get_target_object):
"""
NAT Mode External Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and external_captive_portal_tests and open and twog and NAT and click_to_continue"
"""
def run_command_using_ssh(ssh_client, command: str):
output = ""
try_count = 1
while output.strip() == "" and try_count <= 10:
try:
try_count += 1
time.sleep(2)
logging.info(f"Executing command: {command}")
stdin, stdout, stderr = ssh_client.exec_command(command)
output = stdout.read().decode()
except Exception as exc:
logging.error(f"Handled Exception while running {command}: {exc}", exc_info=True)
if output.strip() == "":
allure.attach(name="No response while running following command:", body=f"{command}")
raise Exception("No output from command, check test body!")
return output
for dut in get_test_library.dut_data:
get_test_library.pre_cleanup()
radio_port_name = list(get_test_library.get_radio_availabilities(num_stations_2g=1)[0].keys())[0]
security = "open"
station = 'sta_ecp'
logging.info(f"Creating a station on the configured ssid on {radio_port_name} radio...")
sta_got_ip = get_test_library.client_connect_using_radio(
ssid=setup_params_general["ssid_modes"][security][0]["ssid_name"],
passkey="[BLANK]",
security="open",
mode="NAT-WAN",
radio=radio_port_name,
station_name=[station],
attach_port_info=False
)
sta_info = get_test_library.json_get(_req_url=f"port/1/1/{station}")
dict_table_sta = {
"Key": list(sta_info["interface"].keys()),
"Value": list(sta_info["interface"].values())
}
data_table_sta = tabulate(dict_table_sta, headers='keys', tablefmt='fancy_grid')
logging.info(f"Stations Data ({station}): \n{data_table_sta}\n")
allure.attach(name=f"Stations Data ({station})", body=str(data_table_sta))
if sta_got_ip is False:
logging.info("Station Failed to get IP")
pytest.fail("Station Failed to get IP")
logging.info("Connecting SSH connection...")
hostname = get_test_library.manager_ip
port = get_test_library.manager_ssh_port
username = 'root'
password = 'lanforge'
ping_host = "google.com"
ping_count = 10
ping_command = f"/home/lanforge/vrf_exec.bash {station} ping -c {ping_count} {ping_host}"
client = paramiko.SSHClient()
try:
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname, port=port, username=username, password=password)
logging.info("Making sure client not getting internet access before UAM authentication...")
ping_output_pre_authentication = run_command_using_ssh(client, ping_command)
logging.info(f"\nBefore Captive Portal-UAM authentication:\n{ping_output_pre_authentication}\n")
allure.attach(name="Before Captive Portal-UAM authentication, station ping response (google.com)",
body=str(ping_output_pre_authentication))
if "100% packet loss" not in ping_output_pre_authentication:
logging.info("Client already have internet access before UAM authentication!!!")
pytest.fail("Client already have internet access before UAM authentication")
logging.info("Client do not have internet access before UAM authentication.")
logging.info("Getting the inet ip address...")
logging.info(f"AP idx: {get_test_library.dut_data.index(dut)}")
cmd_output = get_target_object.get_dut_library_object().run_generic_command(
cmd="ifconfig up0v0",
idx=get_test_library.dut_data.index(dut),
attach_allure=False
)
ip_pattern = re.compile(r"inet addr:(\d+\.\d+\.\d+\.\d+)")
match = ip_pattern.search(cmd_output)
inet_ip_addr = match.group(1)
logging.info(f"inet ip addr: {inet_ip_addr}")
expected_location = f"/home/lanforge/vrf_exec.bash {station} curl -I http://{inet_ip_addr}/hotspot/"
expected_location_output = run_command_using_ssh(client, expected_location)
challenge_link = re.findall(r'^Location:\s+(.*?)\s*$', expected_location_output, re.MULTILINE)[0]
logging.info(f"Redirection link: {challenge_link}")
url_info = {}
for field in challenge_link.split('?')[1].split('&'):
key_val_list = field.split('=')
if len(key_val_list) == 2 and len(key_val_list[1]) != 0:
url_info[key_val_list[0]] = key_val_list[1]
logging.info(f"url_info: {url_info}")
challenge = url_info['challenge']
nasid = url_info['nasid']
station_mac = url_info['mac']
uamport = url_info['uamport']
link = (
f"https://customer.hotspotsystem.com/customer/hotspotlogin.php?name=&email=&company=&address="
f"&city=&state=&country=&zip=&phone=&capture_custom_1=&capture_custom_2=&capture_custom_3="
f"&capture_custom_4=&capture_custom_5=&ssl-login=&chal={challenge}&uamip={inet_ip_addr}"
f"&uamport={uamport}&nasid={nasid}&mac={station_mac}&userurl=&login=login&skin_id="
f"&uid={station_mac}&pwd=password&operator={nasid}&location_id=1&lang=en&agree=1"
)
expected_302 = f'/home/lanforge/vrf_exec.bash {station} curl -I "{link}"'
response_302 = run_command_using_ssh(client, expected_302)
logging.info(f"\n{response_302}")
allure.attach(name="Expected 302 response: ", body=str(response_302),
attachment_type=allure.attachment_type.TEXT)
link_to_hit = re.findall(r'^Location:\s+(.*?)\s*$', response_302, re.MULTILINE)[0]
logging.info(f"Link to hit: {link_to_hit}")
cmd_to_authenticate = f'/home/lanforge/vrf_exec.bash {station} curl "{link_to_hit}"'
authentication_response = run_command_using_ssh(client, cmd_to_authenticate)
logging.info(f"\n{authentication_response}\n")
allure.attach(name="Response from captive portal: ",
body=authentication_response, attachment_type=allure.attachment_type.HTML)
if "<h1> Connected </h1>" not in authentication_response:
logging.info("Captive portal authentication Failed")
pytest.fail("Captive portal authentication Failed")
logging.info("Captive portal authentication successful! Checking if client got internet access...")
ping_output_post_authentication = run_command_using_ssh(client, ping_command)
logging.info(f"\nAfter Captive Portal-UAM authentication:\n{ping_output_post_authentication}\n")
allure.attach(name="After Captive Portal-UAM authentication, station ping response (google.com)",
body=str(ping_output_post_authentication))
if "100% packet loss" in ping_output_post_authentication:
logging.info("Client did not get internet access even after authentication!!!")
pytest.fail("Client did not get internet access even after authentication")
except Exception as e:
logging.error(f"Error occurred: {e}", exc_info=True)
pytest.fail(f"Error occurred: {e}")
finally:
client.close()

View File

@@ -46,7 +46,7 @@ setup_params_general = {
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="External Captive Portal")
@allure.sub_suite(sub_suite_name="Local user/pass mode")
@allure.sub_suite(sub_suite_name="BRIDGE Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
@@ -63,6 +63,7 @@ class TestBridgeModeExternalCaptivePortal(object):
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.local_user_and_pass
@pytest.mark.ow_regression_lf
@allure.title("Local user/pass mode with open encryption 2.4 GHz Band Bridge mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-13683", name="WIFI-13683")
def test_bridge_open_2g_local_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,

View File

@@ -0,0 +1,253 @@
"""
External Captive Portal Test: NAT Mode
pytest -m "external_captive_portal_tests and nat"
"""
import logging
import re
import time
import allure
import paramiko
import pytest
from tabulate import tabulate
from bs4 import BeautifulSoup
pytestmark = [pytest.mark.external_captive_portal_tests, pytest.mark.nat, pytest.mark.advanced_captive_portal_tests]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [
{"ssid_name": "ssid_ext_cap_portal_open_2g_id_p", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "uam",
"uam-port": 3990,
"uam-secret": "hotsys123",
"uam-server": "https://customer.hotspotsystem.com/customer/hotspotlogin.php",
"nasid": "AlmondLabs_6",
"auth-server": "radius.hotspotsystem.com",
"auth-port": 1812,
"auth-secret": "hotsys123",
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com",
"customer.hotspotsystem.com",
"youtube.com"
]
}
}
]},
"rf": {},
"radius": False
}
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="External Captive Portal")
@allure.sub_suite(sub_suite_name="NAT Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestNatModeExternalCaptivePortal(object):
"""
External Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and external_captive_portal_tests and nat"
"""
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.local_user_and_pass
@pytest.mark.ow_regression_lf
@allure.title("Local user/pass mode with open encryption 2.4 GHz Band NAT mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-14125", name="WIFI-14125")
def test_nat_open_2g_local_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,
get_test_device_logs, check_connectivity, setup_configuration,
get_testbed_details, get_target_object):
"""
NAT Mode External Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and external_captive_portal_tests and open and twog and nat and local_user_and_pass"
"""
def run_command_using_ssh(ssh_client, command: str):
output = ""
try_count = 1
while output.strip() == "" and try_count <= 10:
try:
try_count += 1
time.sleep(2)
logging.info(f"Executing command: {command}")
stdin, stdout, stderr = ssh_client.exec_command(command)
output = stdout.read().decode()
except Exception as exc:
logging.error(f"Handled Exception while running {command}: {exc}", exc_info=True)
if output.strip() == "":
allure.attach(name="No response while running following command:", body=f"{command}")
raise Exception("No output from command, check test body!")
return output
for dut in get_test_library.dut_data:
get_test_library.pre_cleanup()
radio_port_name = list(get_test_library.get_radio_availabilities(num_stations_2g=1)[0].keys())[0]
security = "open"
station = 'sta_ecp'
logging.info(f"Creating a station on the configured ssid on {radio_port_name} radio...")
sta_got_ip = get_test_library.client_connect_using_radio(
ssid=setup_params_general["ssid_modes"][security][0]["ssid_name"],
passkey="[BLANK]",
security="open",
mode="NAT-WAN",
radio=radio_port_name,
station_name=[station],
attach_port_info=False
)
sta_info = get_test_library.json_get(_req_url=f"port/1/1/{station}")
dict_table_sta = {
"Key": list(sta_info["interface"].keys()),
"Value": list(sta_info["interface"].values())
}
data_table_sta = tabulate(dict_table_sta, headers='keys', tablefmt='fancy_grid')
logging.info(f"Stations Data ({station}): \n{data_table_sta}\n")
allure.attach(name=f"Stations Data ({station})", body=str(data_table_sta))
if sta_got_ip is False:
logging.info("Station Failed to get IP")
pytest.fail("Station Failed to get IP")
logging.info("Connecting SSH connection...")
hostname = get_test_library.manager_ip
port = get_test_library.manager_ssh_port
username = 'root'
password = 'lanforge'
ping_host = "google.com"
ping_count = 10
ping_command = f"/home/lanforge/vrf_exec.bash {station} ping -c {ping_count} {ping_host}"
client = paramiko.SSHClient()
try:
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname, port=port, username=username, password=password)
logging.info("Making sure client not getting internet access before UAM authentication...")
ping_output_pre_authentication = run_command_using_ssh(client, ping_command)
logging.info(f"\nBefore Captive Portal-UAM authentication:\n{ping_output_pre_authentication}\n")
allure.attach(name="Before Captive Portal-UAM authentication, station ping response (google.com)",
body=str(ping_output_pre_authentication))
if "100% packet loss" not in ping_output_pre_authentication:
logging.info("Client already have internet access before UAM authentication!!!")
pytest.fail("Client already have internet access before UAM authentication")
logging.info("Client do not have internet access before UAM authentication.")
logging.info("Getting the inet ip address...")
logging.info(f"AP idx: {get_test_library.dut_data.index(dut)}")
cmd_output = get_target_object.get_dut_library_object().run_generic_command(
cmd="ifconfig up0v0",
idx=get_test_library.dut_data.index(dut),
attach_allure=False
)
ip_pattern = re.compile(r"inet addr:(\d+\.\d+\.\d+\.\d+)")
match = ip_pattern.search(cmd_output)
inet_ip_addr = match.group(1)
logging.info(f"inet ip addr: {inet_ip_addr}")
expected_location = f"/home/lanforge/vrf_exec.bash {station} curl -I http://{inet_ip_addr}/hotspot/"
expected_location_output = run_command_using_ssh(client, expected_location)
challenge_link = re.findall(r'^Location:\s+(.*?)\s*$', expected_location_output, re.MULTILINE)[0]
logging.info(f"Redirection link: {challenge_link}")
url_info = {}
for field in challenge_link.split('?')[1].split('&'):
key_val_list = field.split('=')
if len(key_val_list) == 2 and len(key_val_list[1]) != 0:
url_info[key_val_list[0]] = key_val_list[1]
logging.info(f"url_info: {url_info}")
challenge = url_info['challenge']
nasid = url_info['nasid']
station_mac = url_info['mac']
uamport = url_info['uamport']
link = (f'https://customer.hotspotsystem.com/customer/hotspotlogin.php?ssl-login=&chal={challenge}'
f'&uamip={inet_ip_addr}&uamport={uamport}&nasid={nasid}&mac={station_mac}'
f'&userurl=ct522-7481%2F&login=login&skin_id=&uid=userr1&pwd=password1')
html_request = f'/home/lanforge/vrf_exec.bash {station} curl "{link}"'
html_response = run_command_using_ssh(client, html_request)
logging.info(f"HTML response containing authentication url:\n{html_response}")
allure.attach(name="HTML response containing authentication url:", body=str(html_response),
attachment_type=allure.attachment_type.TEXT)
soup = BeautifulSoup(html_response, 'html.parser')
meta_tag = soup.find('meta', attrs={'http-equiv': 'refresh'})
content = meta_tag['content']
authentication_url = "=".join(content.split('=')[1:])
logging.info(f"Authentication URL extracted from HTML:\n{authentication_url}\n")
allure.attach(name="Authentication URL extracted from HTML:", body=str(authentication_url))
cmd_to_authenticate = f'/home/lanforge/vrf_exec.bash {station} curl "{authentication_url}"'
authentication_response = run_command_using_ssh(client, cmd_to_authenticate)
logging.info(f"\n{authentication_response}\n")
allure.attach(name="Response from captive portal: ",
body=authentication_response, attachment_type=allure.attachment_type.HTML)
if "<h1> Connected </h1>" not in authentication_response:
logging.info("Captive portal authentication Failed")
pytest.fail("Captive portal authentication Failed")
logging.info("Captive portal authentication successful! Checking if client got internet access...")
ping_output_post_authentication = run_command_using_ssh(client, ping_command)
logging.info(f"\nAfter Captive Portal-UAM authentication:\n{ping_output_post_authentication}\n")
allure.attach(name="After Captive Portal-UAM authentication, station ping response (google.com)",
body=str(ping_output_post_authentication))
if "100% packet loss" in ping_output_post_authentication:
logging.info("Client did not get internet access even after authentication!!!")
pytest.fail("Client did not get internet access even after authentication")
except Exception as e:
logging.error(f"Error occurred: {e}", exc_info=True)
pytest.fail(f"Error occurred: {e}")
finally:
client.close()
logging.info("Checking throughput speed...")
wifi_capacity_obj_list = get_test_library.wifi_capacity(mode="NAT-WAN",
download_rate="10Gbps",
upload_rate="56Kbps",
protocol="UDP-IPv4",
duration="60000",
batch_size="1",
stations=radio_port_name[:4] + station,
add_stations=False,
create_stations=False)
report = wifi_capacity_obj_list[0].report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + "/"
numeric_score = get_test_library.read_kpi_file(column_name=["numeric-score"], dir_name=report)
expected_throughput = 10
throughput = {
"download": [numeric_score[0][0]],
"upload": [numeric_score[1][0]],
"total": [numeric_score[2][0]],
"expected": [f"<= {expected_throughput}"],
"unit": ["Mbps"],
"PASS": [numeric_score[2][0] <= expected_throughput]
}
data_table = tabulate(throughput, headers='keys', tablefmt='fancy_grid')
allure.attach(name='Throughput Data', body=data_table)
logging.info(f"\n{data_table}")
if not throughput["PASS"][0]:
logging.info("Throughput exceeded than set threshold")
pytest.fail("Throughput exceeded than set threshold")
logging.info("Throughput is within the set threshold")

View File

@@ -33,7 +33,7 @@ setup_params_general = {
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="Internal Captive Portal")
@allure.sub_suite(sub_suite_name="Click-to-continue mode")
@allure.sub_suite(sub_suite_name="BRIDGE Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],

View File

@@ -0,0 +1,89 @@
"""
Advanced Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and nat"
"""
import logging
import allure
import pytest
pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.nat, pytest.mark.internal_captive_portal_tests]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [
{"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "click-to-continue",
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com"
]
}
}
]},
"rf": {},
"radius": False
}
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="Internal Captive Portal")
@allure.sub_suite(sub_suite_name="NAT Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestNatModeadvancedcaptiveportal(object):
"""
Advanced Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and nat and internal_captive_portal_tests"
"""
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.click_to_continue
@pytest.mark.ow_regression_lf
@allure.title("Click-to-continue mode with open encryption 2.4 GHz Band NAT mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-14121", name="WIFI-14121")
def test_nat_open_2g_click_to_continue(self, get_test_library, get_dut_logs_per_test_case,
get_test_device_logs, num_stations, check_connectivity,
setup_configuration, get_testbed_details, get_target_object):
"""
nat Mode Advanced Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and internal_captive_portal_tests and open and twog and nat and click_to_continue"
"""
profile_data = {"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"],
"security_key": "something",
"captive": {
"auth-mode": "click-to-continue",
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com"
]
}
}
ssid_name = profile_data["ssid_name"]
security_key = "[BLANK]"
security = "open"
mode = "NAT-WAN"
band = "twog"
# json post data for API
json_post_data = 'action=click&accept_terms=clicked'
allure.attach(name="Definition",
body="Click-to-continue mode: In this mode the client will be redirected to the page where "
"the client needs to accept the terms of service before getting internet.")
passes, result = get_test_library.advanced_captive_portal(ssid=ssid_name, security=security,
dut_data=setup_configuration,
passkey=security_key, mode=mode, band=band,
num_sta=num_stations, json_post_data=json_post_data,
get_testbed_details=get_testbed_details,
tip_2x_obj=get_target_object)
assert passes == "PASS", result

View File

@@ -14,8 +14,8 @@ pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.bridge, pyt
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_personal": [
{"ssid_name": "ssid_captive_portal_wpa2_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"open": [
{"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "credentials",
"credentials": [
@@ -39,7 +39,7 @@ setup_params_general = {
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="Internal Captive Portal")
@allure.sub_suite(sub_suite_name="Local user/pass mode")
@allure.sub_suite(sub_suite_name="BRIDGE Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
@@ -53,20 +53,20 @@ class TestBridgeModeadvancedcaptiveportal(object):
pytest -m "advanced_captive_portal_tests and bridge and internal_captive_portal_tests"
"""
@pytest.mark.wpa2_personal
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.local_user_and_pass
@pytest.mark.ow_regression_lf
@allure.title("Local user/pass mode with wpa2_personal encryption 2.4 GHz Band Bridge mode")
@allure.title("Local user/pass mode with open encryption 2.4 GHz Band Bridge mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-10991", name="WIFI-10991")
def test_bridge_wpa2_2g_local_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,
def test_bridge_open_2g_local_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,
get_test_device_logs, num_stations, check_connectivity,
setup_configuration, get_testbed_details, get_target_object):
"""
BRIDGE Mode Advanced Captive Portal Test with wpa2_personal encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and internal_captive_portal_tests and wpa2_personal and twog and bridge and local_user_and_pass"
BRIDGE Mode Advanced Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and internal_captive_portal_tests and open and twog and bridge and local_user_and_pass"
"""
profile_data = {"ssid_name": "ssid_captive_portal_wpa2_2g_br", "appliedRadios": ["2G"],
profile_data = {"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"],
"security_key": "something",
"captive": {
"auth-mode": "credentials",
@@ -83,8 +83,8 @@ class TestBridgeModeadvancedcaptiveportal(object):
}
}
ssid_name = profile_data["ssid_name"]
security_key = profile_data["security_key"]
security = "wpa2"
security_key = "[BLANK]"
security = "open"
mode = "BRIDGE"
band = "twog"
# json post data for API

View File

@@ -0,0 +1,101 @@
"""
Advanced Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and nat"
"""
import logging
import allure
import pytest
pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.nat, pytest.mark.internal_captive_portal_tests]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [
{"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "credentials",
"credentials": [
{
"username": "abc",
"password": "def"
}
],
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com"
]
}
}
]},
"rf": {},
"radius": False
}
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="Internal Captive Portal")
@allure.sub_suite(sub_suite_name="NAT Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestNatModeadvancedcaptiveportal(object):
"""
Advanced Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and nat and internal_captive_portal_tests"
"""
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.local_user_and_pass
@pytest.mark.ow_regression_lf
@allure.title("Local user/pass mode with open encryption 2.4 GHz Band NAT mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-14122", name="WIFI-14122")
def test_nat_open_2g_local_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,
get_test_device_logs, num_stations, check_connectivity,
setup_configuration, get_testbed_details, get_target_object):
"""
NAT Mode Advanced Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and internal_captive_portal_tests and open and twog and nat and local_user_and_pass"
"""
profile_data = {"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"],
"security_key": "something",
"captive": {
"auth-mode": "credentials",
"credentials": [
{
"username": "abc",
"password": "def"
}
],
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com"
]
}
}
ssid_name = profile_data["ssid_name"]
security_key = "[BLANK]"
security = "open"
mode = "NAT-WAN"
band = "twog"
# json post data for API
json_post_data = 'username=abc&password=def&action=credentials'
allure.attach(name="Definition",
body="Local user/pass mode (Captive-Credentials): In this mode the client needs to "
"enter the valid credentials that are configured in the AP to get the internet access.")
passes, result = get_test_library.advanced_captive_portal(ssid=ssid_name, security=security,
dut_data=setup_configuration,
passkey=security_key, mode=mode, band=band,
num_sta=num_stations, json_post_data=json_post_data,
get_testbed_details=get_testbed_details,
tip_2x_obj=get_target_object)
assert passes == "PASS", result

View File

@@ -14,8 +14,8 @@ pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.bridge, pyt
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_personal": [
{"ssid_name": "ssid_captive_portal_wpa2_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"open": [
{"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "radius",
"auth-server": "10.28.3.21",
@@ -36,7 +36,7 @@ setup_params_general = {
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="Internal Captive Portal")
@allure.sub_suite(sub_suite_name="Radius user/pass mode")
@allure.sub_suite(sub_suite_name="BRIDGE Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
@@ -50,21 +50,21 @@ class TestBridgeModeadvancedcaptiveportal(object):
pytest -m "advanced_captive_portal_tests and bridge and internal_captive_portal_tests"
"""
@pytest.mark.wpa2_personal
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.radius_user_and_pass
@pytest.mark.ow_regression_lf
@allure.title("Radius user/pass mode with wpa2_personal encryption 2.4 GHz Band Bridge mode")
@allure.title("Radius user/pass mode with open encryption 2.4 GHz Band Bridge mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-10996", name="WIFI-10996")
def test_bridge_wpa2_2g_radius_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,
def test_bridge_open_2g_radius_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,
get_test_device_logs, num_stations, check_connectivity,
setup_configuration, get_testbed_details, get_target_object,
radius_info):
"""
BRIDGE Mode Advanced Captive Portal Test with wpa2_personal encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and internal_captive_portal_tests and wpa2_personal and twog and bridge and radius_user_and_pass"
BRIDGE Mode Advanced Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and internal_captive_portal_tests and open and twog and bridge and radius_user_and_pass"
"""
profile_data = {"ssid_name": "ssid_captive_portal_wpa2_2g_br", "appliedRadios": ["2G"],
profile_data = {"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"],
"security_key": "something",
"captive": {
"auth-mode": "radius",
@@ -78,8 +78,8 @@ class TestBridgeModeadvancedcaptiveportal(object):
}
}
ssid_name = profile_data["ssid_name"]
security_key = profile_data["security_key"]
security = "wpa2"
security_key = "[BLANK]"
security = "open"
mode = "BRIDGE"
band = "twog"
identity = radius_info['user']

View File

@@ -0,0 +1,100 @@
"""
Advanced Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and nat"
"""
import logging
import allure
import pytest
pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.nat, pytest.mark.internal_captive_portal_tests]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [
{"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "radius",
"auth-server": "10.28.3.21",
"auth-port": 1812,
"auth-secret": "testing123",
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com"
]
}
}
]},
"rf": {},
"radius": False
}
@allure.feature("Advanced Captive Portal Test")
@allure.parent_suite("Advanced Captive Portal Tests")
@allure.suite(suite_name="Internal Captive Portal")
@allure.sub_suite(sub_suite_name="NAT Mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestNATModeadvancedcaptiveportal(object):
"""
Advanced Captive Portal Test: NAT Mode
pytest -m "advanced_captive_portal_tests and nat and internal_captive_portal_tests"
"""
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.radius_user_and_pass
@pytest.mark.ow_regression_lf
@allure.title("Radius user/pass mode with open encryption 2.4 GHz Band NAT mode")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-14123", name="WIFI-14123")
def test_nat_open_2g_radius_user_and_pass(self, get_test_library, get_dut_logs_per_test_case,
get_test_device_logs, num_stations, check_connectivity,
setup_configuration, get_testbed_details, get_target_object,
radius_info):
"""
NAT Mode Advanced Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and internal_captive_portal_tests and open and twog and nat and radius_user_and_pass"
"""
profile_data = {"ssid_name": "ssid_captive_portal_open_2g_br", "appliedRadios": ["2G"],
"security_key": "something",
"captive": {
"auth-mode": "radius",
"auth-server": "10.28.3.21",
"auth-port": 1812,
"auth-secret": "testing123",
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com"
]
}
}
ssid_name = profile_data["ssid_name"]
security_key = "[BLANK]"
security = "open"
mode = "NAT-WAN"
band = "twog"
identity = radius_info['user']
passwd = radius_info["password"]
# json post data for API
json_post_data = f"username={identity}&password={passwd}&action=radius"
print("json_post_data", json_post_data)
allure.attach(name="Definition",
body="Radius user/pass mode (Captive-Radius): In this mode the client needs to enter"
" the valid credentials that are configured in the radius server being used to get "
"the internet access.")
passes, result = get_test_library.advanced_captive_portal(ssid=ssid_name, security=security,
dut_data=setup_configuration,
passkey=security_key, mode=mode, band=band,
num_sta=num_stations, json_post_data=json_post_data,
get_testbed_details=get_testbed_details,
tip_2x_obj=get_target_object)
assert passes == "PASS", result