Commit 51530def authored by Laine Stump's avatar Laine Stump

set CTRL_IP_LEARNING and DHCPSERVER in filter during no-ip-spoofing test

Adding these parameters to the clean-traffic filter causes a
significant extra piece of code to be executed (a separate thread is
started up, which uses libpcap to capture DHCP traffic and learn the
IP address of the guest / test appliance), so let's get some test
coverage on that code.
Signed-off-by: default avatarLaine Stump <laine@laine.org>
Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
parent 604b3824
......@@ -767,6 +767,7 @@ sub generic_machine_domain {
my $ostype = exists $params{ostype} ? $params{ostype} : "hvm";
my $fullos = exists $params{fullos} ? $params{fullos} : 0;
my $filterref = exists $params{filterref} ? $params{filterref} : undef;
my %filterparams = exists $params{filterparams} ? %{$params{filterparams}} : ();
if ($fullos) {
my %config = $self->get_image($caps, $ostype);
......@@ -793,7 +794,8 @@ sub generic_machine_domain {
source => "default",
model => "virtio",
mac => "52:54:00:11:11:11",
filterref => $filterref);
filterref => $filterref,
filterparams => \%filterparams);
my $xml = $b->as_xml();
# Cleanup the temporary interface
$b->rminterface();
......@@ -898,6 +900,7 @@ sub generic_domain {
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 %filterparams = exists $params{filterparams} ? %{$params{filterparams}} : ();
my $caps = Sys::Virt::TCK::Capabilities->new(xml => $self->conn->get_capabilities);
......@@ -918,7 +921,8 @@ sub generic_domain {
caps => $caps,
ostype => $ostype,
fullos => $fullos,
filterref => $filterref);
filterref => $filterref,
filterparams => \%filterparams);
}
if ($netmode) {
if ($netmode eq "vepa") {
......@@ -934,7 +938,8 @@ sub generic_domain {
source => "default",
model => "virtio",
mac => "52:54:00:11:11:11",
filterref => $filterref);
filterref => $filterref,
filterparams => \%filterparams);
}
}
return $b;
......
......@@ -459,8 +459,14 @@ sub as_xml {
type => $interface->{model});
}
if ($interface->{filterref}) {
$w->emptyTag("filterref",
$w->startTag("filterref",
filter => $interface->{filterref});
foreach my $paramname (keys %{$interface->{filterparams}}) {
$w->emptyTag("parameter",
name => $paramname,
value => $interface->{filterparams}->{$paramname});
}
$w->endTag("filterref");
}
$w->endTag("interface");
}
......
......@@ -42,10 +42,18 @@ END {
$tck->cleanup if $tck;
}
my $networkip = get_network_ip($conn, "default");
my $networkipaddr = $networkip->addr();
diag "network ip is $networkip, individual ip is $networkipaddr";
# create first domain and start it
my $xml = $tck->generic_domain(name => "tck", fullos => 1,
netmode => "network",
filterref => "clean-traffic")->as_xml();
filterref => "clean-traffic",
filterparams => {
CTRL_IP_LEARNING => "dhcp",
DHCPSERVER => $networkipaddr
})->as_xml();
my $dom;
ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment