diff --git a/docs/testspec.md b/docs/testspec.md index 6343f1f45a2c29bf038ba8f6b19994e681a0b07a..e46812ba058a857d45d2dffcafc1fe4543cf55ba 100644 --- a/docs/testspec.md +++ b/docs/testspec.md @@ -34,97 +34,42 @@ libubus, and validates it against the objects json-schema. | Execution ID | Method | Description | Function ID Coverage | | :--- | :--- | :--- | :--- | -| 1 | hosts | No argument | [1](./functionspec.md#hosts) | -| 2 | dummy | Negative Test | | - -#### wifi.ap.\<name\> - -| Execution ID | Method | Description | Function ID Coverage | -| :--- | :--- | :--- | :--- | -| 1 | status | No argument | [2](./functionspec.md#status-1) | -| 2 | stats | No argument | [3](./functionspec.md#stats) | -| 3 | assoclist | No argument | [4](./functionspec.md#assoclist) | -| 4 | stations | No argument | [5](./functionspec.md#stations) | -| 5 | stations | With sta argument | [5](./functionspec.md#stations) | -| 6 | list_neighbor | No argument | [10](./functionspec.md#list_neighbor) | -| 7 | list_neighbor | With client argument | [10](./functionspec.md#list_neighbor) | -| 8 | dummy | Negative Test | | - -#### wifi.radio.\<name\> - -| Execution ID | Method | Description | Function ID Coverage | -| :--- | :--- | :--- | :--- | -| 1 | status | No argument | [15](./functionspec.md#status-2) | -| 2 | stats | No argument | [16](./functionspec.md#stats-1) | -| 3 | scanresults | No argument | [19](./functionspec.md#scanresults) | -| 4 | scanresults | With bssid argument | [19](./functionspec.md#scanresults) | -| 5 | get | No argument | [17](./functionspec.md#get) | -| 6 | autochannel | No argument | [20](./functionspec.md#autochannel) | -| 7 | dummy | Negative Test | | - -#### wifi.wps - -| Execution ID | Method | Description | Function ID Coverage | -| :--- | :--- | :--- | :--- | -| 1 | status | No argument | [23](./functionspec.md#status-3) | -| 2 | status | With vif argument | [23](./functionspec.md#status-3) | -| 3 | generate_pin | No argument | [24](./functionspec.md#generate_pin) | -| 4 | validate_pin | With invalid pin argument | [26](./functionspec.md#validate_pin) | -| 5 | validate_pin | With valid pin argument | [26](./functionspec.md#validate_pin) | -| 6 | showpin | No argument | [25](./functionspec.md#showpin) | -| 7 | showpin | With vif argument | [25](./functionspec.md#showpin) | -| 8 | dummy | Negative Test | | - -### Unit Tests - -The wifimngr unit tests are written in cmocka, invoking the ubus callbacks +| 1 | hosts | No argument | [1](./functionspec.md#hosts) | + +### Functional Tests + +The questd functional tests are dependent on ubus and wifimngr. They are +written in cmocka, invoking the ubus callbacks directly from the source code, which is compiled into a shared library. This means mocking the arguments of a cli or libubus invoke in a -`struct blob_attr *`. The results of the call will be logged to the logfile at -`/tmp/test.log`. +`struct blob_attr *`. | Execution ID | Method | Test Case Name | Function ID Coverage | | :--- | :--- | :--- | :--- | -| 1 | disconnect | [test_api_radio_disconnect](#test_api_radio_disconnect) | [6](./functionspec.md#disconnect) | -| 2 | request_transition | [test_api_req_bss_transition](#test_api_req_bss_transition) | [12](./functionspec.md#request_transition)| -| 3 | request_neighbor | [test_api_req_beacon_report](#test_api_req_beacon_report) | [11](./functionspec.md#request_neighbor) | -| 4 | add_neighbor | [test_api_add_nbr](#test_api_add_nbr) | [8](./functionspec.md#add_neighbor) | -| 5 | start | [test_api_wps_start](#test_api_wps_start) | [21](./functionspec.md#start) | -| 6 | stop | [test_api_wps_stop](#test_api_wps_stop) | [22](./functionspec.md#stop) | -| 7 | add_vendor_ie | [test_api_add_vendor_ie](#test_api_add_vendor_ie) | [13](./functionspec.md#add_vendor_ie) | -| 8 | del_vendor_ie | [test_api_del_vendor_ie](#test_api_del_vendor_ie) | [14](./functionspec.md#del_vendor_ie) | -| 9 | del_neighbor | [test_api_del_neighbor](#test_api_del_neighbor) | [9](./functionspec.md#del_neighbor) | -| 10 | monitor | [test_api_monitor_sta](#test_api_monitor_sta) | [7](./functionspec.md#monitor) | -| 11 | scan | [test_api_scan](#test_api_scan) | [18](./functionspec.md#scan) | -| 12 | setpin | [test_set_wps_ap_pin](#test_set_wps_ap_pin) | [27](./functionspec.md#setpin) | -| 13 | autochannel | [test_api_acs](#test_api_acs) | [20](./functionspec.md#autochannel) | - -#### test_api_radio_disconnect +| 1 | hosts | [test_router_hosts](#test_router_hosts) | [1](./functionspec.md#hosts) | +| +#### test_router_hosts ##### Description -Tests the wifimngr ubus API callback `sta_disconnect(5)`, publishing the method -[disconnect](./functionspec.md#disconnect). +Tests the questd ubus API callback `router.network hosts`, publishing the method +[hosts](./functionspec.md#hosts). ##### Test Steps -Prepare the arguments as: -````bash -{ "sta": "50:31:32:33:34:35" } -```` -Iussing a deauthenticate to a 5GHz client from the libwifi test platform. +Run the wifimngr and ubus as a background process. + +Run the test, and observe host information of wireless 5GHz client `test5` and 2.4GHz client `test2` -Read the logfile and verify that the `sta` argument, and interface, was -accurately logged. +are correctly outputted to the command line interface. ##### Test Expected Results -The expected result is for the log file to have recorded a call to the -disconnect function, through the interface `test5` and with the argument `sta` -as `50:31:32:33:34:35`. +The expected result can given as follows. ````bash -[2020-02-04 13:06:12] disconnect: { "ifname": "test5", "sta": "50:31:32:33:34:35" } +[2020-09-14 15:06:12] hosts: {"hosts":[{"macaddr":"50:80:70:60:50:40","ipaddr":"192.168.1.102","addrsrc":"static","leasetmrmn":0,"device":"test5","network":"lan","type":"wifi","hostname":"","active":true,"activelstch":0,"activeconns":0,"dhcpopts":{"vcid":"","clid":"","ucid":""},"ipv4addr":["192.168.1.102"],"ipv6addr":[],"stats":{"tx_packets":251851,"tx_bytes":197716844,"rx_packets":137122,"rx_bytes":198917288}},{"macaddr":"00:e0:4c:68:18:54","ipaddr":"192.168.1.100","addrsrc":"static","leasetmrmn":0,"device":"test2","network":"lan","type":"ethernet","hostname":"","active":true,"activelstch":0,"activeconns":0,"dhcpopts":{"vcid":"","clid":"01:00:e0:4c:68:18:54","ucid":""},"ipv4addr":["192.168.1.100"],"ipv6addr":[],"stats":{"tx_packets":0,"tx_bytes":0,"rx_packets":0,"rx_bytes":0}},{"macaddr":"20:80:70:60:50:40","ipaddr":"192.168.1.101","addrsrc":"static","leasetmrmn":0,"device":"test2","network":"lan","type":"wifi","hostname":"","active":true,"activelstch":0,"activeconns":0,"dhcpopts":{"vcid":"","clid":"","ucid":""},"ipv4addr":["192.168.1.101"],"ipv6addr":[],"stats":{"tx_packets":23241,"tx_bytes":3912221,"rx_packets":40204,"rx_bytes":36176593}}]} + ```` #### test_api_req_bss_transition