From 8ddf8e41ba31aefaa60a4013c96c47c9d61dec9c Mon Sep 17 00:00:00 2001 From: bhargavi-ct Date: Fri, 20 Jun 2025 12:44:03 +0530 Subject: [PATCH] Update Band Steering testcase Signed-off-by: bhargavi-ct --- libs/tip_2x/controller.py | 13 +++ .../basic/band_steer/bandsteer_config.json | 95 ------------------- .../band_steer/wpa2_personal/__init__.py | 0 .../{ => wpa2_personal}/test_bandsteer.py | 74 ++++++++------- 4 files changed, 53 insertions(+), 129 deletions(-) delete mode 100644 tests/e2e/basic/band_steer/bandsteer_config.json create mode 100644 tests/e2e/basic/band_steer/wpa2_personal/__init__.py rename tests/e2e/basic/band_steer/{ => wpa2_personal}/test_bandsteer.py (55%) diff --git a/libs/tip_2x/controller.py b/libs/tip_2x/controller.py index 50daf1390..364cdefe8 100644 --- a/libs/tip_2x/controller.py +++ b/libs/tip_2x/controller.py @@ -2755,6 +2755,11 @@ class UProfileUtility: ssid_info[options] = ssid_data[options] if options == "captive": ssid_info[options] = ssid_data[options] + if options == "wifi-steering": + ssid_info[options] = ssid_data[options] + ssid_info["services"] = ["wifi-steering"] + if options == "roaming" and ssid_data[options] == True: + ssid_info[options] = ssid_data[options] for i in ssid_data["appliedRadios"]: ssid_info["wifi-bands"].append(i) ssid_info['encryption'] = {} @@ -2798,6 +2803,13 @@ class UProfileUtility: if options == "captive": ssid_info[options] = ssid_data[options] ssid_info["services"] = ["captive"] + if options == "wifi-steering": + ssid_info[options] = ssid_data[options] + ssid_info["services"] = ["wifi-steering"] + if options == "roaming" and ssid_data[options] == True: + ssid_info[options] = ssid_data[options] + + for i in ssid_data["appliedRadios"]: ssid_info["wifi-bands"].append(i) ssid_info['encryption'] = {} @@ -2819,6 +2831,7 @@ class UProfileUtility: "port": radius_accounting_data["port"], "secret": radius_accounting_data["secret"] } + if self.mode == "NAT": self.base_profile_config['interfaces'][1]['ssids'].append(ssid_info) if open_roaming is True: diff --git a/tests/e2e/basic/band_steer/bandsteer_config.json b/tests/e2e/basic/band_steer/bandsteer_config.json deleted file mode 100644 index e1e9339e7..000000000 --- a/tests/e2e/basic/band_steer/bandsteer_config.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "uuid": 2, - "radios": [ - { - "band": "5G", - "country": "CA", - "channel-mode": "HE", - "channel-width": 80 - }, - { - "band": "2G", - "country": "CA", - "channel-mode": "HE", - "channel-width": 80 - } - ], - "interfaces": [ - { - "name": "WAN", - "role": "upstream", - "ethernet": [ - { - "select-ports": [ - "WAN*" - ] - } - ], - "ipv4": { - "addressing": "dynamic" - }, - "ssids": [ - { - "name": "bandsteering_2", - "wifi-bands": [ - "5G", - "2G" - ], - "bss-mode": "ap", - "encryption": { - "proto": "psk2", - "key": "password@123", - "ieee80211w": "optional" - }, - "roaming": true, - - "services": [ "wifi-steering" ] - } - ] - }, - { - "name": "LAN", - "role": "downstream", - "services": [ "ssh" ], - "ethernet": [ - { - "select-ports": [ - "LAN*" - ] - } - ], - "ipv4": { - "addressing": "static", - "subnet": "192.168.1.1/24", - "dhcp": { - "lease-first": 10, - "lease-count": 100, - "lease-time": "6h" - } - } - } - ], - "metrics": { - "statistics": { - "interval": 120, - "types": [ "ssids", "lldp", "clients" ] - }, - "health": { - "interval": 120 - } - }, - "services": { - "wifi-steering": { - "mode": "local", - "network": "upstream", - "assoc-steering": true, - "required-snr": -85, - "required-probe-snr": -80, - "required-roam-snr": -80, - "load-kick-threshold": 90 - }, - "ssh": { - "port": 22 - } - } -} \ No newline at end of file diff --git a/tests/e2e/basic/band_steer/wpa2_personal/__init__.py b/tests/e2e/basic/band_steer/wpa2_personal/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/e2e/basic/band_steer/test_bandsteer.py b/tests/e2e/basic/band_steer/wpa2_personal/test_bandsteer.py similarity index 55% rename from tests/e2e/basic/band_steer/test_bandsteer.py rename to tests/e2e/basic/band_steer/wpa2_personal/test_bandsteer.py index 65e605a1d..6d7f66d8e 100644 --- a/tests/e2e/basic/band_steer/test_bandsteer.py +++ b/tests/e2e/basic/band_steer/wpa2_personal/test_bandsteer.py @@ -10,16 +10,49 @@ pytestmark = [pytest.mark.band_steering_tests, pytest.mark.bridge] setup_params_general = { "mode": "BRIDGE", "ssid_modes": { - "wpa2_personal": [{"ssid_name": "bandsteering_2", "appliedRadios": ["2G"], "security_key": "something"}, - {"ssid_name": "bandsteering_2", "appliedRadios": ["5G"], "security_key": "something"}]}, - "rf": {}, + "wpa2_personal": [ + {"ssid_name": "bandsteering_2", + "appliedRadios": ["2G", "5G"], + "security": "psk2", + "security_key": "password@123", + "roaming": True, + "wifi-steering": + { + "mode": "local", + "network": "upstream", + "assoc-steering": True, + "required-snr": -85, + "required-probe-snr": -80, + "required-roam-snr": -80, + "load-kick-threshold": 90 + } + } + ]}, + "rf": { + "2G": { + "band": "2G", + "country": "CA", + "channel-width": 80, + "channel-mode": "HE" + }, + "5G": { + "band": "5G", + "country": "CA", + "channel-width": 80, + "channel-mode": "HE" + }, + "6G": { + "band": "6G", + "channel-mode": "HE" + } + }, "radius": False } @allure.feature("Band Steering") @allure.parent_suite("Band Steering Tests") -@allure.suite(suite_name="BRIDGE Mode") -@allure.sub_suite(sub_suite_name="General security mode Band Steering") +@allure.suite(suite_name="WPA2 PERSONAL") +@allure.sub_suite(sub_suite_name="Test Band Steering with WPA2 Personal") @pytest.mark.parametrize( 'setup_configuration', [setup_params_general], @@ -42,7 +75,7 @@ class TestBandSteering(object): @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-14518", name="JIRA LINK") def test_band_steering_wpa2_personal(self, get_test_library, get_target_object, check_connectivity, setup_configuration, client_type, get_testbed_details): - """ wpa2 personal + """ Validate steering and data path connectivity pytest -m "band_steering_tests and bridge and wpa2_personal" """ profile_data = {"ssid_name": "bandsteering_2", "appliedRadios": ["2G", "5G"]} @@ -52,39 +85,12 @@ class TestBandSteering(object): mode = "BRIDGE" band = "twog" num_sta = 1 - - #BandSteering Configuration - test_file_dir = os.path.dirname(os.path.abspath(__file__)) - file_path = os.path.join(test_file_dir, 'bandsteer_config.json') - with open(file_path, 'r') as file: - json_string = file.read() - config_data = json.loads(json_string) - - device_name = get_testbed_details['device_under_tests'][0]['identifier'] - payload = {"configuration": json.dumps(config_data), "serialNumber": device_name, "UUID": 2} - - path = "device/" + device_name + "/configure" - uri = get_target_object.controller_library_object.build_uri(path) - logging.info(f"uri::{uri}") - resp = requests.post(uri, data=json.dumps(payload, indent=2), - headers=get_target_object.controller_library_object.make_headers(), verify=False, - timeout=120) - - logging.info(f"response:,{resp}") - if resp.status_code == 200: - logging.info("BandSteering configuration applied successfully") - allure.attach(name=f"Response for Configuration - {resp.status_code} {resp.reason}", - body=str(resp.json())) - else: - allure.attach(name=f"Response for Configuration - {resp.status_code} {resp.reason}", - body=f"TEST FAILED, Configuration is not applied successful {str(resp.json())}") - pass_fail, message = get_test_library.band_steering_test(ssid=ssid, passkey=security_key, security=security, mode=mode, band=band, pre_cleanup=False, num_sta=num_sta, scan_ssid=True, station_data=["ip", "alias", "mac", "channel", "port type", "security", "ap", "parent dev"], allure_attach=True, dut_data=setup_configuration, - get_target_object=get_target_object, config_data=config_data) + get_target_object=get_target_object, get_testbed_details=get_testbed_details) if not pass_fail: pytest.fail(f"Test failed with the following reasons: \n{message}")