Wifi 10977 (#839)

* Added captive option

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

* Added one test case for click-to-continue

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

* Added captive services for captive portal test cases

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

* Added one test case for click to continue mode

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

* Added one test case for local user and password mode

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

* Added one test case for Captive-Radius

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

---------

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
jitendracandela
2023-08-28 10:18:38 +05:30
committed by GitHub
parent d17329c52d
commit 065a60a19e
7 changed files with 292 additions and 0 deletions

View File

@@ -2652,6 +2652,8 @@ class UProfileUtility:
ssid_info[options] = ssid_data[options]
if options == "isolate-clients":
ssid_info[options] = ssid_data[options]
if options == "captive":
ssid_info[options] = ssid_data[options]
for i in ssid_data["appliedRadios"]:
ssid_info["wifi-bands"].append(i)
ssid_info['encryption'] = {}
@@ -2690,6 +2692,9 @@ class UProfileUtility:
ssid_info[options] = ssid_data[options]
if options == "isolate-clients":
ssid_info[options] = ssid_data[options]
if options == "captive":
ssid_info[options] = ssid_data[options]
ssid_info["services"] = ["captive"]
for i in ssid_data["appliedRadios"]:
ssid_info["wifi-bands"].append(i)
ssid_info['encryption'] = {}

View File

@@ -0,0 +1,88 @@
"""
Advanced Captive Portal Test: BRIDGE Mode
pytest -m "advanced_captive_portal_tests and bridge"
"""
import logging
import allure
import pytest
pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.bridge]
setup_params_general = {
"mode": "BRIDGE",
"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="BRIDGE Mode")
@allure.sub_suite(sub_suite_name="Click-to-continue mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestBridgeModeadvancedcaptiveportal(object):
"""
Advanced Captive Portal Test: BRIDGE Mode
pytest -m "advanced_captive_portal_tests and bridge"
"""
@pytest.mark.open
@pytest.mark.twog
@pytest.mark.click_to_continue
@allure.title("Click-to-continue mode with open encryption 2.4 GHz Band")
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-10977", name="WIFI-10977")
def test_bridge_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):
"""
BRIDGE Mode Advanced Captive Portal Test with open encryption 2.4 GHz Band
pytest -m "advanced_captive_portal_tests and open and twog and bridge 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 = "BRIDGE"
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

@@ -0,0 +1,100 @@
"""
Advanced Captive Portal Test: BRIDGE Mode
pytest -m "advanced_captive_portal_tests and bridge"
"""
import logging
import allure
import pytest
pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.bridge]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_personal": [
{"ssid_name": "ssid_captive_portal_wpa2_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="BRIDGE Mode")
@allure.sub_suite(sub_suite_name="Local user/pass mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestBridgeModeadvancedcaptiveportal(object):
"""
Advanced Captive Portal Test: BRIDGE Mode
pytest -m "advanced_captive_portal_tests and bridge"
"""
@pytest.mark.wpa2_personal
@pytest.mark.twog
@pytest.mark.local_user_and_pass
@allure.title("Local user/pass mode with wpa2_personal encryption 2.4 GHz Band")
@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,
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 wpa2_personal and twog and bridge and local_user_and_pass"
"""
profile_data = {"ssid_name": "ssid_captive_portal_wpa2_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 = profile_data["security_key"]
security = "wpa2"
mode = "BRIDGE"
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

@@ -0,0 +1,99 @@
"""
Advanced Captive Portal Test: BRIDGE Mode
pytest -m "advanced_captive_portal_tests and bridge"
"""
import logging
import allure
import pytest
pytestmark = [pytest.mark.advanced_captive_portal_tests, pytest.mark.bridge]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_personal": [
{"ssid_name": "ssid_captive_portal_wpa2_2g_br", "appliedRadios": ["2G"], "security_key": "something",
"captive": {
"auth-mode": "radius",
"auth-server": "10.28.3.43",
"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="BRIDGE Mode")
@allure.sub_suite(sub_suite_name="Radius user/pass mode")
@pytest.mark.parametrize(
'setup_configuration',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_configuration")
class TestBridgeModeadvancedcaptiveportal(object):
"""
Advanced Captive Portal Test: BRIDGE Mode
pytest -m "advanced_captive_portal_tests and bridge"
"""
@pytest.mark.wpa2_personal
@pytest.mark.twog
@pytest.mark.radius_user_and_pass
@allure.title("Radius user/pass mode with wpa2_personal encryption 2.4 GHz Band")
@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,
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 wpa2_personal and twog and bridge and radius_user_and_pass"
"""
profile_data = {"ssid_name": "ssid_captive_portal_wpa2_2g_br", "appliedRadios": ["2G"],
"security_key": "something",
"captive": {
"auth-mode": "radius",
"auth-server": "10.28.3.43",
"auth-port": 1812,
"auth-secret": "testing123",
"walled-garden-fqdn": [
"*.google.com",
"telecominfraproject.com"
]
}
}
ssid_name = profile_data["ssid_name"]
security_key = profile_data["security_key"]
security = "wpa2"
mode = "BRIDGE"
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