TestPacketAssert: fix line processing bug

The last two lines from tcpdump were not being processed due to a bug in
the handling loop. This commit fixes that.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
SlavePool: Support matching virtualized schemes

This commit adds native support for virtual machines with the
matching algorithm. Up to now, virtual machines could be only used
as if they were physical.

Now if the matching for physical machines fails, the controller
will try to find suitable set of virtual machines using which it could
create the required network.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
NetTestSlave: Making the get_iface_info more precise

This patch changes the rpc method so it always returns both the devname
and the hw address. If one of them is missing, it will do a query and
add it to the results.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
NetTestController: Fixing a bug in bridges cleanup

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
Machine: Fixing a number of issues in the virt support

This code hasn't really been tested during the refactoring (because
the virtualization wasn't supported at that time). This patch fixes
a number of issues that accumulated in the code as the rest of the
codebase changed since the last time it was used.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
SlavePool: Adding a is_setup_virtual() predicate

This commit adds a new predicate to the SlavePool class to check if the
match is virtual, i.e., whether LNST will need to use libvirt to
configure the setup.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
VirtUtils: Don't log virsh output

The output of virsh commands was redundant as the same information is
alredy being logged, this patch will disable logging it into debug.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
NetTestController: Adding check for root priviledges

In case the match is virtual, LNST will need euid == 0 so it can connect
to qemu and configure the machines. This commit introduces a check for
that.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
NetTestController: handling of error messages

The communication protocol that was implemented can also send error
messages, however the Controller wasn't handling them and instead raised
an Unknown message exception. This patch fixes that by raising an
exception with the correct message.

I also modified the message that Slave sends when an unsupported method
call is recieved.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
XML: Changing the 'interface' tag

This commit removes the <interface> tag from both the recipe and the
slavemachine config files. Now the interface tag's names are based
on their type.

For example an interface with type="bond" will now be represented by
a tag <bond ...>.

A slight cleanup of the slavemachine parser was done along with this
patch.
lnst-ctl: Adding disable_pool_checks option

This commit adds a new option to the controller. Using this option will
disable the checks that are performed by LNST during startup on pool
machines.

Option:

    -o
    --disable-pool-checks

Some minor cleanup has been done on a few places nearby.
lnst-ctl: Adding match_setup action

This commit adds a new action called 'match_setup'. With this action,
the controller will only read the pool and try to match the recipe
setup to the pool. In case the match was successfull, it will print
the details of the match.

I didn't really pay that much attention to the format of the report.
That might change in the future. The important thing here are the
backend options for this functionality.
lnst-ctl: Changing underscore to dash in -p option

This patch changes the underscore in the --patcket_capture long option
to a dash. Dashes are much more common.
Logs: message type format fix

When logging warning messages the "WARNING:" would get trimmed because
of the format.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
recipes: update recipes to the new format

This commit updates some of the recipes in our library to the new
format. I've also tested the recipe schema on these recipes.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
recipe format: <options> under <eth> moved under <slave>

Until now when setting options of team interface slaves the options had
to be specified under the <netdevice> or <eth> tag (in the new format).
However the new format didn't accept any <options> tags under the <eth>
tag. This commit fixes that by moving the <options> tag under its
respective <slave> tag. The team configuration now looks something like
this:

<eth id="1" network="A"/>
<team id="testiface">
    <options>
        <option>...</option>
    </options>
    <slaves>
        <slave id="1">
            <options>
                <option name="teamd_port_config">
                    {
                        "prio": -10,
                        "sticky": true
                    }
                </option>
            </options>
        </slave>
    </slaves>
    <addresses>
        <address>...</address>
    </addresses>
</team>

This doesn't change the behaviour of <options> tag that are under the
not-eth tags.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
add recipe-schema.rng

This commit adds a RelaxNG schema describing the xml format of recipes.
RelaxNG was chosen because XML Schema has problems with
non-deterministic behaviour of elements which occurs because of the
<define> tag that can be used anywhere.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Fix unspecified action bug v2

If a user omitted action in the lnst-ctl arguments the script would continue
in its execution with no obvious error. I fixed the code so the user gets
information about incorrect arguments and script stops if no action is
specified.

Signed-off-by: Jan Tluka <jtluka@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Update team driver recipes to new recipe xml syntax

This commit converts all recipes under recipes/team directory to
recently changed recipe syntax.

Signed-off-by: Jan Tluka <jtluka@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
VirtUtils: bridge initialization adds iptables rules

When creating virtual networks we are using bridge interfaces on the
host machine. The default behaviour of these bridges is to filter
packets through iptables, which resulted in IPv6 communication being
blocked. This commit fixes that by adding iptable calls to the bridge
initialization. Every newly created bridge now works as an isolated
network.

From what I've seen these are the same rules added by libvirt when
creating an isolated network.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>