This is the same test of miscnetwork. The XML output needs to be the
same. It contains random networks entries separated by indexes and it
needs to produce the order XML definition.

Signed-off-by: Julio Faracco <jcfara...@gmail.com>
---
 .../lxcconf2xml-randomnetwork-v3.config       | 21 +++++++++
 .../lxcconf2xml-randomnetwork.xml             | 45 +++++++++++++++++++
 tests/lxcconf2xmltest.c                       |  1 +
 3 files changed, 67 insertions(+)
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-randomnetwork-v3.config
 create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-randomnetwork.xml

diff --git a/tests/lxcconf2xmldata/lxcconf2xml-randomnetwork-v3.config 
b/tests/lxcconf2xmldata/lxcconf2xml-randomnetwork-v3.config
new file mode 100644
index 0000000000..8d898fa6e0
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-randomnetwork-v3.config
@@ -0,0 +1,21 @@
+lxc.net.0.type = phys
+lxc.net.1.flags = up
+lxc.net.0.link = eth0
+lxc.net.2.link = eth0
+lxc.net.1.hwaddr = 02:00:15:8f:05:c1
+lxc.net.1.link = eth0
+lxc.net.0.name = eth1
+lxc.net.2.macvlan.mode = vepa
+lxc.net.2.type = macvlan
+lxc.net.1.type = vlan
+lxc.net.0.ipv4 = 192.168.122.2/24
+lxc.net.0.ipv4.gateway = 192.168.122.1
+lxc.net.1.vlan.id = 2
+lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64
+lxc.net.2.flags = up
+lxc.net.2.hwaddr = 02:00:15:8f:05:c1
+lxc.net.0.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595
+
+lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs
+lxc.uts.name = migrate_test
+lxc.autodev=1
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-randomnetwork.xml 
b/tests/lxcconf2xmldata/lxcconf2xml-randomnetwork.xml
new file mode 100644
index 0000000000..63189cfaec
--- /dev/null
+++ b/tests/lxcconf2xmldata/lxcconf2xml-randomnetwork.xml
@@ -0,0 +1,45 @@
+<domain type='lxc'>
+  <name>migrate_test</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>65536</memory>
+  <currentMemory unit='KiB'>65536</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type>exe</type>
+    <init>/sbin/init</init>
+  </os>
+  <features>
+    <capabilities policy='allow'>
+    </capabilities>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/libexec/libvirt_lxc</emulator>
+    <filesystem type='mount' accessmode='passthrough'>
+      <source dir='/var/lib/lxc/migrate_test/rootfs'/>
+      <target dir='/'/>
+    </filesystem>
+    <interface type='direct'>
+      <mac address='02:00:15:8f:05:c1'/>
+      <source dev='eth0' mode='vepa'/>
+      <link state='up'/>
+    </interface>
+    <hostdev mode='capabilities' type='net'>
+      <source>
+        <interface>eth0</interface>
+      </source>
+      <ip address='192.168.122.2' family='ipv4' prefix='24'/>
+      <ip address='2003:db8:1:0:214:1234:fe0b:3596' family='ipv6' prefix='64'/>
+      <route family='ipv4' address='0.0.0.0' gateway='192.168.122.1'/>
+      <route family='ipv6' address='::' 
gateway='2003:db8:1:0:214:1234:fe0b:3595'/>
+    </hostdev>
+    <hostdev mode='capabilities' type='net'>
+      <source>
+        <interface>eth0.2</interface>
+      </source>
+    </hostdev>
+  </devices>
+</domain>
diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c
index 2a277042ce..78927d29b1 100644
--- a/tests/lxcconf2xmltest.c
+++ b/tests/lxcconf2xmltest.c
@@ -163,6 +163,7 @@ mymain(void)
     DO_TEST3("macvlannetwork", false);
     DO_TEST3("vlannetwork", false);
     DO_TEST3("miscnetwork", false);
+    DO_TEST3("randomnetwork", false);
     DO_TEST3("idmap", false);
     DO_TEST3("memtune", false);
     DO_TEST3("cputune", false);
-- 
2.19.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to