Overview
========
This regression test ensures that a change does not impact
the generation of XML for default and 'madcloud' configuration examples.

Before starting make sure you have cloned the starlingx/virtual-deployment git
and installed any required packages as presented in ``libvirt/install_packages.sh``.

The regression method sets attributes for a lab, runs the deployment
method's scripts and dumps XML using the virsh command.
These attributes are the overridable environment variables including:
``CONTROLLER, WORKER, BRIDGE_INTERFACE, EXTERNAL_NETWORK, EXTERNAL_IP``

Step 1 export attributes:
---------------------------
The ATTRIBUTE variable is used to name the xml file, and should be
defined for ease of use.

Start with a new bash shell to reset the environment to use default
attributes.

Default values:

	| export ATTRIBUTE=default
	| export CONTROLLER=${CONTROLLER:-controller}
	| export WORKER=${WORKER:-worker}
	| export BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
	| export EXTERNAL_NETWORK=${EXTERNAL_NETWORK:-10.10.10.0/24}
	| export EXTERNAL_IP=${EXTERNAL_IP:-10.10.10.1/24}

Madcloud values:

	| export ATTRIBUTE=madcloud
	| export CONTROLLER=madcloud
	| export WORKER=madnode
	| export BRIDGE_INTERFACE=madbr
	| export EXTERNAL_NETWORK=172.30.20.0/24
	| export EXTERNAL_IP=172.30.20.1/24

Step 2 choose configuration:
------------------------------

	export CONFIGURATION=(simplex, duplex, etc.)

Options are: simplex, duplex, controllerstorage or dedicatedstorage
Along with the attributes this forms a 2x4 matrix:

	| default, simplex
	| default, duplex
	| default, controllerstorage
	| default, dedicatedstorage

And:

	| Madcloud, simplex
	| Madcloud, duplex
	| Madcloud, controllerstorage
	| Madcloud, dedicatedstorage

Step 3 start VM:
------------------

	| ./setup_network.sh
	| ./setup_configuration.sh -c $CONFIGURATION -i $iso

Remember to use a path to a valid iso - it doesn't matter if it
actually boots or etc

Step 4 create dump xml:
-------------------------

	mkdir -p regression

Each configuration has 1 or more domains. For each DOMAIN in virsh list:

	| DOMAIN="simplex-controller-0"
	| outf="regression/${ATTRIBUTE}_${CONFIGURATION}_${DOMAIN}.xml"
	| virsh dumpxml $DOMAIN > "${outf}_${x}"

It is recommended to use either numbers or tags to signify what
iteration you are setting, in this case x represents that

Step 5 reset parameters and workspace:
--------------------------------------------
Teardown configuration and network settings

	| ./destroy_configuration.sh -c $CONFIGURATION
	| ./destroy_network.sh

Step 6 compare files:
-----------------------

	diff -usU9999 "${outf}_${x}.xml" "${outf}_${y}.xml"

In this case x and y represent different iterations.
Details to ignore are changes to: ``UUID, domain ID, mac_addresses,
mounted cdrom, serial/dev/pts``. If there are no changes ignoring those above,
the test is considered a pass.