LANforge-CLI API Cookbook
The LANforge-CLI API Cookbook provides a series of detailed examples of how to
craft testing scripts for unattended/automated operation. Each example
intends to give the reader a runnable test script and a better understanding of how to
use the LANforge-CLI API.
Please read the summary information on this page before reading the chapters listed below.
LANforge-CLI Detailed Cookbook Examples
- CLI: Introduction
- Monitor and Reset Ports with the portmod Script
- Cross Connects and Endpoints Tutorial
- Creating Connections with the FIREmod Script
- Operating Endpoint Hunt Scripts with the CLI
- Generating WiFi Traffic with the Associate Script
- Changing Station WiFi SSID with the CLI API
- Changing Station POST_IFUP Script with the CLI API
- Scripting Attenuation with CSV data
- LANforge Entity IDs
- Station CLI Operations
Places to Run CLI Commands
You do not need to operate scripts directly from the LANforge server, and this allows you to code scripts in your
preferred text editing environment. Likewise, you do not need to run a copy of LANforge Server on your desktop.
Scripts will create a plain-text connection to the LANforger server you specify.
- Windows Desktop
- You can install a copy of the LANforge Server on your windows desktop (without a license) so that you have access
to the Perl scripting libraries. Edit scripts and run them from your C:\Program Files\LANforge-Server\scripts
- Linux Desktop
- You can copy the LANforge scripts folder directly from your LANforge server to your Documents directory with scp.
- SSH or VNC connection to LANforge Server
- Using vncviewer, rdesktop or ssh are all fine options to connect to the
LANforge server to write and operate scripts. The LANforge server comes with a basic Linux desktop and you can use emacs,
vim, pluma, or gedit text editors installed by default. When editing scripts on the LANforge server itself, be careful
to back up your work before you upgrade LANforge. The LANforge install process will over-write scripts of the same
name in the scripts directory.
Requirements for Scripts
Your desktop (or other computer) running CLI scripts needs to have a reliable (wired) connection to the management
port of your LANforge server. If you are engaging in long running tests, you might consider running the scripts from
the LANforge manager itself if your desktop machine needs to be powered off.
- Script Libraries
- CLI scripts are written using Perl. They require the libraries in /home/lanforge/scripts/LANforge
Users may write scripts in other programming languages, such as python, but in that case, they will
not be able to take direct avantage of the Perl scripts included in LANforge.
- On Windows
LANforge is more fully featured on Linux, but basic support exists on Windows as well.
You can run CLI scripts from any Windows desktop as long as you have Perl installed.
You can use ActiveState Perl
or Perl from the Cygwin project.
We also highly suggest installing PuTTY ssh client
to access your LANforge server.
- On Linux/OS X
- Most Linux distributions come with and ssh client and Perl already installed.
- LANforge Server Requirements
- The following examples will create test scenarios that work on LANforge
Linux systems running the LANforge software with the LANforge kernel and
a sufficient license. If you are running LANforge server using another Linux kernel, you may not be
able to operate some of the examples. (Features like Armageddon, operation of WiFi-AC radios, and WanLinks
all require drivers included only in Candela provided kernels.)
Please contact us at firstname.lastname@example.org
if you have any questions.
Before Starting LANforge-CLI Traffic Generation
Before attempting the examples below, ensure that you have successfully
followed these software installation guides:
It is also recommended that you back up your current running LANforge Server
database so that you may safely return to your current operating state.
su - root
tar -cvzf my_db_backup.tar.gz DB
If you have any questions or suggestions, email email@example.com.