def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv6_connection.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
            Create stations that attempt to authenticate, associate, and receive IPV6 addresses on the 
            chosen SSID
                ''',

        description='''\
    test_ipv6_connection.py:
--------------------
Generic command example:
python3 ./test_ipv6_connection.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --dest 10.40.0.1 \\
    --test_duration 2m \\
    --interval 1s \\
    -- timeout 120 \\
    --debug
            ''')

    parser.add_argument('--timeout', help='--timeout sets the length of time to wait until a connection is successful', default=120)

    args = parser.parse_args()
    num_sta=2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ipv6_test = IPv6Test(host=args.mgr, port=args.mgr_port,
                         ssid=args.ssid,
                         password=args.passwd,
                         security=args.security,
                         sta_list=station_list)
    ipv6_test.cleanup(station_list)
    ipv6_test.build()
    if not ipv6_test.passes():
        print(ipv6_test.get_fail_message())
        exit(1)
    ipv6_test.start(station_list, False, False)
    ipv6_test.stop()
    if not ipv6_test.passes():
        print(ipv6_test.get_fail_message())
        exit(1)
    time.sleep(10)
    ipv6_test.cleanup(station_list)
    if ipv6_test.passes():
        print("Full test passed, all stations associated and got IP")
Exemplo n.º 2
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='example_wpa_connection.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Example code that creates a specified amount of stations on a specified SSID using WPA security.
                ''',
        description='''\
        example_wpa_connection.py
        --------------------

        Generic command example:
    python3 ./example_wpa_connection.py  \\
        --host localhost (optional) \\
        --port 8080  (optional) \\
        --num_stations 3 \\
        --ssid netgear-wpa \\
        --passwd admin123-wpa \\
        --radio wiphy1
        --debug 
            ''')

    parser.add_argument('--test_duration',
                        help='--test_duration sets the duration of the test',
                        default="5m")
    parser.add_argument(
        '--url',
        help='--url specifies upload/download, address, and dest',
        default="dl http://10.40.0.1 /dev/null")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPv4Test(lfjson_host,
                       lfjson_port,
                       ssid=args.ssid,
                       password=args.passwd,
                       radio=args.radio,
                       security="wpa",
                       sta_list=station_list)
    ip_test.cleanup(station_list)
    ip_test.timeout = 60
    ip_test.build()
Exemplo n.º 3
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='example_wpa3_connection.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Example code that creates a specified amount of stations on a specified SSID using WPA3 security.
                ''',
        description='''\
        example_wpa_connection.py
        --------------------

        Generic command example:
    python3 ./example_wpa_connection.py  \\
        --host localhost (optional) \\
        --port 8080  (optional) \\
        --num_stations 3 \\
        --security {open|wep|wpa|wpa2|wpa3} \\
        --ssid netgear-wpa3 \\
        --passwd admin123-wpa3 \\
        --debug 

    Note:   multiple --radio switches may be entered up to the number of radios available:
                     --radio wiphy0 <stations> <ssid> <ssid password>  --radio <radio 01> <number of last station> <ssid> <ssid password>
            ''')

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)
    ip_test = IPv4Test(lfjson_host,
                       lfjson_port,
                       ssid=args.ssid,
                       password=args.passwd,
                       radio=args.radio,
                       security=args.security,
                       sta_list=station_list)
    ip_test.cleanup(station_list)
    ip_test.timeout = 60
    ip_test.build()
Exemplo n.º 4
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='example_security_connection.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Example flags and command line input to run the script.
                ''',

        description='''\
        example_security_connection.py
        --------------------
        This python script creates an inputted number of stations using user-inputted security. This verifies that the most basic form of security works with the LANforge device.
        --------------------

        Generic command example:
    python3 ./example_security_connection.py  \\
        --host localhost (optional) \\
        --port 8080  (optional) \\
        --num_stations 6 \\
        --radio wiphy2
        --security {open|wep|wpa|wpa2|wpa3} \\
        --ssid netgear-wpa3 \\
        --passwd admin123-wpa3 \\
        --debug 

            ''')

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                        start_id_=0,
                                        end_id_=num_sta-1,
                                        padding_number_=10000,
                                        radio=args.radio)
    ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio,
                       security=args.security, sta_list=station_list)
    ip_test.cleanup(station_list)
    ip_test.timeout = 60
    ip_test.build()
Exemplo n.º 5
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='example_wpa3_connection.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Example code that creates a specified amount of stations on a specified SSID using WPA3 security.
                ''',
        description='''\
        example_wpa3_connection.py
        --------------------

        Generic command example:
    python3 ./example_wpa3_connection.py  
        --host localhost (optional) 
        --port 8080  (optional) 
        --num_stations 3 
        --ssid netgear-wpa3 
        --passwd admin123-wpa3 
        --radio wiphy1
        --debug 
            ''')

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)
    ip_test = IPv4Test(lfjson_host,
                       lfjson_port,
                       ssid=args.ssid,
                       password=args.passwd,
                       radio=args.radio,
                       security="wpa3",
                       sta_list=station_list)
    ip_test.cleanup(station_list)
    ip_test.timeout = 60
    ip_test.build()
def main():

    parser = LFCliBase.create_basic_argparse(
        prog='example_open_connection.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Example code that creates a specified amount of stations on a specified SSID using Open security.
                ''',

        description='''\
        example_open_connection.py
        --------------------

        Generic command example:
    python3 ./example_open_connection.py  
        --mgr localhost  
        --mgr_port 8080   
        --num_stations 3 
        --radio wiphy1 
        --ssid netgear-open 
        --passwd [BLANK]
        --debug 
            ''')

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_sta = int(args.num_stations)

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                        start_id_=0,
                                        end_id_=num_sta-1,
                                        padding_number_=10000)
    ip_test = IPv4Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd,
                       security="open", radio=args.radio, sta_list=station_list)
    ip_test.cleanup(station_list)
    ip_test.timeout = 60
    ip_test.build()
def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv6_variable_time.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
        Create stations to test IPV6 connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open)
            ''',

        description='''\
test_ipv6_variable_time.py:
--------------------
Generic command example:
python3 ./test_ipv6_connection.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --dest 10.40.0.1 \\
    --test_duration 2m \\
    --interval 1s \\
    --a_min 256000 \\
    --b_min 256000 \\
    --debug
            ''')

    parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
    parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
    parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ip_var_test = IPV6VariableTime(host=args.mgr, port=args.mgr_port,
                                   number_template="00",
                                   sta_list=station_list,
                                   name_prefix="VT",
                                   upstream=args.upstream_port,
                                   ssid=args.ssid,
                                   password=args.passwd,
                                   radio=args.radio,
                                   security=args.security, test_duration=args.test_duration, use_ht160=False,
                                   side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug)

    ip_var_test.pre_cleanup()
    ip_var_test.build()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    ip_var_test.start(False, False)
    ip_var_test.stop()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_var_test.cleanup()
    if ip_var_test.passes():
        print("Full test passed, all connections increased rx bytes")
Exemplo n.º 8
0
def main():
    host = "localhost"
    base_url = "http://%s:8080" % host
    resource_id = 1  # typically you're using resource 1 in stand alone realm
    radio = "wiphy0"
    start_id = 200
    end_id = 202
    padding_number = 10000  # the first digit of this will be deleted
    ssid = "jedway-wpa2-x2048-4-1"
    passphrase = "jedway-wpa2-x2048-4-1"

    parser = argparse.ArgumentParser(description="test creating a station")
    parser.add_argument("-m",
                        "--host",
                        type=str,
                        help="json host to connect to")
    parser.add_argument("-r",
                        "--radio",
                        type=str,
                        help="radio to create a station on")
    parser.add_argument("-a",
                        "--start_id",
                        type=int,
                        help="starting station id")
    parser.add_argument("-b", "--end_id", type=int, help="ending station id")
    parser.add_argument("-s", "--ssid", type=str, help="station ssid")
    parser.add_argument("-p", "--passwd", type=str, help="password for ssid")

    args = None
    try:
        args = parser.parse_args()
        if (args.host is not None):
            host = args.host,
            baseurl = base_url = "http://%s:8080" % host
        if (args.radio is not None):
            radio = args.radio
        if (args.start_id is not None):
            start_id = args.start_id
        if (args.end_id is not None):
            end_id = args.end_id
        if (args.ssid is not None):
            ssid = args.ssid
        if (args.passwd is not None):
            passphrase = args.passwd
    except Exception as e:
        logging.exception(e)
        usage()
        exit(2)

    # station numbers are heavily manipulated strings, often using manual padding
    # sta200 is not sta0200 nor sta00200, and we can format these numbers by adding
    # a 1000 or 10000 to the station id, and trimming the first digit off

    j_printer = pprint.PrettyPrinter(indent=2)
    json_post = ""
    json_response = ""
    found_stations = []
    lf_r = LFRequest.LFRequest(base_url + "/port/1/1/wiphy0")
    wiphy0_json = lf_r.getAsJson()
    if (wiphy0_json is None) or (wiphy0_json['interface'] is None):
        print("Unable to find radio. Are we connected?")
        exit(1)

    # If you need to inspect a radio....
    #print("# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
    #print("# radio wiphy0                                              -")
    #print("# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
    #LFUtils.debug_printer.pprint(wiphy0_json['interface']['alias'])
    #parent_radio_mac = wiphy0_json['interface']['mac']
    #print("# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Example 1                                                 -
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # This section uses URLs /cli-form/rm_vlan, /cli-form/add_sta
    # The /cli-form URIs take URL-encoded form posts
    #
    # For each of the station names, delete them if they exist. It
    # takes a few milliseconds to delete them, so after deleting them
    # you need to poll until they don't appear.
    #
    # NOTE: the ID field of the EID is ephemeral, so best stick to
    # requesting the station name. The station name can be formatted
    # with leading zeros, sta00001 is legal
    # and != {sta0001, sta001, sta01, or sta1}

    desired_stations = LFUtils.portNameSeries("sta", start_id, end_id,
                                              padding_number)
    #LFUtils.debug_printer.pprint(desired_stations)
    print("Example 1: will create stations %s" % (",".join(desired_stations)))
    for sta_name in desired_stations:
        url = base_url + "/port/1/%s/%s" % (resource_id, sta_name)
        print("Ex 1: Checking for station : " + url)
        lf_r = LFRequest.LFRequest(url)
        json_response = lf_r.getAsJson(show_error=False)
        if (json_response != None):
            found_stations.append(sta_name)

    for sta_name in found_stations:
        print("Ex 1: Deleting station %s ...." % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-form/rm_vlan")
        lf_r.addPostData({
            "shelf": 1,
            "resource": resource_id,
            "port": sta_name,
            "suppress_preexec_cli": "yes",
            "suppress_preexec_method": 1
        })
        json_response = lf_r.formPost()
        sleep(0.05
              )  # best to give LANforge a few millis between rm_vlan commands

    LFUtils.waitUntilPortsDisappear(resource_id, base_url, found_stations)

    print("Ex 1: Next we create stations...")
    #68727874560 was previous flags
    for sta_name in desired_stations:
        print("Ex 1: Next we create station %s" % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-form/add_sta")
        # flags are a decimal equivalent of a hexadecimal bitfield
        # you can submit as either 0x(hex) or (dec)
        # a helper page is available at http://localhost:8080/help/add_sta
        #
        # You can watch console output of the LANforge GUI client when you
        # get errors to this command, and you can also watch the websocket
        # output for a response to this command at ws://localhost:8081
        # Use wsdump ws://localhost:8081/
        #
        # modes are listed at http://<YOUR_LANFORGE>/LANforgeDocs-5.4.1/lfcli_ug.html
        # or at https://www.candelatech.com/lfcli_ug.html
        #
        # mac address field is a pattern for creation: entirely random mac addresses
        # do not take advantage of address mask matchin in Ath10k hardware, so we developed
        # this pattern to randomize a section of octets. XX: keep parent, *: randomize, and
        # chars [0-9a-f]: use this digit
        #
        # If you get errors like "X is invalid hex chara cter", this indicates a previous
        # rm_vlan call has not removed your station yet: you cannot rewrite mac addresses
        # with this call, just create new stations
        lf_r.addPostData(
            LFUtils.staNewDownStaRequest(sta_name,
                                         resource_id=resource_id,
                                         radio=radio,
                                         ssid=ssid,
                                         passphrase=passphrase))
        lf_r.formPost()
        sleep(0.1)

    LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations)
    for sta_name in desired_stations:
        sleep(1)
        print("doing portSetDhcpDownRequest on " + sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-form/set_port")
        lf_r.addPostData(LFUtils.portSetDhcpDownRequest(resource_id, sta_name))
        lf_r.formPost()

    # the LANforge API separates STA creation and ethernet port settings
    # We need to revisit the stations we create and amend flags to add
    # things like DHCP or ip+gateway, admin-{up,down}

    LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations)
    for sta_name in desired_stations:
        sleep(1)
        print("Ex 1: station up %s" % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/set_port")
        data = LFUtils.portDhcpUpRequest(resource_id, sta_name)
        lf_r.addPostData(data)
        lf_r.jsonPost()

    LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations)
    # for sta_name in desired_stations:
    #     print("Ex 1: sta down %s"%sta_name)
    #     lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port")
    #     lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name))
    #     lf_r.jsonPost()
    #     sleep(0.05)
    print("...done with example 1\n\n")
    sleep(4)

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Example 2                                                 -
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # uses URLs /cli-json/rm_vlan, /cli-json/add_sta
    # and those accept POST in json formatted text
    desired_stations = []
    found_stations = []
    start_id = 220
    end_id = 222
    desired_stations = LFUtils.portNameSeries("sta", start_id, end_id,
                                              padding_number)

    print("Example 2: using port list to find stations")
    sleep(1)
    url = base_url + "/port/1/%s/list?fields=alias" % (resource_id)
    lf_r = LFRequest.LFRequest(url)
    json_response = lf_r.getAsJson()
    if json_response == None:
        raise Exception("no reponse to: " + url)
    port_map = LFUtils.portListToAliasMap(json_response)
    #LFUtils.debug_printer.pprint(port_map)

    for sta_name in desired_stations:
        print("Ex 2: checking for station : " + sta_name)
        if sta_name in port_map.keys():
            #print("found station : "+sta_name)
            found_stations.append(sta_name)

    for sta_name in found_stations:
        print("Ex 2: delete station %s ..." % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/rm_vlan")
        lf_r.addPostData({
            "shelf": 1,
            "resource": resource_id,
            "port": sta_name
        })
        lf_r.jsonPost(show_error=False)
        sleep(0.05)

    LFUtils.waitUntilPortsDisappear(resource_id, base_url, found_stations)
    for sta_name in desired_stations:
        print("Ex 2: create station %s" % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/add_sta")
        lf_r.addPostData(
            LFUtils.staNewDownStaRequest(sta_name,
                                         resource_id=resource_id,
                                         radio=radio,
                                         ssid=ssid,
                                         passphrase=passphrase))
        lf_r.jsonPost()
        sleep(1)

    LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations)
    # the LANforge API separates STA creation and ethernet port settings
    # We need to revisit the stations we create and amend flags to add
    # things like DHCP or ip+gateway, admin-{up,down}
    for sta_name in desired_stations:
        print("Ex 2: set port %s" % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/set_port")
        data = LFUtils.portDhcpUpRequest(resource_id, sta_name)
        lf_r.addPostData(data)
        lf_r.jsonPost()
        sleep(0.05)

    print("...done with Example 2")
    sleep(1)

    print("Example 3: bring ports up and down")
    sleep(1)
    print("Ex 3: setting ports up...")
    desired_stations.insert(0, "sta0200")
    desired_stations.insert(1, "sta0201")
    desired_stations.insert(2, "sta0202")
    wait_for_these = []
    for sta_name in desired_stations:
        lf_r = LFRequest.LFRequest(base_url +
                                   "/port/1/%s/%s?fields=port,device,down" %
                                   (resource_id, sta_name))
        json_response = lf_r.getAsJson()
        if json_response['interface']['down'] is 'true':
            url = base_url + "/cli-json/set_port"
            lf_r = LFRequest.LFRequest(url)
            lf_r.addPostData(LFUtils.portDhcpUpRequest(resource_id, sta_name))
            print("setting %s up" % sta_name)
            lf_r.jsonPost()
            wait_for_these.append(sta_name)
    LFUtils.waitUntilPortsAdminUp(resource_id, base_url, wait_for_these)
    sleep(4)
    print("Ex 3: setting ports down...")
    for sta_name in desired_stations:
        lf_r = LFRequest.LFRequest(base_url +
                                   "/port/1/%s/%s?fields=port,device,down" %
                                   (resource_id, sta_name))
        json_response = lf_r.getAsJson()
        if json_response['interface']['down'] is 'false':
            url = base_url + "/cli-json/set_port"
            lf_r = LFRequest.LFRequest(url)
            lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name))
            print("setting %s down" % sta_name)
            lf_r.jsonPost()
            wait_for_these.append(sta_name)
    LFUtils.waitUntilPortsAdminDown(resource_id, base_url, wait_for_these)
    print("...ports are down")
    sleep(4)

    print("Example 4: Modify stations to mode /a")
    sleep(1)
    for sta_name in desired_stations:
        #lf_r = LFRequest.LFRequest(base_url+"/port/1/%s/%s"%(resource_id, sta_name))
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/set_port")
        lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name))
        lf_r.jsonPost()
    LFUtils.waitUntilPortsAdminDown(resource_id, base_url, desired_stations)

    for sta_name in desired_stations:
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/add_sta")
        lf_r.addPostData({
            "shelf": 1,
            "resource": resource_id,
            "radio": radio,
            "sta_name": sta_name,
            "mode":
            1,  # 802.11a see http://www.candelatech.com/lfcli_ug.php#add_sta
        })
        print("using add_sta to set %s mode" % sta_name)
        lf_r.jsonPost()
        sleep(0.5)

    for sta_name in desired_stations:
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/set_port")
        lf_r.addPostData(LFUtils.portUpRequest(resource_id, sta_name))
        lf_r.get()
    LFUtils.waitUntilPortsAdminUp(resource_id, base_url, desired_stations)
    print("...done")
    sleep(4)

    print("Example 5: change station encryption from wpa2 to wpa3...")
    sleep(1)
    for sta_name in desired_stations:
        #lf_r = LFRequest.LFRequest(base_url+"/port/1/%s/%s"%(resource_id, sta_name))
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/set_port")
        lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name))
        lf_r.get()
    LFUtils.waitUntilPortsAdminDown(resource_id, base_url, desired_stations)

    for sta_name in desired_stations:
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/add_sta")
        lf_r.addPostData({
            "shelf": 1,
            "resource": resource_id,
            "radio": radio,
            "sta_name": sta_name,
            "mode": 0,  # mode AUTO
            "flags": 1099511627776,  # sets use-wpa3
            "flags_mask":
            1099511628800  # sets interest in use-wpa3, wpa2_enable (becomes zero)
        })
        print("using add_sta to set %s wpa3" % sta_name)
        lf_r.jsonPost()
        sleep(0.5)

    for sta_name in desired_stations:
        lf_r = LFRequest.LFRequest(base_url + "/cli-json/set_port")
        lf_r.addPostData(LFUtils.portUpRequest(resource_id, sta_name))
        lf_r.get()
    LFUtils.waitUntilPortsAdminUp(resource_id, base_url, desired_stations)
    print("...done")
    sleep(4)

    print("Example 7: alter TX power on %s..." % radio)
    # virtual stations do not have individual tx power states
    sleep(1)
    # see http://www.candelatech.com/lfcli_ug.php#set_wifi_radio
    lf_r = LFRequest.LFRequest(base_url + "/cli-json/set_wifi_radio")
    lf_r.addPostData({
        "shelf": 1,
        "resource": resource_id,
        "radio": radio,
        "mode": NA,
        # tx power see: man 8 iwconfig, power is in dBm, auto or off
        "txpower": "auto",
        # meta flag tells lfclient to not check port before issuing command
        "suppress_preexec_method": "true",
    })
    lf_r.jsonPost()
def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_l4_urls_per_ten',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Create layer-4 endpoints to connect to an ftp server and test that urls/s are meeting or exceeding the target rate
                ''',

        description='''\
        test_ipv4_l4_ftp_urls_per_ten.py
--------------------
Generic command example:
python3 ./test_ipv4_l4_ftp_urls_per_ten.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --dest 10.40.0.1 \\
    --test_duration 2m \\
    --interval 1s \\
    --requests_per_ten 600 \\
    --num_tests 1 \\
    --url "dl http://10.40.0.1 /dev/null" \\
    --target_per_ten 600 \\
    --debug
            ''')

    parser.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600)
    parser.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes', default=1)
    parser.add_argument('--url', help='--url specifies upload/download, address, and dest',
                        default="dl http://10.40.0.1 /dev/null")
    parser.add_argument('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90% of this value',
                        default=600)
    args = parser.parse_args()

    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted


    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPV4L4(args.mgr, lfjson_port, ssid=args.ssid, password=args.passwd, upstream_port=args.upstream_port,radio= args.radio,
                     security=args.security, station_list=station_list, url=args.url, num_tests=args.num_tests,
                     target_requests_per_ten=args.target_per_ten,
                     requests_per_ten=args.requests_per_ten)
    ip_test.cleanup(station_list)
    ip_test.build()
    ip_test.start()
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        print("Full test passed, all endpoints met or exceeded 90% of the target rate")
Exemplo n.º 10
0
def main():
    host = "ct524-debbie.jbr.candelatech.com"
    base_url = "http://%s:8080" % host
    resource_id = 1  # typically you're using resource 1 in stand alone realm
    radio = "wiphy0"
    start_id = 200
    end_id = 202
    padding_number = 10000  # the first digit of this will be deleted
    ssid = "jedway-wpa2-x64-3-1"
    passphrase = "jedway-wpa2-x64-3-1"
    clisock = 3990
    cliprompt = 'lfgui# '

    parser = argparse.ArgumentParser(description="test creating a station")
    parser.add_argument("-m",
                        "--host",
                        type=str,
                        help="json host to connect to")
    parser.add_argument("-r",
                        "--radio",
                        type=str,
                        help="radio to create a station on")
    parser.add_argument("-a",
                        "--start_id",
                        type=int,
                        help="starting station id")
    parser.add_argument("-b", "--end_id", type=int, help="ending station id")
    parser.add_argument("-s", "--ssid", type=str, help="station ssid")
    parser.add_argument("-p", "--passwd", type=str, help="password for ssid")

    args = None
    try:
        args = parser.parse_args()
        if (args.host is not None):
            host = args.host,
            baseurl = base_url = "http://%s:8080" % host
        if (args.radio is not None):
            radio = args.radio
        if (args.start_id is not None):
            start_id = args.start_id
        if (args.end_id is not None):
            end_id = args.end_id
        if (args.ssid is not None):
            ssid = args.ssid
        if (args.passwd is not None):
            passphrase = args.passwd
    except Exception as e:
        logging.exception(e)
        usage()
        exit(2)

    # station numbers are heavily manipulated strings, often using manual padding
    # sta200 is not sta0200 nor sta00200, and we can format these numbers by adding
    # a 1000 or 10000 to the station id, and trimming the first digit off

    j_printer = pprint.PrettyPrinter(indent=2)
    json_post = ""
    json_response = ""
    found_stations = []
    lf_r = LFRequest.LFRequest(base_url + "/port/1/1/wiphy2")
    wiphy0_json = lf_r.getAsJson()
    if (wiphy0_json is None) or (wiphy0_json['interface'] is None):
        print("Unable to find radio. Are we connected?")
        exit(1)

    desired_stations = LFUtils.portNameSeries("sta", start_id, end_id,
                                              padding_number)
    #LFUtils.debug_printer.pprint(desired_stations)
    print("Example 1: will create stations %s" % (",".join(desired_stations)))
    for sta_name in desired_stations:
        url = base_url + "/port/1/%s/%s" % (resource_id, sta_name)
        print("Ex 1: Checking for station : " + url)
        lf_r = LFRequest.LFRequest(url)
        json_response = lf_r.getAsJson(show_error=False)
        if (json_response != None):
            found_stations.append(sta_name)

    for sta_name in found_stations:
        print("Ex 1: Deleting station %s ...." % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-form/rm_vlan")
        lf_r.addPostData({
            "shelf": 1,
            "resource": resource_id,
            "port": sta_name
        })
        json_response = lf_r.formPost()
        sleep(0.05
              )  # best to give LANforge a few millis between rm_vlan commands

    LFUtils.waitUntilPortsDisappear(resource_id, base_url, found_stations)

    print("Ex 1: Next we create stations...")
    #68727874560 was previous flags
    for sta_name in desired_stations:
        print("Ex 1: Next we create station %s" % sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-form/add_sta")
        lf_r.addPostData(
            LFUtils.staNewDownStaRequest(sta_name,
                                         resource_id=resource_id,
                                         radio=radio,
                                         ssid=ssid,
                                         passphrase=passphrase))
        lf_r.formPost()
        sleep(0.1)

    LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations)
    for sta_name in desired_stations:
        sleep(1)
        print("doing portSetDhcpDownRequest on " + sta_name)
        lf_r = LFRequest.LFRequest(base_url + "/cli-form/set_port")
        data = LFUtils.portDhcpUpRequest(resource_id, sta_name)
        lf_r.addPostData(data)
        lf_r.jsonPost()

    LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations)

    # Now lets do some cli-socket scripting
    gui_telnet = pexpect.spawn('telnet %s %s' % (host, clisock))
    if gui_telnet is None:
        print("Unable to telnet to %s:%s" % (host, clisock))
        exit(1)

    gui_telnet.expect('lfgui# ')
    gui_telnet.sendline("cv create 'WiFi Capacity' 'wct'")
    gui_telnet.expect('OK')
    gui_telnet.sendline("cv load wct wct-wpa2-x64-two-loops")
    gui_telnet.expect('OK')
    gui_telnet.sendline("cv click wct 'Auto Save Report'")
    gui_telnet.expect('OK')
    gui_telnet.sendline("cv click wct Start")
Exemplo n.º 11
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_generic.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Create layer-4 endpoints and test that the bytes-rd from the chosen URL are increasing over the
                duration of the test
                ''',
        description='''\
        test_ipv4_l4.py
        --------------------
    Generic command layout:
    python ./test_ipv4_l4.py --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password> <security type: wpa2, open, wpa3> --debug

    Command Line Example: 
     python3 ./test_ipv4_l4.py 
        --upstream_port eth1 (optional) 
        --radio wiphy0  (required) 
        --num_stations 3 (optional)
        --security {open|wep|wpa|wpa2|wpa3} (required)
        --ssid netgear (required)
        --url "dl http://10.40.0.1 /dev/null" (required)
        --password admin123 (required)
        --test_duration 2m (optional)
        --debug (optional)

            ''')

    parser.add_argument('--test_duration',
                        help='--test_duration sets the duration of the test',
                        default="5m")
    parser.add_argument(
        '--url',
        help='--url specifies upload/download, address, and dest',
        default="dl http://10.40.0.1 /dev/null")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPV4L4(host=args.mgr,
                     port=args.mgr_port,
                     ssid=args.ssid,
                     radio=args.radio,
                     password=args.passwd,
                     security=args.security,
                     station_list=station_list,
                     url=args.url,
                     test_duration=args.test_duration,
                     upstream_port=args.upstream_port,
                     _debug_on=args.debug)

    ip_test.cleanup(station_list)
    ip_test.build()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        ip_test.exit_fail()
    ip_test.start(False, False)
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        ip_test.exit_fail()
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        print(
            "Full test passed, all endpoints had increased bytes-rd throughout test duration"
        )
        ip_test.exit_success()
Exemplo n.º 12
0
def main():
    #Params for different tests:
    #
    #
    #
    #
    #
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_connection.py',
        #formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
         Create stations that attempt to authenticate, associate, and receive IP addresses on the 
         chosen SSID
            ''',
        description='''\
        test_ipv4_connection.py
--------------------
Generic command example:
python3 ./test_ipv4_connection.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --dest 10.40.0.1 \\
    --test_duration 2m \\
    --interval 1s \\
    --debug
            ''')

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000)
    ip_test = IPv4Test(lfjson_host,
                       lfjson_port,
                       ssid=args.ssid,
                       password=args.passwd,
                       security=args.security,
                       sta_list=station_list,
                       radio=args.radio)
    ip_test.cleanup(station_list)
    #ip_test.timeout = 60
    ip_test.build()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    ip_test.start(station_list, False, False)
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        print("Full test passed, all stations associated and got IP")
Exemplo n.º 13
0
def main():
    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv6_variable_time.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
Create stations to test IPV6 connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open)
''',
        description='''\
test_ipv6_variable_time.py:
--------------------
Generic command example:
./test_ipv6_connection.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --upstream 10.40.0.1 \\
    --test_duration 2m \\
    --interval 1s \\
    --a_min 256000 \\
    --b_min 256000 \\
    --debug
''')
    required_args=None
    for group in parser._action_groups:
        if group.title == "required arguments":
            required_args=group
            break;
    if required_args is not None:
        required_args.add_argument('--a_min', help='minimum bps rate for side_a', default=256000)
        required_args.add_argument('--b_min', help='minimum bps rate for side_b', default=256000)
        required_args.add_argument('--cx_type', help='tcp6 or udp6')
        required_args.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")

    optional_args=None
    for group in parser._action_groups:
        if group.title == "optional arguments":
            optional_args=group
            break;
    if optional_args is not None:
        optional_args.add_argument('--mode',    help='Used to force mode of stations')
        optional_args.add_argument('--ap',      help='Used to force a connection to a particular AP')
        optional_args.add_argument("--a_max",   help="Maximum side_a bps speed", default=0)
        optional_args.add_argument("--b_max",   help="Maximum side_b bps speed", default=0)

    args = parser.parse_args()

    CX_TYPES=("tcp6", "udp6", "lf_tcp6", "lf_udp6")

    if (args.cx_type is None) or (args.cx_type not in CX_TYPES):
        print("cx_type needs to be lf_tcp6 or lf_udp6, bye")
        exit(1)
    if args.cx_type == "tcp6":
        args.cx_type = "lf_tcp6"
    if args.cx_type == "udp6":
        args.cx_type = "lf_udp6"

    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ip_var_test = IPV6VariableTime(_host=args.mgr,
                                   _port=args.mgr_port,
                                   _number_template="00",
                                   _sta_list=station_list,
                                   _name_prefix="VT",
                                   _upstream=args.upstream_port,
                                   _ssid=args.ssid,
                                   _password=args.passwd,
                                   _radio=args.radio,
                                   _security=args.security,
                                   _test_duration=args.test_duration,
                                   _use_ht160=False,
                                   _side_a_min_rate=args.a_min,
                                   _side_b_min_rate=args.b_min,
                                   _side_a_max_rate=args.a_max,
                                   _side_b_max_rate=args.b_max,
                                   _cx_type=args.cx_type,
                                   _debug_on=args.debug)

    ip_var_test.pre_cleanup()
    ip_var_test.build()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    ip_var_test.start(False, False)
    ip_var_test.stop()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_var_test.cleanup()
    if ip_var_test.passes():
        print("Full test passed, all connections increased rx bytes")
Exemplo n.º 14
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080
    endp_types = "lf_udp"
    debug_on = False

    parser = argparse.ArgumentParser(
        prog='lf_cisco_dfs.py',
        #formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
        Useful Information:
            1. Polling interval for checking traffic is fixed at 1 minute
            2. The test will generate csv file 
            3. The tx/rx rates are fixed at 256000 bits per second
            4. Maximum stations per radio is 64
            ''',
        description='''\
lf_cisco_dfs.py:
--------------------

Summary : 
----------
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 recieved.

Generic command layout:
-----------------------
python .\\lf_cisco_dfs.py --test_duration <duration> --endp_type <traffic types> --upstream_port <port> 
        --radio "radio==<radio> stations==<number staions> ssid==<ssid> ssid_pw==<ssid password> security==<security type: wpa2, open, wpa3>" --debug
Multiple radios may be entered with individual --radio switches

generiic command with controller setting channel and channel width test duration 5 min
python3 lf_cisco_dfs.py --cisco_ctlr <IP> --cisco_dfs True/False --mgr <Lanforge IP> 
    --cisco_channel <channel> --cisco_chan_width <20,40,80,120> --endp_type 'lf_udp lf_tcp mc_udp' --upstream_port <1.ethX> 
    --radio "radio==<radio 0 > stations==<number stations> ssid==<ssid> ssid_pw==<ssid password> security==<wpa2 , open>" 
    --radio "radio==<radio 1 > stations==<number stations> ssid==<ssid> ssid_pw==<ssid password> security==<wpa2 , open>" 
    --duration 5m


<duration>: number followed by one of the following 
d - days
h - hours
m - minutes
s - seconds

<traffic type>: 
lf_udp  : IPv4 UDP traffic
lf_tcp  : IPv4 TCP traffic
lf_udp6 : IPv6 UDP traffic
lf_tcp6 : IPv6 TCP traffic
mc_udp  : IPv4 multi cast UDP traffic
mc_udp6 : IPv6 multi cast UDP traffic

<tos>: 
BK, BE, VI, VO:  Optional wifi related Tos Settings.  Or, use your preferred numeric values.

#################################
#Command switches
#################################
--cisco_ctlr <IP of Cisco Controller>',default=None
--cisco_user <User-name for Cisco Controller>',default="admin"
--cisco_passwd <Password for Cisco Controller>',default="Cisco123
--cisco_prompt <Prompt for Cisco Controller>',default="(Cisco Controller) >
--cisco_ap <Cisco AP in question>',default="APA453.0E7B.CF9C"
    
--cisco_dfs <True/False>',default=False
--cisco_channel <channel>',default=None  , no change
--cisco_chan_width <20 40 80 160>',default="20",choices=["20","40","80","160"]
--cisco_band <a | b | abgn>',default="a",choices=["a", "b", "abgn"]

--mgr <hostname for where LANforge GUI is running>',default='localhost'
-d  / --test_duration <how long to run>  example --time 5d (5 days) default: 3m options: number followed by d, h, m or s',default='3m'
--tos:  Support different ToS settings: BK | BE | VI | VO | numeric',default="BE"
--debug:  Enable debugging',default=False
-t  / --endp_type <types of traffic> example --endp_type \"lf_udp lf_tcp mc_udp\"  Default: lf_udp , options: lf_udp, lf_udp6, lf_tcp, lf_tcp6, mc_udp, mc_udp6',
                        default='lf_udp', type=valid_endp_types
-u / --upstream_port <cross connect upstream_port> example: --upstream_port eth1',default='eth1')
-o / --outfile <Output file for csv data>", default='longevity_results'

#########################################
# Examples
# #######################################            
Example #1  running traffic with two radios
1. Test duration 4 minutes
2. Traffic IPv4 TCP
3. Upstream-port eth1
4. Radio #0 wiphy0 has 32 stations, ssid = candelaTech-wpa2-x2048-4-1, ssid password = candelaTech-wpa2-x2048-4-1
5. Radio #1 wiphy1 has 64 stations, ssid = candelaTech-wpa2-x2048-5-3, ssid password = candelaTech-wpa2-x2048-5-3
6. Create connections with TOS of BK and VI

Command: (remove carriage returns)
python3 .\\lf_cisco_dfs.py --test_duration 4m --endp_type \"lf_tcp lf_udp mc_udp\" --tos \"BK VI\" --upstream_port eth1 
--radio "radio==wiphy0 stations==32 ssid==candelaTech-wpa2-x2048-4-1 ssid_pw==candelaTech-wpa2-x2048-4-1 security==wpa2"
--radio "radio==wiphy1 stations==64 ssid==candelaTech-wpa2-x2048-5-3 ssid_pw==candelaTech-wpa2-x2048-5-3 security==wpa2"

Example #2 using cisco controller
1.  cisco controller at 192.168.100.112
2.  cisco dfs True
3.  cisco channel 52  
4.  cisco channel width 20
5.  traffic 'lf_udp lf_tcp mc_udp'
6.  upstream port eth3
7.  radio #0 wiphy0 stations  3 ssid test_candela ssid_pw [BLANK] secruity Open
8.  radio #1 wiphy1 stations 16 ssid test_candela ssid_pw [BLANK] security Open
9.  lanforge manager at 192.168.100.178
10. duration 5m

Command:
python3 lf_cisco_dfs.py --cisco_ctlr 192.168.100.112 --cisco_dfs True --mgr 192.168.100.178 
    --cisco_channel 52 --cisco_chan_width 20 --endp_type 'lf_udp lf_tcp mc_udp' --upstream_port 1.eth3 
    --radio "radio==1.wiphy0 stations==3 ssid==test_candela ssid_pw==[BLANK] security==open" 
    --radio "radio==1.wiphy1 stations==16 ssid==test_candela ssid_pw==[BLANK] security==open"
    --test_duration 5m


        ''')

    parser.add_argument('--cisco_ctlr',
                        help='--cisco_ctlr <IP of Cisco Controller>',
                        default=None)
    parser.add_argument('--cisco_user',
                        help='--cisco_user <User-name for Cisco Controller>',
                        default="admin")
    parser.add_argument('--cisco_passwd',
                        help='--cisco_passwd <Password for Cisco Controller>',
                        default="Cisco123")
    parser.add_argument('--cisco_prompt',
                        help='--cisco_prompt <Prompt for Cisco Controller>',
                        default="\(Cisco Controller\) >")
    parser.add_argument('--cisco_ap',
                        help='--cisco_ap <Cisco AP in question>',
                        default="APA453.0E7B.CF9C")

    parser.add_argument('--cisco_dfs',
                        help='--cisco_dfs <True/False>',
                        default=False)

    parser.add_argument('--cisco_channel',
                        help='--cisco_channel <channel>',
                        default=None)
    parser.add_argument('--cisco_chan_width',
                        help='--cisco_chan_width <20 40 80 160>',
                        default="20",
                        choices=["20", "40", "80", "160"])
    parser.add_argument('--cisco_band',
                        help='--cisco_band <a | b | abgn>',
                        default="a",
                        choices=["a", "b", "abgn"])
    parser.add_argument('--cisco_series',
                        help='--cisco_series <9800 | 3504>',
                        default="3504",
                        choices=["9800", "3504"])
    parser.add_argument(
        '--cisco_scheme',
        help=
        '--cisco_scheme (serial|telnet|ssh): connect via serial, ssh or telnet',
        default="ssh",
        choices=["serial", "telnet", "ssh"])

    parser.add_argument(
        '--cisco_wlan',
        help='--cisco_wlan <wlan name> default: NA, NA means no change',
        default="NA")
    parser.add_argument(
        '--cisco_wlanID',
        help='--cisco_wlanID <wlanID> default: NA , NA means not change',
        default="NA")
    parser.add_argument(
        '--cisco_tx_power',
        help=
        '--cisco_tx_power <1 | 2 | 3 | 4 | 5 | 6 | 7 | 8>  1 is highest power default NA NA means no change',
        default="NA",
        choices=["1", "2", "3", "4", "5", "6", "7", "8", "NA"])

    parser.add_argument(
        '--amount_ports_to_reset',
        help=
        '--amount_ports_to_reset \"<min amount ports> <max amount ports>\" ',
        default=None)
    parser.add_argument(
        '--port_reset_seconds',
        help='--ports_reset_seconds \"<min seconds> <max seconds>\" ',
        default="10 30")

    parser.add_argument(
        '--mgr',
        help='--mgr <hostname for where LANforge GUI is running>',
        default='localhost')
    parser.add_argument(
        '-d',
        '--test_duration',
        help=
        '--test_duration <how long to run>  example --time 5d (5 days) default: 3m options: number followed by d, h, m or s',
        default='3m')
    parser.add_argument(
        '--tos',
        help=
        '--tos:  Support different ToS settings: BK | BE | VI | VO | numeric',
        default="BE")
    parser.add_argument('--debug',
                        help='--debug:  Enable debugging',
                        default=False)
    parser.add_argument(
        '-t',
        '--endp_type',
        help=
        '--endp_type <types of traffic> example --endp_type \"lf_udp lf_tcp mc_udp\"  Default: lf_udp , options: lf_udp, lf_udp6, lf_tcp, lf_tcp6, mc_udp, mc_udp6',
        default='lf_udp',
        type=valid_endp_types)
    parser.add_argument(
        '-u',
        '--upstream_port',
        help=
        '--upstream_port <cross connect upstream_port> example: --upstream_port eth1',
        default='eth1')
    parser.add_argument('-o',
                        '--csv_outfile',
                        help="--csv_outfile <Output file for csv data>",
                        default='longevity_results')
    parser.add_argument('--polling_interval',
                        help="--polling_interval <seconds>",
                        default='60s')
    #parser.add_argument('-c','--csv_output', help="Generate csv output", default=False)

    parser.add_argument('-r','--radio', action='append', nargs=1, help='--radio  \
                        \"radio==<number_of_wiphy stations=<=number of stations> ssid==<ssid> ssid_pw==<ssid password> security==<security>\" '\
                        , required=True)
    parser.add_argument(
        "--cap_ctl_out",
        help=
        "--cap_ctl_out , switch the cisco controller output will be captured",
        action='store_true')

    args = parser.parse_args()

    #print("args: {}".format(args))
    debug_on = args.debug

    if args.test_duration:
        test_duration = args.test_duration

    if args.polling_interval:
        polling_interval = args.polling_interval

    if args.endp_type:
        endp_types = args.endp_type

    if args.mgr:
        lfjson_host = args.mgr

    if args.upstream_port:
        side_b = args.upstream_port

    if args.radio:
        radios = args.radio

    if args.csv_outfile != None:
        current_time = time.strftime("%m_%d_%Y_%H_%M_%S", time.localtime())
        csv_outfile = "{}_{}.csv".format(args.csv_outfile, current_time)
        print("csv output file : {}".format(csv_outfile))

    MAX_NUMBER_OF_STATIONS = 64

    radio_name_list = []
    number_of_stations_per_radio_list = []
    ssid_list = []
    ssid_password_list = []
    ssid_security_list = []

    #optional radio configuration
    reset_port_enable_list = []
    reset_port_time_min_list = []
    reset_port_time_max_list = []

    print("radios {}".format(radios))
    for radio_ in radios:
        radio_keys = ['radio', 'stations', 'ssid', 'ssid_pw', 'security']
        radio_info_dict = dict(
            map(
                lambda x: x.split('=='),
                str(radio_).replace('[', '').replace(']',
                                                     '').replace("'",
                                                                 "").split()))
        print("radio_dict {}".format(radio_info_dict))

        for key in radio_keys:
            if key not in radio_info_dict:
                print(
                    "missing config, for the {}, all of the following need to be present {} "
                    .format(key, radio_keys))
                exit(1)

        radio_name_list.append(radio_info_dict['radio'])
        number_of_stations_per_radio_list.append(radio_info_dict['stations'])
        ssid_list.append(radio_info_dict['ssid'])
        ssid_password_list.append(radio_info_dict['ssid_pw'])
        ssid_security_list.append(radio_info_dict['security'])

        optional_radio_reset_keys = ['reset_port_enable']
        radio_reset_found = True
        for key in optional_radio_reset_keys:
            if key not in radio_info_dict:
                #print("port reset test not enabled")
                radio_reset_found = False
                break

        if radio_reset_found:
            reset_port_enable_list.append(True)
            reset_port_time_min_list.append(
                radio_info_dict['reset_port_time_min'])
            reset_port_time_max_list.append(
                radio_info_dict['reset_port_time_max'])
        else:
            reset_port_enable_list.append(False)
            reset_port_time_min_list.append('0s')
            reset_port_time_max_list.append('0s')

    index = 0
    station_lists = []
    for (radio_name_, number_of_stations_per_radio_) in zip(
            radio_name_list, number_of_stations_per_radio_list):
        number_of_stations = int(number_of_stations_per_radio_)
        if number_of_stations > MAX_NUMBER_OF_STATIONS:
            print("number of stations per radio exceeded max of : {}".format(
                MAX_NUMBER_OF_STATIONS))
            quit(1)
        station_list = LFUtils.portNameSeries(prefix_="sta",
                                              start_id_=1 + index * 1000,
                                              end_id_=number_of_stations +
                                              index * 1000,
                                              padding_number_=10000,
                                              radio=radio_name_)
        station_lists.append(station_list)
        index += 1

    #print("endp-types: %s"%(endp_types))

    dfs = DFS.L3VariableTime(
        lfjson_host,
        lfjson_port,
        args=args,
        number_template="00",
        station_lists=station_lists,
        name_prefix="LT-",
        endp_types=endp_types,
        tos=args.tos,
        side_b=side_b,
        radio_name_list=radio_name_list,
        number_of_stations_per_radio_list=number_of_stations_per_radio_list,
        ssid_list=ssid_list,
        ssid_password_list=ssid_password_list,
        ssid_security_list=ssid_security_list,
        test_duration=test_duration,
        polling_interval=polling_interval,
        reset_port_enable_list=reset_port_enable_list,
        reset_port_time_min_list=reset_port_time_min_list,
        reset_port_time_max_list=reset_port_time_max_list,
        side_a_min_rate=256000,
        side_b_min_rate=256000,
        debug_on=debug_on,
        outfile=csv_outfile)

    dfs.pre_cleanup()

    dfs.build()
    if not dfs.passes():
        print("build step failed.")
        print(dfs.get_fail_message())
        exit(1)
    dfs.start(False, False)
    dfs.stop()
    if not dfs.passes():
        print("stop test failed")
        print(dfs.get_fail_message())

    print(
        "Pausing 30 seconds after run for manual inspection before we clean up."
    )
    time.sleep(30)
    dfs.cleanup()
    if dfs.passes():
        print("Full test passed, all connections increased rx bytes")
Exemplo n.º 15
0
def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_variable_time.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
        Useful Information:
            1. TBD
            ''',

        description='''\
test_ipv4_variable_time.py:
--------------------
TBD

Generic command layout:
python ./test_ipv4_variable_time.py --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password> <security type: wpa2, open, wpa3> --debug

Note:   multiple --radio switches may be entered up to the number of radios available:
                 --radio <radio 0> <stations> <ssid> <ssid password>  --radio <radio 01> <number of last station> <ssid> <ssid password>

 python3 ./test_ipv4_variable_time.py --upstream_port eth1 --radio wiphy0 32 candelaTech-wpa2-x2048-4-1 candelaTech-wpa2-x2048-4-1 wpa2 --radio wiphy1 64 candelaTech-wpa2-x2048-5-3 candelaTech-wpa2-x2048-5-3 wpa2

        ''')

    parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
    parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
    parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted


    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ip_var_test = IPV4VariableTime(args.mgr, lfjson_port, number_template="00", sta_list=station_list,
                                   name_prefix="VT",
                                   upstream=args.upstream_port,
                                   ssid=args.ssid,
                                   password=args.passwd,
                                   radio=args.radio,
                                   security=args.security, test_duration=args.test_duration, use_ht160=False,
                                   side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug)

    ip_var_test.pre_cleanup()
    ip_var_test.build()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    ip_var_test.start(False, False)
    ip_var_test.stop()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_var_test.cleanup()
    if ip_var_test.passes():
        print("Full test passed, all connections increased rx bytes")
def main():
    parser = LFCliBase.create_basic_argparse(
        prog='create_l3_stations.py',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
            Create stations to test connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open)
            ''',

        description='''\
        create_l3_stations.py:
        --------------------
        Generic command layout:

        python3 ./create_l3_stations.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
            --a_min 1000
            --b_min 1000
            --ap "00:0e:8e:78:e1:76"
            --number_template 0000
            --debug

            python3 ./create_l3_stations.py
            --upstream_port eth1
            --radio wiphy0
            --station_list sta00,sta01
            --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
            --a_min 1000
            --b_min 1000
            --ap "00:0e:8e:78:e1:76"
            --number_template 0000
            --debug
            ''')

    required_args = None
    for group in parser._action_groups:
        if group.title == "required arguments":
            required_args = group
            break
    if required_args is not None:
        required_args.add_argument(
            '--a_min',
            help='--a_min bps rate minimum for side_a',
            default=256000)
        required_args.add_argument(
            '--b_min',
            help='--b_min bps rate minimum for side_b',
            default=256000)

    optional_args = None
    for group in parser._action_groups:
        if group.title == "optional arguments":
            optional_args = group
            break
    if optional_args:
        optional_args.add_argument(
            '--mode', help='Used to force mode of stations')
        optional_args.add_argument(
            '--ap', help='Used to force a connection to a particular AP')
        optional_args.add_argument(
            '--number_template',
            help='Start the station numbering with a particular number. Default is 0000',
            default=0000)
        optional_args.add_argument(
            '--station_list',
            help='Optional: User defined station names, can be a comma or space separated list',
            nargs='+',
            default=None)
        optional_args.add_argument(
            '--no_cleanup',
            help="Optional: Don't cleanup existing stations",
            action='store_true')
    args = parser.parse_args()

    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_sta = int(args.num_stations)

    if not args.station_list:
        station_list = LFUtils.portNameSeries(
            prefix_="sta", start_id_=int(
                args.number_template), end_id_=num_sta + int(
                args.number_template) - 1, padding_number_=10000, radio=args.radio)
    else:
        if ',' in args.station_list[0]:
            station_list = args.station_list[0].split(',')
        elif ' ' in args.station_list[0]:
            station_list = args.station_list[0].split()
        else:
            station_list = args.station_list
    ip_var_test = CreateL3(host=args.mgr,
                           port=args.mgr_port,
                           number_template=str(args.number_template),
                           sta_list=station_list,
                           name_prefix="VT",
                           upstream=args.upstream_port,
                           ssid=args.ssid,
                           password=args.passwd,
                           radio=args.radio,
                           security=args.security,
                           use_ht160=False,
                           side_a_min_rate=args.a_min,
                           side_b_min_rate=args.b_min,
                           mode=args.mode,
                           ap=args.ap,
                           _debug_on=args.debug)

    if not args.no_cleanup:
        ip_var_test.pre_cleanup()
    ip_var_test.build()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        ip_var_test.exit_fail()
    print('Creates %s stations and connections' % num_sta)
Exemplo n.º 17
0
def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_variable_time.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''\
test_ipv4_variable_time.py:
---------------------

Generic command layout:
./test_ipv4_variable_time.py
--upstream_port eth1 
--radio wiphy3
--num_stations 4
-ssid jedway-wpa2-x2048-4-1  
-passwd jedway-wpa2-x2048-4-1 
--security  {wpa2|open|wpa|wpa3} 
--a_min 250000
--b_min 260000
--test_duration 2m
--debug
        ''')

    parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
    parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
    parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted


    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ip_var_test = IPV4VariableTime(host=args.mgr, port=args.mgr_port,
                                   number_template="00",
                                   sta_list=station_list,
                                   name_prefix="VT",
                                   upstream=args.upstream_port,
                                   ssid=args.ssid,
                                   password=args.passwd,
                                   radio=args.radio,
                                   security=args.security, test_duration=args.test_duration, use_ht160=False,
                                   side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug)

    ip_var_test.pre_cleanup()
    ip_var_test.build()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    ip_var_test.start(False, False)
    ip_var_test.stop()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_var_test.cleanup()
    if ip_var_test.passes():
        print("Full test passed, all connections increased rx bytes")
def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_l4_ftp',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Create layer-4 endpoints to an ftp server and test that the bytes-wr are increasing over the duration
                of the test 
                ''',
        description='''\
        test_ipv4_l4_ftp_upload.py
--------------------
Generic command example:
python3 ./test_ipv4_l4_ftp_wifi.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --dest 10.40.0.1 \\
    --test_duration 2m \\
    --interval 1s \\
    --url "ul ftp://10.40.0.1 /dev/null" \\
    --requests_per_ten 600 \\
    --debug
            ''')

    parser.add_argument('--test_duration',
                        help='--test_duration sets the duration of the test',
                        default="5m")
    parser.add_argument(
        '--requests_per_ten',
        help='--requests_per_ten number of request per ten minutes',
        default=600)
    parser.add_argument(
        '--url',
        help='--url specifies upload/download, address, and dest',
        default="ul ftp://10.40.0.1 /dev/null")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPV4L4(args.mgr,
                     lfjson_port,
                     ssid=args.ssid,
                     password=args.passwd,
                     security=args.security,
                     station_list=station_list,
                     url=args.url,
                     test_duration=args.test_duration,
                     requests_per_ten=args.requests_per_ten,
                     _debug_on=args.debug,
                     upstream_port=args.upstream_port)
    ip_test.cleanup(station_list)
    ip_test.build()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    ip_test.start(False, False)
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        print(
            "Full test passed, all endpoints had increased bytes-rd throughout test duration"
        )
def main():
    parser = Realm.create_basic_argparse(
        prog='test_ipv4_variable_time.py',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
            Create stations to test connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open)
            ''',
        description='''\
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)
    --monitor_interval_ms 
    --a_min 3000
    --b_min 1000
    --ap "00:0e:8e:78:e1:76"
    --output_format csv
    --traffic_type lf_udp
    --report_file ~/Documents/results.csv                       (Example of csv file output  - please use another extension for other file formats)
    --compared_report ~/Documents/results_prev.csv              (Example of csv file retrieval - please use another extension for other file formats) - UNDER CONSTRUCTION
    --layer3_cols 'name','tx bytes','rx bytes','dropped'          (column names from the GUI to print on report -  please read below to know what to put here according to preferences)
    --port_mgr_cols 'ap','ip'                                    (column names from the GUI to print on report -  please read below to know what to put here according to preferences)
    --debug
    
    python3 ./test_ipv4_variable_time.py
    --upstream_port eth1        (upstream POrt)
    --traffic_type lf_udp       (traffic type, lf_udp | lf_tcp)
    --test_duration 5m          (duration to run traffic 5m --> 5 Minutes)
    --create_sta False          (False, means it will not create stations and use the sta_names specified below)
    --sta_names sta000,sta001,sta002 (used if --create_sta False, comma separated names of stations)
        
    
===============================================================================
 ** FURTHER INFORMATION **
    Using the layer3_cols flag:

    Currently the output function does not support inputting the columns in layer3_cols the way they are displayed in the GUI. This quirk is under construction. To output
    certain columns in the GUI in your final report, please match the according GUI column display to it's counterpart to have the columns correctly displayed in
    your report.

    GUI Column Display       Layer3_cols argument to type in (to print in report)

    Name                |  'name'
    EID                 |  'eid'
    Run                 |  'run'
    Mng                 |  'mng'
    Script              |  'script'
    Tx Rate             |  'tx rate'
    Tx Rate (1 min)     |  'tx rate (1&nbsp;min)'
    Tx Rate (last)      |  'tx rate (last)'
    Tx Rate LL          |  'tx rate ll'
    Rx Rate             |  'rx rate'
    Rx Rate (1 min)     |  'rx rate (1&nbsp;min)'
    Rx Rate (last)      |  'rx rate (last)'
    Rx Rate LL          |  'rx rate ll'
    Rx Drop %           |  'rx drop %'
    Tx PDUs             |  'tx pdus'
    Tx Pkts LL          |  'tx pkts ll'
    PDU/s TX            |  'pdu/s tx'
    Pps TX LL           |  'pps tx ll'
    Rx PDUs             |  'rx pdus'
    Rx Pkts LL          |  'pps rx ll'
    PDU/s RX            |  'pdu/s tx'
    Pps RX LL           |  'pps rx ll'
    Delay               |  'delay'
    Dropped             |  'dropped'
    Jitter              |  'jitter'
    Tx Bytes            |  'tx bytes'
    Rx Bytes            |  'rx bytes'
    Replays             |  'replays'
    TCP Rtx             |  'tcp rtx'
    Dup Pkts            |  'dup pkts'
    Rx Dup %            |  'rx dup %'
    OOO Pkts            |  'ooo pkts'
    Rx OOO %            |  'rx ooo %'
    RX Wrong Dev        |  'rx wrong dev'
    CRC Fail            |  'crc fail'
    RX BER              |  'rx ber'
    CX Active           |  'cx active'
    CX Estab/s          |  'cx estab/s'
    1st RX              |  '1st rx'
    CX TO               |  'cx to'
    Pattern             |  'pattern'
    Min PDU             |  'min pdu'
    Max PDU             |  'max pdu'
    Min Rate            |  'min rate'
    Max Rate            |  'max rate'
    Send Buf            |  'send buf'
    Rcv Buf             |  'rcv buf'
    CWND                |  'cwnd'
    TCP MSS             |  'tcp mss'
    Bursty              |  'bursty'
    A/B                 |  'a/b'
    Elapsed             |  'elapsed'
    Destination Addr    |  'destination addr'
    Source Addr         |  'source addr'
            ''')

    parser.add_argument('--mode', help='Used to force mode of stations')
    parser.add_argument('--ap',
                        help='Used to force a connection to a particular AP')
    parser.add_argument('--traffic_type',
                        help='Select the Traffic Type [lf_udp, lf_tcp]',
                        required=True)
    parser.add_argument('--output_format', help='choose either csv or xlsx')
    parser.add_argument('--report_file',
                        help='where you want to store results',
                        default=None)
    parser.add_argument('--a_min',
                        help='--a_min bps rate minimum for side_a',
                        default=256000)
    parser.add_argument('--b_min',
                        help='--b_min bps rate minimum for side_b',
                        default=256000)
    parser.add_argument('--test_duration',
                        help='--test_duration sets the duration of the test',
                        default="2m")
    parser.add_argument(
        '--layer3_cols',
        help='Columns wished to be monitored from layer 3 endpoint tab',
        default=['name', 'tx bytes', 'rx bytes', 'tx rate', 'rx rate'])
    parser.add_argument(
        '--port_mgr_cols',
        help='Columns wished to be monitored from port manager tab',
        default=['ap', 'ip', 'parent dev'])
    parser.add_argument(
        '--compared_report',
        help=
        'report path and file which is wished to be compared with new report',
        default=None)
    parser.add_argument(
        '--monitor_interval',
        help=
        'how frequently do you want your monitor function to take measurements; \, 35s, 2h',
        default='10s')
    parser.add_argument('--influx_token',
                        help='Username for your Influx database')
    parser.add_argument('--influx_bucket',
                        help='Password for your Influx database')
    parser.add_argument('--influx_org', help='Name of your Influx database')
    parser.add_argument('--influx_port',
                        help='Port where your influx database is located',
                        default=8086)
    parser.add_argument(
        '--influx_tag',
        action='append',
        nargs=2,
        help='--influx_tag <key> <val>   Can add more than one of these.')
    parser.add_argument(
        '--influx_mgr',
        help=
        'IP address of the server your Influx database is hosted if different from your LANforge Manager',
        default=None)
    parser.add_argument('--create_sta',
                        help='Used to force a connection to a particular AP',
                        default=True)
    parser.add_argument('--sta_names',
                        help='Used to force a connection to a particular AP',
                        default="sta0000")
    args = parser.parse_args()
    create_sta = True
    if args.create_sta == "False":
        create_sta = False

    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_sta = int(args.num_stations)

    # Create directory

    # if file path with output file extension is not given...
    # check if home/lanforge/report-data exists. if not, save
    # in new folder based in current file's directory

    if args.report_file is None:
        new_file_path = str(datetime.datetime.now().strftime(
            "%Y-%m-%d-%H-h-%M-m-%S-s")).replace(
                ':', '-') + '_test_ipv4_variable_time'  # create path name
        try:
            path = os.path.join('/home/lanforge/report-data/', new_file_path)
            os.mkdir(path)
        except:
            curr_dir_path = os.path.dirname(
                os.path.dirname(os.path.abspath(__file__)))
            path = os.path.join(curr_dir_path, new_file_path)
            os.mkdir(path)
        systeminfopath = str(path) + '/systeminfo.txt'

        if args.output_format in [
                'csv', 'json', 'html', 'hdf', 'stata', 'pickle', 'pdf', 'png',
                'parquet', 'xlsx'
        ]:
            report_f = str(path) + '/data.' + args.output_format
            output = args.output_format
        else:
            print(
                'Not supporting this report format or cannot find report format provided. Defaulting to csv data file output type, naming it data.csv.'
            )
            report_f = str(path) + '/data.csv'
            output = 'csv'

    else:
        systeminfopath = str(args.report_file).split('/')[-1]
        report_f = args.report_file
        if args.output_format is None:
            output = str(args.report_file).split('.')[-1]
        else:
            output = args.output_format
    print("IPv4 Test Report Data: {}".format(report_f))

    # Retrieve last data file
    compared_rept = None
    if args.compared_report:
        compared_report_format = args.compared_report.split('.')[-1]
        # if compared_report_format not in ['csv', 'json', 'dta', 'pkl','html','xlsx','parquet','h5']:
        if compared_report_format != 'csv':
            print(
                ValueError(
                    "Cannot process this file type. Please select a different file and re-run script."
                ))
            exit(1)
        else:
            compared_rept = args.compared_report

    if create_sta:
        station_list = LFUtils.portNameSeries(prefix_="sta",
                                              start_id_=0,
                                              end_id_=num_sta - 1,
                                              padding_number_=10000,
                                              radio=args.radio)
    else:
        station_list = args.sta_names.split(",")
    ip_var_test = IPV4VariableTime(host=args.mgr,
                                   port=args.mgr_port,
                                   number_template="0000",
                                   sta_list=station_list,
                                   create_sta=create_sta,
                                   name_prefix="VT",
                                   upstream=args.upstream_port,
                                   ssid=args.ssid,
                                   password=args.passwd,
                                   radio=args.radio,
                                   security=args.security,
                                   test_duration=args.test_duration,
                                   use_ht160=False,
                                   side_a_min_rate=args.a_min,
                                   side_b_min_rate=args.b_min,
                                   mode=args.mode,
                                   ap=args.ap,
                                   traffic_type=args.traffic_type,
                                   _debug_on=args.debug)

    ip_var_test.pre_cleanup()

    ip_var_test.build()
    # exit()
    if create_sta:
        if not ip_var_test.passes():
            print(ip_var_test.get_fail_message())
            ip_var_test.exit_fail()

    try:
        layer3connections = ','.join(
            [[*x.keys()][0] for x in ip_var_test.json_get('endp')['endpoint']])
    except:
        raise ValueError(
            'Try setting the upstream port flag if your device does not have an eth1 port'
        )

    if type(args.layer3_cols) is not list:
        layer3_cols = list(args.layer3_cols.split(","))
        # send col names here to file to reformat
    else:
        layer3_cols = args.layer3_cols
        # send col names here to file to reformat
    if type(args.port_mgr_cols) is not list:
        port_mgr_cols = list(args.port_mgr_cols.split(","))
        # send col names here to file to reformat
    else:
        port_mgr_cols = args.port_mgr_cols
        # send col names here to file to reformat
    if args.debug:
        print("Layer 3 Endp column names are...")
        print(layer3_cols)
        print("Port Manager column names are...")
        print(port_mgr_cols)

    print("Layer 3 Endp column names are...")
    print(layer3_cols)
    print("Port Manager column names are...")
    print(port_mgr_cols)

    try:
        monitor_interval = Realm.parse_time(
            args.monitor_interval).total_seconds()
    except ValueError as error:
        print(str(error))
        print(
            ValueError(
                "The time string provided for monitor_interval argument is invalid. Please see supported time stamp increments and inputs for monitor_interval in --help. "
            ))
        exit(1)
    ip_var_test.start(False, False)

    # if args.influx_mgr is None:
    #    manager = args.mgr
    # else:
    #    manager = args.influx_mgr

    if args.influx_org is not None:
        from InfluxRequest import RecordInflux
        grapher = RecordInflux(  # _influx_host=manager,
            _influx_port=args.influx_port,
            _influx_org=args.influx_org,
            _influx_token=args.influx_token,
            _influx_bucket=args.influx_bucket)
        devices = [station.split('.')[-1] for station in station_list]
        tags = dict()
        tags['script'] = 'test_ipv4_variable_time'
        try:
            for k in args.influx_tag:
                tags[k[0]] = k[1]
        except:
            pass
        grapher.monitor_port_data(longevity=Realm.parse_time(
            args.test_duration).total_seconds(),
                                  devices=devices,
                                  monitor_interval=Realm.parse_time(
                                      args.monitor_interval).total_seconds(),
                                  tags=tags)

    ip_var_test.cx_profile.monitor(
        layer3_cols=layer3_cols,
        sta_list=station_list,
        # port_mgr_cols=port_mgr_cols,
        report_file=report_f,
        systeminfopath=systeminfopath,
        duration_sec=Realm.parse_time(args.test_duration).total_seconds(),
        monitor_interval_ms=monitor_interval,
        created_cx=layer3connections,
        output_format=output,
        compared_report=compared_rept,
        script_name='test_ipv4_variable_time',
        arguments=args,
        debug=args.debug)

    ip_var_test.stop()
    if create_sta:
        if not ip_var_test.passes():
            print(ip_var_test.get_fail_message())
            ip_var_test.exit_fail()
        LFUtils.wait_until_ports_admin_up(port_list=station_list)

        if ip_var_test.passes():
            ip_var_test.success()
    ip_var_test.cleanup()
    print("IPv4 Variable Time Test Report Data: {}".format(report_f))
Exemplo n.º 20
0
def main():
    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_l4_urls_per_ten',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
            Create layer-4 endpoints to connect to a url and test that urls/s are meeting or exceeding the target rate
                ''',
        description='''\
    test_ipv4_l4_urls_per_ten.py:
--------------------
Generic command example:
python3 ./test_ipv4_l4_urls_per_ten.py 
    --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --requests_per_ten 600 \\
    --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"} \\
    --num_tests 1 \\
    --url "dl http://10.40.0.1 /dev/null" \\
    --ap "00:0e:8e:78:e1:76"
    --target_per_ten 600 \\
    --output_format csv \\
    --report_file ~/Documents/results.csv \\
    --test_duration 2m \\
    --debug
            ''')
    required = None
    for agroup in parser._action_groups:
        if agroup.title == "required arguments":
            required = agroup
    #if required is not None:

    optional = None
    for agroup in parser._action_groups:
        if agroup.title == "optional arguments":
            optional = agroup

    if optional is not None:
        optional.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600)
        optional.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes', default=1)
        optional.add_argument('--url', help='--url specifies upload/download, address, and dest',default="dl http://10.40.0.1 /dev/null")
        optional.add_argument('--test_duration', help='duration of test',default="2m")
        optional.add_argument('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90 percent this value',default=600)
        optional.add_argument('--mode',help='Used to force mode of stations')
        optional.add_argument('--ap',help='Used to force a connection to a particular AP')
        optional.add_argument('--report_file',help='where you want to store results')
        optional.add_argument('--output_format', help='choose csv or xlsx') #update once other forms are completed
    
    args = parser.parse_args()

    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted
    if args.report_file is None:
        if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','parquet','png','df','xlsx']:
            output_form=args.output_format.lower()
            print("Defaulting file output placement to /home/lanforge.")
            rpt_file='/home/data.' + output_form
        else:
            print("Defaulting data file output type to Excel")
            rpt_file='/home/lanforge/data.xlsx'
            output_form='xlsx'

    else:
        rpt_file=args.report_file
        if args.output_format is None:
            output_form=str(args.report_file).split('.')[-1]
        else:
            output_form=args.output_format 


    #Create directory
    if args.report_file is None:
        try:
            homedir = str(datetime.datetime.now().strftime("%Y-%m-%d-%H-%M")).replace(':','-')+'test_ipv4_l4_urls_per_ten'
            path = os.path.join('/home/lanforge/report-data/',homedir)
            os.mkdir(path)
        except:
            path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
            print('Saving file to local directory')
    else:
        pass

    if args.report_file is None:
        if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','png','df','parquet','xlsx']:
            rpt_file=path+'/data.' + args.output_format
            output=args.output_format
        else:
            print('Defaulting data file output type to Excel')
            rpt_file=path+'/data.xlsx'
            output='xlsx'
    else:
        rpt_file=args.report_file
        if args.output_format is None:
            output=str(args.report_file).split('.')[-1]
        else:
            output=args.output_format


    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPV4L4(host=args.mgr, port=args.mgr_port,
                     ssid=args.ssid,
                     password=args.passwd,
                     radio=args.radio,
                     upstream_port=args.upstream_port,
                     security=args.security,
                     station_list=station_list,
                     url=args.url,
                     mode=args.mode,
                     ap=args.ap,
                     _debug_on=args.debug,
                     test_duration=args.test_duration,
                     num_tests=args.num_tests,
                     target_requests_per_ten=args.target_per_ten,
                     requests_per_ten=args.requests_per_ten)
    ip_test.cleanup(station_list)
    ip_test.build()
    ip_test.start()

    try:
        layer4traffic=','.join([[*x.keys()][0] for x in ip_test.local_realm.json_get('layer4')['endpoint']])
    except:
        pass
    ip_test.l4cxprofile.monitor(col_names=['bytes-rd', 'urls/s'],
                                report_file=rpt_file,
                                duration_sec=ip_test.local_realm.parse_time(args.test_duration).total_seconds(),
                                created_cx=layer4traffic,
                                output_format=output_form,
                                script_name='test_ipv4_l4_urls_per_ten', 
                                arguments=args,
                                debug=args.debug)
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        print("Full test passed, all endpoints met or exceeded 90 percent of the target rate")
Exemplo n.º 21
0
    def __init__(self,
                 lfclient_host="localhost",
                 lfclient_port=8080,
                 radio="wiphy1",
                 sta_prefix="sta",
                 start_id=0,
                 num_sta=2,
                 dut_ssid="lexusdut",
                 dut_security="open",
                 dut_passwd="[BLANK]",
                 upstream="eth1",
                 name_prefix="L3Test",
                 session_id="Layer3Test",
                 test_name="Client/s Connectivity Test",
                 pass_criteria=20,
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(lfclient_host,
                         lfclient_port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        print("Test is about to start")
        self.host = lfclient_host
        self.port = lfclient_port
        self.radio = radio
        self.upstream = upstream
        self.monitor_interval = 1
        self.sta_prefix = sta_prefix
        self.sta_start_id = start_id
        self.pass_criteria = pass_criteria
        self.num_sta = num_sta
        self.name_prefix = name_prefix
        self.ssid = dut_ssid
        self.security = dut_security
        self.password = dut_passwd
        self.session_id = session_id
        self.test_name = test_name
        self.test_duration = 1

        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()

        station_list = []
        for i in range(0, self.num_sta):
            station_list.append(self.sta_prefix + str(i).zfill(4))
        print(station_list)
        self.station_data = dict.fromkeys(station_list)
        for i in station_list:
            self.station_data[i] = "None"
        print(self.station_data)

        self.reports_path = webconsole_dir + "/reports/" + self.test_name + "_" + self.session_id + '/'

        print(self.reports_path)

        if not os.path.exists(self.reports_path):
            os.makedirs(self.reports_path)
        print("Test is Initialized")
        self.station_list = LFUtils.portNameSeries(prefix_=self.sta_prefix,
                                                   start_id_=self.sta_start_id,
                                                   end_id_=self.num_sta - 1,
                                                   padding_number_=10000,
                                                   radio=self.radio)
        print(self.station_profile.station_names)
Exemplo n.º 22
0
def main():
    parser = LFCliBase.create_basic_argparse(
        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
--------------------
Generic command example:
python3 ./test_generic.py 
    --mgr localhost (optional)
    --mgr_port 4122 (optional)
    --upstream_port eth1 (optional)
    --radio wiphy0 (required)
    --num_stations 3 (optional)
    --security {open|wep|wpa|wpa2|wpa3} (required)
    --ssid netgear (required)
    --passwd admin123 (required)
    --type lfping  {generic|lfping|iperf3-client | speedtest | lf_curl} (required)
    --dest 10.40.0.1 (required - also target for iperf3)
    --test_duration 2m 
    --interval 1s 
    --debug 


    Example commands: 
    LFPING:
    ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy0 --num_stations 7 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type lfping --dest 10.40.0.1 --security wpa2
    LFCURL (under construction):
    ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy1  --num_stations 26 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type lfcurl --dest 10.40.0.1
    GENERIC: 
    ./test_generic.py --mgr localhost--mgr_port 4122 --radio wiphy1  --num_stations 2 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type generic
    SPEEDTEST:
  ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy2 --num_stations 13 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type speedtest --speedtest_min_up 20 
    --speedtest_min_dl 20 --speedtest_max_ping 150 --security wpa2
    IPERF3 (under construction):
   ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy1 --num_stations 3 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type iperf3 
''')
    required = parser.add_argument_group('required arguments')
    required.add_argument(
        '--security',
        help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >',
        required=True)
    parser.add_argument(
        '--type',
        help=
        'type of command to run: generic, lfping, iperf3-client, iperf3-server, lfcurl',
        default="lfping")
    parser.add_argument(
        '--cmd',
        help='specifies command to be run by generic type endp',
        default='')
    parser.add_argument('--dest',
                        help='destination IP for command',
                        default="10.40.0.1")
    parser.add_argument('--test_duration',
                        help='duration of the test eg: 30s, 2m, 4h',
                        default="2m")
    parser.add_argument('--interval',
                        help='interval to use when running lfping (1s, 1m)',
                        default=1)
    parser.add_argument(
        '--speedtest_min_up',
        help='sets the minimum upload threshold for the speedtest type',
        default=None)
    parser.add_argument(
        '--speedtest_min_dl',
        help='sets the minimum download threshold for the speedtest type',
        default=None)
    parser.add_argument(
        '--speedtest_max_ping',
        help='sets the minimum ping threshold for the speedtest type',
        default=None)
    parser.add_argument('--client',
                        help='client to the iperf3 server',
                        default=None)

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(radio=args.radio,
                                          prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=100)

    generic_test = GenTest(host=args.mgr,
                           port=args.mgr_port,
                           number_template="00",
                           radio=args.radio,
                           sta_list=station_list,
                           name_prefix="GT",
                           type=args.type,
                           dest=args.dest,
                           cmd=args.cmd,
                           interval=1,
                           ssid=args.ssid,
                           upstream=args.upstream_port,
                           passwd=args.passwd,
                           security=args.security,
                           test_duration=args.test_duration,
                           speedtest_min_up=args.speedtest_min_up,
                           speedtest_min_dl=args.speedtest_min_dl,
                           speedtest_max_ping=args.speedtest_max_ping,
                           client=args.client,
                           _debug_on=args.debug)

    generic_test.cleanup(station_list)
    generic_test.build()
    if not generic_test.passes():
        print(generic_test.get_fail_message())
        generic_test.exit_fail()
    generic_test.start()
    if not generic_test.passes():
        print(generic_test.get_fail_message())
        generic_test.exit_fail()
    generic_test.stop()
    time.sleep(30)
    generic_test.cleanup(station_list)
    if generic_test.passes():
        generic_test.exit_success()
Exemplo n.º 23
0
def main():
    lfjson_port = 8080
    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_l4_urls_per_ten',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Create layer-4 endpoints to connect to an ftp server and test that urls/s are meeting or exceeding the target rate
                ''',
        description='''\
        test_ipv4_l4_ftp_urls_per_ten.py
--------------------
Generic command example:
python3 ./test_ipv4_l4_ftp_urls_per_ten.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --test_duration 2m \\ {2m | 30s | 3h | 1d ...etc}
    --interval 1s \\
    --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",
    --ap "00:0e:8e:78:e1:76"
    --requests_per_ten 600 \\
    --num_tests 1 \\
    --url "ul ftp://lanforge:[email protected]/example.txt  /home/lanforge/example.txt"
    --debug
            ''')
    optional = parser.add_argument_group('optional arguments')
    required = parser.add_argument_group('required arguments')
    required.add_argument(
        '--security',
        help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >',
        required=True)
    parser.add_argument(
        '--requests_per_ten',
        help='--requests_per_ten number of request per ten minutes',
        default=600)
    parser.add_argument('--test_duration',
                        help='--test duration of a single test',
                        default=600)
    parser.add_argument(
        '--num_tests',
        help='--num_tests number of tests to run. Each test runs 10 minutes',
        default=1)
    parser.add_argument(
        '--url',
        help='--url specifies upload/download, address, and dest',
        default="dl http://10.40.0.1 /dev/null")
    optional.add_argument('--mode', help='Used to force mode of stations')
    optional.add_argument('--ap',
                          help='Used to force a connection to a particular AP')
    #parser.add_argument('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90 percent of this value',
    #default=600)
    args = parser.parse_args()

    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPV4L4(host=args.mgr,
                     port=args.mgr_port,
                     ssid=args.ssid,
                     password=args.passwd,
                     upstream_port=args.upstream_port,
                     radio=args.radio,
                     security=args.security,
                     station_list=station_list,
                     url=args.url,
                     mode=args.mode,
                     ap=args.ap,
                     num_tests=args.num_tests,
                     requests_per_ten=args.requests_per_ten,
                     test_duration=args.test_duration,
                     _debug_on=args.debug)
    ip_test.cleanup(station_list)
    ip_test.build()
    ip_test.start()
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        print(
            "Full test passed, all endpoints met or exceeded 90 percent of the target rate"
        )
def main():

    parser = LFCliBase.create_basic_argparse(
        prog='example_security_connection.py',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Example flags and command line input to run the script.
                ''',
        description='''\
        example_security_connection.py
        --------------------
        This python script creates an inputted number of stations using user-inputted security. This verifies that the most basic form of security works with the LANforge device.
        --------------------

        Generic command example:
    python3 ./example_security_connection.py  
        --mgr localhost 
        --mgr_port 8080  
        --num_stations 6 
        --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",
                "anAX"   : "14"}
        --radio wiphy2
        --security {open|wep|wpa|wpa2|wpa3} 
        --ssid netgear-wpa3 
        --ap "00:0e:8e:78:e1:76"
        --passwd admin123-wpa3 
        --debug 

            ''')
    optional = parser.add_argument_group('optional arguments')
    required = parser.add_argument_group('required arguments')
    required.add_argument(
        '--security',
        help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >',
        required=True)
    optional.add_argument('--mode', help='Used to force mode of stations')
    optional.add_argument('--ap',
                          help='Used to force a connection to a particular AP')

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)
    ip_test = IPv4Test(host=args.mgr,
                       port=args.mgr_port,
                       ssid=args.ssid,
                       password=args.passwd,
                       radio=args.radio,
                       mode=args.mode,
                       security=args.security,
                       sta_list=station_list,
                       ap=args.ap)
    ip_test.cleanup(station_list)
    ip_test.timeout = 60
    ip_test.build()
def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        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
--------------------
Generic command example:
python3 ./test_generic.py --upstream_port eth1 
    --radio wiphy0 (required)
    --num_stations 3 
    --security {open|wep|wpa|wpa2|wpa3} (required)
    --ssid netgear (required)
    --passwd admin123 (required)
    --type lfping  {generic|lfping|iperf3-client | speedtest | iperf3-server |lf_curl} (required)
    --dest 10.40.0.1 (required - also target for iperf3)
    --test_duration 2m 
    --interval 1s 
    --debug 
''')

    parser.add_argument(
        '--type',
        help=
        'type of command to run: generic, lfping, iperf3-client, iperf3-server, lfcurl',
        default="lfping")
    parser.add_argument(
        '--cmd',
        help='specifies command to be run by generic type endp',
        default='')
    parser.add_argument('--dest',
                        help='destination IP for command',
                        default="10.40.0.1")
    parser.add_argument('--test_duration',
                        help='duration of the test eg: 30s, 2m, 4h',
                        default="2m")
    parser.add_argument('--interval',
                        help='interval to use when running lfping (1s, 1m)',
                        default=1)
    parser.add_argument(
        '--speedtest_min_up',
        help='sets the minimum upload threshold for the speedtest type',
        default=None)
    parser.add_argument(
        '--speedtest_min_dl',
        help='sets the minimum download threshold for the speedtest type',
        default=None)
    parser.add_argument(
        '--speedtest_max_ping',
        help='sets the minimum ping threshold for the speedtest type',
        default=None)

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(radio=args.radio,
                                          prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=100)

    generic_test = GenTest(args.mgr,
                           lfjson_port,
                           number_template="00",
                           radio=args.radio,
                           sta_list=station_list,
                           name_prefix="GT",
                           type=args.type,
                           dest=args.dest,
                           cmd=args.cmd,
                           interval=1,
                           ssid=args.ssid,
                           upstream=args.upstream_port,
                           password=args.passwd,
                           security=args.security,
                           test_duration=args.test_duration,
                           speedtest_min_up=args.speedtest_min_up,
                           speedtest_min_dl=args.speedtest_min_dl,
                           speedtest_max_ping=args.speedtest_max_ping,
                           _debug_on=args.debug)

    generic_test.cleanup(station_list)
    generic_test.build()
    if not generic_test.passes():
        print(generic_test.get_fail_message())
        exit(1)
    generic_test.start()
    if not generic_test.passes():
        print(generic_test.get_fail_message())
        exit(1)
    generic_test.stop()
    time.sleep(30)
    generic_test.cleanup(station_list)
    if generic_test.passes():
        print("Full test passed")
Exemplo n.º 26
0
def main():
    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv6_connection.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
            Create stations that attempt to authenticate, associate, and receive IPV6 addresses on the 
            chosen SSID
                ''',
        description='''\
test_ipv6_connection.py:
--------------------------------------------------
Generic command example:
python3 ./test_ipv6_connection.py 
        --upstream_port eth1 
        --radio wiphy0 
        --num_stations 3 
        --proxy
        --security {open|wep|wpa|wpa2|wpa3} 
        --ssid netgear 
        --passwd admin123
        --mode   1  
        --ap "00:0e:8e:78:e1:76"
        --test_id
        --timeout 120 
        --debug
            ''')

    required = None
    for agroup in parser._action_groups:
        if agroup.title == "required arguments":
            required = agroup
    #if required is not None:

    optional = None
    for agroup in parser._action_groups:
        if agroup.title == "optional arguments":
            optional = agroup

    if optional is not None:
        optional.add_argument("--ap",
                              help="Add BSSID of access point to connect to")
        optional.add_argument('--mode', help=LFCliBase.Help_Mode)
        optional.add_argument(
            '--timeout',
            help=
            '--timeout sets the length of time to wait until a connection is successful',
            default=30)

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)

    ipv6_test = IPv6Test(host=args.mgr,
                         port=args.mgr_port,
                         ssid=args.ssid,
                         password=args.passwd,
                         security=args.security,
                         ap=args.ap,
                         mode=args.mode,
                         sta_list=station_list,
                         _debug_on=args.debug)
    ipv6_test.cleanup(station_list)
    ipv6_test.build()
    print('Sleeping for 30 seconds...', flush=True)
    time.sleep(30)
    if not ipv6_test.passes():
        print(ipv6_test.get_fail_message())
        exit(1)
    ipv6_test.start(station_list, False, False)
    ipv6_test.stop()
    if not ipv6_test.passes():
        print(ipv6_test.get_fail_message())
        exit(1)
    time.sleep(20)
    ipv6_test.cleanup(station_list)
    if ipv6_test.passes():
        print("Full test passed, all stations associated and got IP")
Exemplo n.º 27
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_ttls.py',
        #formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''Demonstration showing wpa2-ent ttls authentication''',
        description='''\
test_ipv4_ttls.py:
 --------------------
 Generic command layout:
 python ./test_ipv4_ttls.py --upstream_port <port> 
    --radio <radio 0> 
    --num_stations 3
    --ssid ssid-wpa-1
    --keyphrase ssid-wpa-1
    --security <security type: wpa2, open, wpa3> 
    --debug

''')

    parser.add_argument('--a_min',
                        help='--a_min bps rate minimum for side_a',
                        default=256000)
    parser.add_argument('--b_min',
                        help='--b_min bps rate minimum for side_b',
                        default=256000)
    parser.add_argument('--test_duration',
                        help='--test_duration sets the duration of the test',
                        default="5m")
    parser.add_argument('--key-mgmt',
                        help="--key-mgt: { %s }" %
                        ", ".join(realm.wpa_ent_list()),
                        default="WPA-EAP")
    parser.add_argument('--wpa_psk',
                        help='wpa-ent pre shared key',
                        default="[BLANK]")
    parser.add_argument('--eap',
                        help='--eap eap method to use',
                        default="TTLS")
    parser.add_argument('--identity',
                        help='--identity eap identity string',
                        default="testuser")
    parser.add_argument('--ttls_passwd',
                        help='--ttls_passwd eap password string',
                        default="testpasswd")
    parser.add_argument('--ttls_realm',
                        help='--ttls_realm 802.11u home realm to use',
                        default="localhost.localdomain")
    parser.add_argument('--domain',
                        help='--domain 802.11 domain to use',
                        default="localhost.localdomain")
    parser.add_argument(
        '--hessid',
        help='--hessid 802.11u HESSID (MAC addr format/peer for WDS)',
        default="00:00:00:00:00:01")
    parser.add_argument(
        '--ieee80211w',
        help='--ieee80211w <disabled(0),optional(1),required(2)',
        default='1')
    parser.add_argument('--use_hs20', help='use HotSpot 2.0', default=False)
    parser.add_argument('--enable_pkc',
                        help='enable opportunistic PMKSA WPA2 key caching',
                        default=False)
    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000)
    ttls_test = TTLSTest(
        host=args.mgr,
        port=args.mgr_port,
        ssid=args.ssid,
        password=args.passwd,
        security=args.security,
        sta_list=station_list,
        radio=args.radio,
        key_mgmt=args.key_mgmt,
        wpa_psk=args.wpa_psk,
        eap=args.eap,
        identity=args.identity,
        ttls_passwd=args.ttls_passwd,
        ttls_realm=args.ttls_realm,
        domain=args.domain,
        hessid=args.hessid,
        ieee80211w=args.ieee80211w,
        hs20_enable=args.use_hs20,
        enable_pkc=args.enable_pkc,
    )
    ttls_test.cleanup(station_list)
    ttls_test.build()
    if not ttls_test.passes():
        print(ttls_test.get_fail_message())
        exit(1)
    ttls_test.start(station_list, False, False)
    ttls_test.stop()
    if not ttls_test.passes():
        print(ttls_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ttls_test.cleanup(station_list)
    if ttls_test.passes():
        print("Full test passed, all stations associated and got IP")
def main():
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_l4_ftp_wifi.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Create layer-4 endpoints and test that the bytes-wr from the chosen URL are increasing over the
                duration of the test
                ''',

        description='''\
        test_ipv4_l4_ftp_wifi.py
--------------------
Generic command example:
python3 ./test_ipv4_l4_ftp_wifi.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --dest 10.40.0.1 \\
    --test_duration 2m \\
    --interval 1s \\
    --requests_per_ten 600 \\
    --dest /var/www/html/data_slug_4K.bin \\
    --source /tmp/data_slug_4K.bin \\
    --ftp_user lanforge \\
    --ftp_passwd lanforge \\
    --debug
            ''')

    parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")
    parser.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600)
    parser.add_argument('--dest', help='--dest specifies the destination for the file', default="/var/www/html/data_slug_4K.bin")
    parser.add_argument('--source', help='--source specifies the source of the file',
                        default="/tmp/data_slug_4K.bin")
    parser.add_argument('--ftp_user', help='--ftp_user sets the username to be used for ftp', default="lanforge")
    parser.add_argument('--ftp_passwd', help='--ftp_user sets the password to be used for ftp', default="lanforge")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted
        
    station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPV4L4(host=args.mgr, port=args.mgr_port,
                     ssid=args.ssid,
                     password=args.passwd,
                     security=args.security,
                     station_list=station_list,
                     test_duration=args.test_duration,
                     requests_per_ten=args.requests_per_ten,
                     _debug_on=args.debug,
                     upstream_port=args.upstream_port,
                     ftp_user=args.ftp_user,
                     ftp_passwd=args.ftp_passwd,
                     dest=args.dest,
                     source=args.source)
    ip_test.cleanup(station_list)
    ip_test.build()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    ip_test.start(False, False)
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        print("Full test passed, all endpoints had increased bytes-wr throughout test duration")
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = LFCliBase.create_basic_argparse(
        prog='test_ipv4_l4_wifi.py',
        # formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
                Create layer-4 endpoints and test that the bytes-rd from the chosen URL are increasing over the
                duration of the test
                ''',
        description='''\
    test_ipv4_l4_wifi.py:
--------------------
Generic command example:
python3 ./test_ipv4_l4_wifi.py --upstream_port eth1 \\
    --radio wiphy0 \\
    --num_stations 3 \\
    --security {open|wep|wpa|wpa2|wpa3} \\
    --ssid netgear \\
    --passwd admin123 \\
    --test_duration 2m \\
    --requests_per_ten 600 \\
    --direction {ul | dl} \\
    --dest /dev/null (or 10.40.0.1)\\
    --debug
            ''')

    parser.add_argument('--test_duration',
                        help='--test_duration sets the duration of the test',
                        default="5m")
    parser.add_argument(
        '--requests_per_ten',
        help='--requests_per_ten number of request per ten minutes',
        default=600)
    parser.add_argument(
        '--direction',
        help='--direction <ul | dl> specifies upload or download',
        default="dl")
    parser.add_argument(
        '--dest',
        help=
        '--dest specifies the destination (dl) or source (ul) for the file',
        default="/dev/null")

    args = parser.parse_args()
    num_sta = 2
    if (args.num_stations is not None) and (int(args.num_stations) > 0):
        num_stations_converted = int(args.num_stations)
        num_sta = num_stations_converted

    station_list = LFUtils.portNameSeries(prefix_="sta",
                                          start_id_=0,
                                          end_id_=num_sta - 1,
                                          padding_number_=10000,
                                          radio=args.radio)

    ip_test = IPV4L4(host=args.mgr,
                     port=args.mgr_port,
                     ssid=args.ssid,
                     password=args.passwd,
                     radio=args.radio,
                     security=args.security,
                     station_list=station_list,
                     direction=args.direction,
                     dest=args.dest,
                     test_duration=args.test_duration,
                     upstream_port=args.upstream_port,
                     requests_per_ten=args.requests_per_ten,
                     _debug_on=args.debug)
    ip_test.cleanup(station_list)
    ip_test.build()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        ip_test.exit_fail()
    ip_test.start(False, False)
    ip_test.stop()
    if not ip_test.passes():
        print(ip_test.get_fail_message())
        ip_test.exit_fail()
    time.sleep(30)
    ip_test.cleanup(station_list)
    if ip_test.passes():
        ("Full test passed, all endpoints had increased bytes-rd throughout test duration"
         )
        ip_test.exit_success()
Exemplo n.º 30
0
def main():
    lfjson_host = "localhost"
    lfjson_port = 8080

    parser = argparse.ArgumentParser(
        prog='test_l3_longevity.py',
        #formatter_class=argparse.RawDescriptionHelpFormatter,
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''\
Useful Information:

1. Polling interval for checking traffic is fixed at 1 minute
2. The test will exit when traffic has not changed on a station for 1 minute
3. The tx/rx rates are fixed at 256000 bits per second
4. Security is fixed at WPA2
5. Maximum stations per radio is 64
            ''',
        description='''\
test_l3_longevity.py:
--------------------
Basic Idea: 

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 recieved.

Test will exit on failure of not recieving traffice for one minute on any station.

Scripts are executed from: ./lanforge/py-scripts  

Stations start counting form zero,  thus stations count from zero - number of las 

Generic command layout:
python ./test_l3_longevity.py 
        --test_duration <duration> 
        --endp_type <traffic type> 
        --upstream_port <port> 
        --radio <radio_name> <num_stations> <ssid> <ssid_password>

Note:   
multiple --radio switches may be entered up to the number of radios available:
--radio <radio 0> <number ofstations> <ssid> <ssid password>  --radio <radio 01> <number of stations> <ssid> <ssid password>

<duration>: number followed by one of the following 
            d - days
            h - hours
            m - minutes
            s - seconds

<traffic type>: 
            lf_udp  : IPv4 UDP traffic
            lf_tcp  : IPv4 TCP traffic
            lf_udp6 : IPv6 UDP traffic
            lf_tcp6 : IPv6 TCP traffic

Example:
    1. Test duration 4 minutes
    2. Traffic IPv4 TCP
    3. Upstream-port eth1
    4. Radio #1 wiphy0 has 32 stations, ssid = candelaTech-wpa2-x2048-4-1, ssid password = candelaTech-wpa2-x2048-4-1
    5. Radio #2 wiphy1 has 64 stations, ssid = candelaTech-wpa2-x2048-5-3, ssid password = candelaTech-wpa2-x2048-5-3

Example: 
python3 .\\test_l3_longevity.py --test_duration 4m --endp_type lf_tcp --upstream_port eth1 \
                                --radio wiphy0 32 candelaTech-wpa2-x2048-4-1 candelaTech-wpa2-x2048-4-1 \
                                --radio wiphy1 64 candelaTech-wpa2-x2048-5-3 candelaTech-wpa2-x2048-5-3 

        ''')

    parser.add_argument(
        '-d',
        '--test_duration',
        help=
        '--test_duration <how long to run>  example --time 5d (5 days) default: 3m options: number followed by d, h, m or s',
        default='3m')
    parser.add_argument(
        '-t',
        '--endp_type',
        help=
        '--endp_type <type of traffic> example --endp_type lf_udp, default: lf_udp , options: lf_udp, lf_udp6, lf_tcp, lf_tcp6',
        default='lf_udp',
        type=valid_endp_type)
    parser.add_argument(
        '-u',
        '--upstream_port',
        help='--upstream_port <upstream_port> example: --upstream_port eth1',
        default='eth1')
    parser.add_argument('--debug',
                        help='Enable debugging',
                        default=False,
                        action="store_true")

    requiredNamed = parser.add_argument_group('required arguments')
    requiredNamed.add_argument(
        '-r',
        '--radio',
        action='append',
        nargs=4,
        metavar=('<wiphyX>', '<number last station>', '<ssid>',
                 '<ssid password>'),
        help=
        '--radio  <number_of_wiphy> <number of last station> <ssid>  <ssid password> ',
        required=True)
    args = parser.parse_args()

    if args.test_duration:
        test_duration = args.test_duration

    if args.endp_type:
        endp_type = args.endp_type

    side_b = args.upstream_port

    if args.radio:
        radios = args.radio

    radio_offset = 0
    number_of_stations_offset = 1
    ssid_offset = 2
    ssid_password_offset = 3

    MAX_NUMBER_OF_STATIONS = 64

    radio_name_list = []
    number_of_stations_per_radio_list = []
    ssid_list = []
    ssid_password_list = []

    index = 0
    for radio in radios:
        radio_name = radio[radio_offset]
        radio_name_list.append(radio_name)
        number_of_stations_per_radio = radio[number_of_stations_offset]
        number_of_stations_per_radio_list.append(number_of_stations_per_radio)
        ssid = radio[ssid_offset]
        ssid_list.append(ssid)
        ssid_password = radio[ssid_password_offset]
        ssid_password_list.append(ssid_password)
        index += 1

    index = 0
    station_lists = []
    for radio in radios:
        number_of_stations = int(number_of_stations_per_radio_list[index])
        if number_of_stations > MAX_NUMBER_OF_STATIONS:
            print("number of stations per radio exceeded max of : {}".format(
                MAX_NUMBER_OF_STATIONS))
            quit(1)
        station_list = LFUtils.portNameSeries(prefix_="sta",
                                              start_id_=1 + index * 1000,
                                              end_id_=number_of_stations +
                                              index * 1000,
                                              padding_number_=10000)
        station_lists.append(station_list)
        index += 1
    ip_var_test = L3VariableTimeLongevity(
        lfjson_host,
        lfjson_port,
        number_template="00",
        station_lists=station_lists,
        name_prefix="var_time",
        endp_type=endp_type,
        side_b=side_b,
        radios=radios,
        radio_name_list=radio_name_list,
        number_of_stations_per_radio_list=number_of_stations_per_radio_list,
        ssid_list=ssid_list,
        ssid_password_list=ssid_password_list,
        resource=1,
        security="wpa2",
        test_duration=test_duration,
        side_a_min_rate=256000,
        side_b_min_rate=256000,
        _debug_on=args.debug)

    ip_var_test.cleanup(station_list)
    ip_var_test.build()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    ip_var_test.start(False, False)
    ip_var_test.stop()
    if not ip_var_test.passes():
        print(ip_var_test.get_fail_message())
        exit(1)
    time.sleep(30)
    ip_var_test.cleanup(station_list)
    if ip_var_test.passes():
        print("Full test passed, all connections increased rx bytes")