[PATCH] [TEST] #2 Update RPCS/04 with the latest updatesof pool verification

# 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()) -

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

libvirt-cim-bounces@redhat.com wrote on 2009-05-18 17:27:04:
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!
I'm not sure if this failure because of the test_mode = ["None", "nat", "route eth1"] setting in tc. Below are the part code of libvirt-cim provider. I tried to define the test_mode as [0, 1, 2], but it fails yet. How to set the test_mode in cimtest for different types? if (cu_get_u16_prop(inst, "ForwardMode", &type) != CMPI_RC_OK) { pool->pool_info.net.forward_mode = strdup("nat"); } else { free(pool->pool_info.net.forward_mode); switch (type) { case NETPOOL_FORWARD_NONE: pool->pool_info.net.forward_mode = NULL; break; case NETPOOL_FORWARD_NAT: pool->pool_info.net.forward_mode = strdup("nat"); break; case NETPOOL_FORWARD_ROUTED: pool->pool_info.net.forward_mode = strdup("route"); break; default: return "Storage pool type not supported";
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
Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

Guo Lian Yun wrote:
libvirt-cim-bounces@redhat.com wrote on 2009-05-18 17:27:04:
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!
I'm not sure if this failure because of the test_mode = ["None", "nat", "route eth1"] setting in tc. Below are the part code of libvirt-cim provider. I tried to define the test_mode as [0, 1, 2], but it fails yet. How to set the test_mode in cimtest for different types?
if (cu_get_u16_prop(inst, "ForwardMode", &type) != CMPI_RC_OK) { pool->pool_info.net.forward_mode = strdup("nat"); } else { free(pool->pool_info.net.forward_mode);
switch (type) { case NETPOOL_FORWARD_NONE: pool->pool_info.net.forward_mode = NULL; break; case NETPOOL_FORWARD_NAT: pool->pool_info.net.forward_mode = strdup("nat"); break; case NETPOOL_FORWARD_ROUTED: pool->pool_info.net.forward_mode = strdup("route"); break; default: return "Storage pool type not supported";
I checked this too in Virt_RPCS.c file.. Here is the XML that is generated for the route type: xmlgen.c(981): Created pool XML: <network> <name>testpool</name> <bridge/> <forward mode="nat" dev="eth1"/> <ip address="192.168.0.51" netmask="255.255.255.0"> <dhcp> <range start="192.168.0.52" end="192.168.0.61"/> </dhcp> </ip> </network> Seems like only the if condition is getting executed for some reason. Daisy, In your test case I think we need to specify pool_attr["ForwardMode"] = "route" and pool_attr["ForwardDevice"] = "eth1" for route type.
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
Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
_______________________________________________ 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

Below are the part code of libvirt-cim provider. I tried to define the test_mode as [0, 1, 2], but it
What failure are you seeing? This works for me.. here's my pywbem script: from pywbem import WBEMConnection, CIMInstanceName, CIMInstance, cim_types c = WBEMConnection("http://localhost", ("root", "pass"), "root/virt") c.debug = True iname = CIMInstanceName('KVM_NetPoolResourceAllocationSettingData', namespace='root/virt',keybindings = {'InstanceID':'DiskPool/meep-net'}) rasd = CIMInstance('KVM_NetPoolResourceAllocationSettingData', path=iname, properties={"Address":"192.168.0.4", "Netmask":"255.255.254.0", "IPRangeStart":"192.168.0.5", "IPRangeEnd":"192.168.0.27", "ForwardMode":cim_types.Uint16(2), "ForwardDevice":"eth1"}) rasds = [rasd.tomof()] print rasds res = c.InvokeMethod("CreateChildResourcePool", "KVM_ResourcePoolConfigurationService", Settings=rasds, ElementName="meep-net") print c.last_request
fails yet. How to set the test_mode in cimtest for different types?
if (cu_get_u16_prop(inst, "ForwardMode", &type) != CMPI_RC_OK) { pool->pool_info.net.forward_mode = strdup("nat"); } else { free(pool->pool_info.net.forward_mode);
switch (type) { case NETPOOL_FORWARD_NONE: pool->pool_info.net.forward_mode = NULL; break; case NETPOOL_FORWARD_NAT: pool->pool_info.net.forward_mode = strdup("nat"); break; case NETPOOL_FORWARD_ROUTED: pool->pool_info.net.forward_mode = strdup("route"); break; default: return "Storage pool type not supported";
I checked this too in Virt_RPCS.c file.. Here is the XML that is generated for the route type: xmlgen.c(981): Created pool XML: <network> <name>testpool</name> <bridge/> <forward mode="nat" dev="eth1"/> <ip address="192.168.0.51" netmask="255.255.255.0"> <dhcp> <range start="192.168.0.52" end="192.168.0.61"/> </dhcp> </ip> </network>
Seems like only the if condition is getting executed for some reason.
Daisy,
In your test case I think we need to specify pool_attr["ForwardMode"] = "route" and pool_attr["ForwardDevice"] = "eth1" for route type.
The ForwardDevice is a uint16 - it needs to take a number. If you look at the schema: [Description ("Network pool forwarding mode"), ValueMap {"0", "1", "2"}, Values {"None", "NAT", "Routed"}] uint16 ForwardMode; In Daisy's test, she is using strings, but it should be the following: pool_attr["ForwardMode"] = 2 #This will give you a route pool type. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
Below are the part code of libvirt-cim provider. I tried to define the test_mode as [0, 1, 2], but it
What failure are you seeing? This works for me.. here's my pywbem script:
from pywbem import WBEMConnection, CIMInstanceName, CIMInstance, cim_types
c = WBEMConnection("http://localhost", ("root", "pass"), "root/virt")
c.debug = True
iname = CIMInstanceName('KVM_NetPoolResourceAllocationSettingData', namespace='root/virt',keybindings = {'InstanceID':'DiskPool/meep-net'})
rasd = CIMInstance('KVM_NetPoolResourceAllocationSettingData', path=iname, properties={"Address":"192.168.0.4", "Netmask":"255.255.254.0", "IPRangeStart":"192.168.0.5", "IPRangeEnd":"192.168.0.27", "ForwardMode":cim_types.Uint16(2), "ForwardDevice":"eth1"})
rasds = [rasd.tomof()]
print rasds
res = c.InvokeMethod("CreateChildResourcePool", "KVM_ResourcePoolConfigurationService", Settings=rasds, ElementName="meep-net")
print c.last_request
fails yet. How to set the test_mode in cimtest for different types?
if (cu_get_u16_prop(inst, "ForwardMode", &type) != CMPI_RC_OK) { pool->pool_info.net.forward_mode = strdup("nat"); } else { free(pool->pool_info.net.forward_mode);
switch (type) { case NETPOOL_FORWARD_NONE: pool->pool_info.net.forward_mode = NULL; break; case NETPOOL_FORWARD_NAT: pool->pool_info.net.forward_mode = strdup("nat"); break; case NETPOOL_FORWARD_ROUTED: pool->pool_info.net.forward_mode = strdup("route"); break; default: return "Storage pool type not supported";
I checked this too in Virt_RPCS.c file.. Here is the XML that is generated for the route type: xmlgen.c(981): Created pool XML: <network> <name>testpool</name> <bridge/> <forward mode="nat" dev="eth1"/> <ip address="192.168.0.51" netmask="255.255.255.0"> <dhcp> <range start="192.168.0.52" end="192.168.0.61"/> </dhcp> </ip> </network>
Seems like only the if condition is getting executed for some reason.
Daisy,
In your test case I think we need to specify pool_attr["ForwardMode"] = "route" and pool_attr["ForwardDevice"] = "eth1" for route type.
The ForwardDevice is a uint16 - it needs to take a number. If you look at the schema:
[Description ("Network pool forwarding mode"), ValueMap {"0", "1", "2"}, Values {"None", "NAT", "Routed"}] uint16 ForwardMode;
In Daisy's test, she is using strings, but it should be the following:
pool_attr["ForwardMode"] = 2 #This will give you a route pool type. Oh! Thanks so much. Yup! I had tried with the numbers as well which had not worked. May be I missed something.

+test_mode = ["None", "nat", "route eth1"]
If you want to set the forward device as eth1, you'll need to use the ForwardDevice attribute. See the schema (or the template NetPoolRASDs) for more info.
+ for i in range(0, len(test_mode)): + pool_attr["ForwardMode"] = test_mode[i]
ForwardMode needs to be an int, not a string. Really, you should be using the template NetPoolRASD for this. These have the values set appropriately. You can call get_pool_rasds(), and then pull the RASD you want from the list that is returned. Then you won't have to worry about setting the properties appropriately.
+ + 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
Instead of setting PASS at the top of the test case, set status = PASS here. This helps prevent returning a false positive. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

libvirt-cim-bounces@redhat.com wrote on 2009-05-19 01:24:35:
+test_mode = ["None", "nat", "route eth1"]
If you want to set the forward device as eth1, you'll need to use the ForwardDevice attribute. See the schema (or the template NetPoolRASDs) for more info.
+ for i in range(0, len(test_mode)): + pool_attr["ForwardMode"] = test_mode[i]
ForwardMode needs to be an int, not a string. Really, you should be using the template NetPoolRASD for this. These have the values set appropriately.
You can call get_pool_rasds(), and then pull the RASD you want from the list that is returned. Then you won't have to worry about setting the properties appropriately.
Good idea. I get an array of NetPoolRASDs from get_pool_rasds, which including all net types. And then create them by create_netpool. This tc pass for me now. Thanks!!
+ + 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
Instead of setting PASS at the top of the test case, set status = PASS here. This helps prevent returning a false positive.
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (4)
-
Deepti B Kalakeri
-
Guo Lian Yun
-
Kaitlin Rupert
-
yunguol@cn.ibm.com