cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject git commit: updated refs/heads/master to 1baebeb
Date Thu, 06 Feb 2014 13:41:19 GMT
Updated Branches:
  refs/heads/master 41c7e22ee -> 1baebebda


test: Expand LibvirtDomainXMLParserTest with Interface test


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1baebebd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1baebebd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1baebebd

Branch: refs/heads/master
Commit: 1baebebda643fd0f4a21abb5c40eea3d5ec6c034
Parents: 41c7e22
Author: Wido den Hollander <wido@widodh.nl>
Authored: Thu Feb 6 14:40:40 2014 +0100
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Thu Feb 6 14:40:40 2014 +0100

----------------------------------------------------------------------
 .../hypervisor/kvm/resource/LibvirtVMDef.java   |  4 +++
 .../resource/LibvirtDomainXMLParserTest.java    | 26 ++++++++++++++------
 2 files changed, 22 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1baebebd/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 1e90093..ff75d61 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -836,6 +836,10 @@ public class LibvirtVMDef {
             return _macAddr;
         }
 
+        public nicModel getModel() {
+            return _model;
+        }
+
         public void setVirtualPortType(String virtualPortType) {
             _virtualPortType = virtualPortType;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1baebebd/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParserTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParserTest.java
b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParserTest.java
index bbe2f23..c24a8d3 100644
--- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParserTest.java
+++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParserTest.java
@@ -22,6 +22,7 @@ package com.cloud.hypervisor.kvm.resource;
 import junit.framework.TestCase;
 import java.util.List;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
 
 public class LibvirtDomainXMLParserTest extends TestCase {
 
@@ -34,6 +35,9 @@ public class LibvirtDomainXMLParserTest extends TestCase {
         DiskDef.diskFmtType diskFormat = DiskDef.diskFmtType.QCOW2;
         DiskDef.diskCacheMode diskCache = DiskDef.diskCacheMode.NONE;
 
+        InterfaceDef.nicModel ifModel = InterfaceDef.nicModel.VIRTIO;
+        InterfaceDef.guestNetType ifType = InterfaceDef.guestNetType.BRIDGE;
+
         String diskLabel ="vda";
         String diskPath = "/var/lib/libvirt/images/my-test-image.qcow2";
 
@@ -96,35 +100,35 @@ public class LibvirtDomainXMLParserTest extends TestCase {
                      "<alias name='virtio-serial0'/>" +
                      "<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>"
+
                      "</controller>" +
-                     "<interface type='bridge'>" +
+                     "<interface type='" + ifType.toString() + "'>" +
                      "<mac address='0e:00:a9:fe:02:00'/>" +
                      "<source bridge='cloud0'/>" +
                      "<target dev='vnet0'/>" +
-                     "<model type='virtio'/>" +
+                     "<model type='" + ifModel.toString() + "'/>" +
                      "<alias name='net0'/>" +
                      "<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>"
+
                      "</interface>" +
-                     "<interface type='bridge'>" +
+                     "<interface type='" + ifType.toString() + "'>" +
                      "<mac address='06:c5:94:00:05:65'/>" +
                      "<source bridge='cloudbr1'/>" +
                      "<target dev='vnet1'/>" +
-                     "<model type='virtio'/>" +
+                     "<model type='" + ifModel.toString() + "'/>" +
                      "<alias name='net1'/>" +
                      "<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>"
+
                      "</interface>" +
-                     "<interface type='bridge'>" +
+                     "<interface type='" + ifType.toString() + "'>" +
                      "<mac address='06:c9:f4:00:04:40'/>" +
                      "<source bridge='cloudbr0'/>" +
                      "<target dev='vnet2'/>" +
-                     "<model type='virtio'/>" +
+                     "<model type='" + ifModel.toString() + "'/>" +
                      "<alias name='net2'/>" +
                      "<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>"
+
                      "</interface>" +
-                     "<interface type='bridge'>" +
+                     "<interface type='" + ifType.toString() + "'>" +
                      "<mac address='06:7e:c6:00:05:68'/>" +
                      "<source bridge='cloudbr1'/>" +
                      "<target dev='vnet3'/>" +
-                     "<model type='virtio'/>" +
+                     "<model type='" + ifModel.toString() + "'/>" +
                      "<alias name='net3'/>" +
                      "<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>"
+
                      "</interface>" +
@@ -180,5 +184,11 @@ public class LibvirtDomainXMLParserTest extends TestCase {
         assertEquals(diskType, disks.get(diskId).getDiskType());
         assertEquals(deviceType, disks.get(diskId).getDeviceType());
         assertEquals(diskFormat, disks.get(diskId).getDiskFormatType());
+
+        List<InterfaceDef> ifs = parser.getInterfaces();
+        for (int i = 0; i < ifs.size(); i++) {
+            assertEquals(ifModel, ifs.get(i).getModel());
+            assertEquals(ifType, ifs.get(i).getNetType());
+        }
     }
 }
\ No newline at end of file


Mime
View raw message