NetTestResultSerializer: rename cmd_seq to task

Since we changed command_sequences to tasks in xml, this commit changes
the summary as well.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
NetTestCommand: command result interface change

This commit changes the way commands report their results. The
NetTestCommandGeneric class no longer defines a set_result function, and
instead set_pass or set_fail functions should be used. These functions
create the result object (a dictionary) that contains relevant fields.
The functions also check the expect property of the command potentially
inverting the result of the command, with a relevant message added.

Previously there was an option to supply a message when calling the
set_pass or set_fail method from a test module. This was removed and
instead these messages should be moved into the res_data object of the
test module.

The main reason for this was to move the checking of expect to the slave
and to also move res_data formatting to the slave.

Both set_ functions accept a parameter that contains result data of the
command. This should be a dictionary that can be serialized into a valid
xml document and a check function for this will be added later.

The supplied res_data is formatted using the function format_res_data
which can be overridden in the subclasses if the user wants to customize
the formatting.

The function _format_cmd_res_header is used to format the first line of
the command summary, which differs by command type. This shouldn't be
overridden when implementing a custom test module.

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

Control commands need to be changed because of the previous commit.
Without this change the result summary would contain the incorrect
result header line for commands that were interrupted or killed before
finishing but would display information correctly when the command
finished before the control command.

The changes made in this commit ensure that the header line is
reformatted when appropriate.

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

The expect value is now checked on the slave.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
NetTestController: accept new result dictionaries

The controller will now use the new format of the command result
dictionaries and print them to the logs during recipe execution.

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

This commit reimplements the result serializer so that it doesn't
automatically create a DOM tree out of the supplied results. Instead
results are stored in a nice dictionary hierarchy.

This changed combined with moving the res_data formatting done on slaves
makes it very easy to print the summary. And at the same time be able to
easily create an xml file.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
smoke tests: move expect attribute of bg cmd

The expect attribute for bg commands should now be specified in the bg
command tag instead of the associated control command.

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

This commit updates the test modules to correctly use the set_pass and
set_fail functions and supply relevant res_data. Any messages that used
to be reported using the old interface are now a part of the res_data
object.

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

This method checks validity of result data that will eventually be
serialized into an xml. We have agreed that we will only accept result
data in form of nested dictionaries, lists and stringable objects.

The function checks the structure of the data and uses regexes to check
if valid element names and character data can be created.

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

The reges for the Icmp6Ping test was broken up into two lines and
contained an error causing it to never properly match. This commit fixes
that.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
smoke lib: remove timeout from intr command

intr commands don't support timeout attribute anymore.

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