mirror of
				https://github.com/Telecominfraproject/wlan-testing.git
				synced 2025-10-31 02:48:11 +00:00 
			
		
		
		
	Update Band Steering testcase
Signed-off-by: bhargavi-ct <bhargavimamidipaka@candelatech.com>
This commit is contained in:
		| @@ -2755,6 +2755,11 @@ class UProfileUtility: | |||||||
|                     ssid_info[options] = ssid_data[options] |                     ssid_info[options] = ssid_data[options] | ||||||
|                 if options == "captive": |                 if options == "captive": | ||||||
|                     ssid_info[options] = ssid_data[options] |                     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"]: |             for i in ssid_data["appliedRadios"]: | ||||||
|                 ssid_info["wifi-bands"].append(i) |                 ssid_info["wifi-bands"].append(i) | ||||||
|             ssid_info['encryption'] = {} |             ssid_info['encryption'] = {} | ||||||
| @@ -2798,6 +2803,13 @@ class UProfileUtility: | |||||||
|                 if options == "captive": |                 if options == "captive": | ||||||
|                     ssid_info[options] = ssid_data[options] |                     ssid_info[options] = ssid_data[options] | ||||||
|                     ssid_info["services"] = ["captive"] |                     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"]: |             for i in ssid_data["appliedRadios"]: | ||||||
|                 ssid_info["wifi-bands"].append(i) |                 ssid_info["wifi-bands"].append(i) | ||||||
|             ssid_info['encryption'] = {} |             ssid_info['encryption'] = {} | ||||||
| @@ -2819,6 +2831,7 @@ class UProfileUtility: | |||||||
|                     "port": radius_accounting_data["port"], |                     "port": radius_accounting_data["port"], | ||||||
|                     "secret": radius_accounting_data["secret"] |                     "secret": radius_accounting_data["secret"] | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|         if self.mode == "NAT": |         if self.mode == "NAT": | ||||||
|             self.base_profile_config['interfaces'][1]['ssids'].append(ssid_info) |             self.base_profile_config['interfaces'][1]['ssids'].append(ssid_info) | ||||||
|             if open_roaming is True: |             if open_roaming is True: | ||||||
|   | |||||||
| @@ -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 |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -10,16 +10,49 @@ pytestmark = [pytest.mark.band_steering_tests, pytest.mark.bridge] | |||||||
| setup_params_general = { | setup_params_general = { | ||||||
|     "mode": "BRIDGE", |     "mode": "BRIDGE", | ||||||
|     "ssid_modes": { |     "ssid_modes": { | ||||||
|         "wpa2_personal": [{"ssid_name": "bandsteering_2", "appliedRadios": ["2G"], "security_key": "something"}, |         "wpa2_personal": [ | ||||||
|                           {"ssid_name": "bandsteering_2", "appliedRadios": ["5G"], "security_key": "something"}]}, |             {"ssid_name": "bandsteering_2", | ||||||
|     "rf": {}, |              "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 |     "radius": False | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @allure.feature("Band Steering") | @allure.feature("Band Steering") | ||||||
| @allure.parent_suite("Band Steering Tests") | @allure.parent_suite("Band Steering Tests") | ||||||
| @allure.suite(suite_name="BRIDGE Mode") | @allure.suite(suite_name="WPA2 PERSONAL") | ||||||
| @allure.sub_suite(sub_suite_name="General security mode Band Steering") | @allure.sub_suite(sub_suite_name="Test Band Steering with WPA2 Personal") | ||||||
| @pytest.mark.parametrize( | @pytest.mark.parametrize( | ||||||
|     'setup_configuration', |     'setup_configuration', | ||||||
|     [setup_params_general], |     [setup_params_general], | ||||||
| @@ -42,7 +75,7 @@ class TestBandSteering(object): | |||||||
|     @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-14518", name="JIRA LINK") |     @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, |     def test_band_steering_wpa2_personal(self, get_test_library, get_target_object, check_connectivity, | ||||||
|                                                 setup_configuration, client_type, get_testbed_details): |                                                 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" |             pytest -m "band_steering_tests and bridge and wpa2_personal" | ||||||
|         """ |         """ | ||||||
|         profile_data = {"ssid_name": "bandsteering_2", "appliedRadios": ["2G", "5G"]} |         profile_data = {"ssid_name": "bandsteering_2", "appliedRadios": ["2G", "5G"]} | ||||||
| @@ -52,39 +85,12 @@ class TestBandSteering(object): | |||||||
|         mode = "BRIDGE" |         mode = "BRIDGE" | ||||||
|         band = "twog" |         band = "twog" | ||||||
|         num_sta = 1 |         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, |         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, |                                        mode=mode, band=band, pre_cleanup=False, num_sta=num_sta, scan_ssid=True, | ||||||
|                                        station_data=["ip", "alias", "mac", "channel", "port type", "security", |                                        station_data=["ip", "alias", "mac", "channel", "port type", "security", | ||||||
|                                                              "ap", "parent dev"], |                                                              "ap", "parent dev"], | ||||||
|                                        allure_attach=True, dut_data=setup_configuration, |                                        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: |         if not pass_fail: | ||||||
|             pytest.fail(f"Test failed with the following reasons: \n{message}") |             pytest.fail(f"Test failed with the following reasons: \n{message}") | ||||||
		Reference in New Issue
	
	Block a user
	 bhargavi-ct
					bhargavi-ct