There are several Linux based tools that can be used to communicate with and configure a device using its web-based management interface. These tools can be used to create scripts for automating device configuration.
For automation purposes, we recommend using a separate physical interface for all device configuration. For example, if eth1 and eth2 are allocated to CDRouter as the LAN and WAN test interfaces, we would recommend connecting a third interface, typically eth3 (if available), to the LAN side of the router for automated configuration purposes. This additional interface should be configured with either a static IP address (recommended) or DHCP.
The CDRouter Linux host can use this dedicated interface to communicate directly with the router you are testing. There are a couple of different tools which can be useful for driving cgi type scripts:
Any scripts that are used to configure the device under test can be executed either by a top-level test script that also controls CDRouter, or by CDRouter directly. The following example illustrates how a top-level test script might be used to execute both device configuration and CDRouter tests:
#!/bin/bash cd /home/user/testing /usr/bin/curl http://192.168.1.1/load_config.cgi?config=a /usr/bin/buddy -config dhcp.conf | tee -i dhcp_test_run.txt
Alternatively, device configuration scripts can be executed directly by CDRouter using the testvars RestartDut and ShutdownDut. These testvars allow the user to specify a script to be executed by CDRouter during the startup phase before any tests are performed and during the shutdown procedure, respectively. The default configuration file included with CDRouter provides an example startup script utilizing wget to remotely toggle a power supply (and reboot the device under test). This simple startup script could be expanded to include device configuration as well.
If you don't have any unused Ethernet interfaces available, it is also possible to use CDRouter's LAN test interface for automated device configuration. If CDRouter's LAN test interface is used it must be configured with a static IP address and the LAN MAC address used by CDRouter (testvar lanMac) must be changed.
Note: If you are using a dedicated interface with DHCP for all device configuration, you may encounter failures when running the DHCP scaling tests. We recommend using a static IP address outside of the DHCP pool range whenever possible.