From 7c4789b673f338b3aabd1b97b0c761ac9618ef05 Mon Sep 17 00:00:00 2001 From: Logan Lipke Date: Wed, 30 Dec 2020 16:53:34 -0800 Subject: [PATCH] Added docstring for documentation and usage example --- py-scripts/test_fileio.py | 13 +++++ py-scripts/test_generic.py | 13 ++++- py-scripts/test_ipv4_variable_time.py | 68 +++++++++++++++------------ py-scripts/test_ipv6_connection.py | 10 +++- py-scripts/test_ipv6_variable_time.py | 8 ++++ 5 files changed, 80 insertions(+), 32 deletions(-) diff --git a/py-scripts/test_fileio.py b/py-scripts/test_fileio.py index 12f4f974..1da9d178 100755 --- a/py-scripts/test_fileio.py +++ b/py-scripts/test_fileio.py @@ -1,5 +1,18 @@ #!/usr/bin/env python3 +""" + This script will create a variable number of stations or macvlans to test fileio traffic. Pre-existing stations and + macvlans can be used as well. Command line options are available to update cross-connects as well as using a list of + existing cross-connects if desired. if none are given, cross-connects and endpoints will be created by the script. + Modes such as read-only, write-only, or both can be specified as well as ip addresses and starting numbers for sequential + stations or macvlans that are created in case of limited or pre-existing configurations. The test that is run during + this script will depend on the mode used, a read-only test will check the read-bps column, write-only will check write-bps + and both will check both columns. If the relevant columns increase over the duration of the test it will pass, + otherwise it will fail. + + Use './test_fileio.py --help' to see command line usage and options +""" + import sys if sys.version_info[0] != 3: print("This script requires Python 3") diff --git a/py-scripts/test_generic.py b/py-scripts/test_generic.py index 78207082..f15faad9 100755 --- a/py-scripts/test_generic.py +++ b/py-scripts/test_generic.py @@ -1,4 +1,14 @@ #!/usr/bin/env python3 + +""" + This script will create a variable number of stations to test generic endpoints. Multiple command types can be tested + including ping, speedtest, generic types. The test will check the last result column for different things + depending on what test is being run. Ping will test for successful pings, speedtest will test for download + speed, upload speed, and ping time, generic will test for successful generic commands + + Use './test_generic.py --help' to see command line usage and options +""" + import pprint import sys import os @@ -187,7 +197,8 @@ def main(): prog='test_generic.py', formatter_class=argparse.RawTextHelpFormatter, epilog='''Create generic endpoints and test for their ability to execute chosen commands\n''', - description='''test_generic.py + description=''' +test_generic.py -------------------- Generic command example: python3 ./test_generic.py diff --git a/py-scripts/test_ipv4_variable_time.py b/py-scripts/test_ipv4_variable_time.py index 17819947..2d4d3aed 100755 --- a/py-scripts/test_ipv4_variable_time.py +++ b/py-scripts/test_ipv4_variable_time.py @@ -1,5 +1,13 @@ #!/usr/bin/env python3 +""" + This script will create a variable number of stations each with their own set of cross-connects and endpoints. + It will then create layer 3 traffic over a specified amount of time, testing for increased traffic at regular intervals. + This test will pass if all stations increase traffic over the full test duration. + + Use './test_ipv4_variable_time.py --help' to see command line usage and options +""" + import sys import os @@ -141,37 +149,37 @@ def main(): ''', description='''\ - test_ipv4_variable_time.py: - -------------------- - Generic command layout: +test_ipv4_variable_time.py: +-------------------- +Generic command layout: - python3 ./test_ipv4_variable_time.py - --upstream_port eth1 - --radio wiphy0 - --num_stations 32 - --security {open|wep|wpa|wpa2|wpa3} \\ - --mode 1 - {"auto" : "0", - "a" : "1", - "b" : "2", - "g" : "3", - "abg" : "4", - "abgn" : "5", - "bgn" : "6", - "bg" : "7", - "abgnAC" : "8", - "anAC" : "9", - "an" : "10", - "bgnAC" : "11", - "abgnAX" : "12", - "bgnAX" : "13", - --ssid netgear - --password admin123 - --test_duration 2m (default) - --a_min 1000 - --b_min 1000 - --ap "00:0e:8e:78:e1:76" - --debug +python3 ./test_ipv4_variable_time.py + --upstream_port eth1 + --radio wiphy0 + --num_stations 32 + --security {open|wep|wpa|wpa2|wpa3} \\ + --mode 1 + {"auto" : "0", + "a" : "1", + "b" : "2", + "g" : "3", + "abg" : "4", + "abgn" : "5", + "bgn" : "6", + "bg" : "7", + "abgnAC" : "8", + "anAC" : "9", + "an" : "10", + "bgnAC" : "11", + "abgnAX" : "12", + "bgnAX" : "13", + --ssid netgear + --password admin123 + --test_duration 2m (default) + --a_min 1000 + --b_min 1000 + --ap "00:0e:8e:78:e1:76" + --debug ''') required_args=None diff --git a/py-scripts/test_ipv6_connection.py b/py-scripts/test_ipv6_connection.py index bfea8ccc..c0c22c80 100755 --- a/py-scripts/test_ipv6_connection.py +++ b/py-scripts/test_ipv6_connection.py @@ -1,5 +1,13 @@ #!/usr/bin/env python3 +""" + Script for creating a variable number of stations and attempting to connect them to an SSID using IPv6. + A test will run to verify stations are associated and get an IP, if these conditions are both true, the test will + pass, otherwise, the test will fail. + + Use './test_ipv6_connection.py --help' to see command line usage and options +""" + import sys import os if sys.version_info[0] != 3: @@ -129,7 +137,7 @@ def main(): ''', description='''\ - test_ipv6_connection.py: +test_ipv6_connection.py: -------------------------------------------------- Generic command example: python3 ./test_ipv6_connection.py diff --git a/py-scripts/test_ipv6_variable_time.py b/py-scripts/test_ipv6_variable_time.py index 129d85af..8262e59e 100755 --- a/py-scripts/test_ipv6_variable_time.py +++ b/py-scripts/test_ipv6_variable_time.py @@ -1,5 +1,13 @@ #!/usr/bin/env python3 +""" + This script will create a variable number of stations, using IPv6, each with their own set of cross-connects and endpoints. + It will then create layer 3 traffic over a specified amount of time, testing for increased traffic at regular intervals. + This test will pass if all stations increase traffic over the full test duration. + + Use './test_ipv6_variable_time.py --help' to see command line usage and options +""" + import sys import os