Hi Daniel,
I am currently looking into TCK test cases to verify setting 802.1Qbg
functionality from libvirt. My current approach requires changes to some
library functions in lib/Sys/Virt/TCK/.
I would appreciate your feedback about these changes before continuing
much further.
I also attach the test case.

Thanks in advance.

-- 
Best regards, 

Gerhard Stenzel, 
-----------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
Index: libvirt-tck/lib/Sys/Virt/TCK/DomainBuilder.pm
===================================================================
--- libvirt-tck.orig/lib/Sys/Virt/TCK/DomainBuilder.pm
+++ libvirt-tck/lib/Sys/Virt/TCK/DomainBuilder.pm
@@ -410,8 +410,25 @@ sub as_xml {
 
 	$w->emptyTag("mac",
 		     address =>  $interface->{mac});
-	$w->emptyTag("source",
-		     network => $interface->{source});
+
+	if( $interface->{dev}) {
+	    $w->emptyTag("source",
+			 dev => $interface->{dev},
+			 mode => $interface->{mode});
+	} else {
+	    $w->emptyTag("source",
+			 network => $interface->{source});
+	}
+	if( $interface->{virtualport}) {
+	    $w->startTag("virtualport",
+			 type => $interface->{virtualport});
+	    $w->emptyTag("parameters",
+			 managerid => '1',
+			 typeid => '2',
+			 typeidversion => '3',
+			 instanceid => '40000000-0000-0000-0000-000000000000');
+	    $w->endTag("virtualport");
+	}
 	$w->emptyTag("model",
 		     type => $interface->{model});
 	if( $interface->{filterref}) {
Index: libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm
===================================================================
--- libvirt-tck.orig/lib/Sys/Virt/TCK/NetworkHelpers.pm
+++ libvirt-tck/lib/Sys/Virt/TCK/NetworkHelpers.pm
@@ -50,10 +50,21 @@ sub build_domain{
     my $filterref = "clean-traffic";
     my $network = "network";
     my $source = "default";
+    my $dev = "eth2";
+    my $mode;
+    my $virtualport;
 
     my ($cdrom, $ksurl) = build_cdrom_ks_image($tck);
 
     my $guest = $tck->generic_domain($domain_name);
+
+    # change the type of network connection for 802.1Qbg tests
+    if ($domain_name =~ "8021Qbg") {
+	$mode = "vepa";
+	$network ="direct";
+	$virtualport = "802.1Qbg";
+   }
+
     # We want a bigger disk than normal
     $guest->rmdisk();
     my $diskpath = $tck->create_sparse_disk("nwfilter", "main.img", 2048);
@@ -79,12 +90,23 @@ sub build_domain{
     } else {
 	diag "Do normal boot";
 	$guest->clear_kernel_initrd_cmdline();
-	$guest->interface(type => $network,
-			  source => $source,
-			  model => $model,
-			  mac => $mac,
-			  filterref => $filterref);
+	if ($domain_name =~ "8021Qbg") {
+	    $guest->interface(type => $network,
+			      source => $source,
+			      model => $model,
+			      mac => $mac,
+			      dev => $dev,
+			      mode => $mode,
+			      virtualport => $virtualport);
+	} else {
+	    $guest->interface(type => $network,
+			      source => $source,
+			      model => $model,
+			      mac => $mac,
+			      filterref => $filterref);
+	}
     }
+
     # common configuration
     $guest->maxmem("524288");
     $guest->memory("524288");
Index: libvirt-tck/scripts/nwfilter/300-vsitype.t
===================================================================
--- /dev/null
+++ libvirt-tck/scripts/nwfilter/300-vsitype.t
@@ -0,0 +1,70 @@
+# -*- 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
+
+nwfilter/300-vsitype.t - verify VSI informatio
+
+=head1 DESCRIPTION
+
+The test case validates that the corrrect VSI is set in the adjacent switch
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use Sys::Virt::TCK;
+use Sys::Virt::TCK::NetworkHelpers;
+use Test::Exception;
+use Net::SSH::Perl;
+use File::Spec::Functions qw(catfile catdir rootdir);
+
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END {
+    $tck->cleanup if $tck;
+}
+
+# creating domain with 8021Qbg in the name. this will change the network interface to direct
+my $dom1;
+my $dom_name ="tck8021Qbgtest";
+
+$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;
+my $mac1 =  get_first_macaddress($dom1);
+diag "mac is $mac1";
+
+sleep(30);
+
+# 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
+ok($lldptool =~ "instance", "check instance");
+ok($lldptool =~ $mac1, "check mac as well");
+
+
+shutdown_vm_gracefully($dom1);
+
+exit 0;
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to