This tc fails for routed and isolated mode because that the forward mode is "nat" always when we dumpxml in verify_pool() function.
Although the networkpool is created with routed/isolated ForwardMode, the forward mode of dump netxml is "nat".

Is there any error in mode setting on cimtest?
Thanks!


libvirt-cim-bounces@redhat.com wrote on 2009-05-18 17:28:43:

> # HG changeset patch
> # User Yun Guo Lian <yunguol@cn.ibm.com>
> # Date 1242638914 25200
> # Node ID eb0bbc2200a1b3c1649dcbe921f7e7103c2345a0
> # Parent  43fb40db432952d38509a76e92e61d7d3d3702f7
> [TEST] #2 Update RPCS/04 with the latest updatesof pool verification
>
>
> Tested for KVM with current sources
> Signed-off-by: Guolian Yun<yunguol@cn.ibm.com
>
> diff -r 43fb40db4329 -r eb0bbc2200a1 suites/libvirt-
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py
> --- a/suites/libvirt-
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.
> py   Fri May 15 14:03:39 2009 -0700
> +++ b/suites/libvirt-
> cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.
> py   Mon May 18 02:28:34 2009 -0700
> @@ -39,45 +39,73 @@
>  # 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
> +import random
>  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, undefine_netpool
>  
> -cim_errno  = pywbem.CIM_ERR_NOT_SUPPORTED
> -cim_mname  = "CreateChildResourcePool"
> +test_pool = "testpool"
> +test_mode = ["None", "nat", "route eth1"]
>  
>  @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
> +
> +    subnet = '192.168.0.'
> +    ip_base = random.randint(1, 100)
> +    addr = subnet+'%d' % ip_base
> +    range_addr_start = subnet+'%d' % (ip_base + 1)
> +    range_addr_end = subnet+'%d' %(ip_base + 10)
> +    pool_attr = {
> +                 "Address" : addr,
> +                 "Netmask" : "255.255.255.0",
> +                 "IPRangeStart" : range_addr_start,
> +                 "IPRangeEnd"   : range_addr_end
> +                }
> +    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)
> +            undefine_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
> +
> +        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())
> -    
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim