mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 01:18:00 +03:00
Test network update XML parsing
Add checks for updating sections of network definition via virNetworkDefUpdateSection. https://bugzilla.redhat.com/show_bug.cgi?id=989569
This commit is contained in:
parent
d8bd24a9ec
commit
2d9185a9f3
@ -3980,7 +3980,7 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
virNetworkDefUpdateSection(virNetworkDefPtr def,
|
||||
unsigned int command, /* virNetworkUpdateCommand */
|
||||
unsigned int section, /* virNetworkUpdateSection */
|
||||
|
@ -428,4 +428,13 @@ int virNetworkObjListExport(virConnectPtr conn,
|
||||
virNetworkObjListFilter filter,
|
||||
unsigned int flags);
|
||||
|
||||
/* for testing */
|
||||
int
|
||||
virNetworkDefUpdateSection(virNetworkDefPtr def,
|
||||
unsigned int command, /* virNetworkUpdateCommand */
|
||||
unsigned int section, /* virNetworkUpdateSection */
|
||||
int parentIndex,
|
||||
const char *xml,
|
||||
unsigned int flags); /* virNetworkUpdateFlags */
|
||||
|
||||
#endif /* __NETWORK_CONF_H__ */
|
||||
|
@ -503,6 +503,7 @@ virNetworkDefGetIpByIndex;
|
||||
virNetworkDefParseFile;
|
||||
virNetworkDefParseNode;
|
||||
virNetworkDefParseString;
|
||||
virNetworkDefUpdateSection;
|
||||
virNetworkDeleteConfig;
|
||||
virNetworkFindByName;
|
||||
virNetworkFindByUUID;
|
||||
|
@ -73,6 +73,8 @@ EXTRA_DIST = \
|
||||
networkxml2xmlin \
|
||||
networkxml2xmlout \
|
||||
networkxml2confdata \
|
||||
networkxml2xmlupdatein \
|
||||
networkxml2xmlupdateout \
|
||||
nodedevschemadata \
|
||||
nodedevschematest \
|
||||
nodeinfodata \
|
||||
@ -191,7 +193,7 @@ if WITH_YAJL
|
||||
test_programs += jsontest
|
||||
endif
|
||||
|
||||
test_programs += networkxml2xmltest
|
||||
test_programs += networkxml2xmltest networkxml2xmlupdatetest
|
||||
|
||||
if WITH_NETWORK
|
||||
test_programs += networkxml2conftest
|
||||
@ -505,6 +507,11 @@ networkxml2xmltest_SOURCES = \
|
||||
testutils.c testutils.h
|
||||
networkxml2xmltest_LDADD = $(LDADDS)
|
||||
|
||||
networkxml2xmlupdatetest_SOURCES = \
|
||||
networkxml2xmlupdatetest.c \
|
||||
testutils.c testutils.h
|
||||
networkxml2xmlupdatetest_LDADD = $(LDADDS)
|
||||
|
||||
if WITH_NETWORK
|
||||
networkxml2conftest_SOURCES = \
|
||||
networkxml2conftest.c \
|
||||
|
27
tests/networkxml2xmlin/nat-network-dns-srv-records.xml
Normal file
27
tests/networkxml2xmlin/nat-network-dns-srv-records.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<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'/>
|
||||
<dns>
|
||||
<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
|
||||
<srv service='name' protocol='tcp' domain='donkey' target='.' port='404' priority='10' weight='10'/>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
27
tests/networkxml2xmlout/nat-network-dns-srv-records.xml
Normal file
27
tests/networkxml2xmlout/nat-network-dns-srv-records.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<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'/>
|
||||
<dns>
|
||||
<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
|
||||
<srv service='name' protocol='tcp' domain='donkey' target='.' port='404' priority='10' weight='10'/>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
@ -104,6 +104,7 @@ mymain(void)
|
||||
DO_TEST("netboot-proxy-network");
|
||||
DO_TEST("nat-network-dns-txt-record");
|
||||
DO_TEST("nat-network-dns-srv-record");
|
||||
DO_TEST("nat-network-dns-srv-records");
|
||||
DO_TEST("nat-network-dns-srv-record-minimal");
|
||||
DO_TEST("nat-network-dns-hosts");
|
||||
DO_TEST("nat-network-dns-forward-plain");
|
||||
|
1
tests/networkxml2xmlupdatein/dhcp-range-existing.xml
Normal file
1
tests/networkxml2xmlupdatein/dhcp-range-existing.xml
Normal file
@ -0,0 +1 @@
|
||||
<range start="192.168.122.2" end="192.168.122.254"/>
|
1
tests/networkxml2xmlupdatein/dhcp-range.xml
Normal file
1
tests/networkxml2xmlupdatein/dhcp-range.xml
Normal file
@ -0,0 +1 @@
|
||||
<range start='10.0.0.10' end='10.0.0.100'/>
|
@ -0,0 +1,3 @@
|
||||
<host>
|
||||
<hostname>gateway</hostname>
|
||||
</host>
|
3
tests/networkxml2xmlupdatein/dns-host-pudding.xml
Normal file
3
tests/networkxml2xmlupdatein/dns-host-pudding.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<host ip='f0:0d::f0:0d'>
|
||||
<hostname>pudding</hostname>
|
||||
</host>
|
1
tests/networkxml2xmlupdatein/dns-txt-record-example.xml
Normal file
1
tests/networkxml2xmlupdatein/dns-txt-record-example.xml
Normal file
@ -0,0 +1 @@
|
||||
<txt name='example' value='example value'/>
|
1
tests/networkxml2xmlupdatein/dns-txt-record-snowman.xml
Normal file
1
tests/networkxml2xmlupdatein/dns-txt-record-snowman.xml
Normal file
@ -0,0 +1 @@
|
||||
<txt name='snowman' value='water'/>
|
1
tests/networkxml2xmlupdatein/host-existing.xml
Normal file
1
tests/networkxml2xmlupdatein/host-existing.xml
Normal file
@ -0,0 +1 @@
|
||||
<host mac="00:16:3e:77:e2:ed" name="a.example.com" ip="192.168.122.10"/>
|
1
tests/networkxml2xmlupdatein/host-incomplete.xml
Normal file
1
tests/networkxml2xmlupdatein/host-incomplete.xml
Normal file
@ -0,0 +1 @@
|
||||
<host mac="00:16:3e:77:e2:ed"/>
|
1
tests/networkxml2xmlupdatein/host-new-incomplete.xml
Normal file
1
tests/networkxml2xmlupdatein/host-new-incomplete.xml
Normal file
@ -0,0 +1 @@
|
||||
<host name='tea'/>
|
1
tests/networkxml2xmlupdatein/host-new.xml
Normal file
1
tests/networkxml2xmlupdatein/host-new.xml
Normal file
@ -0,0 +1 @@
|
||||
<host mac="00:16:3e:77:f0:0d" name="m.example.com" ip="192.168.122.12"/>
|
1
tests/networkxml2xmlupdatein/host-updated.xml
Normal file
1
tests/networkxml2xmlupdatein/host-updated.xml
Normal file
@ -0,0 +1 @@
|
||||
<host mac="00:16:3e:77:e2:ed" name="a.example.com" ip="192.168.122.47"/>
|
1
tests/networkxml2xmlupdatein/interface-eth1.xml
Normal file
1
tests/networkxml2xmlupdatein/interface-eth1.xml
Normal file
@ -0,0 +1 @@
|
||||
<interface dev='eth1'/>
|
1
tests/networkxml2xmlupdatein/interface-eth47.xml
Normal file
1
tests/networkxml2xmlupdatein/interface-eth47.xml
Normal file
@ -0,0 +1 @@
|
||||
<interface dev='eth47'/>
|
10
tests/networkxml2xmlupdatein/portgroup-alice-new.xml
Normal file
10
tests/networkxml2xmlupdatein/portgroup-alice-new.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<portgroup name='alice'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='888'/>
|
||||
<tag id='808'/>
|
||||
<tag id='909'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='alice-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
11
tests/networkxml2xmlupdatein/portgroup-alison.xml
Normal file
11
tests/networkxml2xmlupdatein/portgroup-alison.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<portgroup name='alison'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='4'/>
|
||||
<tag id='8'/>
|
||||
<tag id='13'/>
|
||||
<tag id='1990'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='alison-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
1
tests/networkxml2xmlupdatein/srv-record-donkey.xml
Normal file
1
tests/networkxml2xmlupdatein/srv-record-donkey.xml
Normal file
@ -0,0 +1 @@
|
||||
<srv service='name' protocol='tcp' domain='donkey' target='.' port='404' priority='10' weight='10'/>
|
1
tests/networkxml2xmlupdatein/srv-record-invalid.xml
Normal file
1
tests/networkxml2xmlupdatein/srv-record-invalid.xml
Normal file
@ -0,0 +1 @@
|
||||
<srv protocol='pudding'/>
|
1
tests/networkxml2xmlupdatein/srv-record-protocol.xml
Normal file
1
tests/networkxml2xmlupdatein/srv-record-protocol.xml
Normal file
@ -0,0 +1 @@
|
||||
<srv protocol='tcp'/>
|
1
tests/networkxml2xmlupdatein/srv-record-service.xml
Normal file
1
tests/networkxml2xmlupdatein/srv-record-service.xml
Normal file
@ -0,0 +1 @@
|
||||
<srv service='name'/>
|
1
tests/networkxml2xmlupdatein/srv-record.xml
Normal file
1
tests/networkxml2xmlupdatein/srv-record.xml
Normal file
@ -0,0 +1 @@
|
||||
<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
|
1
tests/networkxml2xmlupdatein/unparsable-dns-host.xml
Normal file
1
tests/networkxml2xmlupdatein/unparsable-dns-host.xml
Normal file
@ -0,0 +1 @@
|
||||
<host protocol='name'/>
|
@ -0,0 +1,27 @@
|
||||
<network>
|
||||
<name>local</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
|
||||
<forward dev='eth1' mode='route'>
|
||||
<interface dev='eth1'/>
|
||||
</forward>
|
||||
<bridge name='virbr1' stp='on' delay='0'/>
|
||||
<mac address='12:34:56:78:9a:bc'/>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='10.0.0.10' end='10.0.0.100'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
<dhcp>
|
||||
<host id='0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63' ip='2001:db8:ac10:fd01::1:20'/>
|
||||
<host name='paul' ip='2001:db8:ac10:fd01::1:21'/>
|
||||
<host id='0:3:0:1:0:16:3e:11:22:33' name='peter.xyz' ip='2001:db8:ac10:fd01::1:22'/>
|
||||
<host id='0:3:0:1:0:16:3e:44:55:33' ip='2001:db8:ac10:fd01::1:23'/>
|
||||
<host id='0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66' name='badbob' ip='2001:db8:ac10:fd01::1:24'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<route address='192.168.222.0' netmask='255.255.255.0' gateway='192.168.122.10'/>
|
||||
<route family='ipv6' address='2001:db8:ac10:fc00::' prefix='64' gateway='2001:db8:ac10:fd01::1:24'/>
|
||||
</network>
|
@ -0,0 +1,27 @@
|
||||
<network>
|
||||
<name>local</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
|
||||
<forward dev='eth1' mode='route'>
|
||||
<interface dev='eth1'/>
|
||||
</forward>
|
||||
<bridge name='virbr1' stp='on' delay='0'/>
|
||||
<mac address='12:34:56:78:9a:bc'/>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='10.0.0.10' end='10.0.0.100'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
<dhcp>
|
||||
<host id='0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63' ip='2001:db8:ac10:fd01::1:20'/>
|
||||
<host name='paul' ip='2001:db8:ac10:fd01::1:21'/>
|
||||
<host id='0:3:0:1:0:16:3e:11:22:33' name='peter.xyz' ip='2001:db8:ac10:fd01::1:22'/>
|
||||
<host id='0:3:0:1:0:16:3e:44:55:33' ip='2001:db8:ac10:fd01::1:23'/>
|
||||
<host id='0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66' name='badbob' ip='2001:db8:ac10:fd01::1:24'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<route address='192.168.222.0' netmask='255.255.255.0' gateway='192.168.122.10'/>
|
||||
<route family='ipv6' address='2001:db8:ac10:fc00::' prefix='64' gateway='2001:db8:ac10:fd01::1:24'/>
|
||||
</network>
|
19
tests/networkxml2xmlupdateout/nat-network-dns-more-hosts.xml
Normal file
19
tests/networkxml2xmlupdateout/nat-network-dns-more-hosts.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<network>
|
||||
<name>default</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
|
||||
<forward dev='eth0' mode='nat'>
|
||||
<interface dev='eth0'/>
|
||||
</forward>
|
||||
<bridge name='virbr0' stp='on' delay='0'/>
|
||||
<dns>
|
||||
<host ip='f0:d::f0:d'>
|
||||
<hostname>pudding</hostname>
|
||||
</host>
|
||||
<host ip='192.168.122.1'>
|
||||
<hostname>host</hostname>
|
||||
<hostname>gateway</hostname>
|
||||
</host>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
</network>
|
26
tests/networkxml2xmlupdateout/nat-network-dns-srv-record.xml
Normal file
26
tests/networkxml2xmlupdateout/nat-network-dns-srv-record.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<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'/>
|
||||
<dns>
|
||||
<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
@ -0,0 +1,27 @@
|
||||
<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'/>
|
||||
<dns>
|
||||
<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
|
||||
<srv service='name' protocol='tcp' domain='donkey' target='.' port='404' priority='10' weight='10'/>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
23
tests/networkxml2xmlupdateout/nat-network-dns-txt-none.xml
Normal file
23
tests/networkxml2xmlupdateout/nat-network-dns-txt-none.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<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'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
@ -0,0 +1,27 @@
|
||||
<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'/>
|
||||
<dns>
|
||||
<txt name='snowman' value='water'/>
|
||||
<txt name='example' value='example value'/>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
27
tests/networkxml2xmlupdateout/nat-network-forward-ifaces.xml
Normal file
27
tests/networkxml2xmlupdateout/nat-network-forward-ifaces.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<network>
|
||||
<name>default</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
|
||||
<forward dev='eth47' mode='nat'>
|
||||
<interface dev='eth47'/>
|
||||
<interface dev='eth1'/>
|
||||
</forward>
|
||||
<bridge name='virbr0' stp='on' delay='0'/>
|
||||
<dns>
|
||||
<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
23
tests/networkxml2xmlupdateout/nat-network-host-updated.xml
Normal file
23
tests/networkxml2xmlupdateout/nat-network-host-updated.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<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'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.47'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
24
tests/networkxml2xmlupdateout/nat-network-hosts.xml
Normal file
24
tests/networkxml2xmlupdateout/nat-network-hosts.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<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'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
<host mac='00:16:3e:77:f0:0d' name='m.example.com' ip='192.168.122.12'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
@ -0,0 +1,24 @@
|
||||
<network>
|
||||
<name>default</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
|
||||
<forward mode='nat'/>
|
||||
<bridge name='virbr0' stp='on' delay='0'/>
|
||||
<dns>
|
||||
<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
|
||||
</dns>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
10
tests/networkxml2xmlupdateout/nat-network-no-hosts.xml
Normal file
10
tests/networkxml2xmlupdateout/nat-network-no-hosts.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<network>
|
||||
<name>default</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
|
||||
<forward dev='eth0' mode='nat'>
|
||||
<interface dev='eth0'/>
|
||||
</forward>
|
||||
<bridge name='virbr0' stp='on' delay='0'/>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
</network>
|
22
tests/networkxml2xmlupdateout/nat-network-no-range.xml
Normal file
22
tests/networkxml2xmlupdateout/nat-network-no-range.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<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>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
22
tests/networkxml2xmlupdateout/nat-network-one-host.xml
Normal file
22
tests/networkxml2xmlupdateout/nat-network-one-host.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<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'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
23
tests/networkxml2xmlupdateout/nat-network.xml
Normal file
23
tests/networkxml2xmlupdateout/nat-network.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<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'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
33
tests/networkxml2xmlupdateout/openvswitch-net-modified.xml
Normal file
33
tests/networkxml2xmlupdateout/openvswitch-net-modified.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<network>
|
||||
<name>openvswitch-net</name>
|
||||
<uuid>81ff0d90-c92e-6742-64da-4a736edb9a8b</uuid>
|
||||
<forward mode='bridge'/>
|
||||
<virtualport type='openvswitch'/>
|
||||
<portgroup name='bob' default='yes'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='666'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='bob-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
<portgroup name='alice'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='888'/>
|
||||
<tag id='808'/>
|
||||
<tag id='909'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='alice-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
<portgroup name='native'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='123' nativeMode='tagged'/>
|
||||
<tag id='444'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='native-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
</network>
|
@ -0,0 +1,44 @@
|
||||
<network>
|
||||
<name>openvswitch-net</name>
|
||||
<uuid>81ff0d90-c92e-6742-64da-4a736edb9a8b</uuid>
|
||||
<forward mode='bridge'/>
|
||||
<virtualport type='openvswitch'/>
|
||||
<portgroup name='alison'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='4'/>
|
||||
<tag id='8'/>
|
||||
<tag id='13'/>
|
||||
<tag id='1990'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='alison-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
<portgroup name='bob' default='yes'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='666'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='bob-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
<portgroup name='alice'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='777'/>
|
||||
<tag id='888'/>
|
||||
<tag id='999'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='alice-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
<portgroup name='native'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='123' nativeMode='tagged'/>
|
||||
<tag id='444'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='native-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
</network>
|
@ -0,0 +1,23 @@
|
||||
<network>
|
||||
<name>openvswitch-net</name>
|
||||
<uuid>81ff0d90-c92e-6742-64da-4a736edb9a8b</uuid>
|
||||
<forward mode='bridge'/>
|
||||
<virtualport type='openvswitch'/>
|
||||
<portgroup name='bob' default='yes'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='666'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='bob-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
<portgroup name='native'>
|
||||
<vlan trunk='yes'>
|
||||
<tag id='123' nativeMode='tagged'/>
|
||||
<tag id='444'/>
|
||||
</vlan>
|
||||
<virtualport>
|
||||
<parameters profileid='native-profile'/>
|
||||
</virtualport>
|
||||
</portgroup>
|
||||
</network>
|
372
tests/networkxml2xmlupdatetest.c
Normal file
372
tests/networkxml2xmlupdatetest.c
Normal file
@ -0,0 +1,372 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "testutils.h"
|
||||
#include "network_conf.h"
|
||||
#include "testutilsqemu.h"
|
||||
#include "virstring.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
||||
static int
|
||||
testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
|
||||
const char *outxml, unsigned int flags,
|
||||
unsigned int command, unsigned int section,
|
||||
int parentIndex, bool expectFailure)
|
||||
{
|
||||
char *netXmlData = NULL;
|
||||
char *updateXmlData = NULL;
|
||||
char *outXmlData = NULL;
|
||||
char *actual = NULL;
|
||||
int ret = -1;
|
||||
virNetworkDefPtr def = NULL;
|
||||
|
||||
if (virtTestLoadFile(netxml, &netXmlData) < 0)
|
||||
goto error;
|
||||
if (virtTestLoadFile(updatexml, &updateXmlData) < 0)
|
||||
goto error;
|
||||
|
||||
if (!(def = virNetworkDefParseString(netXmlData)))
|
||||
goto fail;
|
||||
|
||||
if (virNetworkDefUpdateSection(def, command, section, parentIndex,
|
||||
updateXmlData, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (!(actual = virNetworkDefFormat(def, flags)))
|
||||
goto fail;
|
||||
|
||||
if (!expectFailure) {
|
||||
if (virtTestLoadFile(outxml, &outXmlData) < 0)
|
||||
goto error;
|
||||
|
||||
if (STRNEQ(outXmlData, actual)) {
|
||||
virtTestDifference(stderr, outXmlData, actual);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
fail:
|
||||
if (expectFailure) {
|
||||
if (ret == 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Failed to fail.");
|
||||
ret = -1;
|
||||
} else {
|
||||
virResetLastError();
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
error:
|
||||
VIR_FREE(netXmlData);
|
||||
VIR_FREE(updateXmlData);
|
||||
VIR_FREE(outXmlData);
|
||||
VIR_FREE(actual);
|
||||
virNetworkDefFree(def);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct testInfo {
|
||||
const char *name;
|
||||
const char *updatexml;
|
||||
const char *netxml;
|
||||
const char *outxml;
|
||||
unsigned int command;
|
||||
unsigned int section;
|
||||
int parentIndex;
|
||||
unsigned int flags;
|
||||
bool expectFailure;
|
||||
};
|
||||
|
||||
static int
|
||||
testCompareXMLToXMLHelper(const void *data)
|
||||
{
|
||||
const struct testInfo *info = data;
|
||||
int result = -1;
|
||||
char *netxml = NULL;
|
||||
char *updatexml = NULL;
|
||||
char *outxml = NULL;
|
||||
|
||||
if (virAsprintf(&netxml, "%s/networkxml2xmlin/%s.xml",
|
||||
abs_srcdir, info->netxml) < 0 ||
|
||||
virAsprintf(&updatexml, "%s/networkxml2xmlupdatein/%s.xml",
|
||||
abs_srcdir, info->updatexml) < 0 ||
|
||||
virAsprintf(&outxml, "%s/networkxml2xmlupdateout/%s.xml",
|
||||
abs_srcdir, info->outxml) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = testCompareXMLToXMLFiles(netxml, updatexml, outxml, info->flags,
|
||||
info->command, info->section,
|
||||
info->parentIndex, info->expectFailure);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(netxml);
|
||||
VIR_FREE(updatexml);
|
||||
VIR_FREE(outxml);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
mymain(void)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int section;
|
||||
|
||||
#define DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, \
|
||||
parentIndex, flags, expectFailure) \
|
||||
do { \
|
||||
const struct testInfo info = {name, updatexml, netxml, outxml, \
|
||||
command, section, flags, \
|
||||
parentIndex, expectFailure}; \
|
||||
if (virtTestRun("Network XML-2-XML " name, \
|
||||
1, testCompareXMLToXMLHelper, &info) < 0) \
|
||||
ret = -1; \
|
||||
} while (0)
|
||||
|
||||
#define DO_TEST(name, updatexml, netxml, outxml, command) \
|
||||
DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, -12435, \
|
||||
0, false)
|
||||
#define DO_TEST_FAIL(name, updatexml, netxml, command) \
|
||||
DO_TEST_FULL(name, updatexml, netxml, "n/a", command, section, -12345, \
|
||||
0, true)
|
||||
|
||||
#define DO_TEST_INDEX(name, updatexml, netxml, outxml, command, index) \
|
||||
DO_TEST_FULL(name, updatexml, netxml, outxml, command, section, index, \
|
||||
0, false)
|
||||
#define DO_TEST_INDEX_FAIL(name, updatexml, netxml, command, index) \
|
||||
DO_TEST_FULL(name, updatexml, netxml, "n/a", command, section, index, \
|
||||
0, true)
|
||||
|
||||
|
||||
section = VIR_NETWORK_SECTION_IP_DHCP_HOST;
|
||||
DO_TEST_INDEX_FAIL("add-host-incomplete",
|
||||
"host-incomplete",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST,
|
||||
0);
|
||||
DO_TEST_INDEX_FAIL("add-host-new-incomplete",
|
||||
"host-new-incomplete",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST,
|
||||
0);
|
||||
DO_TEST_INDEX_FAIL("add-host-existing",
|
||||
"host-existing",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST,
|
||||
0);
|
||||
DO_TEST_INDEX("add-host-new",
|
||||
"host-new",
|
||||
"nat-network",
|
||||
"nat-network-hosts",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST,
|
||||
0);
|
||||
DO_TEST_INDEX_FAIL("modify-host-missing",
|
||||
"host-new",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_MODIFY,
|
||||
0);
|
||||
DO_TEST_INDEX_FAIL("modify-host-incomplete",
|
||||
"host-incomplete",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_MODIFY,
|
||||
0);
|
||||
DO_TEST_INDEX("modify-host",
|
||||
"host-updated",
|
||||
"nat-network",
|
||||
"nat-network-host-updated",
|
||||
VIR_NETWORK_UPDATE_COMMAND_MODIFY,
|
||||
0);
|
||||
DO_TEST_INDEX("delete-host-incomplete",
|
||||
"host-incomplete",
|
||||
"nat-network",
|
||||
"nat-network-one-host",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE,
|
||||
0);
|
||||
DO_TEST_INDEX("delete-host-existing",
|
||||
"host-existing",
|
||||
"nat-network",
|
||||
"nat-network-one-host",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE,
|
||||
0);
|
||||
DO_TEST_INDEX_FAIL("delete-host-missing",
|
||||
"host-new",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE,
|
||||
0);
|
||||
|
||||
|
||||
section = VIR_NETWORK_SECTION_IP_DHCP_RANGE;
|
||||
DO_TEST_INDEX("add-dhcp-range",
|
||||
"dhcp-range",
|
||||
"dhcp6host-routed-network",
|
||||
"dhcp6host-routed-network-range",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST,
|
||||
0);
|
||||
DO_TEST_INDEX("append-dhcp-range",
|
||||
"dhcp-range",
|
||||
"dhcp6host-routed-network",
|
||||
"dhcp6host-routed-network-another-range",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST,
|
||||
1);
|
||||
DO_TEST_INDEX("delete-dhcp-range",
|
||||
"dhcp-range-existing",
|
||||
"nat-network",
|
||||
"nat-network-no-range",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE,
|
||||
0);
|
||||
DO_TEST_INDEX_FAIL("delete-dhcp-range",
|
||||
"dhcp-range",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE,
|
||||
0);
|
||||
|
||||
|
||||
section = VIR_NETWORK_SECTION_FORWARD_INTERFACE;
|
||||
DO_TEST("insert-forward-interface",
|
||||
"interface-eth47",
|
||||
"nat-network-dns-srv-record",
|
||||
"nat-network-forward-ifaces",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST);
|
||||
DO_TEST("delete-forward-interface",
|
||||
"interface-eth1",
|
||||
"nat-network-dns-srv-record",
|
||||
"nat-network-no-forward-ifaces",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST_FAIL("delete-forward-interface",
|
||||
"interface-eth47",
|
||||
"nat-network-dns-srv-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
|
||||
|
||||
section = VIR_NETWORK_SECTION_PORTGROUP;
|
||||
DO_TEST("insert-portgroup",
|
||||
"portgroup-alison",
|
||||
"openvswitch-net",
|
||||
"openvswitch-net-more-portgroups",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST);
|
||||
DO_TEST_FAIL("append-duplicate-portgroup",
|
||||
"portgroup-alice-new",
|
||||
"openvswitch-net",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
|
||||
DO_TEST("modify-portgroup",
|
||||
"portgroup-alice-new",
|
||||
"openvswitch-net",
|
||||
"openvswitch-net-modified",
|
||||
VIR_NETWORK_UPDATE_COMMAND_MODIFY);
|
||||
DO_TEST_FAIL("modify-missing-portgroup",
|
||||
"portgroup-alison",
|
||||
"openvswitch-net",
|
||||
VIR_NETWORK_UPDATE_COMMAND_MODIFY);
|
||||
DO_TEST("delete-portgroup",
|
||||
"portgroup-alice-new",
|
||||
"openvswitch-net",
|
||||
"openvswitch-net-without-alice",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST_FAIL("delete-missing-portgroup",
|
||||
"portgroup-alice-new",
|
||||
"nat-network-dns-srv-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
|
||||
|
||||
section = VIR_NETWORK_SECTION_DNS_HOST;
|
||||
DO_TEST_FAIL("insert-incomplete-host",
|
||||
"dns-host-gateway-incomplete",
|
||||
"nat-network-dns-hosts",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST);
|
||||
DO_TEST("insert-host",
|
||||
"dns-host-pudding",
|
||||
"nat-network-dns-hosts",
|
||||
"nat-network-dns-more-hosts",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST);
|
||||
DO_TEST_FAIL("delete-missing-unparsable-dns-host",
|
||||
"unparsable-dns-host",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST("delete-dns-host",
|
||||
"dns-host-gateway-incomplete",
|
||||
"nat-network-dns-hosts",
|
||||
"nat-network-no-hosts",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
|
||||
|
||||
section = VIR_NETWORK_SECTION_DNS_TXT;
|
||||
DO_TEST("insert-dns-txt-record",
|
||||
"dns-txt-record-snowman",
|
||||
"nat-network-dns-txt-record",
|
||||
"nat-network-dns-txt-records",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST);
|
||||
DO_TEST_FAIL("append-duplicate-dns-txt-record",
|
||||
"dns-txt-record-example",
|
||||
"nat-network-dns-txt-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
|
||||
DO_TEST("delete-dns-txt-record",
|
||||
"dns-txt-record-example",
|
||||
"nat-network-dns-txt-record",
|
||||
"nat-network-dns-txt-none",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST_FAIL("delete-missing-dns-txt-record",
|
||||
"dns-txt-record-snowman",
|
||||
"nat-network-dns-txt-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
|
||||
|
||||
section = VIR_NETWORK_SECTION_DNS_SRV;
|
||||
DO_TEST("insert-first-srv-record-service",
|
||||
"srv-record",
|
||||
"nat-network",
|
||||
"nat-network-dns-srv-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST);
|
||||
DO_TEST("append-first-srv-record-service",
|
||||
"srv-record",
|
||||
"nat-network",
|
||||
"nat-network-dns-srv-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
|
||||
DO_TEST_FAIL("add-existing-dns-srv-record",
|
||||
"srv-record",
|
||||
"nat-network-dns-srv-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
|
||||
DO_TEST("append-srv-record-service",
|
||||
"srv-record-donkey",
|
||||
"nat-network-dns-srv-record",
|
||||
"nat-network-dns-srv-records",
|
||||
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
|
||||
|
||||
DO_TEST_FAIL("delete-missing-srv-record-service",
|
||||
"srv-record-service",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST_FAIL("delete-srv-record-invalid",
|
||||
"srv-record-invalid",
|
||||
"nat-network-dns-srv-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST("delete-srv-record-donkey",
|
||||
"srv-record-donkey",
|
||||
"nat-network-dns-srv-records",
|
||||
"nat-network-dns-srv-record",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST_FAIL("delete-ambiguous-srv-record-service",
|
||||
"srv-record-service",
|
||||
"nat-network-dns-srv-records",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
DO_TEST("delete-srv-record-protocol",
|
||||
"srv-record-protocol",
|
||||
"nat-network-dns-srv-record",
|
||||
"nat-network",
|
||||
VIR_NETWORK_UPDATE_COMMAND_DELETE);
|
||||
|
||||
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIRT_TEST_MAIN(mymain)
|
Loading…
Reference in New Issue
Block a user