[PATCH] [TEST]Update RPCS/04 with the latest updates of pool verification

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1242287412 25200 # Node ID e1ca990097ed08771ba19aa8d6ac21af16c10a65 # Parent 9391439d65e7ec6b88f34923d97f969c6114a237 [TEST]Update RPCS/04 with the latest updates of pool verification Tested for KVM with current sources Signed-off-by: Guolian Yun<yunguol@cn.ibm.com> diff -r 9391439d65e7 -r e1ca990097ed suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Wed May 13 07:28:33 2009 -0700 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Thu May 14 00:50:12 2009 -0700 @@ -39,45 +39,59 @@ # OUT -- Error -- String -- Encoded error instance if the operation # failed and did not return a job # -# REVISIT : -# -------- -# As of now the CreateChildResourcePool() simply throws an Exception. -# We must improve this tc once the service is implemented. -# -# -Date: 20.02.2008 - +# Exception details before Revision 837 +# ----- +# Error code: CIM_ERR_NOT_SUPPORTED +# +# After revision 837, the service is implemented +# +# -Date: 20.02.2008 import sys -import pywbem -from XenKvmLib import rpcs_service from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class +from XenKvmLib.common_util import destroy_netpool +from XenKvmLib.pool import create_netpool, verify_pool -cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED -cim_mname = "CreateChildResourcePool" +test_pool = "testpool" +test_mode = ["nat"] @do_main(platform_sup) def main(): + status = PASS options = main.options - rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \ - "ResourcePoolConfigurationService"))(options.ip) - try: - rpcs_conn.CreateChildResourcePool() - except pywbem.CIMError, (err_no, desc): - if err_no == cim_errno : - logger.info("Got expected exception for '%s' service", cim_mname) - logger.info("Errno is '%s' ", err_no) - logger.info("Error string is '%s'", desc) - return PASS - else: - logger.error("Unexpected rc code %s and description %s\n", - err_no, desc) + + np = get_typed_class(options.virt, 'NetworkPool') + np_id = "NetworkPool/%s" % test_pool + pool_attr = { + "Address" : "192.168.0.8", + "Netmask" : "255.255.255.0", + "IPRangeStart" : "192.168.0.9", + "IPRangeEnd" : "192.168.0.15" + } + for i in range(0, len(test_mode)): + pool_attr["ForwardMode"] = test_mode[i] + status = create_netpool(options.ip, options.virt, + test_pool, pool_attr) + if status != PASS: + logger.error("Error in networkpool creation") return FAIL - - logger.error("The execution should not have reached here!!") - return FAIL + + status = verify_pool(options.ip, options.virt, np, + test_pool, pool_attr) + if status != PASS: + logger.error("Error in networkpool verification") + destroy_netpool(options.ip, options.virt, test_pool) + return FAIL + + status = destroy_netpool(options.ip, options.virt, test_pool) + if status != PASS: + logger.error("Unable to destroy networkpool %s", test_pool) + return FAIL + + return status + if __name__ == "__main__": sys.exit(main()) -

yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1242287412 25200 # Node ID e1ca990097ed08771ba19aa8d6ac21af16c10a65 # Parent 9391439d65e7ec6b88f34923d97f969c6114a237 [TEST]Update RPCS/04 with the latest updates of pool verification
Tested for KVM with current sources Signed-off-by: Guolian Yun<yunguol@cn.ibm.com>
diff -r 9391439d65e7 -r e1ca990097ed suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Wed May 13 07:28:33 2009 -0700 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Thu May 14 00:50:12 2009 -0700 @@ -39,45 +39,59 @@ # OUT -- Error -- String -- Encoded error instance if the operation # failed and did not return a job # -# REVISIT : -# -------- -# As of now the CreateChildResourcePool() simply throws an Exception. -# We must improve this tc once the service is implemented. -# -# -Date: 20.02.2008 - +# Exception details before Revision 837 +# ----- +# Error code: CIM_ERR_NOT_SUPPORTED +# +# After revision 837, the service is implemented +# +# -Date: 20.02.2008
import sys -import pywbem -from XenKvmLib import rpcs_service from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class +from XenKvmLib.common_util import destroy_netpool +from XenKvmLib.pool import create_netpool, verify_pool
-cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED -cim_mname = "CreateChildResourcePool" +test_pool = "testpool" +test_mode = ["nat"]
Why is routed and isolated mode not included.
@do_main(platform_sup) def main(): + status = PASS options = main.options - rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \ - "ResourcePoolConfigurationService"))(options.ip) - try: - rpcs_conn.CreateChildResourcePool() - except pywbem.CIMError, (err_no, desc): - if err_no == cim_errno : - logger.info("Got expected exception for '%s' service", cim_mname) - logger.info("Errno is '%s' ", err_no) - logger.info("Error string is '%s'", desc) - return PASS - else: - logger.error("Unexpected rc code %s and description %s\n", - err_no, desc) + + np = get_typed_class(options.virt, 'NetworkPool') + np_id = "NetworkPool/%s" % test_pool + pool_attr = { + "Address" : "192.168.0.8", + "Netmask" : "255.255.255.0", + "IPRangeStart" : "192.168.0.9", + "IPRangeEnd" : "192.168.0.15" + }
The test case failed saying the IP was already in use. I know this is not a test case issue but, using a random generated IP address is always better than hardcoding it. you can use something like this to create one: ip_base = random.randint(1, 100) addr = subnet+'%d' % ip_base
+ for i in range(0, len(test_mode)): + pool_attr["ForwardMode"] = test_mode[i] + status = create_netpool(options.ip, options.virt, + test_pool, pool_attr) + if status != PASS: + logger.error("Error in networkpool creation") return FAIL - - logger.error("The execution should not have reached here!!") - return FAIL + + status = verify_pool(options.ip, options.virt, np, + test_pool, pool_attr) + if status != PASS: + logger.error("Error in networkpool verification") + destroy_netpool(options.ip, options.virt, test_pool) + return FAIL + + status = destroy_netpool(options.ip, options.virt, test_pool) + if status != PASS: + logger.error("Unable to destroy networkpool %s", test_pool) + return FAIL
Need to undefine the testpool before exiting
+ + return status + if __name__ == "__main__": sys.exit(main()) -
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com
participants (2)
-
Deepti B Kalakeri
-
yunguol@cn.ibm.com