[libvirt] [PATCH tck] Adapt network tests to changed cli tool formats

The network tests invoke various ifconfig and route commands to test network setup, and also grep for dnsmasq/radvd args. Switch to use 'ip' since ifconfig and route commands are not installed by default on recent distros any more and their output formats have also changed. Remove grepping for dnsmasq args since libvirt uses a config file now too. Also avoid looking for radvd, since we let dnsmasq handle IPv6 too now. --- .../networks/networkxml2hostout/tck-testnet-1.dat | 20 ++++----- .../networks/networkxml2hostout/tck-testnet-2.dat | 16 +++---- .../networks/networkxml2hostout/tck-testnet-3.dat | 51 +++++++--------------- 3 files changed, 33 insertions(+), 54 deletions(-) diff --git a/scripts/networks/networkxml2hostout/tck-testnet-1.dat b/scripts/networks/networkxml2hostout/tck-testnet-1.dat index da1a51e..977489f 100644 --- a/scripts/networks/networkxml2hostout/tck-testnet-1.dat +++ b/scripts/networks/networkxml2hostout/tck-testnet-1.dat @@ -1,19 +1,19 @@ #iptables -t nat -L -n | grep ' 10\.1\.2\.' +RETURN all -- 10.1.2.0/24 224.0.0.0/24 +RETURN all -- 10.1.2.0/24 255.255.255.255 MASQUERADE tcp -- 10.1.2.0/24 !10.1.2.0/24 masq ports: 1024-65535 MASQUERADE udp -- 10.1.2.0/24 !10.1.2.0/24 masq ports: 1024-65535 MASQUERADE all -- 10.1.2.0/24 !10.1.2.0/24 -#iptables -n -L FORWARD | grep ' 10\.1\.2\.' +#iptables -n -L FORWARD | grep ' 10\.1\.2\.' | sed -e 's/ctstate/state/' ACCEPT all -- 0.0.0.0/0 10.1.2.0/24 state RELATED,ESTABLISHED ACCEPT all -- 10.1.2.0/24 0.0.0.0/0 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 10\.1\.2\.1*\).*|\1|p' -listen-address 10.1.2.1 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(dhcp-range 10\.1\.2\.2\,10\.1\.2\.254*\).*|\1|p' -dhcp-range 10.1.2.2,10.1.2.254 -#route -n | grep '10\.1\.2\.' -10.1.2.0 0.0.0.0 255.255.255.0 U 0 0 0 tck-testbr +#ip -o route show dev tck-testbr | gawk '{print $1" "$7}' +10.1.2.0/24 10.1.2.1 +#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p' +/dnsmasq/tck-testnet.conf #brctl show | grep tck-testbr | gawk '{print $1" "$3}' tck-testbr yes -#ifconfig tck-testbr | grep ':10\.1\.2\.' - inet addr:10.1.2.1 Bcast:10.1.2.255 Mask:255.255.255.0 +#ip -o addr show dev tck-testbr | gawk '{print $4" "$6}' +10.1.2.1/24 10.1.2.255 #virsh net-list | grep tck-testnet -tck-testnet active no + tck-testnet active no no diff --git a/scripts/networks/networkxml2hostout/tck-testnet-2.dat b/scripts/networks/networkxml2hostout/tck-testnet-2.dat index b2f4315..72ba48b 100644 --- a/scripts/networks/networkxml2hostout/tck-testnet-2.dat +++ b/scripts/networks/networkxml2hostout/tck-testnet-2.dat @@ -2,15 +2,13 @@ ACCEPT all -- 0.0.0.0/0 10.1.2.0/24 ACCEPT all -- 10.1.2.0/24 0.0.0.0/0 #iptables -t nat -L -n | grep ' 10\.1\.2\.' -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 10\.1\.2\.1\).*|\1|p' -listen-address 10.1.2.1 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(dhcp-range 10\.1\.2\.2,10\.1\.2\.254\).*|\1|p' -dhcp-range 10.1.2.2,10.1.2.254 -#route -n | grep '10\.1\.2\.' -10.1.2.0 0.0.0.0 255.255.255.0 U 0 0 0 tck-testbr +#ip -o route show dev tck-testbr | gawk '{print $1" "$7}' +10.1.2.0/24 10.1.2.1 +#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p' +/dnsmasq/tck-testnet.conf #brctl show | grep tck-testbr | gawk '{print $1" "$3}' tck-testbr yes -#ifconfig tck-testbr | grep ':10\.1\.2\.' - inet addr:10.1.2.1 Bcast:10.1.2.255 Mask:255.255.255.0 +#ip -o addr show dev tck-testbr | gawk '{print $4" "$6}' +10.1.2.1/24 10.1.2.255 #virsh net-list | grep tck-testnet -tck-testnet active no + tck-testnet active no no diff --git a/scripts/networks/networkxml2hostout/tck-testnet-3.dat b/scripts/networks/networkxml2hostout/tck-testnet-3.dat index 36c7b32..f9417fc 100644 --- a/scripts/networks/networkxml2hostout/tck-testnet-3.dat +++ b/scripts/networks/networkxml2hostout/tck-testnet-3.dat @@ -1,8 +1,10 @@ #iptables -t nat -L -n | grep ' 10\.1\.2\.' +RETURN all -- 10.1.2.0/24 224.0.0.0/24 +RETURN all -- 10.1.2.0/24 255.255.255.255 MASQUERADE tcp -- 10.1.2.0/24 !10.1.2.0/24 masq ports: 1024-65535 MASQUERADE udp -- 10.1.2.0/24 !10.1.2.0/24 masq ports: 1024-65535 MASQUERADE all -- 10.1.2.0/24 !10.1.2.0/24 -#iptables -n -L FORWARD | grep ' 10\.1\.2\.' +#iptables -n -L FORWARD | grep ' 10\.1\.2\.' | sed -e 's/ctstate/state/' ACCEPT all -- 0.0.0.0/0 10.1.2.0/24 state RELATED,ESTABLISHED ACCEPT all -- 10.1.2.0/24 0.0.0.0/0 #ip6tables -n -L FORWARD | grep ' 2001:db8:ac10' @@ -10,40 +12,19 @@ ACCEPT all ::/0 2001:db8:ac10:fd01::/64 ACCEPT all 2001:db8:ac10:fd01::/64 ::/0 ACCEPT all ::/0 2001:db8:ac10:fe01::/64 ACCEPT all 2001:db8:ac10:fe01::/64 ::/0 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 10\.1\.2\.1\).*|\1|p' -listen-address 10.1.2.1 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 192\.168\.123\.1\).*|\1|p' -listen-address 192.168.123.1 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 172\.28\.255\.241\).*|\1|p' -listen-address 172.28.255.241 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(dhcp-range 10\.1\.2\.2,10\.1\.2\.254\).*|\1|p' -dhcp-range 10.1.2.2,10.1.2.254 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 2001\:db8\:ac10\:fe01\:\:1\).*|\1|p' -listen-address 2001:db8:ac10:fe01::1 -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 2001\:db8\:ac10\:fd01\:\:1\).*|\1|p' -listen-address 2001:db8:ac10:fd01::1 -#ps aux | sed -n '/radvd --.*tck-testnet-/ s|.*\(\/radvd\/tck-testnet-radvd.conf\).*|\1|p' -/radvd/tck-testnet-radvd.conf -#route -n | grep '10\.1\.2\.' -10.1.2.0 0.0.0.0 255.255.255.0 U 0 0 0 tck-testbr -#route -n | grep '192\.168\.123\.' -192.168.123.0 0.0.0.0 255.255.255.0 U 0 0 0 tck-testbr -#route -n | grep '172\.28\.255\.240' -172.28.255.240 0.0.0.0 255.255.255.240 U 0 0 0 tck-testbr +#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(\/dnsmasq\/tck-testnet.conf\).*|\1|p' +/dnsmasq/tck-testnet.conf #brctl show | grep tck-testbr | gawk '{print $1" "$3}' tck-testbr yes -#ifconfig tck-testbr | grep ':10\.1\.2\.' - inet addr:10.1.2.1 Bcast:10.1.2.255 Mask:255.255.255.0 -#ifconfig tck-testbr | grep 'inet6 addr: 2001' - inet6 addr: 2001:db8:ac10:fd01::1/64 Scope:Global - inet6 addr: 2001:db8:ac10:fe01::1/64 Scope:Global -#ip addr show tck-testbr | grep "inet " - inet 10.1.2.1/24 brd 10.1.2.255 scope global tck-testbr - inet 192.168.123.1/24 brd 192.168.123.255 scope global tck-testbr - inet 172.28.255.241/28 brd 172.28.255.255 scope global tck-testbr -#ip route show dev tck-testbr -172.28.255.240/28 proto kernel scope link src 172.28.255.241 -10.1.2.0/24 proto kernel scope link src 10.1.2.1 -192.168.123.0/24 proto kernel scope link src 192.168.123.1 +#ip -o addr show dev tck-testbr | gawk '{print $4" "$6}' +10.1.2.1/24 10.1.2.255 +192.168.123.1/24 192.168.123.255 +172.28.255.241/28 172.28.255.255 +2001:db8:ac10:fd01::1/64 global +2001:db8:ac10:fe01::1/64 global +#ip -o route show dev tck-testbr | gawk '{print $1" "$7}' +10.1.2.0/24 10.1.2.1 +172.28.255.240/28 172.28.255.241 +192.168.123.0/24 192.168.123.1 #virsh net-list | grep tck-testnet -tck-testnet active no + tck-testnet active no no -- 1.8.5.3

On Thursday, March 27, 2014 02:49:25 PM Daniel P. Berrange wrote:
The network tests invoke various ifconfig and route commands to test network setup, and also grep for dnsmasq/radvd args. Switch to use 'ip' since ifconfig and route commands are not installed by default on recent distros any more and their output formats have also changed. Remove grepping for dnsmasq args since libvirt uses a config file now too. Also avoid looking for radvd, since we let dnsmasq handle IPv6 too now. --- .../networks/networkxml2hostout/tck-testnet-1.dat | 20 ++++----- .../networks/networkxml2hostout/tck-testnet-2.dat | 16 +++---- .../networks/networkxml2hostout/tck-testnet-3.dat | 51 +++++++--------------- 3 files changed, 33 insertions(+), 54 deletions(-)
ACK. This works in my environment and obsoletes a local patch I was using. There are some differences between the two patches, but nothing critical. The main difference is that my version greps through the tck-testnet.conf file to validate the settings. For example:
diff --git a/scripts/networks/networkxml2hostout/tck-testnet-1.dat b/scripts/networks/networkxml2hostout/tck-testnet-1.dat index ... -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 10\.1\.2\.1*\).*|\1|p' -listen-address 10.1.2.1
Instead of eliminating the above test, I checked for the bind-dynamic setting in the conf file as follows: #grep bind-dynamic `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf- file=\(.*tck-testnet.conf\).*|\1|p'` bind-dynamic
-#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(dhcp-range 10\.1\.2\.2\,10\.1\.2\.254*\).*|\1|p' -dhcp-range 10.1.2.2,10.1.2.254
I used the same approach here also, only grepping for 'dhcp-range'.: #grep dhcp-range `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf- file=\(.*tck-testnet.conf\).*|\1|p'` dhcp-range=10.1.2.2,10.1.2.254 The above two checks exist in all three .dat files. The test results match across the three test until the final dhcp-range check, where the test produces the following results (in my environment): #grep dhcp-range `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf- file=\(.*tck-testnet.conf\).*|\1|p'` dhcp-range=10.1.2.2,10.1.2.254 dhcp-range=2001:db8:ac10:fe01::1,ra-only dhcp-range=2001:db8:ac10:fd01::1,ra-only Is there any reason to include these checks, or is it safe to just verify the existence of the conf file itself? -Mike

On Thu, Mar 27, 2014 at 02:52:31PM -0600, Mike Latimer wrote:
On Thursday, March 27, 2014 02:49:25 PM Daniel P. Berrange wrote:
The network tests invoke various ifconfig and route commands to test network setup, and also grep for dnsmasq/radvd args. Switch to use 'ip' since ifconfig and route commands are not installed by default on recent distros any more and their output formats have also changed. Remove grepping for dnsmasq args since libvirt uses a config file now too. Also avoid looking for radvd, since we let dnsmasq handle IPv6 too now. --- .../networks/networkxml2hostout/tck-testnet-1.dat | 20 ++++----- .../networks/networkxml2hostout/tck-testnet-2.dat | 16 +++---- .../networks/networkxml2hostout/tck-testnet-3.dat | 51 +++++++--------------- 3 files changed, 33 insertions(+), 54 deletions(-)
ACK. This works in my environment and obsoletes a local patch I was using. There are some differences between the two patches, but nothing critical. The main difference is that my version greps through the tck-testnet.conf file to validate the settings.
For example:
diff --git a/scripts/networks/networkxml2hostout/tck-testnet-1.dat b/scripts/networks/networkxml2hostout/tck-testnet-1.dat index ... -#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(listen-address 10\.1\.2\.1*\).*|\1|p' -listen-address 10.1.2.1
Instead of eliminating the above test, I checked for the bind-dynamic setting in the conf file as follows: #grep bind-dynamic `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf- file=\(.*tck-testnet.conf\).*|\1|p'` bind-dynamic
-#ps aux | sed -n '/dnsmasq .*tck-testnet/ s|.*\(dhcp-range 10\.1\.2\.2\,10\.1\.2\.254*\).*|\1|p' -dhcp-range 10.1.2.2,10.1.2.254
I used the same approach here also, only grepping for 'dhcp-range'.: #grep dhcp-range `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf- file=\(.*tck-testnet.conf\).*|\1|p'` dhcp-range=10.1.2.2,10.1.2.254
The above two checks exist in all three .dat files. The test results match across the three test until the final dhcp-range check, where the test produces the following results (in my environment):
#grep dhcp-range `ps aux | sed -n '0,/dnsmasq .*tck-testnet/ s|.*--conf- file=\(.*tck-testnet.conf\).*|\1|p'` dhcp-range=10.1.2.2,10.1.2.254 dhcp-range=2001:db8:ac10:fe01::1,ra-only dhcp-range=2001:db8:ac10:fd01::1,ra-only
Is there any reason to include these checks, or is it safe to just verify the existence of the conf file itself?
Yes, you are right. I was being lazy by just deleting this stuff. I'll add your examples into the patch before pushing. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Mike Latimer