+def dump_netxml(server, netname):
+ cmd = "virsh net-dumpxml %s | awk '/ip address/ {print}' | \
+ cut -d ' ' -f 4 | sed 's/address=//'" % netname
+ s, addr = run_remote(server, cmd)
+ addr = addr.strip("'")
+
+ return addr
This only checks the IP, it doesn't check the - the netmask, ip start,
ip end, etc.
I would try to leverage the NetXML class here. You can have a function
similar to dumpxml. You can also have functions similar to
xml_get_net_mac(), xml_get_vcpus() etc. This will allow you to verify
all the values of the XML, not just the IP.
+def verify_pool(server, pooltype, poolid, address):
+ status = FAIL
+ pool_list = EnumInstances(server, pooltype)
+ if len(pool_list) < 1:
+ logger.error("Return %i instances, expected at least one instance",
+ len(pool_list))
+ return FAIL
+
+ for i in range(0, len(pool_list)):
+ ret_pool = pool_list[i].InstanceID
+ ret_pool_name = ret_pool.split("/")[1]
You can use the parse_instance_id() function for this.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com