Change tests which need a full OS image over to use the new
virtbuilder images instead of provisioning from a kickstart
file. This should make them much more reliable to run.

Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
---
 scripts/domain/110-memory-balloon.t       | 10 ++--
 scripts/nwfilter/090-install-image.t      | 55 ---------------------
 scripts/nwfilter/100-ping-still-working.t | 54 ++++++++++-----------
 scripts/nwfilter/210-no-mac-spoofing.t    | 81 +++++++++++++++++--------------
 scripts/nwfilter/220-no-ip-spoofing.t     | 78 +++++++++++++++++------------
 scripts/nwfilter/230-no-mac-broadcast.t   | 53 +++++++++++---------
 scripts/nwfilter/240-no-arp-spoofing.t    | 60 +++++++++++++----------
 scripts/nwfilter/300-vsitype.t            | 40 ++++++++-------
 scripts/nwfilter/nwfilter_concurrent.sh   |  4 +-
 9 files changed, 212 insertions(+), 223 deletions(-)
 delete mode 100644 scripts/nwfilter/090-install-image.t

diff --git a/scripts/domain/110-memory-balloon.t 
b/scripts/domain/110-memory-balloon.t
index 6d7df3a..1f90698 100644
--- a/scripts/domain/110-memory-balloon.t
+++ b/scripts/domain/110-memory-balloon.t
@@ -28,10 +28,9 @@ its value of current memory, max memory.
 use strict;
 use warnings;
 
-use Test::More tests => 15;
+use Test::More tests => 16;
 
 use Sys::Virt::TCK;
-use Sys::Virt::TCK::NetworkHelpers;
 use Test::Exception;
 use File::Spec::Functions qw(catfile catdir rootdir);
 
@@ -41,7 +40,6 @@ BAIL_OUT "failed to setup test harness: $@" if $@;
 END { $tck->cleanup if $tck; }
 
 diag "Define a new real domain, default memory is 1048576";
-my $dom_name ="tckmemballoon";
 my $default_mem = 1048576;
 my $max_mem1 = 1572864;
 my $max_mem2 = 1148576;
@@ -50,7 +48,9 @@ my $live_mem = 824288;
 my $current_mem = 724288;
 
 # Install a guest with default memory size
-my $dom = prepare_test_disk_and_vm($tck, $conn, $dom_name);
+my $xml = $tck->generic_domain(name => "tck", fullos => 1)->as_xml;
+my $dom;
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent 
domain object");
 
 
 diag "Set max memory for inactive domain";
@@ -62,6 +62,8 @@ is($dom->get_max_memory(), $max_mem1, "Get max memory 
$max_mem1");
 diag "Start domain";
 $dom->create;
 ok($dom->get_id() > 0, "running domain has an ID > 0");
+
+diag "Waiting 30 seconds for guest to finish booting";
 sleep(30);
 
 diag "Get max memory for domain when domain is active";
diff --git a/scripts/nwfilter/090-install-image.t 
b/scripts/nwfilter/090-install-image.t
deleted file mode 100644
index 6fd8a0c..0000000
--- a/scripts/nwfilter/090-install-image.t
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- perl -*-
-#
-# Copyright (C) 2010 IBM Corp.
-#
-# This program is free software; You can redistribute it and/or modify
-# it under the GNU General Public License as published by the Free
-# Software Foundation; either version 2, or (at your option) any
-# later version
-#
-# The file "LICENSE" distributed along with this file provides full
-# details of the terms and conditions
-#
-
-=pod
-
-=head1 NAME
-
-network/000-install-image.t - install network test image
-
-=head1 DESCRIPTION
-
-The test case creates and install a 2GB fedora virtual 
-disk via kickstart file from the network.
-
-=cut
-
-use strict;
-use warnings;
-
-use Test::More tests => 1;
-
-use Sys::Virt::TCK;
-use Sys::Virt::TCK::NetworkHelpers;
-
-
-my $tck = Sys::Virt::TCK->new();
-my $conn = eval { $tck->setup(); };
-BAIL_OUT "failed to setup test harness: $@" if $@;
-END { $tck->cleanup if $tck; }
-
-use File::Spec::Functions qw(catfile catdir rootdir);
-
-# variables which may need to be adapted
-my $dom_name ="tcknwtest";
-
-my $testdom = prepare_test_disk_and_vm($tck, $conn, $dom_name);
-$testdom->create();
-ok($testdom->get_id() > 0, "running domain has an ID > 0");
-sleep(20);
-
-shutdown_vm_gracefully($testdom);
-
-exit 0;
-
-
diff --git a/scripts/nwfilter/100-ping-still-working.t 
b/scripts/nwfilter/100-ping-still-working.t
index a263cf9..0bfdc00 100644
--- a/scripts/nwfilter/100-ping-still-working.t
+++ b/scripts/nwfilter/100-ping-still-working.t
@@ -27,7 +27,7 @@ the host.
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 4;
 
 use Sys::Virt::TCK;
 use Sys::Virt::TCK::NetworkHelpers;
@@ -44,40 +44,38 @@ END {
 }
 
 # create first domain and start it
-diag "Trying domain lookup by name";
-my $dom1;
-my $dom_name ="tcknwtest";
-
-$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name);
-$dom1->create();
-
-my $xml = $dom1->get_xml_description;
-diag $xml;
-ok($dom1->get_id() > 0, "running domain has an ID > 0");
-#my $mac1 = get_macaddress($xml);
-#diag $mac1;
-#my $result = xpath($dom1, "/domain/devices/interface/mac/\@address");
-#my @macaddrs = map { $_->getNodeValue} $result->get_nodelist;
-# we want the first mac
-#my $mac1 =  $macaddrs[0];
-my $mac1 =  get_first_macaddress($dom1);
-diag "mac is $mac1";
+my $xml = $tck->generic_domain(name => "tck", fullos => 1,
+                              netmode => "network")->as_xml();
 
+my $dom;
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent 
domain object");
+
+diag "Start domain";
+$dom->create;
+ok($dom->get_id() > 0, "running domain has an ID > 0");
+
+diag "Waiting 30 seconds for guest to finish booting";
 sleep(30);
-my $guestip1 = get_ip_from_leases($mac1);
-diag "ip is $guestip1";
+
+my $mac = get_first_macaddress($dom);
+diag "mac is $mac";
+
+my $guestip = get_ip_from_leases($mac);
+diag "ip is $guestip";
 
 # check ebtables entry
-my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
-diag $ebtable1;
+my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+diag $ebtable;
 # fixme to include mac adress
-ok($ebtable1 =~ "vnet0", "check ebtables entry");
+ok($ebtable =~ "vnet0", "check ebtables entry");
 
 # ping guest1
-my $ping1 = `ping -c 10 $guestip1`;
-diag $ping1;
-ok($ping1 =~ "10 received", "ping $guestip1 test");
+my $ping = `ping -c 10 $guestip`;
+diag $ping;
+ok($ping =~ "10 received", "ping $guestip test");
+
+shutdown_vm_gracefully($dom);
 
-shutdown_vm_gracefully($dom1);
+$dom->undefine();
 
 exit 0;
diff --git a/scripts/nwfilter/210-no-mac-spoofing.t 
b/scripts/nwfilter/210-no-mac-spoofing.t
index 4a05882..fb20351 100644
--- a/scripts/nwfilter/210-no-mac-spoofing.t
+++ b/scripts/nwfilter/210-no-mac-spoofing.t
@@ -26,7 +26,7 @@ The test case validates that MAC spoofing is prevented
 use strict;
 use warnings;
 
-use Test::More tests => 4;
+use Test::More tests => 5;
 
 use Sys::Virt::TCK;
 use Sys::Virt::TCK::NetworkHelpers;
@@ -43,57 +43,60 @@ END {
 }
 
 # create first domain and start it
+my $xml = $tck->generic_domain(name => "tck", fullos => 1,
+                              netmode => "network")->as_xml();
 
-my $dom_name ="tcknwtest";
+my $dom;
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent 
domain object");
 
-my $dom1;
-$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name);
-$dom1->create();
-ok($dom1->get_id() > 0, "running domain has an ID > 0");
-my $xml = $dom1->get_xml_description;
-diag $xml;
+diag "Start domain";
+$dom->create;
+ok($dom->get_id() > 0, "running domain has an ID > 0");
 
+diag "Waiting 30 seconds for guest to finish booting";
+sleep(30);
 
-# ping guest1 first nic
-my $mac1 =  get_first_macaddress($dom1);
-diag "mac is $mac1";
+# ping guest first nic
+my $mac =  get_first_macaddress($dom);
+diag "mac is $mac";
 
-sleep(30);
-my $guestip1 = get_ip_from_leases($mac1);
-diag "ip is $guestip1";
+my $guestip = get_ip_from_leases($mac);
+diag "ip is $guestip";
 
 # check ebtables entry
-my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
-diag $ebtable1;
+my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+diag $ebtable;
 # ebtables shortens :00: to :0: so we need to do that too
-$_ = $mac1;
+$_ = $mac;
 s/00/0/g; 
-ok($ebtable1 =~ $_, "check ebtables entry");
+ok($ebtable =~ $_, "check ebtables entry");
 
 my $gateway = "192.168.122.1";
 my $macfalse = "52:54:00:f9:21:22";
-my $ping1 = `ping -c 10 $guestip1`;
-diag $ping1;
-ok($ping1 =~ "10 received", "ping $guestip1 test");
+my $ping = `ping -c 10 $guestip`;
+diag $ping;
+ok($ping =~ "10 received", "ping $guestip test");
 
 # log into guest
-my $ssh = Net::SSH::Perl->new($guestip1);
-$ssh->login("root", "foobar");
+my $ssh = Net::SSH::Perl->new($guestip);
+diag "ssh'ing into $guestip";
+$ssh->login("root", $tck->root_password());
 
 # now bring eth0 down, change MAC and bring it up again
 diag "fiddling with mac";
-my $cmdfile = "echo '" . 
-    "/sbin/ifconfig eth0\n".
-    "/sbin/ifconfig eth0 down\n".
-    "/sbin/ifconfig eth0 hw ether ${macfalse}\n".
-    "/sbin/ifconfig eth0 up\n".
-    "/sbin/ifconfig eth0\n".
-    "ping -c 10 ${gateway}\n".
-    "/sbin/ifconfig eth0 down\n".
-    "/sbin/ifconfig eth0 hw ether ${mac1}\n".
-    "/sbin/ifconfig eth0 up\n".
-    "/sbin/ifconfig eth0\n".
-    "' > /test.sh";
+my $cmdfile = <<EOF;
+echo "DEV=`ip link | head -3 | tail -1 | awk '{print \\\$2}' | sed -e 's/://'`
+/sbin/ip addr show dev \\\$DEV
+/sbin/ip link set \\\$DEV down
+/sbin/ip link set \\\$DEV address ${macfalse}
+/sbin/ip link set \\\$DEV up
+/sbin/ip addr show dev \\\$DEV
+/bin/ping -c 10 ${gateway}
+/sbin/ip link set \\\$DEV down
+/sbin/ip link set \\\$DEV address ${mac}
+/sbin/ip link set \\\$DEV up
+/sbin/ip addr show dev \\\$DEV" > /test.sh
+EOF
 diag $cmdfile;
 my ($stdout, $stderr, $exit)  = $ssh->cmd($cmdfile);
 diag $stdout;
@@ -107,12 +110,18 @@ diag $exit;
 diag $stdout;
 diag $stderr;
 diag $exit;
+($stdout, $stderr, $exit)  = $ssh->cmd("cat /test.sh");
+diag $stdout;
+diag $stderr;
+diag $exit;
 ($stdout, $stderr, $exit)  = $ssh->cmd("cat /test.log");
 diag $stdout;
 diag $stderr;
 diag $exit;
 ok($stdout =~ "100% packet loss", "packet loss expected");
 
-shutdown_vm_gracefully($dom1);
+shutdown_vm_gracefully($dom);
+
+$dom->undefine();
 
 exit 0;
diff --git a/scripts/nwfilter/220-no-ip-spoofing.t 
b/scripts/nwfilter/220-no-ip-spoofing.t
index 067ca88..063bb5b 100644
--- a/scripts/nwfilter/220-no-ip-spoofing.t
+++ b/scripts/nwfilter/220-no-ip-spoofing.t
@@ -26,7 +26,7 @@ The test case validates that IP spoofing is prevented
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 4;
 
 use Sys::Virt::TCK;
 use Sys::Virt::TCK::NetworkHelpers;
@@ -42,48 +42,56 @@ END {
     $tck->cleanup if $tck;
 }
 
-# looking up domain
-my $dom1;
-my $dom_name ="tcknwtest";
+# create first domain and start it
+my $xml = $tck->generic_domain(name => "tck", fullos => 1,
+                              netmode => "network")->as_xml();
 
-$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name);
-$dom1->create();
+my $dom;
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent 
domain object");
 
-ok($dom1->get_id() > 0, "running domain has an ID > 0");
-my $xml = $dom1->get_xml_description;
-diag $xml;
-my $mac1 =  get_first_macaddress($dom1);
-diag "mac is $mac1";
+diag "Start domain";
+$dom->create;
+ok($dom->get_id() > 0, "running domain has an ID > 0");
 
+diag "Waiting 30 seconds for guest to finish booting";
 sleep(30);
-my $guestip1 = get_ip_from_leases($mac1);
-diag "ip is $guestip1";
+
+# ping guest first nic
+my $mac =  get_first_macaddress($dom);
+diag "mac is $mac";
+
+my $guestip = get_ip_from_leases($mac);
+diag "ip is $guestip";
 
 # check ebtables entry
-my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
-diag $ebtable1;
+my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+diag $ebtable;
 # check if IP address is listed
-ok($ebtable1 =~ "$guestip1", "check ebtables entry");
+ok($ebtable =~ "$guestip", "check ebtables entry");
 
 # log into guest
-my $ssh = Net::SSH::Perl->new($guestip1);
-$ssh->login("root", "foobar");
+my $ssh = Net::SSH::Perl->new($guestip);
+diag "ssh'ing into $guestip";
+$ssh->login("root", $tck->root_password());
 
 # now bring eth0 down, change IP and bring it up again
 diag "preparing ip spoof";
-my $cmdfile = "echo '" . 
-    "/bin/sleep 1\n".
-    "/sbin/ifconfig eth0\n".
-    "/sbin/ifconfig eth0 down\n".
-    "/sbin/ifconfig eth0 192.168.122.183 netmask 255.255.255.0 up\n".
-    "/sbin/ifconfig eth0\n".
-    "/bin/sleep 1\n".
-    "/bin/ping -c 1 192.168.122.1\n".
-    "/sbin/ifconfig eth0 down\n".
-    "/sbin/ifconfig eth0 ${guestip1} netmask 255.255.255.0 up\n".
-    "/sbin/ifconfig eth0 \n".
-    "/bin/sleep 1\n".
-    "' > /test.sh";
+my $cmdfile = <<EOF;
+echo "DEV=`ip link | head -3 | tail -1 | awk '{print \\\$2}' | sed -e 's/://'`
+/sbin/ip addr show \\\$DEV
+/sbin/ip link set \\\$DEV down
+/sbin/ip addr flush dev \\\$DEV
+/sbin/ip addr add 192.168.122.183/24 dev \\\$DEV
+/sbin/ip link set \\\$DEV up
+/sbin/ip addr show \\\$DEV
+/bin/sleep 1
+/bin/ping -c 1 192.168.122.1
+/sbin/ip link set \\\$DEV down
+/sbin/ip addr flush dev \\\$DEV
+/sbin/ip addr add ${guestip}/24 dev \\\$DEV
+/sbin/ip link set \\\$DEV up
+/sbin/ip link \\\$DEV" > /test.sh
+EOF
 diag $cmdfile;
 my ($stdout, $stderr, $exit)  = $ssh->cmd($cmdfile);
 diag $stdout;
@@ -93,6 +101,10 @@ diag $exit;
 diag $stdout;
 diag $stderr;
 diag $exit;
+($stdout, $stderr, $exit)  = $ssh->cmd("cat /test.sh");
+diag $stdout;
+diag $stderr;
+diag $exit;
 diag "running ip spoof";
 ($stdout, $stderr, $exit)  = $ssh->cmd("/test.sh");
 diag $stdout;
@@ -101,6 +113,8 @@ diag $exit;
 diag "checking result";
 ok($stdout =~ "100% packet loss", "packet loss expected");
 
-shutdown_vm_gracefully($dom1);
+shutdown_vm_gracefully($dom);
+
+$dom->undefine;
 
 exit 0;
diff --git a/scripts/nwfilter/230-no-mac-broadcast.t 
b/scripts/nwfilter/230-no-mac-broadcast.t
index e7242e0..09a758b 100644
--- a/scripts/nwfilter/230-no-mac-broadcast.t
+++ b/scripts/nwfilter/230-no-mac-broadcast.t
@@ -26,7 +26,7 @@ The test case validates that MAC broadcasts are prevented
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 4;
 
 use Sys::Virt::TCK;
 use Sys::Virt::TCK::NetworkHelpers;
@@ -42,41 +42,48 @@ END {
 }
 
 # create first domain and start it
-my $dom1;
-my $dom_name ="tcknwtest";
+my $xml = $tck->generic_domain(name => "tck", fullos => 1,
+                              netmode => "network")->as_xml();
 
-$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name);
-$dom1->create();
+my $dom;
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent 
domain object");
 
-ok($dom1->get_id() > 0, "running domain has an ID > 0");
-my $xml = $dom1->get_xml_description;
-diag $xml;
-my $mac1 =  get_first_macaddress($dom1);
-diag "mac is $mac1";
+diag "Start domain";
+$dom->create;
+ok($dom->get_id() > 0, "running domain has an ID > 0");
 
+diag "Waiting 30 seconds for guest to finish booting";
 sleep(30);
-my $guestip1 = get_ip_from_leases($mac1);
-diag "ip is $guestip1";
+
+# ping guest first nic
+my $mac =  get_first_macaddress($dom);
+diag "mac is $mac";
+
+my $guestip = get_ip_from_leases($mac);
+diag "ip is $guestip";
 
 # check ebtables entry
-my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
-diag $ebtable1;
-# fixme to include mac adress
-ok($ebtable1 =~ "vnet0", "check ebtables entry");
+my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+diag $ebtable;
+# ebtables shortens :00: to :0: so we need to do that too
+$_ = $mac;
+s/00/0/g; 
+ok($ebtable =~ $_, "check ebtables entry");
 
 # prepare tcpdump
 diag "prepare tcpdump";
 system("/usr/sbin/tcpdump -v -i virbr0 -n host 255.255.255.255 2> 
/tmp/tcpdump.log &");
 
 # log into guest
-my $ssh = Net::SSH::Perl->new($guestip1);
-$ssh->login("root", "foobar");
+my $ssh = Net::SSH::Perl->new($guestip);
+diag "ssh'ing into $guestip";
+$ssh->login("root", $tck->root_password());
 
 # now generate a mac broadcast paket 
 diag "generate mac broadcast";
-my $cmdfile = "echo '" . 
-    "/bin/ping -c 1 192.168.122.255 -b\n".
-    "' > /test.sh";
+my $cmdfile = <<EOF;
+echo '/bin/ping -c 1 192.168.122.255 -b' > /test.sh
+EOF
 diag $cmdfile;
 my ($stdout, $stderr, $exit)  = $ssh->cmd($cmdfile);
 diag $stdout;
@@ -102,6 +109,8 @@ my $tcpdumplog = `cat /tmp/tcpdump.log`;
 diag($tcpdumplog);
 ok($tcpdumplog =~ "0 packets captured", "tcpdump expected to capture no 
packets");
 
-shutdown_vm_gracefully($dom1);
+shutdown_vm_gracefully($dom);
+
+$dom->undefine;
 
 exit 0;
diff --git a/scripts/nwfilter/240-no-arp-spoofing.t 
b/scripts/nwfilter/240-no-arp-spoofing.t
index 5b1270b..c31ea48 100644
--- a/scripts/nwfilter/240-no-arp-spoofing.t
+++ b/scripts/nwfilter/240-no-arp-spoofing.t
@@ -26,7 +26,7 @@ The test case validates that ARP spoofing is prevented
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 4;
 
 use Sys::Virt::TCK;
 use Sys::Virt::TCK::NetworkHelpers;
@@ -43,45 +43,51 @@ END {
     $tck->cleanup if $tck;
 }
 
-# creating domain
-my $dom1;
-my $dom_name ="tcknwtest";
+# create first domain and start it
+my $xml = $tck->generic_domain(name => "tck", fullos => 1,
+                              netmode => "network")->as_xml();
 
-$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name);
-$dom1->create();
+my $dom;
+ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent 
domain object");
 
-ok($dom1->get_id() > 0, "running domain has an ID > 0");
-my $xml = $dom1->get_xml_description;
-diag $xml;
-my $mac1 =  get_first_macaddress($dom1);
-diag "mac is $mac1";
+diag "Start domain";
+$dom->create;
+ok($dom->get_id() > 0, "running domain has an ID > 0");
 
+diag "Waiting 30 seconds for guest to finish booting";
 sleep(30);
-my $guestip1 = get_ip_from_leases($mac1);
-diag "ip is $guestip1";
+
+# ping guest first nic
+my $mac =  get_first_macaddress($dom);
+diag "mac is $mac";
+
+my $guestip = get_ip_from_leases($mac);
+diag "ip is $guestip";
 
 # check ebtables entry
-my $ebtable1 = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
-diag $ebtable1;
-# check if mac address is listed
-ok($ebtable1 =~ "$guestip1", "check ebtables entry");
+my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+diag $ebtable;
+# check if IP address is listed
+ok($ebtable =~ "$guestip", "check ebtables entry");
 
 # prepare tcpdump
 diag "prepare tcpdump";
 system("/usr/sbin/tcpdump -v -i virbr0 not ip  > /tmp/tcpdump.log &");
 
 # log into guest
-my $ssh = Net::SSH::Perl->new($guestip1);
-$ssh->login("root", "foobar");
+my $ssh = Net::SSH::Perl->new($guestip);
+diag "ssh'ing into $guestip";
+$ssh->login("root", $tck->root_password());
 
 # now generate a arp spoofing packets 
 diag "generate arpspoof";
-my $cmdfile = "echo '" . 
-    "/usr/bin/yum -y install dsniff\n".
-    "/usr/sbin/arpspoof ${spoofid} &\n".
-    "/bin/sleep 10\n".
-    "kill -15 `/sbin/pidof arpspoof`\n".
-    "' > /test.sh";
+my $cmdfile = <<EOF;
+echo '/usr/bin/yum -y install dsniff
+/usr/sbin/arpspoof ${spoofid} &
+/bin/sleep 10
+kill -15 `/sbin/pidof arpspoof`' > /test.sh
+EOF
+
 diag "content of cmdfile:";
 diag $cmdfile;
 diag "creating cmdfile";
@@ -111,6 +117,8 @@ my $tcpdumplog = `cat /tmp/tcpdump.log`;
 diag($tcpdumplog);
 ok($tcpdumplog !~ "${spoofid} is-at", "tcpdump expected to capture no arp 
reply packets");
 
-shutdown_vm_gracefully($dom1);
+shutdown_vm_gracefully($dom);
+
+$dom->undefine;
 
 exit 0;
diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t
index 3d06803..5d0c455 100644
--- a/scripts/nwfilter/300-vsitype.t
+++ b/scripts/nwfilter/300-vsitype.t
@@ -26,7 +26,7 @@ The test case validates that the corrrect VSI is set in the 
adjacent switch
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 4;
 
 use Sys::Virt::TCK;
 use Sys::Virt::TCK::NetworkHelpers;
@@ -42,33 +42,37 @@ END {
 }
 
 SKIP: {
-     skip "lldptool not present", 3  unless -e "/usr/sbin/lldptool";
+     skip "lldptool not present", 4  unless -e "/usr/sbin/lldptool";
+     skip "No host net device", 4 unless $tck->get_host_network_device();
 
-# creating domain
-     my $dom1;
-     my $dom_name ="tck8021Qbgtest";
+     # create first domain and start it
+     my $xml = $tck->generic_domain(name => "tck", fullos => 1,
+                                   netmode => "vepa")->as_xml();
 
-# speficy mode="vepa" for a direct interface
-     $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name, "vepa");
-     $dom1->create();
+     my $dom;
+     ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent 
domain object");
 
-     ok($dom1->get_id() > 0, "running domain has an ID > 0");
-     my $xml = $dom1->get_xml_description;
-     diag $xml;
-     my $mac1 =  get_first_macaddress($dom1);
-     diag "mac is $mac1";
+     diag "Start domain";
+     $dom->create;
+     ok($dom->get_id() > 0, "running domain has an ID > 0");
 
+     diag "Waiting 30 seconds for guest to finish booting";
      sleep(30);
 
-# check vsi information
+     # ping guest first nic
+     my $mac =  get_first_macaddress($dom);
+     diag "mac is $mac";
+
+     # check vsi information
      diag "Verifying VSI information using lldptool";
      my $lldptool = `/usr/sbin/lldptool -t -i eth2 -V vdp mode`;
      diag $lldptool;
-# check if instance is listed
+     # check if instance is listed
      ok($lldptool =~ "instance", "check instance");
-     ok($lldptool =~ $mac1, "check mac as well");
+     ok($lldptool =~ $mac, "check mac as well");
 
-     shutdown_vm_gracefully($dom1);
-     exit 0;
+     shutdown_vm_gracefully($dom);
 
+     $dom->undefine();
 };
+exit 0;
diff --git a/scripts/nwfilter/nwfilter_concurrent.sh 
b/scripts/nwfilter/nwfilter_concurrent.sh
index 5704807..4c9b878 100644
--- a/scripts/nwfilter/nwfilter_concurrent.sh
+++ b/scripts/nwfilter/nwfilter_concurrent.sh
@@ -242,9 +242,9 @@ runTest()
 
   [ $? -ne 0 ] && rm -rf "${tmpdir}" && return 1;
 
-  # Test runs for a maximum of 3 minutes
+  # Test runs for a maximum of 5 minutes
   now=`date +%s`
-  test_end=$(($now + 3 * 60))
+  test_end=$(($now + 5 * 60))
 
   while :;
   do
-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to