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

Daniel P. Berrangé berrange at redhat.com
Thu Feb 8 09:23:20 UTC 2018


On Wed, Feb 07, 2018 at 09:04:56PM -0500, Laine Stump wrote:
> ...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;

You could put "clean-traffic" here instead of the  'undef' which....


> 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");

....avoids need for any of these changes.



> 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;

This one is needed to override the default


> 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");

This one can be dropped

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list