[PATCH 0 of 3] [TEST] IPv6 test case.

# HG changeset patch # User Sharad Mishra <snmishra@us.ibm.com> # Date 1259886908 28800 # Node ID 9d767d98ffbf90aaf06f714581f210d17cfca9cb # Parent 45c6da8ca664a61a727b0c0d1811c4337efb53b0 [TEST] (#2) Changes to vxml for IPv6 Support #2: Name changes, ipv6 to ipv6_flag and IsIPv6Only to is_ipv6_only Signed-off-by: Sharad Mishra <snmishra@us.ibm.com> diff -r 45c6da8ca664 -r 9d767d98ffbf suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Dec 01 16:08:15 2009 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Dec 03 16:35:08 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=True, 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=True, 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=True, 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=True, 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 1259886916 28800 # Node ID be49d6153b0830a04c6e8f7184c847ff7f2ad684 # Parent 9d767d98ffbf90aaf06f714581f210d17cfca9cb [TEST] (#2) Changes to vsms for IPv6 testcase. #2: Name changes, ipv6 to ipv6_flag and IsIPv6Only to is_ipv6_only Signed-off-by: Sharad Mishra <snmishra@us.ibm.com> diff -r 9d767d98ffbf -r be49d6153b08 suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Dec 03 16:35:08 2009 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Dec 03 16:35:16 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,9 @@ if ip != None and lport != None: self.Address = '%s:%s' % (ip, lport) + if ipv6_flag != None: + self.is_ipv6_only = ipv6_flag + if keymap != None: self.KeyMap = keymap

# HG changeset patch # User Sharad Mishra <snmishra@us.ibm.com> # Date 1259886917 28800 # Node ID 233a91c19b857d1016d2df0ebd6c4526a3e4b89c # Parent be49d6153b0830a04c6e8f7184c847ff7f2ad684 [TEST] (#2) IPv6 Support test. This test checks support for IPv6 in libvirt-cim. #2: Changed ipv6 to ipv6_flag and IsIPv6Only to is_ipv6_only Signed-off-by: Sharad Mishra<snmishra@us.ibm.com> diff -r be49d6153b08 -r 233a91c19b85 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 Thu Dec 03 16:35:17 2009 -0800 @@ -0,0 +1,138 @@ +#!/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(): + print key + print value + 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) + print vsxml + # 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") + print "vnc is %s" % vnc + 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 + + print dev + 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) + + print dev + 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())
participants (1)
-
Sharad Mishra