summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2006-11-15 00:38:13 +0000
committerDaniel P. Berrange <berrange@redhat.com>2006-11-15 00:38:13 +0000
commit6d8b20ce85aae6d0a1de38d33e3985197cc443bf (patch)
tree1a5602f449eb9fd2ed1bf15a5ae79161008d4efb /tests
parent* src/xend_internal.c src/xml.c: fix for shareable drive support (diff)
downloadlibvirt-6d8b20ce85aae6d0a1de38d33e3985197cc443bf.tar.gz
libvirt-6d8b20ce85aae6d0a1de38d33e3985197cc443bf.tar.bz2
libvirt-6d8b20ce85aae6d0a1de38d33e3985197cc443bf.zip
Added support for non-bridged networking
Diffstat (limited to 'tests')
-rw-r--r--tests/sexpr2xmldata/sexpr2xml-net-bridged.sexpr2
-rw-r--r--tests/sexpr2xmldata/sexpr2xml-net-bridged.xml27
-rw-r--r--tests/sexpr2xmldata/sexpr2xml-net-routed.sexpr2
-rw-r--r--tests/sexpr2xmldata/sexpr2xml-net-routed.xml27
-rw-r--r--tests/sexpr2xmltest.c21
-rw-r--r--tests/xml2sexprdata/xml2sexpr-net-bridged.sexpr1
-rw-r--r--tests/xml2sexprdata/xml2sexpr-net-bridged.xml29
-rw-r--r--tests/xml2sexprdata/xml2sexpr-net-routed.sexpr1
-rw-r--r--tests/xml2sexprdata/xml2sexpr-net-routed.xml30
-rw-r--r--tests/xml2sexprtest.c22
10 files changed, 162 insertions, 0 deletions
diff --git a/tests/sexpr2xmldata/sexpr2xml-net-bridged.sexpr b/tests/sexpr2xmldata/sexpr2xml-net-bridged.sexpr
new file mode 100644
index 000000000..7670443b8
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-net-bridged.sexpr
@@ -0,0 +1,2 @@
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge'))))
+
diff --git a/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml b/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
new file mode 100644
index 000000000..9ff80f40a
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
@@ -0,0 +1,27 @@
+<domain type='xen' id='6'>
+ <name>pvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <os>
+ <type>linux</type>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
+ </os>
+ <memory>430080</memory>
+ <vcpu>2</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='file'/>
+ <source file='/root/some.img'/>
+ <target dev='xvda'/>
+ </disk>
+ <interface type='bridge'>
+ <source bridge='xenbr2'/>
+ <mac address='00:11:22:33:44:55'/>
+ <script path='vif-bridge'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/sexpr2xmldata/sexpr2xml-net-routed.sexpr b/tests/sexpr2xmldata/sexpr2xml-net-routed.sexpr
new file mode 100644
index 000000000..b3c4ceb82
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-net-routed.sexpr
@@ -0,0 +1,2 @@
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(dev 'eth3')(script 'vif-routed')(ip '172.14.5.6')))
+
diff --git a/tests/sexpr2xmldata/sexpr2xml-net-routed.xml b/tests/sexpr2xmldata/sexpr2xml-net-routed.xml
new file mode 100644
index 000000000..a0ede8a48
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-net-routed.xml
@@ -0,0 +1,27 @@
+<domain type='xen' id='6'>
+ <name>pvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <os>
+ <type>linux</type>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
+ </os>
+ <memory>430080</memory>
+ <vcpu>2</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='file'/>
+ <source file='/root/some.img'/>
+ <target dev='xvda'/>
+ </disk>
+ <interface type='ethernet'>
+ <mac address='00:11:22:33:44:55'/>
+ <ip address='172.14.5.6'/>
+ <script path='vif-routed'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index a7b2b5ca6..3c968112c 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -97,6 +97,19 @@ static int testCompareResizedMemory(void *data ATTRIBUTE_UNUSED) {
}
+static int testCompareNetRouted(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("sexpr2xmldata/sexpr2xml-net-routed.xml",
+ "sexpr2xmldata/sexpr2xml-net-routed.sexpr",
+ 1);
+}
+
+static int testCompareNetBridged(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("sexpr2xmldata/sexpr2xml-net-bridged.xml",
+ "sexpr2xmldata/sexpr2xml-net-bridged.sexpr",
+ 1);
+}
+
+
int
main(int argc, char **argv)
{
@@ -145,5 +158,13 @@ main(int argc, char **argv)
1, testCompareResizedMemory, NULL) != 0)
ret = -1;
+ if (virtTestRun("SEXPR-2-XML net routed",
+ 1, testCompareNetRouted, NULL) != 0)
+ ret = -1;
+
+ if (virtTestRun("SEXPR-2-XML net bridged",
+ 1, testCompareNetBridged, NULL) != 0)
+ ret = -1;
+
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/tests/xml2sexprdata/xml2sexpr-net-bridged.sexpr b/tests/xml2sexprdata/xml2sexpr-net-bridged.sexpr
new file mode 100644
index 000000000..93b1de31b
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-net-bridged.sexpr
@@ -0,0 +1 @@
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge')))) \ No newline at end of file
diff --git a/tests/xml2sexprdata/xml2sexpr-net-bridged.xml b/tests/xml2sexprdata/xml2sexpr-net-bridged.xml
new file mode 100644
index 000000000..7c5115c77
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-net-bridged.xml
@@ -0,0 +1,29 @@
+<domain type='xen' id='15'>
+ <name>pvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <os>
+ <type>linux</type>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
+ </os>
+ <memory>430080</memory>
+ <vcpu>2</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/root/some.img'/>
+ <target dev='xvda'/>
+ </disk>
+ <interface type="bridge">
+ <mac address="00:11:22:33:44:55"/>
+ <source bridge="xenbr2"/>
+ <script path="vif-bridge"/>
+ <target dev="vif4.0"/>
+ </interface>
+ <console tty='/dev/pts/4'/>
+ </devices>
+</domain>
+
diff --git a/tests/xml2sexprdata/xml2sexpr-net-routed.sexpr b/tests/xml2sexprdata/xml2sexpr-net-routed.sexpr
new file mode 100644
index 000000000..c8b5f9ffc
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-net-routed.sexpr
@@ -0,0 +1 @@
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(dev 'eth3')(script 'vif-routed')(ip '172.14.5.6')))) \ No newline at end of file
diff --git a/tests/xml2sexprdata/xml2sexpr-net-routed.xml b/tests/xml2sexprdata/xml2sexpr-net-routed.xml
new file mode 100644
index 000000000..aae20806f
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-net-routed.xml
@@ -0,0 +1,30 @@
+<domain type='xen' id='15'>
+ <name>pvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <os>
+ <type>linux</type>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
+ </os>
+ <memory>430080</memory>
+ <vcpu>2</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/root/some.img'/>
+ <target dev='xvda'/>
+ </disk>
+ <interface type="ethernet">
+ <mac address="00:11:22:33:44:55"/>
+ <ip address="172.14.5.6"/>
+ <source dev="eth3"/>
+ <script path="vif-routed"/>
+ <target dev="vif4.0"/>
+ </interface>
+ <console tty='/dev/pts/4'/>
+ </devices>
+</domain>
+
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index 9ca42b973..a1c09e403 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -138,6 +138,21 @@ static int testCompareMemoryResize(void *data ATTRIBUTE_UNUSED) {
2);
}
+static int testCompareNetRouted(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("xml2sexprdata/xml2sexpr-net-routed.xml",
+ "xml2sexprdata/xml2sexpr-net-routed.sexpr",
+ "pvtest",
+ 2);
+}
+
+static int testCompareNetBridged(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("xml2sexprdata/xml2sexpr-net-bridged.xml",
+ "xml2sexprdata/xml2sexpr-net-bridged.sexpr",
+ "pvtest",
+ 2);
+}
+
+
int
main(int argc, char **argv)
{
@@ -202,6 +217,13 @@ main(int argc, char **argv)
1, testCompareMemoryResize, NULL) != 0)
ret = -1;
+ if (virtTestRun("XML-2-SEXPR Net Routed",
+ 1, testCompareNetRouted, NULL) != 0)
+ ret = -1;
+
+ if (virtTestRun("XML-2-SEXPR Net Bridged",
+ 1, testCompareNetBridged, NULL) != 0)
+ ret = -1;
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}