[PATCH] [TEST] Updates to VSMS 19_definenetwork_ers.py

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1247619180 25200 # Node ID 2daf5abc8b907906380fa9b911a0711d23aaa19f # Parent b2eb25caa1c8b2736418c39e448b6f228fc153bc [TEST] Updates to VSMS 19_definenetwork_ers.py Skip bridge type networks with provider versions that don't support setting the bridge type via the providers. Set different expected error messages for Xen guests, and for older versions of libvirt. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r b2eb25caa1c8 -r 2daf5abc8b90 suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py Tue Jul 14 16:14:07 2009 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py Tue Jul 14 17:53:00 2009 -0700 @@ -31,8 +31,9 @@ from XenKvmLib import vxml from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS -from XenKvmLib.const import default_network_name, do_main +from XenKvmLib.const import default_network_name, do_main, get_provider_version from XenKvmLib.common_util import create_netpool_conf, destroy_netpool +from XenKvmLib.xm_virt_util import virsh_version sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' @@ -40,6 +41,8 @@ npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100)) +bridge_support_rev = 900 + exp_rc = CIM_ERR_FAILED def verify_error(exp_rc, exp_desc,cxml): @@ -50,7 +53,11 @@ def main(): options = main.options - nettypes = ['bridge','network'] + nettypes = ['network'] + + rev, changeset = get_provider_version(options.virt, options.ip) + if rev >= bridge_support_rev: + nettypes.append('bridge') expected_values = { "invalid" : {'bridge' : 'internal error Failed to add tap interface', @@ -61,6 +68,27 @@ 'network' : "Valid param "} } + if options.virt == "Xen" or options.virt == "XenFV": + libvirt_version = virsh_version(options.ip, options.virt) + if libvirt_version <= "0.3.3": + expected_values['empty']['network'] = "no network with matching name" + expected_values['invalid']['network'] = "no network with matching name" + + inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ + "could not be connected. Could not find bridge device " + \ + "invalid')" + + expected_values['invalid']['bridge'] = inv_br_str + + else: + expected_values['empty']['network'] = "Network not found" + expected_values['invalid']['network'] = "Network not found" + + inv_br_str = "POST operation failed: xend_post: error from xen " + \ + "daemon: (xend.err 'Device 0 (vif) could not be " + \ + "connected. Could not find bridge device invalid')" + expected_values['invalid']['bridge'] = inv_br_str + tc_scen = { 'invalid' : 'invalid', 'empty' : '',

Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1247619180 25200 # Node ID 2daf5abc8b907906380fa9b911a0711d23aaa19f # Parent b2eb25caa1c8b2736418c39e448b6f228fc153bc [TEST] Updates to VSMS 19_definenetwork_ers.py
Skip bridge type networks with provider versions that don't support setting the bridge type via the providers.
Set different expected error messages for Xen guests, and for older versions of libvirt.
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r b2eb25caa1c8 -r 2daf5abc8b90 suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py Tue Jul 14 16:14:07 2009 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py Tue Jul 14 17:53:00 2009 -0700 @@ -31,8 +31,9 @@ from XenKvmLib import vxml from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS -from XenKvmLib.const import default_network_name, do_main +from XenKvmLib.const import default_network_name, do_main, get_provider_version from XenKvmLib.common_util import create_netpool_conf, destroy_netpool +from XenKvmLib.xm_virt_util import virsh_version
sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' @@ -40,6 +41,8 @@ npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100))
+bridge_support_rev = 900 + exp_rc = CIM_ERR_FAILED
def verify_error(exp_rc, exp_desc,cxml): @@ -50,7 +53,11 @@ def main(): options = main.options
- nettypes = ['bridge','network'] + nettypes = ['network'] + + rev, changeset = get_provider_version(options.virt, options.ip) + if rev >= bridge_support_rev: + nettypes.append('bridge')
expected_values = { "invalid" : {'bridge' : 'internal error Failed to add tap interface', @@ -61,6 +68,27 @@ 'network' : "Valid param "} }
+ if options.virt == "Xen" or options.virt == "XenFV": + libvirt_version = virsh_version(options.ip, options.virt) + if libvirt_version <= "0.3.3": + expected_values['empty']['network'] = "no network with matching name" + expected_values['invalid']['network'] = "no network with matching name" + + inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ + "could not be connected. Could not find bridge device " + \ + "invalid')" + + expected_values['invalid']['bridge'] = inv_br_str + + else: + expected_values['empty']['network'] = "Network not found" + expected_values['invalid']['network'] = "Network not found" + + inv_br_str = "POST operation failed: xend_post: error from xen " + \ + "daemon: (xend.err 'Device 0 (vif) could not be " + \ + "connected. Could not find bridge device invalid')" + expected_values['invalid']['bridge'] = inv_br_str
We can use a common variable to assign these error messages get the assignment to the expected_values fields before coming out of the if options.virt == "Xen" or options.virt == "XenFV": check.
+ tc_scen = { 'invalid' : 'invalid', 'empty' : '',
_______________________________________________ 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

+ if options.virt == "Xen" or options.virt == "XenFV": + libvirt_version = virsh_version(options.ip, options.virt) + if libvirt_version <= "0.3.3": + expected_values['empty']['network'] = "no network with matching name" + expected_values['invalid']['network'] = "no network with matching name" + + inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ + "could not be connected. Could not find bridge device " + \ + "invalid')" + + expected_values['invalid']['bridge'] = inv_br_str + + else: + expected_values['empty']['network'] = "Network not found" + expected_values['invalid']['network'] = "Network not found" + + inv_br_str = "POST operation failed: xend_post: error from xen " + \ + "daemon: (xend.err 'Device 0 (vif) could not be " + \ + "connected. Could not find bridge device invalid')" + expected_values['invalid']['bridge'] = inv_br_str
We can use a common variable to assign these error messages get the assignment to the expected_values fields before coming out of the
if options.virt == "Xen" or options.virt == "XenFV": check.
Not sure what you mean here... But any suggestions appreciated, because what I have here isn't very pretty. =) -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
+ if options.virt == "Xen" or options.virt == "XenFV": + libvirt_version = virsh_version(options.ip, options.virt) + if libvirt_version <= "0.3.3": + expected_values['empty']['network'] = "no network with matching name" + expected_values['invalid']['network'] = "no network with matching name" + + inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ + "could not be connected. Could not find bridge device " + \ + "invalid')" + + expected_values['invalid']['bridge'] = inv_br_str + + else: + expected_values['empty']['network'] = "Network not found" + expected_values['invalid']['network'] = "Network not found" + + inv_br_str = "POST operation failed: xend_post: error from xen " + \ + "daemon: (xend.err 'Device 0 (vif) could not be " + \ + "connected. Could not find bridge device invalid')" + expected_values['invalid']['bridge'] = inv_br_str
We can use a common variable to assign these error messages get the assignment to the expected_values fields before coming out of the
inv_br_str check.
Not sure what you mean here...
But any suggestions appreciated, because what I have here isn't very pretty. =)
Sorry for not being clear. What I meant is the fields expected_values['empty']['network'] and expected_values['invalid']['network'] have similar values that are assigned so we can use one var inside the if conditions to assign appropriate value. Also, the value for the field expected_values['invalid']['bridge'] is stored in inv_br_str . We can use the variables in which the values are assigned after the if else and assign it for once instead of repeating the same separately in the if and else conditions. For ex: if options.virt == "Xen" or options.virt == "XenFV": libvirt_version = virsh_version(options.ip, options.virt) if libvirt_version <= "0.3.3": net_invalid_empty = "no network with matching name" inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ "could not be connected. Could not find bridge device " + \ "invalid')" else: net_invalid_empty = "Network not found" inv_br_str = "POST operation failed: xend_post: error from xen " + \ "daemon: (xend.err 'Device 0 (vif) could not be " + \ "connected. Could not find bridge device invalid')" expected_values['empty']['network'] = expected_values['invalid']['network'] = net_invalid_empty expected_values['invalid']['bridge'] = inv_br_str -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

Not sure what you mean here...
But any suggestions appreciated, because what I have here isn't very pretty. =)
Sorry for not being clear. What I meant is the fields expected_values['empty']['network'] and expected_values['invalid']['network'] have similar values that are assigned so we can use one var inside the if conditions to assign appropriate value. Also, the value for the field expected_values['invalid']['bridge'] is stored in inv_br_str . We can use the variables in which the values are assigned after the if else and assign it for once instead of repeating the same separately in the if and else conditions.
For ex:
if options.virt == "Xen" or options.virt == "XenFV": libvirt_version = virsh_version(options.ip, options.virt) if libvirt_version <= "0.3.3": net_invalid_empty = "no network with matching name" inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ "could not be connected. Could not find bridge device " + \ "invalid')"
else: net_invalid_empty = "Network not found"
inv_br_str = "POST operation failed: xend_post: error from xen " + \ "daemon: (xend.err 'Device 0 (vif) could not be " + \ "connected. Could not find bridge device invalid')"
expected_values['empty']['network'] = expected_values['invalid']['network'] = net_invalid_empty expected_values['invalid']['bridge'] = inv_br_str
Oh yes! I got what you mean.. thanks for the clarification =) I'll make this change and resubmit. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Deepti B Kalakeri
-
Kaitlin Rupert