[PATCH 0 of 4] [TEST] ipv6 support test cases

# HG changeset patch # User Sharad Mishra <snmishra@us.ibm.com> # Date 1260230701 28800 # Node ID 97557bbd149ab83bf48ba597ec951db960f6aa7d # Parent 60eb89c3ac9db80ef89401c48a9711e59f12b4bc [TEST] (#3) Changes to vxml for IPv6 Support #2: Name changes, ipv6 to ipv6_flag and IsIPv6Only to is_ipv6_only #3: is_ipv6_only defaults to None. Signed-off-by: Sharad Mishra <snmishra@us.ibm.com> diff -r 60eb89c3ac9d -r 97557bbd149a suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Dec 01 15:08:50 2009 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Dec 07 16:05:01 2009 -0800 @@ -569,7 +569,7 @@ def __init__(self, virt, dom_name, uuid, pae, acpi, apic, disk_dev, disk_source, net_type, net_name, net_mac, vcpus, mem, mem_allocunits, emu_type, grstype, ip, - port_num, kmap, irstype, btype, vnc_passwd): + is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd): self.virt = virt self.domain_name = dom_name self.err_rc = None @@ -591,6 +591,7 @@ dom_name, emu_type) self.gasd = vsms.get_gasd_class(virt)(name=dom_name, res_sub_type=grstype, ip=ip, + ipv6_flag=is_ipv6_only, lport=port_num, keymap=kmap, vnc_passwd=vnc_passwd) self.masd = vsms.get_masd_class(virt)(megabytes=mem, @@ -813,7 +814,8 @@ disk=const.Xen_default_disk_dev, ntype=const.default_net_type, net_name=const.default_network_name, - emu_type=None, grstype="vnc", address="127.0.0.1", + emu_type=None, grstype="vnc", address=None, + is_ipv6_only=None, port_num='-1', keymap="en-us", irstype="mouse", btype="xen", vnc_passwd=None): if not (os.path.exists(const.Xen_kernel_path) \ @@ -828,7 +830,8 @@ VirtCIM.__init__(self, 'Xen', test_dom, uuid, pae, acpi, apic, disk, disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, emu_type, grstype, address, - port_num, keymap, irstype, btype, vnc_passwd) + is_ipv6_only, port_num, keymap, irstype, btype, + vnc_passwd) def _os(self, os_kernel, os_initrd): os = self.get_node('/domain/os') @@ -882,7 +885,8 @@ disk=const.KVM_default_disk_dev, ntype=const.default_net_type, net_name=const.default_network_name, - emu_type=None, grstype="vnc", address="127.0.0.1", + emu_type=None, grstype="vnc", address=None, + is_ipv6_only=None, port_num='-1', keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None): if not os.path.exists(disk_file_path): @@ -892,7 +896,8 @@ VirtCIM.__init__(self, 'KVM', test_dom, uuid, pae, acpi, apic, disk, disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, emu_type, grstype, address, - port_num, keymap, irstype, btype, vnc_passwd) + is_ipv6_only, port_num, keymap, irstype, btype, + vnc_passwd) self._os() self._devices(const.KVM_default_emulator, ntype, disk_file_path, disk, mac, net_name) @@ -942,7 +947,8 @@ ntype=const.default_net_type, net_name=const.default_network_name, emu_type=None, grstype="vnc", - address="127.0.0.1", port_num='-1', keymap="en-us", + address=None, is_ipv6_only=None, port_num='-1', + keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None): if not os.path.exists(disk_file_path): logger.error('Error: Disk image does not exist') @@ -950,7 +956,8 @@ VirtXML.__init__(self, 'xenfv', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'XenFV', test_dom, disk, uuid, pae, acpi, apic, disk_file_path, ntype, net_name, mac, vcpus, mem, - mem_allocunits, emu_type, grstype, address, port_num, + mem_allocunits, emu_type, grstype, address, + is_ipv6_only, port_num, keymap, irstype, btype, vnc_passwd) self._os(const.XenFV_default_loader) self._devices(const.XenFV_default_emulator, @@ -993,13 +1000,15 @@ ntype=const.default_net_type, net_name=const.default_network_name, tty=const.LXC_default_tty, grstype="vnc", - address="127.0.0.1", port_num='-1', keymap="en-us", + address=None, is_ipv6_only=None, port_num='-1', + keymap="en-us", irstype="mouse", btype="usb", vnc_passwd=None): VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'LXC', test_dom, uuid, const.LXC_default_mp, const.LXC_default_source, ntype, net_name, mac, vcpus, mem, const.default_mallocunits, None, grstype, - address, port_num, keymap, irstype, btype, vnc_passwd) + address, is_ipv6_only, port_num, keymap, irstype, + btype, vnc_passwd) self._os(const.LXC_init_path) self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty) self.create_lxc_file(CIM_IP, const.LXC_init_path)

# HG changeset patch # User Sharad Mishra <snmishra@us.ibm.com> # Date 1260230774 28800 # Node ID 47ff422b8de98ad8e60ce08eb2ef7c3218461eed # Parent 97557bbd149ab83bf48ba597ec951db960f6aa7d [TEST] (#4) Changes to vsms for IPv6 testcase. #2: Name changes, ipv6 to ipv6_flag and IsIPv6Only to is_ipv6_only #3: Changing is_ipv6_only to IsIPv6Only #4: set Address to None by default. Signed-off-by: Sharad Mishra <snmishra@us.ibm.com> diff -r 97557bbd149a -r 47ff422b8de9 suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Mon Dec 07 16:05:01 2009 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Mon Dec 07 16:06:14 2009 -0800 @@ -255,7 +255,7 @@ class CIM_GraphicsResourceAllocationSettingData(CIMClassMOF): - def __init__(self, name, res_sub_type="vnc", ip="127.0.0.1", + def __init__(self, name, res_sub_type="vnc", ip=None, ipv6_flag=None, lport='-1', keymap="en-us", vnc_passwd=None): self.InstanceID = '%s/graphics' %name self.ResourceType = RASD_TYPE_GRAPHICS @@ -266,6 +266,12 @@ if ip != None and lport != None: self.Address = '%s:%s' % (ip, lport) + else: + self.Address = None + + if ipv6_flag != None: + self.IsIPv6Only = ipv6_flag + if keymap != None: self.KeyMap = keymap

# HG changeset patch # User Sharad Mishra <snmishra@us.ibm.com> # Date 1260230830 28800 # Node ID d7c67e4d36807857c05eb0d536718b4e1dfd7e33 # Parent 47ff422b8de98ad8e60ce08eb2ef7c3218461eed [TEST] (#3) IPv6 Support test. This test checks support for IPv6 in libvirt-cim. #2: Changed ipv6 to ipv6_flag and IsIPv6Only to is_ipv6_only #3: Removed some debug print statements, that were accidently left in #2. Signed-off-by: Sharad Mishra<snmishra@us.ibm.com> diff -r 47ff422b8de9 -r d7c67e4d3680 suites/libvirt-cim/cimtest/KVMRedirectionSAP/02_ipv6_support.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/KVMRedirectionSAP/02_ipv6_support.py Mon Dec 07 16:07:10 2009 -0800 @@ -0,0 +1,132 @@ +#!/usr/bin/python +# +# Copyright 2009 IBM Corp. +# +# Authors: +# Sharad Mishra <snmishra@us.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# This test case is used to verify IPv6 support. It verifies that if an IP +# address is supplied, that address gets used for VNC. If an address is not +# supplied then the new is_ipv6_only flag is read. If the flag is set, then +# default ipv6 address is used. Else default ipv4 address gets used. +# This test case: +# +# Defines a guest in a loop with different settings of IP +# address and is_ipv6_only flag. +# +# Once the guest is defined, gets the instance of DisplayController +# and GRASD. +# Checks to make sure expected vnc address is set for both. +# +# Date : Nov. 11, 2009 +# + +import sys +from XenKvmLib.enumclass import GetInstance +from XenKvmLib.vxml import get_class +from XenKvmLib.classes import get_typed_class +from XenKvmLib.const import do_main, get_provider_version +from CimTest.Globals import logger +from CimTest.ReturnCodes import PASS, FAIL, SKIP + +sup_types = ['Xen', 'KVM', 'XenFV'] +libvirtcim_redSAP_changes = 1017 +test_dom = 'test_ipv6_dom' + +address_dict = {('127.0.0.1', None) : '127.0.0.1:-1', + ('[::1]', None) : '[::1]:-1', + ('127.0.0.1', True) : '127.0.0.1:-1', + ('[::1]', False) : '[::1]:-1', + ('127.0.0.1', False) : '127.0.0.1:-1', + ('[::1]', True) : '[::1]:-1', + (None, True) : '[::1]:-1', + (None, False) : '127.0.0.1:-1', + (None, None) : '127.0.0.1:-1' + } + +@do_main(sup_types) +def main(): + status = PASS + virt = main.options.virt + server = main.options.ip + + cname = 'KVMRedirectionSAP' + classname = get_typed_class(virt, cname) + + # This check is required for libvirt-cim providers which do not have + # REDSAP changes in it and the REDSAP provider is available with + # revision >= 1017. + curr_cim_rev, changeset = get_provider_version(virt, server) + if curr_cim_rev < libvirtcim_redSAP_changes: + logger.info("'%s' provider not supported, hence skipping the tc ....", + classname) + return SKIP + + vsxml = None + + try: + virt_xml = get_class(virt) + for key, value in address_dict.iteritems(): + add = key[0] + flg = key[1] + if add == None: + vsxml = virt_xml(test_dom, is_ipv6_only=flg) + else: + vsxml = virt_xml(test_dom, address=add, is_ipv6_only=flg) + # Define the VS + ret = vsxml.cim_define(server) + if not ret: + raise Exception("Failed to define the dom: %s" % test_dom) + + devid = "%s/%s" % (test_dom, 'graphics') + vnc = get_typed_class(virt, "DisplayController") + key_list = { 'DeviceID' : devid, + 'CreationClassName' : vnc, + 'SystemName' : test_dom, + 'SystemCreationClassName' : + get_typed_class(virt, "ComputerSystem") + } + dev = GetInstance(server, vnc, key_list) + vp = "vnc/%s" % value + + if vp != dev.VideoProcessor: + vsxml.undefine(server) + raise Exception("Unxpected VNC server address") + + vnc = get_typed_class(virt, "GraphicsResourceAllocationSettingData") + key_list = { 'InstanceID' : devid, + 'CreationClassName' : vnc, + 'SystemName' : test_dom, + 'SystemCreationClassName' : + get_typed_class(virt, "ComputerSystem") + } + dev = GetInstance(server, vnc, key_list) + + if value != dev.Address: + vsxml.undefine(server) + raise Exception("Unxpected VNC server address") + + vsxml.undefine(server) + + except Exception, detail: + logger.error("Exception: %s", detail) + status = FAIL + + return status + +if __name__ == "__main__": + sys.exit(main())

# HG changeset patch # User Sharad Mishra <snmishra@us.ibm.com> # Date 1260230884 28800 # Node ID ae7ffb52d6cd8649d202d859d279211e906e096b # Parent d7c67e4d36807857c05eb0d536718b4e1dfd7e33 [TEST] Update test to pass an ip address. Signed-off-by: Sharad Mishra<snmishra@us.ibm.com> diff -r d7c67e4d3680 -r ae7ffb52d6cd suites/libvirt-cim/cimtest/KVMRedirectionSAP/01_enum_KVMredSAP.py --- a/suites/libvirt-cim/cimtest/KVMRedirectionSAP/01_enum_KVMredSAP.py Mon Dec 07 16:07:10 2009 -0800 +++ b/suites/libvirt-cim/cimtest/KVMRedirectionSAP/01_enum_KVMredSAP.py Mon Dec 07 16:08:04 2009 -0800 @@ -106,7 +106,7 @@ try: virt_xml = get_class(virt) lport = randrange(5900, 5999) - vsxml = virt_xml(test_dom, port_num=str(lport)) + vsxml = virt_xml(test_dom, address='127.0.0.1', port_num=str(lport)) # Define the VS, and verify the KVMRedirectionSAP values. ret = vsxml.cim_define(server)
participants (1)
-
Sharad Mishra