Shahar Havivi has uploaded a new change for review.

Change subject: v2v: add test for getOvaInfo verb
......................................................................

v2v: add test for getOvaInfo verb

Change-Id: I398943c356a87cf93a3e0557f4d78da0490814c5
Signed-off-by: Shahar Havivi <shah...@redhat.com>
---
M tests/v2vTests.py
1 file changed, 52 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/44471/1

diff --git a/tests/v2vTests.py b/tests/v2vTests.py
index 520de61..20db6ee 100644
--- a/tests/v2vTests.py
+++ b/tests/v2vTests.py
@@ -90,6 +90,38 @@
 def hypervisorConnect(uri, username, passwd):
     return LibvirtMock()
 
+def read_ovf(ovf_path):
+    return """<?xml version="1.0" encoding="UTF-8"?>
+<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1";
+          xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1";
+          
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";>
+  <References>
+    <File ovf:href="First-disk1.vmdk" ovf:id="file1" ovf:size="349405696"/>
+  </References>
+  <DiskSection>
+    <Disk ovf:capacity="32" ovf:fileRef="file1"/>
+  </DiskSection>
+  <VirtualSystem ovf:id="First">
+    <Name>First</Name>
+    <VirtualHardwareSection>
+      <Item>
+        <rasd:ResourceType>4</rasd:ResourceType>
+        <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+      </Item>
+      <Item>
+        <rasd:ResourceType>3</rasd:ResourceType>
+        <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+      </Item>
+      <Item>
+        <rasd:Connection>VM Network</rasd:Connection>
+        <rasd:ElementName>Ethernet 1</rasd:ElementName>
+        <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
+        <rasd:ResourceType>10</rasd:ResourceType>
+      </Item>
+    </VirtualHardwareSection>
+  </VirtualSystem>
+</Envelope>"""
+
 
 class v2vTests(TestCaseBase):
     @MonkeyPatch(libvirtconnection, 'open_connection', hypervisorConnect)
@@ -139,3 +171,23 @@
             (v2v.DiskProgress(0)),
             (v2v.DiskProgress(50)),
             (v2v.DiskProgress(100))])
+
+    @MonkeyPatch(v2v, '_read_ovf_from_ova', read_ovf)
+    def testGetOvaInfo(self):
+        ret = v2v.get_ova_info("dummy")
+        vm = ret['vmList'][0]
+        self.assertEquals(vm['vmName'], 'First')
+        self.assertEquals(vm['memSize'], 2048)
+        self.assertEquals(vm['smp'], 1)
+
+        disk = vm['disks'][0]
+        self.assertEquals(disk['allocation'], '349405696')
+        self.assertEquals(disk['capacity'], '34359738368')
+        self.assertEquals(disk['type'], 'disk')
+        self.assertEquals(disk['alias'], 'First-disk1.vmdk')
+
+        network = vm['networks'][0]
+        self.assertEquals(network['bridge'], 'VM Network')
+        self.assertEquals(network['model'], 'E1000')
+        self.assertEquals(network['type'], 'bridge')
+        self.assertEquals(network['dev'], 'Ethernet 1')


-- 
To view, visit https://gerrit.ovirt.org/44471
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I398943c356a87cf93a3e0557f4d78da0490814c5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shav...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to