[libvirt] [PATCH v2 0/3] Add tests for network update XML parsing

v1: https://www.redhat.com/archives/libvir-list/2013-July/msg01971.html v2: remove the spaces from other elements instead of adding one Ján Tomko (3): Remove the space before the slash in network XML Reverse logic allowing partial DHCP host XML Test network XML update src/conf/network_conf.h | 9 + src/conf/network_conf.c | 47 +-- src/libvirt_private.syms | 1 + src/network/default.xml | 4 +- src/test/test_driver.c | 4 +- tests/Makefile.am | 9 +- tests/networkxml2xmltest.c | 3 + tests/networkxml2xmlupdatetest.c | 372 +++++++++++++++++++++ tests/networkxml2confdata/dhcp6-nat-network.xml | 20 +- tests/networkxml2confdata/dhcp6-network.xml | 14 +- .../dhcp6host-routed-network.xml | 16 +- tests/networkxml2confdata/isolated-network.xml | 4 +- .../networkxml2confdata/nat-network-dns-hosts.xml | 2 +- .../nat-network-dns-srv-record-minimal.xml | 10 +- .../nat-network-dns-srv-record.xml | 10 +- .../nat-network-dns-txt-record.xml | 10 +- tests/networkxml2confdata/nat-network.xml | 8 +- tests/networkxml2confdata/netboot-network.xml | 8 +- .../networkxml2confdata/netboot-proxy-network.xml | 6 +- tests/networkxml2confdata/routed-network.xml | 2 +- tests/networkxml2xmlin/bandwidth-network.xml | 4 +- .../networkxml2xmlin/dhcp6host-routed-network.xml | 16 +- tests/networkxml2xmlin/empty-allow-ipv6.xml | 2 +- tests/networkxml2xmlin/isolated-network.xml | 4 +- tests/networkxml2xmlin/nat-network-dns-hosts.xml | 2 +- .../nat-network-dns-srv-record-minimal.xml | 10 +- .../nat-network-dns-srv-record.xml | 10 +- .../nat-network-dns-srv-records.xml | 27 ++ .../nat-network-dns-txt-record.xml | 10 +- tests/networkxml2xmlin/nat-network.xml | 8 +- tests/networkxml2xmlin/netboot-network.xml | 6 +- tests/networkxml2xmlin/netboot-proxy-network.xml | 4 +- tests/networkxml2xmlin/routed-network.xml | 2 +- tests/networkxml2xmlout/bandwidth-network.xml | 4 +- .../networkxml2xmlout/dhcp6host-routed-network.xml | 16 +- tests/networkxml2xmlout/empty-allow-ipv6.xml | 2 +- tests/networkxml2xmlout/host-bridge-net.xml | 2 +- tests/networkxml2xmlout/isolated-network.xml | 4 +- tests/networkxml2xmlout/nat-network-dns-hosts.xml | 2 +- .../nat-network-dns-srv-record-minimal.xml | 10 +- .../nat-network-dns-srv-record.xml | 10 +- .../nat-network-dns-srv-records.xml | 27 ++ .../nat-network-dns-txt-record.xml | 10 +- tests/networkxml2xmlout/nat-network.xml | 8 +- tests/networkxml2xmlout/netboot-network.xml | 8 +- tests/networkxml2xmlout/netboot-proxy-network.xml | 6 +- tests/networkxml2xmlout/routed-network.xml | 2 +- .../networkxml2xmlupdatein/dhcp-range-existing.xml | 1 + tests/networkxml2xmlupdatein/dhcp-range.xml | 1 + .../dns-host-gateway-incomplete.xml | 3 + tests/networkxml2xmlupdatein/dns-host-pudding.xml | 3 + .../dns-txt-record-example.xml | 1 + .../dns-txt-record-snowman.xml | 1 + tests/networkxml2xmlupdatein/host-existing.xml | 1 + tests/networkxml2xmlupdatein/host-incomplete.xml | 1 + .../networkxml2xmlupdatein/host-new-incomplete.xml | 1 + tests/networkxml2xmlupdatein/host-new.xml | 1 + tests/networkxml2xmlupdatein/host-updated.xml | 1 + tests/networkxml2xmlupdatein/interface-eth1.xml | 1 + tests/networkxml2xmlupdatein/interface-eth47.xml | 1 + .../networkxml2xmlupdatein/portgroup-alice-new.xml | 10 + tests/networkxml2xmlupdatein/portgroup-alison.xml | 11 + tests/networkxml2xmlupdatein/srv-record-donkey.xml | 1 + .../networkxml2xmlupdatein/srv-record-invalid.xml | 1 + .../networkxml2xmlupdatein/srv-record-protocol.xml | 1 + .../networkxml2xmlupdatein/srv-record-service.xml | 1 + tests/networkxml2xmlupdatein/srv-record.xml | 1 + .../networkxml2xmlupdatein/unparsable-dns-host.xml | 1 + .../dhcp6host-routed-network-another-range.xml | 27 ++ .../dhcp6host-routed-network-range.xml | 27 ++ .../nat-network-dns-more-hosts.xml | 19 ++ .../nat-network-dns-srv-record.xml | 26 ++ .../nat-network-dns-srv-records.xml | 27 ++ .../nat-network-dns-txt-none.xml | 23 ++ .../nat-network-dns-txt-records.xml | 27 ++ .../nat-network-forward-ifaces.xml | 27 ++ .../nat-network-host-updated.xml | 23 ++ .../networkxml2xmlupdateout/nat-network-hosts.xml | 24 ++ .../nat-network-no-forward-ifaces.xml | 24 ++ .../nat-network-no-hosts.xml | 10 + .../nat-network-no-range.xml | 22 ++ .../nat-network-one-host.xml | 22 ++ tests/networkxml2xmlupdateout/nat-network.xml | 23 ++ .../openvswitch-net-modified.xml | 33 ++ .../openvswitch-net-more-portgroups.xml | 44 +++ .../openvswitch-net-without-alice.xml | 23 ++ 86 files changed, 1100 insertions(+), 170 deletions(-) create mode 100644 tests/networkxml2xmlupdatetest.c create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-records.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-records.xml create mode 100644 tests/networkxml2xmlupdatein/dhcp-range-existing.xml create mode 100644 tests/networkxml2xmlupdatein/dhcp-range.xml create mode 100644 tests/networkxml2xmlupdatein/dns-host-gateway-incomplete.xml create mode 100644 tests/networkxml2xmlupdatein/dns-host-pudding.xml create mode 100644 tests/networkxml2xmlupdatein/dns-txt-record-example.xml create mode 100644 tests/networkxml2xmlupdatein/dns-txt-record-snowman.xml create mode 100644 tests/networkxml2xmlupdatein/host-existing.xml create mode 100644 tests/networkxml2xmlupdatein/host-incomplete.xml create mode 100644 tests/networkxml2xmlupdatein/host-new-incomplete.xml create mode 100644 tests/networkxml2xmlupdatein/host-new.xml create mode 100644 tests/networkxml2xmlupdatein/host-updated.xml create mode 100644 tests/networkxml2xmlupdatein/interface-eth1.xml create mode 100644 tests/networkxml2xmlupdatein/interface-eth47.xml create mode 100644 tests/networkxml2xmlupdatein/portgroup-alice-new.xml create mode 100644 tests/networkxml2xmlupdatein/portgroup-alison.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-donkey.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-invalid.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-protocol.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-service.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record.xml create mode 100644 tests/networkxml2xmlupdatein/unparsable-dns-host.xml create mode 100644 tests/networkxml2xmlupdateout/dhcp6host-routed-network-another-range.xml create mode 100644 tests/networkxml2xmlupdateout/dhcp6host-routed-network-range.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-more-hosts.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-srv-records.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-txt-none.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-txt-records.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-forward-ifaces.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-host-updated.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-hosts.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-no-forward-ifaces.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-no-hosts.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-no-range.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-one-host.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network.xml create mode 100644 tests/networkxml2xmlupdateout/openvswitch-net-modified.xml create mode 100644 tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml create mode 100644 tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml -- 1.8.1.5

This matches the style we use elsewhere and allows nat-network-dns-srv-record{,-minimal}.xml to be tested in network XML -> XML test. --- src/conf/network_conf.c | 24 +++++++++++----------- src/network/default.xml | 4 ++-- src/test/test_driver.c | 4 ++-- tests/networkxml2xmltest.c | 2 ++ tests/networkxml2confdata/dhcp6-nat-network.xml | 20 +++++++++--------- tests/networkxml2confdata/dhcp6-network.xml | 14 ++++++------- .../dhcp6host-routed-network.xml | 16 +++++++-------- tests/networkxml2confdata/isolated-network.xml | 4 ++-- .../networkxml2confdata/nat-network-dns-hosts.xml | 2 +- .../nat-network-dns-srv-record-minimal.xml | 10 ++++----- .../nat-network-dns-srv-record.xml | 10 ++++----- .../nat-network-dns-txt-record.xml | 10 ++++----- tests/networkxml2confdata/nat-network.xml | 8 ++++---- tests/networkxml2confdata/netboot-network.xml | 8 ++++---- .../networkxml2confdata/netboot-proxy-network.xml | 6 +++--- tests/networkxml2confdata/routed-network.xml | 2 +- tests/networkxml2xmlin/bandwidth-network.xml | 4 ++-- .../networkxml2xmlin/dhcp6host-routed-network.xml | 16 +++++++-------- tests/networkxml2xmlin/empty-allow-ipv6.xml | 2 +- tests/networkxml2xmlin/isolated-network.xml | 4 ++-- tests/networkxml2xmlin/nat-network-dns-hosts.xml | 2 +- .../nat-network-dns-srv-record-minimal.xml | 10 ++++----- .../nat-network-dns-srv-record.xml | 10 ++++----- .../nat-network-dns-txt-record.xml | 10 ++++----- tests/networkxml2xmlin/nat-network.xml | 8 ++++---- tests/networkxml2xmlin/netboot-network.xml | 6 +++--- tests/networkxml2xmlin/netboot-proxy-network.xml | 4 ++-- tests/networkxml2xmlin/routed-network.xml | 2 +- tests/networkxml2xmlout/bandwidth-network.xml | 4 ++-- .../networkxml2xmlout/dhcp6host-routed-network.xml | 16 +++++++-------- tests/networkxml2xmlout/empty-allow-ipv6.xml | 2 +- tests/networkxml2xmlout/host-bridge-net.xml | 2 +- tests/networkxml2xmlout/isolated-network.xml | 4 ++-- tests/networkxml2xmlout/nat-network-dns-hosts.xml | 2 +- .../nat-network-dns-srv-record-minimal.xml | 10 ++++----- .../nat-network-dns-srv-record.xml | 10 ++++----- .../nat-network-dns-txt-record.xml | 10 ++++----- tests/networkxml2xmlout/nat-network.xml | 8 ++++---- tests/networkxml2xmlout/netboot-network.xml | 8 ++++---- tests/networkxml2xmlout/netboot-proxy-network.xml | 6 +++--- tests/networkxml2xmlout/routed-network.xml | 2 +- 41 files changed, 154 insertions(+), 152 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index e3998f3..0bf72e8 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2259,7 +2259,7 @@ virNetworkDNSDefFormat(virBufferPtr buf, virBufferAdjustIndent(buf, 2); for (i = 0; i < def->ntxts; i++) { - virBufferAsprintf(buf, "<txt name='%s' value='%s' />\n", + virBufferAsprintf(buf, "<txt name='%s' value='%s'/>\n", def->txts[i].name, def->txts[i].value); } @@ -2338,7 +2338,7 @@ virNetworkIpDefFormat(virBufferPtr buf, virBufferAdjustIndent(buf, 2); if (def->tftproot) { - virBufferEscapeString(buf, "<tftp root='%s' />\n", + virBufferEscapeString(buf, "<tftp root='%s'/>\n", def->tftproot); } if ((def->nranges || def->nhosts)) { @@ -2355,36 +2355,36 @@ virNetworkIpDefFormat(virBufferPtr buf, VIR_FREE(saddr); goto error; } - virBufferAsprintf(buf, "<range start='%s' end='%s' />\n", + virBufferAsprintf(buf, "<range start='%s' end='%s'/>\n", saddr, eaddr); VIR_FREE(saddr); VIR_FREE(eaddr); } for (i = 0; i < def->nhosts; i++) { - virBufferAddLit(buf, "<host "); + virBufferAddLit(buf, "<host"); if (def->hosts[i].mac) - virBufferAsprintf(buf, "mac='%s' ", def->hosts[i].mac); + virBufferAsprintf(buf, " mac='%s'", def->hosts[i].mac); if (def->hosts[i].id) - virBufferAsprintf(buf, "id='%s' ", def->hosts[i].id); + virBufferAsprintf(buf, " id='%s'", def->hosts[i].id); if (def->hosts[i].name) - virBufferAsprintf(buf, "name='%s' ", def->hosts[i].name); + virBufferAsprintf(buf, " name='%s'", def->hosts[i].name); if (VIR_SOCKET_ADDR_VALID(&def->hosts[i].ip)) { char *ipaddr = virSocketAddrFormat(&def->hosts[i].ip); if (!ipaddr) goto error; - virBufferAsprintf(buf, "ip='%s' ", ipaddr); + virBufferAsprintf(buf, " ip='%s'", ipaddr); VIR_FREE(ipaddr); } virBufferAddLit(buf, "/>\n"); } if (def->bootfile) { - virBufferEscapeString(buf, "<bootp file='%s' ", + virBufferEscapeString(buf, "<bootp file='%s'", def->bootfile); if (VIR_SOCKET_ADDR_VALID(&def->bootserver)) { char *ipaddr = virSocketAddrFormat(&def->bootserver); if (!ipaddr) goto error; - virBufferEscapeString(buf, "server='%s' ", ipaddr); + virBufferEscapeString(buf, " server='%s'", ipaddr); VIR_FREE(ipaddr); } virBufferAddLit(buf, "/>\n"); @@ -2632,12 +2632,12 @@ virNetworkDefFormatInternal(virBufferPtr buf, virBufferAddLit(buf, "<bridge"); if (def->bridge) virBufferEscapeString(buf, " name='%s'", def->bridge); - virBufferAsprintf(buf, " stp='%s' delay='%ld' />\n", + virBufferAsprintf(buf, " stp='%s' delay='%ld'/>\n", def->stp ? "on" : "off", def->delay); } else if (def->forward.type == VIR_NETWORK_FORWARD_BRIDGE && def->bridge) { - virBufferEscapeString(buf, "<bridge name='%s' />\n", def->bridge); + virBufferEscapeString(buf, "<bridge name='%s'/>\n", def->bridge); } diff --git a/src/network/default.xml b/src/network/default.xml index 9cfc01e..d7241d0 100644 --- a/src/network/default.xml +++ b/src/network/default.xml @@ -1,10 +1,10 @@ <network> <name>default</name> - <bridge name="virbr0" /> + <bridge name="virbr0"/> <forward/> <ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> + <range start="192.168.122.2" end="192.168.122.254"/> </dhcp> </ip> </network> diff --git a/src/test/test_driver.c b/src/test/test_driver.c index f7eaf06..db89f2f 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -250,11 +250,11 @@ static const char *defaultNetworkXML = "<network>" " <name>default</name>" " <uuid>dd8fe884-6c02-601e-7551-cca97df1c5df</uuid>" -" <bridge name='virbr0' />" +" <bridge name='virbr0'/>" " <forward/>" " <ip address='192.168.122.1' netmask='255.255.255.0'>" " <dhcp>" -" <range start='192.168.122.2' end='192.168.122.254' />" +" <range start='192.168.122.2' end='192.168.122.254'/>" " </dhcp>" " </ip>" "</network>"; diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index 0dfed16..bb8a9ad 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -103,6 +103,8 @@ mymain(void) DO_TEST("netboot-network"); 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-record-minimal"); DO_TEST("nat-network-dns-hosts"); DO_TEST("8021Qbh-net"); DO_TEST("direct-net"); diff --git a/tests/networkxml2confdata/dhcp6-nat-network.xml b/tests/networkxml2confdata/dhcp6-nat-network.xml index 4259173..a67bde8 100644 --- a/tests/networkxml2confdata/dhcp6-nat-network.xml +++ b/tests/networkxml2confdata/dhcp6-nat-network.xml @@ -2,24 +2,24 @@ <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='nat'/> - <bridge name='virbr0' stp='on' delay='0' /> + <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' /> + <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:fd01::1' prefix='64'> <dhcp> - <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff' /> - <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' /> + <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/> + <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> <ip family='ipv4' address='10.24.10.1'> diff --git a/tests/networkxml2confdata/dhcp6-network.xml b/tests/networkxml2confdata/dhcp6-network.xml index 776737e..ae9ff1f 100644 --- a/tests/networkxml2confdata/dhcp6-network.xml +++ b/tests/networkxml2confdata/dhcp6-network.xml @@ -2,16 +2,16 @@ <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='nat'/> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <domain name='mynet'/> <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'> <dhcp> - <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff' /> - <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' /> + <range start='2001:db8:ac10:fd01::1:10' end='2001:db8:ac10:fd01::1:ff'/> + <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> </network> diff --git a/tests/networkxml2confdata/dhcp6host-routed-network.xml b/tests/networkxml2confdata/dhcp6host-routed-network.xml index 2693d87..42b9d3f 100644 --- a/tests/networkxml2confdata/dhcp6host-routed-network.xml +++ b/tests/networkxml2confdata/dhcp6host-routed-network.xml @@ -2,21 +2,21 @@ <name>local</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='route'/> - <bridge name='virbr1' stp='on' delay='0' /> + <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> - <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: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' /> + <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> </network> diff --git a/tests/networkxml2confdata/isolated-network.xml b/tests/networkxml2confdata/isolated-network.xml index cc320a9..b22d4ea 100644 --- a/tests/networkxml2confdata/isolated-network.xml +++ b/tests/networkxml2confdata/isolated-network.xml @@ -1,11 +1,11 @@ <network> <name>private</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name='virbr2' stp='on' delay='0' /> + <bridge name='virbr2' stp='on' delay='0'/> <mac address='52:54:00:17:3F:37'/> <ip address='192.168.152.1' netmask='255.255.255.0'> <dhcp> - <range start='192.168.152.2' end='192.168.152.254' /> + <range start='192.168.152.2' end='192.168.152.254'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2confdata/nat-network-dns-hosts.xml b/tests/networkxml2confdata/nat-network-dns-hosts.xml index 2180a5d..d634e5e 100644 --- a/tests/networkxml2confdata/nat-network-dns-hosts.xml +++ b/tests/networkxml2confdata/nat-network-dns-hosts.xml @@ -2,7 +2,7 @@ <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid> <forward dev='eth0' mode='nat'/> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <domain name="example.com"/> <dns> <host ip='192.168.122.1'> diff --git a/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.xml b/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.xml index f6f24e1..13b1c24 100644 --- a/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.xml +++ b/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.xml @@ -4,15 +4,15 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> - <srv service='name' protocol='tcp' /> + <srv service='name' protocol='tcp'/> </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' /> + <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'> diff --git a/tests/networkxml2confdata/nat-network-dns-srv-record.xml b/tests/networkxml2confdata/nat-network-dns-srv-record.xml index 4be85b5..3dd19e6 100644 --- a/tests/networkxml2confdata/nat-network-dns-srv-record.xml +++ b/tests/networkxml2confdata/nat-network-dns-srv-record.xml @@ -4,15 +4,15 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <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='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' /> + <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'> diff --git a/tests/networkxml2confdata/nat-network-dns-txt-record.xml b/tests/networkxml2confdata/nat-network-dns-txt-record.xml index bd16976..0a6bd59 100644 --- a/tests/networkxml2confdata/nat-network-dns-txt-record.xml +++ b/tests/networkxml2confdata/nat-network-dns-txt-record.xml @@ -2,15 +2,15 @@ <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='nat'/> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> - <txt name='example' value='example value' /> + <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' /> + <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'> diff --git a/tests/networkxml2confdata/nat-network.xml b/tests/networkxml2confdata/nat-network.xml index eb71d9e..e44d35d 100644 --- a/tests/networkxml2confdata/nat-network.xml +++ b/tests/networkxml2confdata/nat-network.xml @@ -2,12 +2,12 @@ <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='nat'/> - <bridge name='virbr0' stp='on' delay='0' /> + <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' /> + <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'> diff --git a/tests/networkxml2confdata/netboot-network.xml b/tests/networkxml2confdata/netboot-network.xml index b8a4d99..8d5ad31 100644 --- a/tests/networkxml2confdata/netboot-network.xml +++ b/tests/networkxml2confdata/netboot-network.xml @@ -2,13 +2,13 @@ <name>netboot</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward mode='nat'/> - <bridge name='virbr1' stp='off' delay='1' /> + <bridge name='virbr1' stp='off' delay='1'/> <domain name='example.com'/> <ip address='192.168.122.1' netmask='255.255.255.0'> - <tftp root='/var/lib/tftproot' /> + <tftp root='/var/lib/tftproot'/> <dhcp> - <range start='192.168.122.2' end='192.168.122.254' /> - <bootp file='pxeboot.img' /> + <range start='192.168.122.2' end='192.168.122.254'/> + <bootp file='pxeboot.img'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2confdata/netboot-proxy-network.xml b/tests/networkxml2confdata/netboot-proxy-network.xml index e11c50b..a5b7c1e 100644 --- a/tests/networkxml2confdata/netboot-proxy-network.xml +++ b/tests/networkxml2confdata/netboot-proxy-network.xml @@ -2,12 +2,12 @@ <name>netboot</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward mode='nat'/> - <bridge name='virbr1' stp='off' delay='1' /> + <bridge name='virbr1' stp='off' delay='1'/> <domain name='example.com'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start='192.168.122.2' end='192.168.122.254' /> - <bootp file='pxeboot.img' server='10.20.30.40' /> + <range start='192.168.122.2' end='192.168.122.254'/> + <bootp file='pxeboot.img' server='10.20.30.40'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2confdata/routed-network.xml b/tests/networkxml2confdata/routed-network.xml index 3aa8109..6b0853a 100644 --- a/tests/networkxml2confdata/routed-network.xml +++ b/tests/networkxml2confdata/routed-network.xml @@ -2,7 +2,7 @@ <name>local</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='route'/> - <bridge name='virbr1' stp='on' delay='0' /> + <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'> </ip> diff --git a/tests/networkxml2xmlin/bandwidth-network.xml b/tests/networkxml2xmlin/bandwidth-network.xml index 555ee18..5164a1e 100644 --- a/tests/networkxml2xmlin/bandwidth-network.xml +++ b/tests/networkxml2xmlin/bandwidth-network.xml @@ -2,7 +2,7 @@ <name>test-net</name> <uuid>986fed9e-a488-186d-ef2d-17ebfd1993f8</uuid> <forward mode='nat'/> - <bridge name='virbr1' stp='on' delay='0' /> + <bridge name='virbr1' stp='on' delay='0'/> <mac address='52:54:00:E6:A2:C9'/> <bandwidth> <inbound average='1000' peak='2000' burst='1024'/> @@ -10,7 +10,7 @@ </bandwidth> <ip address='192.168.120.1' netmask='255.255.255.0'> <dhcp> - <range start='192.168.120.2' end='192.168.120.254' /> + <range start='192.168.120.2' end='192.168.120.254'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlin/dhcp6host-routed-network.xml b/tests/networkxml2xmlin/dhcp6host-routed-network.xml index 40f6dfe..59f89e4 100644 --- a/tests/networkxml2xmlin/dhcp6host-routed-network.xml +++ b/tests/networkxml2xmlin/dhcp6host-routed-network.xml @@ -2,21 +2,21 @@ <name>local</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='route'/> - <bridge name='virbr1' stp='on' delay='0' /> + <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> - <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: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' /> + <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"/> diff --git a/tests/networkxml2xmlin/empty-allow-ipv6.xml b/tests/networkxml2xmlin/empty-allow-ipv6.xml index 9d1e4e4..78abfa3 100644 --- a/tests/networkxml2xmlin/empty-allow-ipv6.xml +++ b/tests/networkxml2xmlin/empty-allow-ipv6.xml @@ -1,6 +1,6 @@ <network ipv6='yes'> <name>empty</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid> - <bridge name='virbr7' /> + <bridge name='virbr7'/> <mac address='52:54:00:17:3F:47'/> </network> diff --git a/tests/networkxml2xmlin/isolated-network.xml b/tests/networkxml2xmlin/isolated-network.xml index 5aa88c1..0c51c64 100644 --- a/tests/networkxml2xmlin/isolated-network.xml +++ b/tests/networkxml2xmlin/isolated-network.xml @@ -1,11 +1,11 @@ <network ipv6='no'> <name>private</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr2" /> + <bridge name="virbr2"/> <mac address='52:54:00:17:3F:37'/> <ip address="192.168.152.1" netmask="255.255.255.0"> <dhcp> - <range start="192.168.152.2" end="192.168.152.254" /> + <range start="192.168.152.2" end="192.168.152.254"/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlin/nat-network-dns-hosts.xml b/tests/networkxml2xmlin/nat-network-dns-hosts.xml index 9a83fed..3babb5c 100644 --- a/tests/networkxml2xmlin/nat-network-dns-hosts.xml +++ b/tests/networkxml2xmlin/nat-network-dns-hosts.xml @@ -2,7 +2,7 @@ <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid> <forward dev='eth0' mode='nat'/> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> <host ip='192.168.122.1'> <hostname>host</hostname> diff --git a/tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml b/tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml index e9b7680..a18afae 100644 --- a/tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml +++ b/tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml @@ -4,15 +4,15 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> - <srv service='name' protocol='tcp' /> + <srv service='name' protocol='tcp'/> </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' /> + <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'> diff --git a/tests/networkxml2xmlin/nat-network-dns-srv-record.xml b/tests/networkxml2xmlin/nat-network-dns-srv-record.xml index 4be85b5..3dd19e6 100644 --- a/tests/networkxml2xmlin/nat-network-dns-srv-record.xml +++ b/tests/networkxml2xmlin/nat-network-dns-srv-record.xml @@ -4,15 +4,15 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <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='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' /> + <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'> diff --git a/tests/networkxml2xmlin/nat-network-dns-txt-record.xml b/tests/networkxml2xmlin/nat-network-dns-txt-record.xml index bd16976..0a6bd59 100644 --- a/tests/networkxml2xmlin/nat-network-dns-txt-record.xml +++ b/tests/networkxml2xmlin/nat-network-dns-txt-record.xml @@ -2,15 +2,15 @@ <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward dev='eth1' mode='nat'/> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> - <txt name='example' value='example value' /> + <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' /> + <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'> diff --git a/tests/networkxml2xmlin/nat-network.xml b/tests/networkxml2xmlin/nat-network.xml index 23f7fcb..4fdde79 100644 --- a/tests/networkxml2xmlin/nat-network.xml +++ b/tests/networkxml2xmlin/nat-network.xml @@ -1,13 +1,13 @@ <network> <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr0" /> + <bridge name="virbr0"/> <forward mode="nat" dev="eth1"/> <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" /> + <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"> diff --git a/tests/networkxml2xmlin/netboot-network.xml b/tests/networkxml2xmlin/netboot-network.xml index ed75663..0db79e3 100644 --- a/tests/networkxml2xmlin/netboot-network.xml +++ b/tests/networkxml2xmlin/netboot-network.xml @@ -5,10 +5,10 @@ <domain name="example.com"/> <forward/> <ip address="192.168.122.1" netmask="255.255.255.0"> - <tftp root="/var/lib/tftproot" /> + <tftp root="/var/lib/tftproot"/> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> - <bootp file="pxeboot.img" /> + <range start="192.168.122.2" end="192.168.122.254"/> + <bootp file="pxeboot.img"/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlin/netboot-proxy-network.xml b/tests/networkxml2xmlin/netboot-proxy-network.xml index ecb6738..0f02cee 100644 --- a/tests/networkxml2xmlin/netboot-proxy-network.xml +++ b/tests/networkxml2xmlin/netboot-proxy-network.xml @@ -6,8 +6,8 @@ <forward/> <ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> - <bootp file="pxeboot.img" server="10.20.30.40" /> + <range start="192.168.122.2" end="192.168.122.254"/> + <bootp file="pxeboot.img" server="10.20.30.40"/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlin/routed-network.xml b/tests/networkxml2xmlin/routed-network.xml index 61d73c0..ab5e15b 100644 --- a/tests/networkxml2xmlin/routed-network.xml +++ b/tests/networkxml2xmlin/routed-network.xml @@ -1,7 +1,7 @@ <network> <name>local</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr1" /> + <bridge name="virbr1"/> <mac address='12:34:56:78:9A:BC'/> <forward mode="route" dev="eth1"/> <ip address="192.168.122.1" netmask="255.255.255.0"> diff --git a/tests/networkxml2xmlout/bandwidth-network.xml b/tests/networkxml2xmlout/bandwidth-network.xml index c0c8ac3..7294ae1 100644 --- a/tests/networkxml2xmlout/bandwidth-network.xml +++ b/tests/networkxml2xmlout/bandwidth-network.xml @@ -2,7 +2,7 @@ <name>test-net</name> <uuid>986fed9e-a488-186d-ef2d-17ebfd1993f8</uuid> <forward mode='nat'/> - <bridge name='virbr1' stp='on' delay='0' /> + <bridge name='virbr1' stp='on' delay='0'/> <mac address='52:54:00:e6:a2:c9'/> <bandwidth> <inbound average='1000' peak='2000' burst='1024'/> @@ -10,7 +10,7 @@ </bandwidth> <ip address='192.168.120.1' netmask='255.255.255.0'> <dhcp> - <range start='192.168.120.2' end='192.168.120.254' /> + <range start='192.168.120.2' end='192.168.120.254'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlout/dhcp6host-routed-network.xml b/tests/networkxml2xmlout/dhcp6host-routed-network.xml index fc8666b..b275afa 100644 --- a/tests/networkxml2xmlout/dhcp6host-routed-network.xml +++ b/tests/networkxml2xmlout/dhcp6host-routed-network.xml @@ -4,21 +4,21 @@ <forward dev='eth1' mode='route'> <interface dev='eth1'/> </forward> - <bridge name='virbr1' stp='on' delay='0' /> + <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> - <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: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' /> + <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'/> diff --git a/tests/networkxml2xmlout/empty-allow-ipv6.xml b/tests/networkxml2xmlout/empty-allow-ipv6.xml index 53e4fa7..f355285 100644 --- a/tests/networkxml2xmlout/empty-allow-ipv6.xml +++ b/tests/networkxml2xmlout/empty-allow-ipv6.xml @@ -1,6 +1,6 @@ <network ipv6='yes'> <name>empty</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid> - <bridge name='virbr7' stp='on' delay='0' /> + <bridge name='virbr7' stp='on' delay='0'/> <mac address='52:54:00:17:3f:47'/> </network> diff --git a/tests/networkxml2xmlout/host-bridge-net.xml b/tests/networkxml2xmlout/host-bridge-net.xml index 84992a9..c76d64a 100644 --- a/tests/networkxml2xmlout/host-bridge-net.xml +++ b/tests/networkxml2xmlout/host-bridge-net.xml @@ -2,5 +2,5 @@ <name>host-bridge-net</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8e</uuid> <forward mode='bridge'/> - <bridge name='br0' /> + <bridge name='br0'/> </network> diff --git a/tests/networkxml2xmlout/isolated-network.xml b/tests/networkxml2xmlout/isolated-network.xml index 9ff1f55..e2c6283 100644 --- a/tests/networkxml2xmlout/isolated-network.xml +++ b/tests/networkxml2xmlout/isolated-network.xml @@ -1,11 +1,11 @@ <network> <name>private</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name='virbr2' stp='on' delay='0' /> + <bridge name='virbr2' stp='on' delay='0'/> <mac address='52:54:00:17:3f:37'/> <ip address='192.168.152.1' netmask='255.255.255.0'> <dhcp> - <range start='192.168.152.2' end='192.168.152.254' /> + <range start='192.168.152.2' end='192.168.152.254'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlout/nat-network-dns-hosts.xml b/tests/networkxml2xmlout/nat-network-dns-hosts.xml index b26fa03..a2f46da 100644 --- a/tests/networkxml2xmlout/nat-network-dns-hosts.xml +++ b/tests/networkxml2xmlout/nat-network-dns-hosts.xml @@ -4,7 +4,7 @@ <forward dev='eth0' mode='nat'> <interface dev='eth0'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> <host ip='192.168.122.1'> <hostname>host</hostname> diff --git a/tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml b/tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml index e9b7680..a18afae 100644 --- a/tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml +++ b/tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml @@ -4,15 +4,15 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> - <srv service='name' protocol='tcp' /> + <srv service='name' protocol='tcp'/> </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' /> + <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'> diff --git a/tests/networkxml2xmlout/nat-network-dns-srv-record.xml b/tests/networkxml2xmlout/nat-network-dns-srv-record.xml index 4be85b5..3dd19e6 100644 --- a/tests/networkxml2xmlout/nat-network-dns-srv-record.xml +++ b/tests/networkxml2xmlout/nat-network-dns-srv-record.xml @@ -4,15 +4,15 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <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='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' /> + <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'> diff --git a/tests/networkxml2xmlout/nat-network-dns-txt-record.xml b/tests/networkxml2xmlout/nat-network-dns-txt-record.xml index f767f48..a459011 100644 --- a/tests/networkxml2xmlout/nat-network-dns-txt-record.xml +++ b/tests/networkxml2xmlout/nat-network-dns-txt-record.xml @@ -4,15 +4,15 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <bridge name='virbr0' stp='on' delay='0'/> <dns> - <txt name='example' value='example value' /> + <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' /> + <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'> diff --git a/tests/networkxml2xmlout/nat-network.xml b/tests/networkxml2xmlout/nat-network.xml index 02d6849..93bc7db 100644 --- a/tests/networkxml2xmlout/nat-network.xml +++ b/tests/networkxml2xmlout/nat-network.xml @@ -4,12 +4,12 @@ <forward dev='eth1' mode='nat'> <interface dev='eth1'/> </forward> - <bridge name='virbr0' stp='on' delay='0' /> + <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' /> + <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'> diff --git a/tests/networkxml2xmlout/netboot-network.xml b/tests/networkxml2xmlout/netboot-network.xml index b8a4d99..8d5ad31 100644 --- a/tests/networkxml2xmlout/netboot-network.xml +++ b/tests/networkxml2xmlout/netboot-network.xml @@ -2,13 +2,13 @@ <name>netboot</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward mode='nat'/> - <bridge name='virbr1' stp='off' delay='1' /> + <bridge name='virbr1' stp='off' delay='1'/> <domain name='example.com'/> <ip address='192.168.122.1' netmask='255.255.255.0'> - <tftp root='/var/lib/tftproot' /> + <tftp root='/var/lib/tftproot'/> <dhcp> - <range start='192.168.122.2' end='192.168.122.254' /> - <bootp file='pxeboot.img' /> + <range start='192.168.122.2' end='192.168.122.254'/> + <bootp file='pxeboot.img'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlout/netboot-proxy-network.xml b/tests/networkxml2xmlout/netboot-proxy-network.xml index e11c50b..a5b7c1e 100644 --- a/tests/networkxml2xmlout/netboot-proxy-network.xml +++ b/tests/networkxml2xmlout/netboot-proxy-network.xml @@ -2,12 +2,12 @@ <name>netboot</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> <forward mode='nat'/> - <bridge name='virbr1' stp='off' delay='1' /> + <bridge name='virbr1' stp='off' delay='1'/> <domain name='example.com'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start='192.168.122.2' end='192.168.122.254' /> - <bootp file='pxeboot.img' server='10.20.30.40' /> + <range start='192.168.122.2' end='192.168.122.254'/> + <bootp file='pxeboot.img' server='10.20.30.40'/> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlout/routed-network.xml b/tests/networkxml2xmlout/routed-network.xml index cb81bae..81abf06 100644 --- a/tests/networkxml2xmlout/routed-network.xml +++ b/tests/networkxml2xmlout/routed-network.xml @@ -4,7 +4,7 @@ <forward dev='eth1' mode='route'> <interface dev='eth1'/> </forward> - <bridge name='virbr1' stp='on' delay='0' /> + <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'> </ip> -- 1.8.1.5

Before, missing attributes were only OK when adding entries; modification and deletion required all of them. Now, only deletion works with missing attributes, as long as the host is uniquely identified. --- src/conf/network_conf.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 0bf72e8..956ec48 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -3297,6 +3297,7 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, int ret = -1; virNetworkIpDefPtr ipdef = virNetworkIpDefByIndex(def, parentIndex); virNetworkDHCPHostDef host; + bool isDelete = (command == VIR_NETWORK_UPDATE_COMMAND_DELETE); memset(&host, 0, sizeof(host)); @@ -3307,13 +3308,11 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, if (!ipdef) goto cleanup; - /* parse the xml into a virNetworkDHCPHostDef */ - if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) { + if (virNetworkDHCPHostDefParseXML(def->name, ipdef, ctxt->node, + &host, isDelete) < 0) + goto cleanup; - if (virNetworkDHCPHostDefParseXML(def->name, ipdef, - ctxt->node, &host, false) < 0) { - goto cleanup; - } + if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) { /* search for the entry with this (mac|name), * and update the IP+(mac|name) */ @@ -3345,11 +3344,6 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, } else if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) || (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) { - if (virNetworkDHCPHostDefParseXML(def->name, ipdef, - ctxt->node, &host, true) < 0) { - goto cleanup; - } - /* log error if an entry with same name/address/ip already exists */ for (i = 0; i < ipdef->nhosts; i++) { if ((host.mac && @@ -3379,11 +3373,6 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, goto cleanup; } else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) { - if (virNetworkDHCPHostDefParseXML(def->name, ipdef, - ctxt->node, &host, false) < 0) { - goto cleanup; - } - /* find matching entry - all specified attributes must match */ for (i = 0; i < ipdef->nhosts; i++) { if ((!host.mac || -- 1.8.1.5

On 08/01/2013 10:42 AM, Ján Tomko wrote:
Before, missing attributes were only OK when adding entries; modification and deletion required all of them.
Now, only deletion works with missing attributes, as long as the host is uniquely identified. --- src/conf/network_conf.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
This one has been ACKed and pushed already: https://www.redhat.com/archives/libvir-list/2013-August/msg00299.html Jan

Add checks for updating sections of network definition via virNetworkDefUpdateSection. https://bugzilla.redhat.com/show_bug.cgi?id=989569 --- src/conf/network_conf.h | 9 + src/conf/network_conf.c | 2 +- src/libvirt_private.syms | 1 + tests/Makefile.am | 9 +- tests/networkxml2xmltest.c | 1 + tests/networkxml2xmlupdatetest.c | 372 +++++++++++++++++++++ .../nat-network-dns-srv-records.xml | 27 ++ .../nat-network-dns-srv-records.xml | 27 ++ .../networkxml2xmlupdatein/dhcp-range-existing.xml | 1 + tests/networkxml2xmlupdatein/dhcp-range.xml | 1 + .../dns-host-gateway-incomplete.xml | 3 + tests/networkxml2xmlupdatein/dns-host-pudding.xml | 3 + .../dns-txt-record-example.xml | 1 + .../dns-txt-record-snowman.xml | 1 + tests/networkxml2xmlupdatein/host-existing.xml | 1 + tests/networkxml2xmlupdatein/host-incomplete.xml | 1 + .../networkxml2xmlupdatein/host-new-incomplete.xml | 1 + tests/networkxml2xmlupdatein/host-new.xml | 1 + tests/networkxml2xmlupdatein/host-updated.xml | 1 + tests/networkxml2xmlupdatein/interface-eth1.xml | 1 + tests/networkxml2xmlupdatein/interface-eth47.xml | 1 + .../networkxml2xmlupdatein/portgroup-alice-new.xml | 10 + tests/networkxml2xmlupdatein/portgroup-alison.xml | 11 + tests/networkxml2xmlupdatein/srv-record-donkey.xml | 1 + .../networkxml2xmlupdatein/srv-record-invalid.xml | 1 + .../networkxml2xmlupdatein/srv-record-protocol.xml | 1 + .../networkxml2xmlupdatein/srv-record-service.xml | 1 + tests/networkxml2xmlupdatein/srv-record.xml | 1 + .../networkxml2xmlupdatein/unparsable-dns-host.xml | 1 + .../dhcp6host-routed-network-another-range.xml | 27 ++ .../dhcp6host-routed-network-range.xml | 27 ++ .../nat-network-dns-more-hosts.xml | 19 ++ .../nat-network-dns-srv-record.xml | 26 ++ .../nat-network-dns-srv-records.xml | 27 ++ .../nat-network-dns-txt-none.xml | 23 ++ .../nat-network-dns-txt-records.xml | 27 ++ .../nat-network-forward-ifaces.xml | 27 ++ .../nat-network-host-updated.xml | 23 ++ .../networkxml2xmlupdateout/nat-network-hosts.xml | 24 ++ .../nat-network-no-forward-ifaces.xml | 24 ++ .../nat-network-no-hosts.xml | 10 + .../nat-network-no-range.xml | 22 ++ .../nat-network-one-host.xml | 22 ++ tests/networkxml2xmlupdateout/nat-network.xml | 23 ++ .../openvswitch-net-modified.xml | 33 ++ .../openvswitch-net-more-portgroups.xml | 44 +++ .../openvswitch-net-without-alice.xml | 23 ++ 47 files changed, 941 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2xmlupdatetest.c create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-records.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-records.xml create mode 100644 tests/networkxml2xmlupdatein/dhcp-range-existing.xml create mode 100644 tests/networkxml2xmlupdatein/dhcp-range.xml create mode 100644 tests/networkxml2xmlupdatein/dns-host-gateway-incomplete.xml create mode 100644 tests/networkxml2xmlupdatein/dns-host-pudding.xml create mode 100644 tests/networkxml2xmlupdatein/dns-txt-record-example.xml create mode 100644 tests/networkxml2xmlupdatein/dns-txt-record-snowman.xml create mode 100644 tests/networkxml2xmlupdatein/host-existing.xml create mode 100644 tests/networkxml2xmlupdatein/host-incomplete.xml create mode 100644 tests/networkxml2xmlupdatein/host-new-incomplete.xml create mode 100644 tests/networkxml2xmlupdatein/host-new.xml create mode 100644 tests/networkxml2xmlupdatein/host-updated.xml create mode 100644 tests/networkxml2xmlupdatein/interface-eth1.xml create mode 100644 tests/networkxml2xmlupdatein/interface-eth47.xml create mode 100644 tests/networkxml2xmlupdatein/portgroup-alice-new.xml create mode 100644 tests/networkxml2xmlupdatein/portgroup-alison.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-donkey.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-invalid.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-protocol.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record-service.xml create mode 100644 tests/networkxml2xmlupdatein/srv-record.xml create mode 100644 tests/networkxml2xmlupdatein/unparsable-dns-host.xml create mode 100644 tests/networkxml2xmlupdateout/dhcp6host-routed-network-another-range.xml create mode 100644 tests/networkxml2xmlupdateout/dhcp6host-routed-network-range.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-more-hosts.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-srv-records.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-txt-none.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-txt-records.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-forward-ifaces.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-host-updated.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-hosts.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-no-forward-ifaces.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-no-hosts.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-no-range.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network-one-host.xml create mode 100644 tests/networkxml2xmlupdateout/nat-network.xml create mode 100644 tests/networkxml2xmlupdateout/openvswitch-net-modified.xml create mode 100644 tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml create mode 100644 tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index a1d3282..b35ab56 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -427,4 +427,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__ */ diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 956ec48..71daf5b 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -3959,7 +3959,7 @@ cleanup: return ret; } -static int +int virNetworkDefUpdateSection(virNetworkDefPtr def, unsigned int command, /* virNetworkUpdateCommand */ unsigned int section, /* virNetworkUpdateSection */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a958d94..6da9e28 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -503,6 +503,7 @@ virNetworkDefGetIpByIndex; virNetworkDefParseFile; virNetworkDefParseNode; virNetworkDefParseString; +virNetworkDefUpdateSection; virNetworkDeleteConfig; virNetworkFindByName; virNetworkFindByUUID; diff --git a/tests/Makefile.am b/tests/Makefile.am index 9c578fa..31a7af5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -72,6 +72,8 @@ EXTRA_DIST = \ networkxml2xmlin \ networkxml2xmlout \ networkxml2confdata \ + networkxml2xmlupdatein \ + networkxml2xmlupdateout \ nodedevschemadata \ nodedevschematest \ nodeinfodata \ @@ -189,7 +191,7 @@ if WITH_YAJL test_programs += jsontest endif -test_programs += networkxml2xmltest +test_programs += networkxml2xmltest networkxml2xmlupdatetest if WITH_NETWORK test_programs += networkxml2conftest @@ -500,6 +502,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 \ diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index bb8a9ad..37c7f3d 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -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("8021Qbh-net"); diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c new file mode 100644 index 0000000..e5a17b2 --- /dev/null +++ b/tests/networkxml2xmlupdatetest.c @@ -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) diff --git a/tests/networkxml2xmlin/nat-network-dns-srv-records.xml b/tests/networkxml2xmlin/nat-network-dns-srv-records.xml new file mode 100644 index 0000000..eda9e20 --- /dev/null +++ b/tests/networkxml2xmlin/nat-network-dns-srv-records.xml @@ -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> diff --git a/tests/networkxml2xmlout/nat-network-dns-srv-records.xml b/tests/networkxml2xmlout/nat-network-dns-srv-records.xml new file mode 100644 index 0000000..eda9e20 --- /dev/null +++ b/tests/networkxml2xmlout/nat-network-dns-srv-records.xml @@ -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> diff --git a/tests/networkxml2xmlupdatein/dhcp-range-existing.xml b/tests/networkxml2xmlupdatein/dhcp-range-existing.xml new file mode 100644 index 0000000..d229a62 --- /dev/null +++ b/tests/networkxml2xmlupdatein/dhcp-range-existing.xml @@ -0,0 +1 @@ +<range start="192.168.122.2" end="192.168.122.254"/> diff --git a/tests/networkxml2xmlupdatein/dhcp-range.xml b/tests/networkxml2xmlupdatein/dhcp-range.xml new file mode 100644 index 0000000..ed775c8 --- /dev/null +++ b/tests/networkxml2xmlupdatein/dhcp-range.xml @@ -0,0 +1 @@ +<range start='10.0.0.10' end='10.0.0.100'/> diff --git a/tests/networkxml2xmlupdatein/dns-host-gateway-incomplete.xml b/tests/networkxml2xmlupdatein/dns-host-gateway-incomplete.xml new file mode 100644 index 0000000..6972d2e --- /dev/null +++ b/tests/networkxml2xmlupdatein/dns-host-gateway-incomplete.xml @@ -0,0 +1,3 @@ +<host> + <hostname>gateway</hostname> +</host> diff --git a/tests/networkxml2xmlupdatein/dns-host-pudding.xml b/tests/networkxml2xmlupdatein/dns-host-pudding.xml new file mode 100644 index 0000000..0878a4b --- /dev/null +++ b/tests/networkxml2xmlupdatein/dns-host-pudding.xml @@ -0,0 +1,3 @@ +<host ip='f0:0d::f0:0d'> + <hostname>pudding</hostname> +</host> diff --git a/tests/networkxml2xmlupdatein/dns-txt-record-example.xml b/tests/networkxml2xmlupdatein/dns-txt-record-example.xml new file mode 100644 index 0000000..c822dde --- /dev/null +++ b/tests/networkxml2xmlupdatein/dns-txt-record-example.xml @@ -0,0 +1 @@ +<txt name='example' value='example value'/> diff --git a/tests/networkxml2xmlupdatein/dns-txt-record-snowman.xml b/tests/networkxml2xmlupdatein/dns-txt-record-snowman.xml new file mode 100644 index 0000000..420d898 --- /dev/null +++ b/tests/networkxml2xmlupdatein/dns-txt-record-snowman.xml @@ -0,0 +1 @@ +<txt name='snowman' value='water'/> diff --git a/tests/networkxml2xmlupdatein/host-existing.xml b/tests/networkxml2xmlupdatein/host-existing.xml new file mode 100644 index 0000000..205178e --- /dev/null +++ b/tests/networkxml2xmlupdatein/host-existing.xml @@ -0,0 +1 @@ +<host mac="00:16:3e:77:e2:ed" name="a.example.com" ip="192.168.122.10"/> diff --git a/tests/networkxml2xmlupdatein/host-incomplete.xml b/tests/networkxml2xmlupdatein/host-incomplete.xml new file mode 100644 index 0000000..d882e45 --- /dev/null +++ b/tests/networkxml2xmlupdatein/host-incomplete.xml @@ -0,0 +1 @@ +<host mac="00:16:3e:77:e2:ed"/> diff --git a/tests/networkxml2xmlupdatein/host-new-incomplete.xml b/tests/networkxml2xmlupdatein/host-new-incomplete.xml new file mode 100644 index 0000000..42d5188 --- /dev/null +++ b/tests/networkxml2xmlupdatein/host-new-incomplete.xml @@ -0,0 +1 @@ +<host name='tea'/> diff --git a/tests/networkxml2xmlupdatein/host-new.xml b/tests/networkxml2xmlupdatein/host-new.xml new file mode 100644 index 0000000..657dc2f --- /dev/null +++ b/tests/networkxml2xmlupdatein/host-new.xml @@ -0,0 +1 @@ +<host mac="00:16:3e:77:f0:0d" name="m.example.com" ip="192.168.122.12"/> diff --git a/tests/networkxml2xmlupdatein/host-updated.xml b/tests/networkxml2xmlupdatein/host-updated.xml new file mode 100644 index 0000000..acfb7a1 --- /dev/null +++ b/tests/networkxml2xmlupdatein/host-updated.xml @@ -0,0 +1 @@ +<host mac="00:16:3e:77:e2:ed" name="a.example.com" ip="192.168.122.47"/> diff --git a/tests/networkxml2xmlupdatein/interface-eth1.xml b/tests/networkxml2xmlupdatein/interface-eth1.xml new file mode 100644 index 0000000..1663a66 --- /dev/null +++ b/tests/networkxml2xmlupdatein/interface-eth1.xml @@ -0,0 +1 @@ +<interface dev='eth1'/> diff --git a/tests/networkxml2xmlupdatein/interface-eth47.xml b/tests/networkxml2xmlupdatein/interface-eth47.xml new file mode 100644 index 0000000..5c244ff --- /dev/null +++ b/tests/networkxml2xmlupdatein/interface-eth47.xml @@ -0,0 +1 @@ +<interface dev='eth47'/> diff --git a/tests/networkxml2xmlupdatein/portgroup-alice-new.xml b/tests/networkxml2xmlupdatein/portgroup-alice-new.xml new file mode 100644 index 0000000..46656c2 --- /dev/null +++ b/tests/networkxml2xmlupdatein/portgroup-alice-new.xml @@ -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> diff --git a/tests/networkxml2xmlupdatein/portgroup-alison.xml b/tests/networkxml2xmlupdatein/portgroup-alison.xml new file mode 100644 index 0000000..ca6b7c1 --- /dev/null +++ b/tests/networkxml2xmlupdatein/portgroup-alison.xml @@ -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> diff --git a/tests/networkxml2xmlupdatein/srv-record-donkey.xml b/tests/networkxml2xmlupdatein/srv-record-donkey.xml new file mode 100644 index 0000000..b379a08 --- /dev/null +++ b/tests/networkxml2xmlupdatein/srv-record-donkey.xml @@ -0,0 +1 @@ +<srv service='name' protocol='tcp' domain='donkey' target='.' port='404' priority='10' weight='10'/> diff --git a/tests/networkxml2xmlupdatein/srv-record-invalid.xml b/tests/networkxml2xmlupdatein/srv-record-invalid.xml new file mode 100644 index 0000000..6a6811d --- /dev/null +++ b/tests/networkxml2xmlupdatein/srv-record-invalid.xml @@ -0,0 +1 @@ +<srv protocol='pudding'/> diff --git a/tests/networkxml2xmlupdatein/srv-record-protocol.xml b/tests/networkxml2xmlupdatein/srv-record-protocol.xml new file mode 100644 index 0000000..87478d0 --- /dev/null +++ b/tests/networkxml2xmlupdatein/srv-record-protocol.xml @@ -0,0 +1 @@ +<srv protocol='tcp'/> diff --git a/tests/networkxml2xmlupdatein/srv-record-service.xml b/tests/networkxml2xmlupdatein/srv-record-service.xml new file mode 100644 index 0000000..5c8c9cd --- /dev/null +++ b/tests/networkxml2xmlupdatein/srv-record-service.xml @@ -0,0 +1 @@ +<srv service='name'/> diff --git a/tests/networkxml2xmlupdatein/srv-record.xml b/tests/networkxml2xmlupdatein/srv-record.xml new file mode 100644 index 0000000..3a65198 --- /dev/null +++ b/tests/networkxml2xmlupdatein/srv-record.xml @@ -0,0 +1 @@ +<srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/> diff --git a/tests/networkxml2xmlupdatein/unparsable-dns-host.xml b/tests/networkxml2xmlupdatein/unparsable-dns-host.xml new file mode 100644 index 0000000..392c67a --- /dev/null +++ b/tests/networkxml2xmlupdatein/unparsable-dns-host.xml @@ -0,0 +1 @@ +<host protocol='name'/> diff --git a/tests/networkxml2xmlupdateout/dhcp6host-routed-network-another-range.xml b/tests/networkxml2xmlupdateout/dhcp6host-routed-network-another-range.xml new file mode 100644 index 0000000..ee6eb7a --- /dev/null +++ b/tests/networkxml2xmlupdateout/dhcp6host-routed-network-another-range.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/dhcp6host-routed-network-range.xml b/tests/networkxml2xmlupdateout/dhcp6host-routed-network-range.xml new file mode 100644 index 0000000..ee6eb7a --- /dev/null +++ b/tests/networkxml2xmlupdateout/dhcp6host-routed-network-range.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-more-hosts.xml b/tests/networkxml2xmlupdateout/nat-network-dns-more-hosts.xml new file mode 100644 index 0000000..6554c07 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-dns-more-hosts.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-srv-record.xml b/tests/networkxml2xmlupdateout/nat-network-dns-srv-record.xml new file mode 100644 index 0000000..3dd19e6 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-dns-srv-record.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-srv-records.xml b/tests/networkxml2xmlupdateout/nat-network-dns-srv-records.xml new file mode 100644 index 0000000..eda9e20 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-dns-srv-records.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-txt-none.xml b/tests/networkxml2xmlupdateout/nat-network-dns-txt-none.xml new file mode 100644 index 0000000..93bc7db --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-dns-txt-none.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-txt-records.xml b/tests/networkxml2xmlupdateout/nat-network-dns-txt-records.xml new file mode 100644 index 0000000..63254d2 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-dns-txt-records.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-forward-ifaces.xml b/tests/networkxml2xmlupdateout/nat-network-forward-ifaces.xml new file mode 100644 index 0000000..6b87cd8 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-forward-ifaces.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-host-updated.xml b/tests/networkxml2xmlupdateout/nat-network-host-updated.xml new file mode 100644 index 0000000..816ab38 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-host-updated.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-hosts.xml b/tests/networkxml2xmlupdateout/nat-network-hosts.xml new file mode 100644 index 0000000..eb7acd7 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-hosts.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-no-forward-ifaces.xml b/tests/networkxml2xmlupdateout/nat-network-no-forward-ifaces.xml new file mode 100644 index 0000000..ae49a30 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-no-forward-ifaces.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-no-hosts.xml b/tests/networkxml2xmlupdateout/nat-network-no-hosts.xml new file mode 100644 index 0000000..bc9e419 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-no-hosts.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-no-range.xml b/tests/networkxml2xmlupdateout/nat-network-no-range.xml new file mode 100644 index 0000000..7128783 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-no-range.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network-one-host.xml b/tests/networkxml2xmlupdateout/nat-network-one-host.xml new file mode 100644 index 0000000..62778e4 --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network-one-host.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/nat-network.xml b/tests/networkxml2xmlupdateout/nat-network.xml new file mode 100644 index 0000000..93bc7db --- /dev/null +++ b/tests/networkxml2xmlupdateout/nat-network.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/openvswitch-net-modified.xml b/tests/networkxml2xmlupdateout/openvswitch-net-modified.xml new file mode 100644 index 0000000..cc0c344 --- /dev/null +++ b/tests/networkxml2xmlupdateout/openvswitch-net-modified.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml b/tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml new file mode 100644 index 0000000..7c19ad9 --- /dev/null +++ b/tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml @@ -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> diff --git a/tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml b/tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml new file mode 100644 index 0000000..4104424 --- /dev/null +++ b/tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml @@ -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> -- 1.8.1.5
participants (1)
-
Ján Tomko