-
Notifications
You must be signed in to change notification settings - Fork 31
Set up Your Machine Pool
In this document, we will explain how to set up your own test lab with LNST and how to start using it for executing your tests. At first, you need to set up your own machine pool. This task is covered in the first part of this document. There are some differences in the formatting of the test recipes when you want to use machines in the pool instead of putting your own machine configuration into the recipe file. This will be covered in the second part of this howto.
I have the following lab configuration that I want to set up for LNST:
+-----------+ +-----------+ +-----------+
| Machine 1 | | Machine 2 | | Machine 3 |
+-----------+ +-----------+ +-----------+
| | |
A | B | C |
| | |
| +-----------+ |
+----------------| Machine 4 |----------------+
+-----------+
| | |
D | D | D |
| | |
+-----------+ D +-----------+
+----------------| Switch |----------| Machine 5 |
| +-----------+ +-----------+
D | | |
| D | | D
| +--+ +-------------------+
| | |
+-----------+ +-----------+ +-----------+
| Machine 6 | | Machine 7 | | Machine 8 |
+-----------+ +-----------+ +-----------+
There are eight (1-8) machines, one non-managed switch and four (A-D) network segments. I will use this example to guide you through the whole process.
To set up a test lab for use in LNST, you need to create a pool directory for your lab. This directory will contain configuration of all the machines in your lab. One machine per-file.
I will create a directory called lab and populate it with one XML file for each machine.
These files will contain machine configurations. The switch in the lab is not managed, so there
will be no configuration for it in the pool.
[admin@controller ~]$ cd lab/
[admin@controller ~/lab]$ ls -1
machine1.xml
machine2.xml
machine3.xml
machine4.xml
machine5.xml
machine6.xml
machine7.xml
machine8.xml
[admin@controller ~/lab]$ Each of these files will contain a slavemachine of the respective machine. Here's an example configuration for machines 1 and 4:
<slavemachine>
<params>
<param name="hostname" value="192.168.100.10"/>
<param name="rpcport" value="9999"/>
<params>
<interfaces>
<eth network="A" id="1">
<params>
<param name="hwaddr" value="52:54:00:a7:32:15"/>
</params>
</eth>
</interfaces>
</slavemachine><slavemachine>
<params>
<param name="hostname" value="192.168.100.1"/>
</params>
<interfaces>
<eth id="1" network="A">
<params>
<param name="hwaddr" value="52:54:00:e4:75:16"/>
</params>
</eth>
<eth id="2" network="B">
<params>
<param name="hwaddr" value="52:54:00:91:01:9c"/>
</params>
</eth>
<eth id="3" network="C">
<params>
<param name="hwaddr" value="52:54:00:94:b7:32"/>
</params>
</eth>
<eth id="4" network="D">
<params>
<param name="hwaddr" value="52:54:00:f3:a1:2a"/>
</params>
</eth>
<eth id="5" network="D">
<params>
<param name="hwaddr" value="52:54:00:12:eb:07"/>
</params>
</eth>
<eth id="6" network="D">
<params>
<param name="hwaddr" value="52:54:00:78:dd:42"/>
</params>
</eth>
</interfaces>
</slavemachine>As you can see, there are two sections in a slavemachine config. The first section, <params>, contains
information about the machine itself, e.g. IP address or hostname, and any additonal information that can describe the machine. The other section contains information about physical devices that are available for testing. Each device must have a unique ID string assigned (the id attribute). This is used by LNST for further reference to the device. Another important attribute is network. It gives the controller information about how the machines within the lab are connected to each other. It is then used to construct the lab topology.
When you have your pool directory set up and ready, you need to point LNST to its location. This is done
in the configuration file in ~/.lnst/lnst-ctl.conf. Here is an example of how it usually looks:
[environment]
mac_pool_range = 52:54:01:00:00:01 52:54:01:FF:FF:FF
rpcport = 9999
machine_pool_dirs += ./pool.d
test_tool_dirs += ./test_tools
test_module_dirs += ./test_modules
log_dir = ./LogsAll you need to do is to append the path to your new lab directory to the machine_pool_dirs option.
machine_pool_dirs += ./pool.d ~/labIf the file doesn't exist you can create it with the following content:
[environment]
machine_pool_dirs += ./pool.d ~/labWhen you have a working lab already set up to work with LNST, you can proceed directly to testing. The recipe format for testing with a machine pool is slightly different. It will be covered in this section.
Let's start with an example of a recipe:
<lnstrecipe>
<machines>
<machine id="1">
<params/>
<interfaces>
<eth id="1" network="test_net">
<addresses>
<address value="192.168.1.226/24"/>
</addresses>
</eth>
<eth id="2" network="test_net">
<addresses>
<address value="192.168.1.240/24"/>
</addresses>
</eth>
</interfaces>
</machine>
<machine id="2">
<params/>
<interfaces>
<eth id="1" network="test_net">
<addresses>
<address value="192.168.1.215/24"/>
</addresses>
</eth>
</interfaces>
</machine>
</machines>
<task>
<run machine="1" timeout="30" module="IcmpPing">
<options>
<option name="addr" value="{ip(2,1)}"/>
<option name="count" value="40"/>
<option name="interval" value="0.2"/>
<option name="limit_rate" value="95"/>
</options>
</run>
</task>
</lnstrecipe>As you can see, instead of full machine configs, there are only requirements for machines under params and interfaces tags. When LNST finds them in a recipe, it will search available pools for machines suitable for this setup.
You can constrain the search by adding more specific requirements. The only mandatory
information is that about the test interfaces. These are essential for the LNST controller,
because all the configuration (e.g. setting IP addresses) done within <eth> will be bound to these definitions.
You can choose the id's as you like, they don't need to match the id's
in the pool. It is even better to choose different descriptive names that will make your
test recipe more readable, e.g. test_interface1.
Here are a few examples of various machine requirement definitions with a short commentary.
<interfaces>
<eth network="line1" id="1"/>
<eth network="line2" id="2"/>
</interfaces>This is the minimal configuration necessary. Only required devices are specified here.
<params>
<param name="hostname" value="192.168.1.100"/>
</params>
<interfaces>
<eth network="line1" id="1"/>
<eth network="line2" id="2"/>
</interfaces>This example is a request for a specific machine from a pool. There is only one possible match to these requirements -- a machine with IP 192.168.1.100.
<interfaces>
<eth network="line1" id="1">
<params>
<param name="driver" value="bnx2"/>
</params>
</eth>
<eth network="line2" id="2"/>
</interfaces>This will use only machines that have one device that uses bnx2 network driver. Please note that the driver information must be present in slavemachine config file as it is not deducted automatically by LNST. LNST works only with metadata provided in machine pool by user.