Contact Us
+1.831.460.7010

Maxwell Pro Network Emulator and Protocol Tester


 

Maxwell Pro:  The Engineer's Network EmulatorTM

maxwell-pro-product
 

Using Maxwell Pro from Python, Perl, Tcl, Java, or Shell Scripts

Maxwell Pro can be controlled from scripts or other applications. A control system or test harness can send commands to Maxwel Pro to start, stop, save configuration files and save results from scenarios, along with many other functions.

InterWorking Labs provides a "Maxwell Control API Guide" that describes how to connect to Maxwell and the syntax and semantics of the commands you may send to control Maxwell's behavior.

Any programming language that is capable of opening a TCP/IP connection can be used to control Maxwell. Maxwell Pro is supplied with a Java jar file, Perl Module, Python module, and shell commands that should allow you to quickly write programs and scripts to control Maxwell Pro. (The Maxwell Pro GUI itself uses the included Python module.) If you wish to use a language not included, please send a note to maxwell-support@iwl.mojohelpdesk.com with your request to receive the appropriate command/response codes.

Three Examples Using Shell Scripts

  • Initiate a DHCP impairment.
  • Initiate a user configured IPv4 fragmentation impairment on only UDP packets.
  • Enable jitter on all frames.
  •  

#1  Initiate a DHCP Impairment
#!/bin/bash
# This file illustrates one way to control impairments from a shell script. # The specific example in this script initiates a DHCP impairment.
# If the standard impairment server program (stdiserver) is not already running # with the desired plugin, if any, then the first step is to start the standard # impairment server with the desired plugin. # We'll assume any already running stdiserver process is not loaded with the # desired plugin, so we first kill any previously running stdiserver process.
pkill stdiserver sleep 1
# Wait a second for the process to exit.
# Since this is an example that performs an impairment to DHCP packets, we must # use the TCP/IP impairment plugin. We must specify the entire path to the # plugin file and redirect the standard filedescriptors in order to place the # server in the background.
sdiserver -L /usr/local/lib/iwl/ip_plugins/tcpip_plugin.so \ /dev/null 2>&1 & sleep 1
# Wait a second for the process to finish initializing.
# The following is not strictly needed, but is used here to display the # description of the control fields for the plugin. The meaning of its # output can be determined by studying the standard_impairment_apis.pdf # document and reading the help in the nstdigui.py GUI control application. # It should provide an understanding on how to change the arguments passed to # the setplugin commands below so as to customize them.
getpluginmeta
# For flow 0 (whose default match criteria matches all packets) we want to # set both interfaces (0 and 1) to perform the following impairment: # Under IPv4 tests (also known as protocol group 050) select the DHCP # impairment set of tests (set number 15), and test 18 within that set. # That test sets the server host name and boot file name to non-null terminated # values inside the DHCP client response. # The following two commands start the requested impairment:
setplugin 0 0 on init button 0 num 0 15 num 1 18 setplugin 0 1 on init button 0 num 0 15 num 1 18
# Print the plugin settings to insure we set them to our desired values:
getplugin 0 0 getplugin 0 1
# This runs the impairment for an hour (or until the break key is pressed) by # putting this script to sleep and then killing the server process just before # the script exits. There are of course many other possible ways to handle the # situation, such as issuing commands to clear any flow matches and impairments # that have been set and keep stdiserver running so as to allow traffic to flow # through Maxwell even after this script exits.
sleep 3600 pkill stdiserver
#2 Initiate a user configured IPv4 fragmentation impairment on only UDP packets.
#!/bin/bash
# This file illustrates one way to control impairments from a shell script. # The specific example in this script initiates a user configured IPv4 # fragmentation impairment on only UDP packets.
# If the standard impairment server program (stdiserver) is not already running # with the desired plugin, if any, then the first step is to start the standard # impairment server with the desired plugin. # We'll assume any already running stdiserver process is not loaded with the # desired plugin, so we first kill any previously running stdiserver process.
pkill stdiserver sleep 1
# Wait a second for the process to exit.
# Since this is an example that performs an IPv4 impairment to datagrams, we # must use the TCP/IP impairment plugin. We must specify the entire path to the # plugin file and redirect the standard file descriptors in order to place the # server in the background.
stdiserver -L /usr/local/lib/iwl/ip_plugins/tcpip_plugin.so \ /dev/null 2>&1 & sleep 1
# Wait a second for the process to finish initializing.
# The following is not strictly needed, but is used hereto display the # description of the control fields for the plugin. ThE meaning of its # output can be determined by studying the standard_impairment_apis.pdf # document and reading the help in the nstdigui.py GUI control application. # It should provide an understanding on how to change the arguments passed to # the setplugin commands below so as to customize them.
getpluginmeta
# For flow 0 we want to fragment only in one direction so we set just one # interface (0) to perform the following impairment: # Under IPv4 tests (known as protocol group 050 in the docs or radio button 0 # in the plugin control metadata) we select the Fragment impairment set of # tests (set number 10), and test 23 within that set. That test provides a way # for a user to customize the fragmentation. # This example customization sets each fragment to contain 16 bytes with 8 byte # overlap and sends the fragments in reverse order. # The following command selects and starts the requested impairment:
setplugin 0 0 on init button 0 num 0 10 num 1 2 3 num 2 16 num 3 8 num 4 0
# Print the plugin settings to insure we set them to our desired values:
getplugin 0 0
# This is where we set flow 0, interface 0 so the fragmentation is applied only # to UDP datagrams flowing into interface 0:
setmatch 0 0 IPv4 Proto 17 0xff
# Print the match setting to insure we set them to our desirec values:
getmatch 0 0
# This runs the impairment for an hour (or until the break key is pressed) by # putting this script to sleep and then killing the server process just before # the script exits. There are of course many other possible ways to handle the # situation, such as issuing commands to clear any flow matches and impairments # that have been set and keep stdiserver running so as to allow traffic to flow # through Maxwell even after this script exits.
sleep 3600 pkill stdiserver
#3 Enable jitter on all frames.
#!/bin/bash
# This file illustrates one way to control impairments from a shell script. # The specific example in this script enables jitter on all frames. # If the standard impairment server program (stdiserver) is not already running # then the first step is to start the standard impairment server. (We do not # need to load a plugin since jitter impairments are standard impairments # already built into the server.) # We'll assume any already running stdiserver process is in an unkown state # and it is simpler to kill and restart it in a known state.
pkill stdiserver sleep 1
# Wait a second for the process to exit.
# This example needs no plugins. So when we start the server we only need to # redirect the standard file descriptors in order to placethe server in the # background.
stdiserver /dev/null 2>&1 & sleep 1
# Wait a second for the process to finish initializing.
# Please read /usr/local/iwl/docs/standard_impairment_apis.pdf # for more information on the following commands.
# We set the packets traveling from interface 0 to interface 1 to be delayed # (jittered) a random amount of time between 0 and 0.1 seconds. Any value # between 0 and 0.1 seconds is equally probable. # Packets traveling from interface 1 to interface 0 will be delayed (jittered) # a random amount of time from 0 to about 4294 seconds, but most probably 0.01 # seconds with a standard deviation of 0.007 seconds. The probability of the # delay follows a Gaussian distribution with an upper limit of ~4294 seconds.
setimpair 0 0 zerostats jitter 100 linear 0 100000 reorderok setimpair 0 1 zerostats jitter 100 gaussian 10000 7000 reorderok
# Print the impairment settings to insure we set them to our desired values:
getimpair 0 0 getimpair 0 1
# On exit from this script the impairment will continue to run until the # stdiserver process is killed or the impairment is changed using another # script or using the nstdgui.py GUI control application.

Do you need more info about using scripts with Maxwell Pro?



Contact an Expert

Not sure what you need?