Candela Technologies Logo
Network Testing and Emulation Solutions

Associating stations with the lf_associate_ap script.

Goal: Create, destroy, start and stop virtual stations without needing to use the LANforge GUI.

Automated wireless traffic is possible using the lf_associate_ap.pl script. This script can be run within the LANforge server or outside the LANforge Server (on a windows desktop). The output of the script should be redirected to a text file if you want to review the resuts. Use this file in conjunction with the lf_firemod.pl script to create traffic. Requires a LANforge CT520 (or better) system and an access point.

Script Capabilities

The lf_assocatiate_ap.pl script has many options, but here are the basic actions:

Before you begin

  1. We assume you have a separate WiFi access point in routed mode. These examples can be used on a CT523 (or better) system with more than one radio if you want to practice the techniques. You would dedicate a radio to be a virtual AP (see cookbook).
  2. For these examples, our AP will be open with no username or password, and the SSID will be jedtest
  3. If you want to run scripts from your Windows desktop, you have ActivePerl installed.

Creating a virtual station with traffic

Using lf_associate_ap on Windows

  1. In the LANforge GUI, we will inspect our wiphy0 radio. And the radio should be set to channel -1 AUTO
  2. CMD window shortcut: R cmd
    LANforge Scripts are at C:\Program Files\LANforge-Server\scripts
  3. cd C:\Program Files\LANforge-Server\scripts
  4. perl .\lf_associate_ap.pl --help Will show you the script options.
  5. We can create a virtual station with this command:
  6. perl .\lf_associate_ap.pl --resource 1  --resource 1 --mgr jedtest ^
       --action step1       --radio wiphy0    --ssid jedtest ^
       --first_sta sta100   --num_stations 1  --duration 20 ^
       --first_ip DHCP      --upstream eth1 --security wpa2 --passphrase jedtest1
    Long DOS commands and be continued on the next line with the ^ character.
  7. We can see the port appear in the LANforge GUI: and we can inspect it.

Using lf_associate_ap on Linux

  1. Double click on your PuTTY icon and open a connection to your LANforge machine.
  2. The lf_associate_ap.pl script is in the scripts sub directory.
  3. Our command is basically the same.
  4. Long shell commands and be continued on the next line with the \ character.
    ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 1  --duration 20 \
       --first_ip DHCP      --upstream eth1   --security wpa2 --passphrase jedtest1
          
  5. We will see similar output:

More Traffic Examples

  1. Creating Multiple stations that transm
  2. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100 --num_stations 10 --duration 20 \
       --first_ip DHCP      --upstream eth1   --security wpa2 --passphrase jedtest1
  3. Creating TCP/IP bursty traffic from 30Mbps to 450 Mbps
  4. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1   --security wpa2 --passphrase jedtest1 \
       --cxtype tcp --bps-min 30Mpbs \
       --bps-max 450Mbps
  5. Capturing that report with redirection
  6. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1   --security wpa2 --passphrase jedtest1 \
       --cxtype tcp --bps-min 30Mpbs --bps-max 450Mbps &> report.txt
    Both DOS and Linux command output can be saved to a file with the &> operator.
    Both DOS and Linux files can be viewed with the more command.
  7. Creating steady UDP traffic to at 450Mbps
  8. $ ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1   --security wpa2 --passphrase jedtest1 \
       --cxtype udp --bps-min 450Mpbs \
       --bps-max SAME &> report.txt
    $  more report.txt
  9. Associating to an open AP
  10. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1   --security open
  11. Connecting a station at 802.11/abg speeds
  12. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1 --security open \
       --wifi_mode abg
  13. Initializing your test secenario by pre-loading a database. The database is the same name as the dropdown in the GUI Status tab.
  14. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1 --security open \
       --db_preload day_236
  15. Saving your test state after completing a traffic run
  16. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1 --security open \
       --db_preload day_236 --db_save station_results
  17. Cleaning out your scenario settings after completing a traffic run. We can do this by loading the EMPTY database with the db_postload switch.
  18. ./lf_associate_ap.pl --resource 1 --mgr localhost \
       --action step1       --radio wiphy0    --ssid jedtest \
       --first_sta sta100   --num_stations 10 --duration 120 \
       --first_ip DHCP      --upstream eth1 --security open \
       --db_preload day_236 --db_save station_results --db_postload EMPTY

Using lf_associate_ap to stress test an AP

We can have a series of stations associate and unassociate over and over. This can be quite a bit of exercise for an AP. Below is a command that tests five clients connecting.

./lf_associate_ap.pl --mgr jedtest --action step2 \
 --ssid jedtest --first_sta sta100 --first_ip DHCP \
 --num_stations 10 --security wpa2 --passphrase jedtest1
      
This will create set of ten stations bring them up and then take them down.

Script Options

These might have been update since publication, please check --help output for your version of the script.

./lf_associate_ap.pl   [--mgr {host-name | IP}]
      [--mgr_port {ip port}]     # use if on non-default management port
      [--resource {resource}]    # use if multiple lanforge systems; defaults to 1
      [--quiet { yes | no }]     # debug output; -q

      ##       AP selection
      [--radio {name}]           # e.g. wiphy2
      [--ssid {ssid}]            # e.g. jedtest
      [--security {open|wep|wpa|wpa2}] # station authentication type
      [--passphrase {...}]       # implies wpa2 if --security not set
      [--wifi_mode {a|abg|abgn|abgnAC|an|anAC|b|bg|bgn|g}]

      ##       station configuration
      [--num_stations {10}]
      [--first_sta {sta100}]
      [--first_ip {DHCP |ip address}]
      [--netmask {255.255.0.0}]

      ##       connection configuration
      [--cxtype {tcp/tcp6/udp/udp6}]   # use a tcp/udp connection, default tcp
      [--upstream {name|eth1}]
         # could be AP or could be port on LANforge
         # connected to WAN side of AP
      [--bps-min {10000000}]         # minimum tx bps
      [--bps-max {SAME|bps-value}]  # maximum tx bps, use SAME or omit for SAME
      [--duration {30}]      # connection duration, seconds, default 60
      [--poll-time {5}]    # nap time between connection displays
      [--action {step1,step2}]
         # step1: creates [num_stations] stations and L3 connections
         # step2: does bringup test

      [--traffic_type {separate|concurrent}]
         # for step1: separate does download then upload
         # concurrent does upload and download at same time

      [--db_preload {scenario name}]
         # load this database before creating stations
         # option intended as a cleanup step

      [--db_save {name}]
         # save the state of this test scenario after running the
         # connections, before --db_postload

      [--db_postload {scenario name}]
         # load this database after running connections,
         # option intended as a cleanup step

Candela  Technologies, 2417 Main Street, Suite 201, Ferndale, WA 98248, USA
www.candelatech.com | sales@candelatech.com | +1.360.380.1618
Facebook | LinkedIn | Blog