[libvirt] [tck PATCH 6/9] parameterize filterref in generic_domain

Laine Stump laine at laine.org
Thu Feb 8 02:04:56 UTC 2018


...and set it properly in all the nwfilter tests (it's irrelevant for
the others).

This corrects a problem with the no-mac-broadcast test, which was
checking to see that packets with a destination MAC address of
ff:ff:ff:ff:ff:ff weren't allowed, but was neglecting to add the
"no-mac-broadcast" nwfilter to the domain (the test was erroneously
succeeding because it was checking for a different type of packet than
it was generating, which is fixed in a separate patch).
---
 lib/Sys/Virt/TCK.pm                       | 9 ++++++---
 scripts/nwfilter/100-ping-still-working.t | 3 ++-
 scripts/nwfilter/210-no-mac-spoofing.t    | 3 ++-
 scripts/nwfilter/220-no-ip-spoofing.t     | 3 ++-
 scripts/nwfilter/230-no-mac-broadcast.t   | 3 ++-
 scripts/nwfilter/240-no-arp-spoofing.t    | 3 ++-
 6 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index ce8e81b..2259042 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -766,6 +766,7 @@ sub generic_machine_domain {
     my $caps = exists $params{caps} ? $params{caps} : die "caps parameter is required";
     my $ostype = exists $params{ostype} ? $params{ostype} : "hvm";
     my $fullos = exists $params{fullos} ? $params{fullos} : 0;
+    my $filterref = exists $params{filterref} ? $params{filterref} : undef;
 
     if ($fullos) {
 	my %config = $self->get_image($caps, $ostype);
@@ -792,7 +793,7 @@ sub generic_machine_domain {
 			  source => "default",
                           model => "virtio",
 			  mac => "52:54:00:11:11:11",
-			  filterref => "clean-traffic");
+			  filterref => $filterref);
 	    my $xml = $b->as_xml();
 	    # Cleanup the temporary interface
 	    $b->rminterface();
@@ -896,6 +897,7 @@ sub generic_domain {
     my $ostype = exists $params{ostype} ? $params{ostype} : "hvm";
     my $fullos = exists $params{fullos} ? $params{fullos} : 0;
     my $netmode = exists $params{netmode} ? $params{netmode} : undef;
+    my $filterref = exists $params{filterref} ? $params{filterref} : undef;
 
     my $caps = Sys::Virt::TCK::Capabilities->new(xml => $self->conn->get_capabilities);
 
@@ -915,7 +917,8 @@ sub generic_domain {
 	$b = $self->generic_machine_domain(name => $name,
 					   caps => $caps,
 					   ostype => $ostype,
-					   fullos => $fullos);
+                                           fullos => $fullos,
+                                           filterref => $filterref);
     }
     if ($netmode) {
 	if ($netmode eq "vepa") {
@@ -931,7 +934,7 @@ sub generic_domain {
 			  source => "default",
                           model => "virtio",
 			  mac => "52:54:00:11:11:11",
-			  filterref => "clean-traffic");
+			  filterref => $filterref);
 	}
     }
     return $b;
diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t
index 5afc6a6..1bbd7c5 100644
--- a/scripts/nwfilter/100-ping-still-working.t
+++ b/scripts/nwfilter/100-ping-still-working.t
@@ -44,7 +44,8 @@ END {
 
 # create first domain and start it
 my $xml = $tck->generic_domain(name => "tck", fullos => 1,
-			       netmode => "network")->as_xml();
+                               netmode => "network",
+                               filterref => "clean-traffic")->as_xml();
 
 my $dom;
 ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object");
diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t
index eb01d13..b4a4990 100644
--- a/scripts/nwfilter/210-no-mac-spoofing.t
+++ b/scripts/nwfilter/210-no-mac-spoofing.t
@@ -44,7 +44,8 @@ END {
 
 # create first domain and start it
 my $xml = $tck->generic_domain(name => "tck", fullos => 1,
-			       netmode => "network")->as_xml();
+                               netmode => "network",
+                               filterref => "clean-traffic")->as_xml();
 
 my $dom;
 ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object");
diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t
index 5903961..f3e4a38 100644
--- a/scripts/nwfilter/220-no-ip-spoofing.t
+++ b/scripts/nwfilter/220-no-ip-spoofing.t
@@ -44,7 +44,8 @@ END {
 
 # create first domain and start it
 my $xml = $tck->generic_domain(name => "tck", fullos => 1,
-			       netmode => "network")->as_xml();
+                               netmode => "network",
+                               filterref => "clean-traffic")->as_xml();
 
 my $dom;
 ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object");
diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t
index 70c1ab4..292c056 100644
--- a/scripts/nwfilter/230-no-mac-broadcast.t
+++ b/scripts/nwfilter/230-no-mac-broadcast.t
@@ -43,7 +43,8 @@ END {
 
 # create first domain and start it
 my $xml = $tck->generic_domain(name => "tck", fullos => 1,
-			       netmode => "network")->as_xml();
+                               netmode => "network",
+                               filterref => "no-mac-broadcast")->as_xml();
 
 my $dom;
 ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object");
diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t
index 45f790a..33febe9 100644
--- a/scripts/nwfilter/240-no-arp-spoofing.t
+++ b/scripts/nwfilter/240-no-arp-spoofing.t
@@ -45,7 +45,8 @@ END {
 
 # create first domain and start it
 my $xml = $tck->generic_domain(name => "tck", fullos => 1,
-			       netmode => "network")->as_xml();
+                               netmode => "network",
+                               filterref => "clean-traffic")->as_xml();
 
 my $dom;
 ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object");
-- 
2.13.6




More information about the libvir-list mailing list