instruct people to use update_deps.py

This commit is contained in:
Matthew Stidham
2021-01-26 15:52:45 -08:00
committed by Jed Reynolds
parent be7e94916f
commit 2550204f3e
3 changed files with 118 additions and 87 deletions

View File

@@ -1,7 +1,10 @@
# LANForge Python Scripts
# LANForge Python Scripts
This directory contains python scripts useful for unit-tests. It uses libraries in ../py-json. Please place new tests in this directory. Unless they are libraries, please avoid adding python scripts to ../py-json. Please read https://www.candelatech.com/cookbook/cli/json-python to learn about how to use the LANforge client JSON directly. Review http://www.candelatech.com/scripting_cookbook.php to understand more about scripts in general.
# Getting Started
The first step is to make sure all dependencies are installed in your system by running update_deps.py in this folder.
Please consider using the `LFCliBase` class as your script superclass. It will help you with a consistent set of JSON handling methods and pass and fail methods for recording test results. Below is a sample snippet that includes LFCliBase:
if 'py-json' not in sys.path:
@@ -12,11 +15,11 @@ Please consider using the `LFCliBase` class as your script superclass. It will h
from LANforge.LFUtils import *
import realm
from realm import Realm
class Eggzample(LFCliBase):
def __init__(self, lfclient_host, lfclient_port):
super().__init__(lfclient_host, lfclient_port, debug=True)
def main():
eggz = Eggzample("http://localhost", 8080)
frontpage_json = eggz.json_get("/")
@@ -25,7 +28,7 @@ Please consider using the `LFCliBase` class as your script superclass. It will h
"message": "hello world"
}
eggz.json_post("/cli-json/gossip", data, debug_=True)
if __name__ == "__main__":
main()
@@ -47,14 +50,14 @@ The above example will stimulate output on the LANforge client websocket `ws://l
* /stations: entities that are associated to your virtual access points (vAP)
There are more URIs you can explore, these are the more useful ones.
#### Scripts included are:
#### Scripts included are:
* `cicd_TipIntegration.py`: battery of TIP tests that include upgrading DUT and executing sta_connect script
* `cicd_testrail.py`:
* `cicd_testrail.py`:
* `function send_get`: Issues a GET request (read) against the API.
* `function send_post`: Issues a write against the API.
* `function __send_request`:
* `function __send_request`:
* `function get_project_id`: Gets the project ID using the project name
* `function get_run_id`: Gets the run ID using test name and project name
* `function update_testrail`: Update TestRail for a given run_id and case_id
@@ -74,7 +77,7 @@ There are more URIs you can explore, these are the more useful ones.
* `run_cv_scenario.py`:
* class `RunCvScenario`: imports the LFCliBase class.
* function `get_report_file_name`: returns report name
* function `build`: loads and sends the ports available?
* function `build`: loads and sends the ports available?
* function `start`: /gui_cli takes commands keyed on 'cmd' and this function create an array of commands
* `sta_connect.py`: This function creates a station, create TCP and UDP traffic, run it a short amount of time,
and verify whether traffic was sent and received. It also verifies the station connected
@@ -88,7 +91,7 @@ There are more URIs you can explore, these are the more useful ones.
* function `remove_stations`: removes all stations
* function `num_associated`:
* function `clear_test_results`:
* function `run`:
* function `run`:
* function `setup`:
* function `start`:
* function `stop`:
@@ -103,61 +106,61 @@ There are more URIs you can explore, these are the more useful ones.
* function `get_upstream_url`:
* function `compare_vals`: compares pre-test values to post-test values
* function `remove_stations`: removes all ports
* function `num_associated`:
* function `num_associated`:
* function `clear_test_results`
* function `setup`: verifies upstream url, creates stations and turns dhcp on, creates endpoints,
UDP endpoints,
* function `start`:
* function `start`:
* function `stop`:
* function `cleanup`:
* function `main`:
* function `main`:
* `sta_connect_example.py`: example of how to instantiate StaConnect and run the test
* `sta_connect_multi_example.py`: example of how to instantiate StaConnect and run the test and create multiple OPEN stations,have
some stations using WPA2
* `sta_connect_multi_example.py`: example of how to instantiate StaConnect and run the test and create multiple OPEN stations,have
some stations using WPA2
* `stations_connected.py`: Contains examples of using realm to query stations and get specific information from them
* `test_ipv4_connection.py`: This script will create a variable number of stations that will attempt to connect to a chosen SSID using a provided password and security type.
The test is considered passed if all stations are able to associate and obtain IPV4 addresses
* `test_ipv4_connection.py`: This script will create a variable number of stations that will attempt to connect to a chosen SSID using a provided password and security type.
The test is considered passed if all stations are able to associate and obtain IPV4 addresses
* class `IPv4Test`
* function `build`: This function will use the given parameters (Number of stations, SSID, password, and security type) to create a series of stations.
* function `start`: This function will admin-up the stations created in the build phase. It will then check all stations periodically for association and IP addresses.
This will continue until either the specified timeout has been reached or all stations obtain an IP address.
* function `stop`: This function will admin-down all stations once one of the ending criteria is met.
* function `start`: This function will admin-up the stations created in the build phase. It will then check all stations periodically for association and IP addresses.
This will continue until either the specified timeout has been reached or all stations obtain an IP address.
* function `stop`: This function will admin-down all stations once one of the ending criteria is met.
* function `cleanup`: This function will clean up all stations created during the test.
* command line options :
* `--mgr`: Specifies the hostname where LANforge is running. Defaults to http://localhost
* `--mgr_port`: Specifies the port to use when connecting to LANforge. Defaults to 8080
* `--ssid`: Specifies SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--security`: Specifies security type (WEP, WPA, WPA2, WPA3, Open) of SSID to be used in the test
* `--num_stations`: Specifies number of stations to create for the test
* `--radio`: Specifies the radio to be used in the test. Eg wiphy0
* `--debug`: Turns on debug output for the test
* `--help`: Displays help output for the script
* `test_ipv6_connection.py`: This script will create a variable number of stations that will attempt to connect to a chosen SSID using a provided password and security type.
The test is considered passed if all stations are able to associate and obtain IPV6 addresses
* `test_ipv6_connection.py`: This script will create a variable number of stations that will attempt to connect to a chosen SSID using a provided password and security type.
The test is considered passed if all stations are able to associate and obtain IPV6 addresses
* class `IPv6Test`
* function `build`: This function will use the given parameters (Number of stations, SSID, password, and security type) to create a series of stations.
* function `start`: This function will admin-up the stations created in the build phase. It will then check all stations periodically for association and IP addresses.
This will continue until either the specified timeout has been reached or all stations obtain an IP address.
* function `stop`: This function will admin-down all stations once one of the ending criteria is met.
* function `start`: This function will admin-up the stations created in the build phase. It will then check all stations periodically for association and IP addresses.
This will continue until either the specified timeout has been reached or all stations obtain an IP address.
* function `stop`: This function will admin-down all stations once one of the ending criteria is met.
* function `cleanup`: This function will clean up all stations created during the test.
* Command line options :
* `--mgr`: Specifies the hostname where LANforge is running. Defaults to http://localhost
* `--mgr_port`: Specifies the port to use when connecting to LANforge. Defaults to 8080
* `--ssid`: Specifies SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--security`: Specifies security type (WEP, WPA, WPA2, WPA3, Open) of SSID to be used in the test
* `--num_stations`: Specifies number of stations to create for the test
* `--radio`: Specifies the radio to be used in the test. Eg wiphy0
* `--debug`: Turns on debug output for the test
* `--help`: Displays help output for the script
* `test_l3_unicast_traffic_gen.py`: This script will create stations, create traffic between upstream port and stations, run traffic.
* `test_l3_unicast_traffic_gen.py`: This script will create stations, create traffic between upstream port and stations, run traffic.
The traffic on the stations will be checked once per minute to verify that traffic is transmitted and received.
Test will exit on failure of not receiving traffic for one minute on any station.
* class `L3VariableTimeLongevity`
@@ -170,10 +173,10 @@ Test will exit on failure of not receiving traffic for one minute on any station
* `-d, --test_duration`: Determines the total length of the test. Consists of number followed by letter indicating length
10m would be 10 minutes or 3d would be 3 days. Available options for length are Day (d), Hour (h), Minute (m), or Second (s)
* `-t, --endp_type`: Specifies type of endpoint to be used in the test. Options are lf_udp, lf_udp6, lf_tcp, lf_tcp6
* `-u, --upstream_port`: This is the upstream port to be used for traffic. An upstream port is some data source on the wired LAN or WAN beyond the AP
* `-u, --upstream_port`: This is the upstream port to be used for traffic. An upstream port is some data source on the wired LAN or WAN beyond the AP
* `-r, --radio`: This switch will determine the radio name, number of stations, ssid, and ssid password. Security type is fixed at WPA2.
Usage of this switch could look like: `--radio wiphy1 64 candelaTech-wpa2-x2048-5-3 candelaTech-wpa2-x2048-5-3`
* `test_ipv4_l4_urls_per_ten.py`: This script measure the number of urls per ten minutes over layer 4 traffic
* class `IPV4L4`
* function `build`: This function will create all stations and cross-connects to be used in the test
@@ -186,17 +189,17 @@ Test will exit on failure of not receiving traffic for one minute on any station
* `--mgr`: Specifies the hostname where LANforge is running. Defaults to http://localhost
* `--mgr_port`: Specifies the port to use when connecting to LANforge. Defaults to 8080
* `--ssid`: Specifies SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--security`: Specifies security type (WEP, WPA, WPA2, WPA3, Open) of SSID to be used in the test
* `--num_stations`: Specifies number of stations to create for the test
* `--radio`: Specifies the radio to be used in the test. Eg wiphy0
* `--requests_per_ten`: Configures the number of request per ten minutes
* `--num_tests`: Configures the number of tests to be run. Each test runs for ten minutes
* `--url`: Specifies the upload/download, address, and destination. Example: dl http://10.40.0.1 /dev/null
* `--target_per_ten`: Rate of target urls per ten minutes. 90% of this value will be considered the threshold for a passed test.
* `--target_per_ten`: Rate of target urls per ten minutes. 90% of this value will be considered the threshold for a passed test.
* `--debug`: Turns on debug output for the test
* `--help`: Displays help output for the script
* `test_ipv4_l4_ftp_urls_per_ten.py`: This script measure the number of urls per ten minutes over layer 4 ftp traffic
* class `IPV4L4`
@@ -210,29 +213,29 @@ Test will exit on failure of not receiving traffic for one minute on any station
* `--mgr`: Specifies the hostname where LANforge is running. Defaults to http://localhost
* `--mgr_port`: Specifies the port to use when connecting to LANforge. Defaults to 8080
* `--ssid`: Specifies SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--security`: Specifies security type (WEP, WPA, WPA2, WPA3, Open) of SSID to be used in the test
* `--num_stations`: Specifies number of stations to create for the test
* `--radio`: Specifies the radio to be used in the test. Eg wiphy0
* `--requests_per_ten`: Configures the number of request per ten minutes
* `--num_tests`: Configures the number of tests to be run. Each test runs for ten minutes
* `--url`: Specifies the upload/download, address, and destination. Example: dl http://10.40.0.1 /dev/null
* `--target_per_ten`: Rate of target urls per ten minutes. 90% of this value will be considered the threshold for a passed test.
* `--target_per_ten`: Rate of target urls per ten minutes. 90% of this value will be considered the threshold for a passed test.
* `--debug`: Turns on debug output for the test
* `--help`: Displays help output for the script
* `test_generic`:
* class `GenTest`: This script will create
* class `GenTest`: This script will create
* function `build`: This function will create the stations and cross-connects to be used during the test.
* function `start`: This function will start traffic and measure different values dependent on the command chosen.
* function `start`: This function will start traffic and measure different values dependent on the command chosen.
Commands currently available for use: lfping, generic, and speedtest.
* function `stop`: This function will admin-down stations, stop traffic on cross-connects and cleanup any stations or cross-connects associated with the test.
* function `cleanup`: This function will remove any stations and cross-connects created during the test.
* Command line options:
* Command line options:
* `--mgr`: Specifies the hostname where LANforge is running. Defaults to http://localhost
* `--mgr_port`: Specifies the port to use when connecting to LANforge. Defaults to 8080
* `--ssid`: Specifies SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--password`: Specifies the password for the SSID to be used in the test
* `--security`: Specifies security type (WEP, WPA, WPA2, WPA3, Open) of SSID to be used in the test
* `--num_stations`: Specifies number of stations to create for the test
* `--radio`: Specifies the radio to be used in the test. Eg wiphy0
@@ -263,6 +266,3 @@ Test will exit on failure of not receiving traffic for one minute on any station
* class `VapStations`
* function `run`:
* function `main`: