Wireless-Innovation-Forum / 6-GHz-AFC

This repository contains code and data for testing the compliance of Automated Frequency Coordinator (AFC) software. The AFC is defined by the FCC in proceeding 18-295 on Unlicensed Use of the 6 GHz Band. This repository contains procedures, documentation, and tests for such software, and for the devices authorized by it. To contribute, please first read the CONTRIBUTING file in the repository for instructions.
14 stars 3 forks source link

Failed to get AFC response #36

Closed PaidupatiBharath closed 11 months ago

PaidupatiBharath commented 1 year ago

#ISSUE1

I have cloned the code and without modifying the base_url I ran the script and received an error saying as below

AFCS.FSP.1 - INFO: Sending request to AFC via https://localhost:4065/availableSpectrumInquiry... AFCS.FSP.1 - CRITICAL: Encountered exception while running test: HTTPSConnectionPool(host='localhost', port=4065): Max retries exceeded with url: /availableSpectrumInquiry (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe0579fc0d0>: Failed to establish a new connection: [Errno 111] Connection refused')). Test SKIPPED.

I am not sure where we are initializing the AFC server. Is the current code taking care of this by default ?

#ISSUE2

I have downloaded the quick track tool from wifi alliance and started it. It gave me some url and copied the same url to the AFC base url. After running the script I saw a different error as below

AFCS.FSP.1 - INFO: Sending request to AFC via https://localhost:8080/availableSpectrumInquiry... AFCS.FSP.1 - CRITICAL: Encountered exception while running test: HTTPSConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /availableSpectrumInquiry (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)'))). Test SKIPPED.

#ISSUE3

The quick track tool gave me the url with http not with https. So I changed the url to use http. Now I got a different error as below

AFCS.FSP.1 - INFO: Sending request to AFC via http://localhost:8080/availableSpectrumInquiry...
AFCS.FSP.1 - WARNING: Requested a non-https URL, which is disallowed.
AFCS.FSP.1 - CRITICAL: Encountered exception while running test: Non-https URLs are not permitted. Test SKIPPED.

Could you please help me in getting the setup ready to get the AFC response successfully ?

PaidupatiBharath commented 1 year ago

Could you please add the requirements.txt as well to avoid issues with 3rd party dependency libraries ?

AEgbert commented 1 year ago

It sounds like you're trying to use the code from this repository (System Under Test (SUT) test harness, designed for testing AFC systems) with the test harness provided by Wi-Fi Alliance for testing AFC client devices (Device Under Test (DUT) test harness, aka, quick track tool). Is this correct? If so, please note that these two test harnesses were not designed to be used with each other, and attempting to do so may result in some issues occurring.

From what you've said, it sounds like the mock AFC interface within the Wi-Fi Alliance DUT test harness may not accept HTTPS connections. As HTTPS connections are required by Wi-Fi Alliance's AFC System-Device Interface specification, and given that the purpose of the SUT test harness in this repository is to test AFC systems against a variety of requirements (including security requirements, such as HTTPS support), this harness requires an HTTPS connection. These two factors together are the root causes for #ISSUE2 (Wi-Fi Alliance mock AFC may not support HTTPS) and #ISSUE3 (SUT test harness enforces security requirements, including the use of HTTPS). Please note that I have not used the Wi-Fi Alliance DUT test harness, so my assumption that it does not support HTTPS is purely based on your reported #ISSUE2. It's possible that the DUT test harness is listening on a port other than 8080, and you have a different application operating an HTTP-only server at port 8080 on your machine.

Regarding #ISSUE1, it sounds like you've already found how to configure the SUT test harness to connect to an AFC, given the testing you attempted against the DUT test harness's mock AFC. For completeness, the base_url option in src/harness/cfg/afc.toml should be edited to the base URL of the AFC system being tested, as provided by the AFC System operator. If the AFC System under test requires additional client authentication (client-side certificates, OATH2/bearer tokens, etc.), then the relevant fields in the [auth_info] section of afc.toml must also be edited appropriately.

Finally, the required third party libraries are listed in src/harness/README.md. If using pip as a package manager, the required and optional third party libraries can easily be installed by executing pip install requests tomli geopy. If these were not installed correctly on your system, I expect you would have received a relevant error earlier in the execution of the test harness.

For information on setting up the test harness and a demo of its execution, you may wish to consult the AFC system testing webinar, available on YouTube here.

PaidupatiBharath commented 1 year ago

Then your code doesnt provide mock AFC system. From where can i get the mock AFC system ?

AEgbert commented 1 year ago

Correct, this repository provides a harness for executing tests against an AFC system, but does not provide AFC system functionality.

If you're looking for a mock AFC system for use when testing AFC devices, one is provided as part of the AFC DUT test harness that is developed by Wi-Fi Alliance. The source for the DUT test harness is here, and the official release is available here under "AFC Device Under Test (DUT) Specifications and Test Plans Package" -> "AFC DUT Test Harness".

If this isn't what you're looking for (i.e., you're not wanting to test AFC devices), feel free to give me some more info on what you're trying to accomplish and I'll see if I can point you in the right direction.

PaidupatiBharath commented 1 year ago

Actually, I was looking for AFC system functionality and also some python script which will send AFC request to the AFC System without any AP DUT and get the AFC response.

Thats why I was combining both the test harness from you and from Wi-Fi Alliance. I tried downloading Wi-Fi Alliance AFC system and gave that URL in your code. But seems there are some issues in doing that.

Is there any AFC system available for free apart from Wi-Fi Alliance AFC system, since we are seeing some issues with it.?

I have already submitted issue on their github page to get some response.

AEgbert commented 1 year ago

Thanks for the clarifications and follow-up questions. Hopefully the below responses are helpful.

I was looking for AFC system functionality …

Given that you’re looking for AFC system functionality, it may be relevant to note that the Wi-Fi Alliance AFC system included in the DUT test harness is not a “real” AFC system, but rather returns fake/arbitrary responses for the purposes of testing the device. In other words, an actual AFC system would be expected to give significantly different responses than the DUT test harness AFC system provides. Depending on what you’re attempting to accomplish, this may make the DUT test harness AFC system not suitable for your needs, even without the HTTPS support issue.

Is there any AFC system available for free apart from Wi-Fi Alliance AFC system, since we are seeing some issues with it.?

I’m not aware of any publicly available AFC systems. One option for you may be the OpenAFC project, but I’m unsure of what conditions may be required to gain access to their implementation.

I was looking for … also some python script which will send AFC request to the AFC System without any AP DUT and get the AFC response.

For simply sending requests to and receiving responses from an AFC system, you may find the src/harness/afc.py file included in this test harness useful. This file includes the baseline code the harness uses to communicate with AFC systems and includes an example main() that demonstrates sending a request and receiving a response without the additional steps to validate and process the requests and responses against the expected response content. By default, the example main() uses the same src/harness/cfg/afc.toml config file used by the full test harness and sends the request_sample.json request file.