On 07/16/2013 05:38 PM, hongming zhang wrote:
Modify the old network_list.py. The new network_list.py covers all
flags of listAllNetworks and the following api. and add network_list to
basic_network.conf.
virNetwork:
name()
bridgeName()
isActive()
isPersistent()
virConnect:
listAllNetworks()
---
cases/basic_network.conf | 37 +++++-
repos/network/network_list.py | 279 ++++++++++++++++++-----------------------
2 files changed, 151 insertions(+), 165 deletions(-)
diff --git a/cases/basic_network.conf b/cases/basic_network.conf
index 991ad99..805cfd0 100644
--- a/cases/basic_network.conf
+++ b/cases/basic_network.conf
@@ -14,6 +14,16 @@ network:define
netmode
nat
+#VIR_CONNECT_LIST_NETWORKS_INACTIVE = 1
+#VIR_CONNECT_LIST_NETWORKS_ACTIVE = 2
+#VIR_CONNECT_LIST_NETWORKS_PERSISTENT = 4
+#VIR_CONNECT_LIST_NETWORKS_TRANSIENT = 8
+#VIR_CONNECT_LIST_NETWORKS_AUTOSTART = 16
+#VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART = 32
About the list all networks testcase, we can divide the about six flags
into three groups
1 inactive/active
2 persistent/transistent
3 autostart/non-autostart
we just test the result with these three flags
Currently, the case compares the results of 'virsh network-list' to the
results of calling python APIs
it is not so necessary because both virsh and python bindings calls the
same libvirt shared library.
we can test the virsh tool by using shell scripts in other tests place.
After getting the result from python API, checking its validation in
/etc/libvirt/qemu/networks/ make
the testcase looks good.
+network:network_list
+ flags
+ 1
+
using string here is better than digit.
The conversion between digit to string is a little complicated. The
simpler, the better.
So finally it comes to four tesecases.
1 list all network(default flags == 0)
2 list inactive/active networks
3,list persistent/transistent networks
4,list autostart/non-autostart networks.
Or, go further, we can pick up one of networks to change its state, then
see the changes in the output of
this list.
Guannan