--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
+id:0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63,[2001:db8:ac10:fd01::1:20]
+paul,[2001:db8:ac10:fd01::1:21]
+id:0:3:0:1:0:16:3e:11:22:33,peter.xyz,[2001:db8:ac10:fd01::1:22]
+id:0:3:0:1:0:16:3e:44:55:33,[2001:db8:ac10:fd01::1:23]
+id:0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66,badbob,[2001:db8:ac10:fd01::1:24]
--- /dev/null
+id:0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63,[2001:db8:ac10:fd01::1:20]
+paul,[2001:db8:ac10:fd01::1:21]
+id:0:3:0:1:0:16:3e:11:22:33,peter.xyz,[2001:db8:ac10:fd01::1:22]
+id:0:3:0:1:0:16:3e:44:55:33,[2001:db8:ac10:fd01::1:23]
+id:0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66,badbob,[2001:db8:ac10:fd01::1:24]
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
+id:0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63,[2001:db8:ac10:fd01::1:20]
+paul,[2001:db8:ac10:fd01::1:21]
+id:0:3:0:1:0:16:3e:11:22:33,peter.xyz,[2001:db8:ac10:fd01::1:22]
+id:0:3:0:1:0:16:3e:44:55:33,[2001:db8:ac10:fd01::1:23]
+id:0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66,badbob,[2001:db8:ac10:fd01::1:24]
--- /dev/null
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,1h
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com,2h
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com,3h
--- /dev/null
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254'>
+ <lease expiry='1' unit='hours'/>
+ </range>
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'>
+ <lease expiry='2' unit='hours'/>
+ </host>
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'>
+ <lease expiry='3' unit='hours'/>
+ </host>
+ </dhcp>
+ </ip>
+</network>
--- /dev/null
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,infinite
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com,infinite
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com,infinite
--- /dev/null
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254'>
+ <lease expiry='0'/>
+ </range>
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'>
+ <lease expiry='0'/>
+ </host>
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'>
+ <lease expiry='0'/>
+ </host>
+ </dhcp>
+ </ip>
+</network>
--- /dev/null
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,10m
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com,20m
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com,30m
--- /dev/null
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254'>
+ <lease expiry='10' unit='minutes'/>
+ </range>
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'>
+ <lease expiry='20' unit='minutes'/>
+ </host>
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'>
+ <lease expiry='30' unit='minutes'/>
+ </host>
+ </dhcp>
+ </ip>
+</network>
--- /dev/null
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0,200s
+dhcp-no-override
+dhcp-authoritative
+dhcp-lease-max=253
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com,300s
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com,400s
--- /dev/null
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254'>
+ <lease expiry='200' unit='seconds'/>
+ </range>
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'>
+ <lease expiry='300' unit='seconds'/>
+ </host>
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'>
+ <lease expiry='400' unit='seconds'/>
+ </host>
+ </dhcp>
+ </ip>
+</network>
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
--- /dev/null
+00:16:3e:77:e2:ed,192.168.122.10,a.example.com
+00:16:3e:3e:a9:1a,192.168.122.11,b.example.com
#define VIR_FROM_THIS VIR_FROM_NONE
static int
-testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr caps)
+testCompareXMLToConfFiles(const char *inxml, const char *outconf,
+ char *outhostsfile, dnsmasqCapsPtr caps)
{
char *confactual = NULL;
char *hostsfileactual = NULL;
if (virTestCompareToFile(confactual, outconf) < 0)
goto fail;
+ if (virFileExists(outhostsfile)) {
+ if (!hostsfileactual) {
+ VIR_TEST_DEBUG("%s: hostsfile exists but the configuration did "
+ "not specify any host", outhostsfile);
+ goto fail;
+ } else if (virTestCompareToFile(hostsfileactual, outhostsfile) < 0) {
+ goto fail;
+ }
+ } else if (hostsfileactual) {
+ VIR_TEST_DEBUG("%s: file does not exist but actual data was expected",
+ outhostsfile);
+ goto fail;
+ }
+
ret = 0;
fail:
const testInfo *info = data;
char *inxml = NULL;
char *outconf = NULL;
+ char *outhostsfile = NULL;
inxml = g_strdup_printf("%s/networkxml2confdata/%s.xml", abs_srcdir, info->name);
outconf = g_strdup_printf("%s/networkxml2confdata/%s.conf", abs_srcdir, info->name);
+ outhostsfile = g_strdup_printf("%s/networkxml2confdata/%s.hostsfile", abs_srcdir, info->name);
- result = testCompareXMLToConfFiles(inxml, outconf, info->caps);
+ result = testCompareXMLToConfFiles(inxml, outconf, outhostsfile, info->caps);
VIR_FREE(inxml);
VIR_FREE(outconf);
+ VIR_FREE(outhostsfile);
return result;
}
DO_TEST("dhcp6host-routed-network", dhcpv6);
DO_TEST("ptr-domains-auto", dhcpv6);
DO_TEST("dnsmasq-options", dhcpv6);
+ DO_TEST("leasetime-seconds", full);
+ DO_TEST("leasetime-minutes", full);
+ DO_TEST("leasetime-hours", full);
+ DO_TEST("leasetime-infinite", full);
virObjectUnref(dhcpv6);
virObjectUnref(full);
--- /dev/null
+../networkxml2confdata/leasetime-hours.xml
\ No newline at end of file
--- /dev/null
+../networkxml2confdata/leasetime-infinite.xml
\ No newline at end of file
--- /dev/null
+../networkxml2confdata/leasetime-minutes.xml
\ No newline at end of file
--- /dev/null
+../networkxml2confdata/leasetime-seconds.xml
\ No newline at end of file
--- /dev/null
+../networkxml2xmlin/leasetime-hours.xml
\ No newline at end of file
--- /dev/null
+../networkxml2xmlin/leasetime-infinite.xml
\ No newline at end of file
--- /dev/null
+../networkxml2xmlin/leasetime-minutes.xml
\ No newline at end of file
--- /dev/null
+../networkxml2xmlin/leasetime-seconds.xml
\ No newline at end of file
DO_TEST("metadata");
DO_TEST("set-mtu");
DO_TEST("dnsmasq-options");
+ DO_TEST("leasetime-seconds");
+ DO_TEST("leasetime-minutes");
+ DO_TEST("leasetime-hours");
+ DO_TEST("leasetime-infinite");
DO_TEST("isolated-ports");
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;