Candela Technologies Logo
Network Testing and Emulation Solutions

Changing Station WiFi SSID with the CLI API

Goal: Programmatically change a stations SSID

Programatically creating LANforge virtual stations requires using the add_sta command. If you already have a station and need to change the SSID, you still use the add_sta command.

The general sequence of commands is:

  1. if port is up, set port down with:
  2. cur_flags=0x1 interest_flags=0x800002
  3. issue add_port with changed SSID
  4. issue set_port to bring it up with:
  5. cur_flags=0x0 interest_flags=0x800002

We can create a station using this script command:

./lf_associate_ap.pl --action step2 --mgr jedtest \
   --resource 1 --radio wiphy0 \
   --ssid jedtest --first_sta sta100 \
   --num_stations 1 --first_ip=DHCP \
   --wifi_mode abgn --security wpa2 \
   --passphrase jedtest1 --quiet=0
   

The format of the add_sta command is listed in the CLI User's Guide. When we watch the debug output of the lf_associate_ap script, we see this add_sta command executed:

'add_sta' '1' '1' 'wiphy0' 'sta100' '1024' 'jedtest'
   'NA' 'jedtest1' 'AUTO' 'NA' '00:E3:F7:91:4A:1A' '5' 'NA'
   'NA' 'NA' 'NA' 'NA' '1024' 'NA' 'NA' 'NA' 'NA'
   

Looking at an example in the lf_associate_ap.pl script we see it being formatted here:

   my $sta1_cmd   = fmt_vsta_cmd($::resource, $::sta_wiphy, $sta_name,
                                 "$flags", "$::ssid", "$::passphrase",
                                 $mac_addr, "$flagsmask", $wifi_m);
   doCmd($sta1_cmd);
   

We format the parameters:

      return fmt_cmd("add_sta", 1, $resource, $sta_wiphy, $sta_name, "$flags",
                  "$ssid", "NA", "$key", $ap, $cfg_file, $mac,
                  $mode, $rate, $amsdu, $ampdu_factor, $ampdu_density,
                  $sta_br_id, "$flags_mask" );
   

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