[PATCH] [TEST] Simplify RPCS/04 for networkpool creation and validation through provider

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1241687089 25200 # Node ID 5bf7603206d39d26feef19c91121b6e17e52dbe8 # Parent 92caf252c2fa8c8a7a9b70548d12b03c52f3935c [TEST] Simplify RPCS/04 for networkpool creation and validation through provider Tested for KVM with current sources Signed-off-by: Guolian Yun<yunguol@cn.ibm.com> diff -r 92caf252c2fa -r 5bf7603206d3 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Mon May 04 03:49:32 2009 -0700 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Thu May 07 02:04:49 2009 -0700 @@ -39,45 +39,56 @@ # 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 undefine_netpool, create_netpool, verify_pool -cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED -cim_mname = "CreateChildResourcePool" +test_pool = "testpool" +test_mode = ["None", "route eth1", "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 + addr = "192.168.0.8" + for i in range(0, len(test_mode)): + status = create_netpool(options.ip, options.virt, test_pool, + addr, test_mode[i]) + 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, np, np_id, addr) + if status != PASS: + logger.error("Error in networkpool verification") + 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 + + status = undefine_netpool(options.ip, options.virt, test_pool) + if status != PASS: + logger.error("Unable to undefine networkpool %s", test_pool) + return FAIL + + return status + if __name__ == "__main__": sys.exit(main()) -

+1 -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com
participants (2)
-
Deepti B Kalakeri
-
yunguol@cn.ibm.com