[PATCH 0 of 3] [TEST] Add new tc to verify SAE association with CRS

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1242128012 25200 # Node ID bbea7924536083ce35de6ec8b680a7e873591d82 # Parent 92caf252c2fa8c8a7a9b70548d12b03c52f3935c [TEST] Adding InputRASD to vsms.py. Tested on F10 with KVM and current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r 92caf252c2fa -r bbea79245360 suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Mon May 04 03:49:32 2009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Tue May 12 04:33:32 2009 -0700 @@ -34,6 +34,7 @@ RASD_TYPE_NET_OTHER = 11 RASD_TYPE_DISK = 17 RASD_TYPE_GRAPHICS = 24 +RASD_TYPE_INPUT = 13 VSSD_RECOVERY_NONE = 2 VSSD_RECOVERY_RESTART = 3 @@ -266,6 +267,32 @@ def get_gasd_class(virt): pass +class CIM_InputResourceAllocationSettingData(CIMClassMOF): + def __init__(self, name, res_sub_type=None, bus_type=None): + self.InstanceID = '%s' % name + self.ResourceType = RASD_TYPE_INPUT + + if res_sub_type != None: + self.ResourceSubType = res_sub_type + self.InstanceID += '/%s' % res_sub_type + + if bus_type != None: + self.BusType = bus_type + self.InstanceID += ':%s' % bus_type + +class Xen_InputResourceAllocationSettingData(CIM_InputResourceAllocationSettingData): + pass + +class KVM_InputResourceAllocationSettingData(CIM_InputResourceAllocationSettingData): + pass + +class LXC_InputResourceAllocationSettingData(CIM_InputResourceAllocationSettingData): + pass + +@eval_cls('InputResourceAllocationSettingData') +def get_iasd_class(virt): + pass + def default_vssd_rasd_str(dom_name='test_domain', disk_dev='xvda', disk_source=const.Xen_disk_path,

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1242128081 25200 # Node ID d9658db27f664f2058966a0ace1e158cae4a58b6 # Parent bbea7924536083ce35de6ec8b680a7e873591d82 [TEST] Adding InputRASD to cim_define of vxml.py. Tested on F10 with KVM and current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r bbea79245360 -r d9658db27f66 suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue May 12 04:33:32 2009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue May 12 04:34:41 2009 -0700 @@ -52,6 +52,7 @@ from XenKvmLib.const import get_provider_version vsms_graphics_sup = 763 +vsms_inputdev_sup = 771 class XMLClass: xml_string = "" @@ -502,7 +503,7 @@ def __init__(self, virt, dom_name, disk_dev, disk_source, net_type, net_name, net_mac, vcpus, mem, mem_allocunits, emu_type, grstype, ip, - port_num, kmap): + port_num, kmap, irstype, btype): self.virt = virt self.domain_name = dom_name self.err_rc = None @@ -526,7 +527,9 @@ self.gasd = vsms.get_gasd_class(virt)(name=dom_name, res_sub_type=grstype, ip=ip, lport=port_num, keymap=kmap) - + self.iasd = vsms.get_iasd_class(virt)(name=dom_name, + res_sub_type=irstype, + bus_type=btype) def cim_define(self, ip, ref_conf=None): service = vsms.get_vsms_class(self.virt)(ip) sys_settings = str(self.vssd) @@ -549,6 +552,10 @@ if self.gasd is not None: res_settings.append(str(self.gasd)) + if curr_cim_rev >= vsms_inputdev_sup: + if self.iasd is not None: + res_settings.append(str(self.iasd)) + if ref_conf is None: ref_conf = ' ' @@ -733,7 +740,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"): + port_num='-1', keymap="en-us", irstype="mouse", + btype="xen"): if not (os.path.exists(const.Xen_kernel_path) \ and os.path.exists(const.Xen_init_path)): logger.error('ERROR: Either the kernel image ' @@ -745,7 +753,8 @@ VirtCIM.__init__(self, 'Xen', test_dom, disk, disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, - emu_type, grstype, address, port_num, keymap) + emu_type, grstype, address, port_num, keymap, irstype, + btype) def _os(self, os_kernel, os_initrd): os = self.get_node('/domain/os') @@ -796,7 +805,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"): + port_num='-1', keymap="en-us", irstype="mouse", + btype="ps2"): if not os.path.exists(disk_file_path): logger.error('Error: Disk image does not exist') sys.exit(1) @@ -804,7 +814,7 @@ VirtCIM.__init__(self, 'KVM', test_dom, disk, disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, emu_type, grstype, address, - port_num, keymap) + port_num, keymap, irstype, btype) self._os() self._devices(const.KVM_default_emulator, ntype, disk_file_path, disk, mac, net_name) @@ -850,14 +860,16 @@ 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="127.0.0.1", port_num='-1', keymap="en-us", + irstype="mouse", btype="usb"): if not os.path.exists(disk_file_path): logger.error('Error: Disk image does not exist') sys.exit(1) VirtXML.__init__(self, 'xenfv', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'XenFV', test_dom, disk, disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, - emu_type, grstype, address, port_num, keymap) + emu_type, grstype, address, port_num, keymap, + irstype, btype) self._features() self._os(const.XenFV_default_loader) self._devices(const.XenFV_default_emulator, @@ -905,12 +917,13 @@ 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="127.0.0.1", port_num='-1', keymap="en-us", + irstype="mouse", btype="usb"): VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'LXC', test_dom, const.LXC_default_mp, const.LXC_default_source, ntype, net_name, mac, vcpus, mem, const.default_mallocunits, None, grstype, - address, port_num, keymap) + address, port_num, keymap, irstype, btype) self._os(const.LXC_init_path) self._devices(mac, ntype, net_name, const.LXC_default_tty) self.create_lxc_file(CIM_IP, const.LXC_init_path)

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1242128319 25200 # Node ID 2d9e512a8116eb52eba4267617bb5b6eac1fc224 # Parent d9658db27f664f2058966a0ace1e158cae4a58b6 [TEST] Adding new tc to verify the SAE Association with CRS. Tested on F10 with KVM and current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r d9658db27f66 -r 2d9e512a8116 suites/libvirt-cim/cimtest/ServiceAffectsElement/01_forward.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/ServiceAffectsElement/01_forward.py Tue May 12 04:38:39 2009 -0700 @@ -0,0 +1,190 @@ +#!/usr/bin/python +# +# Copyright 2009 IBM Corp. +# +# Authors: +# Deepti B. Kalakeri <dkalaker@in.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 the SAE association with the CRS providers. +# The SAE association when queried with the CRS should give the details of the +# Source from which the +# 1) Console Flow can be started represented by the ComputerSystem class +# 2) Original Poiniting Device associated with the guest +# 3) Original Graphics Device associated with the guest +# +# Ex: Command and some of the fields that are verified are given below. +# Command +# ------- +# wbemcli ain -ac KVM_ServiceAffectsElement 'http://root:passwd@localhost +# /root/virt:KVM_ConsoleRedirectionService.CreationClassName=\ +# "KVM_ConsoleRedirectionService", Name="ConsoleRedirectionService", +# SystemCreationClassName="KVM_HostSystem",SystemName="host"' +# +# Output +# ------ +# host/root/virt:KVM_ComputerSystem.CreationClassName="KVM_ComputerSystem", +# Name="demo2" +# host/root/virt:KVM_PointingDevice.CreationClassName="KVM_PointingDevice", +# DeviceID="demo2/mouse:ps2", SystemCreationClassName="KVM_ComputerSystem", +# SystemName="demo2" +# host/root/virt:KVM_DisplayController.CreationClassName=\ +# "KVM_DisplayController",DeviceID="demo2/graphics", +# SystemCreationClassName="KVM_ComputerSystem",SystemName="demo2" +# Date : 12-05-2009 + + +import sys +from sets import Set +from XenKvmLib import assoc +from XenKvmLib import vxml +from CimTest.Globals import logger +from XenKvmLib.classes import get_typed_class +from XenKvmLib.enumclass import EnumInstances +from XenKvmLib.common_util import parse_instance_id +from XenKvmLib.const import do_main, get_provider_version +from CimTest.ReturnCodes import FAIL, PASS + +sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] +sae_assoc_with_input_graphics_rev = 795 + +test_dom = "SAE_dom" + +def get_dom_records(an_cn, assoc_ei_info, assoc_ei_insts): + + for assoc_ei_item in assoc_ei_info: + rec = None + CCN = assoc_ei_item['CreationClassName'] + if 'DisplayController' in CCN or 'PointingDevice' in CCN : + guest, dev, status = parse_instance_id(assoc_ei_item['DeviceID']) + if status != PASS: + logger.error("Unable to parse DeviceID") + return assoc_ei_insts, status + + if guest == test_dom: + rec = assoc_ei_item + elif 'ComputerSystem' in CCN: + if assoc_ei_item['Name'] == test_dom: + rec = assoc_ei_item + else: + logger.error("Unexpected CreationClassName %s returned by " \ + "%s association", CCN, an_cn) + return assoc_ei_insts, FAIL + + if not CCN in assoc_ei_insts.keys() and rec != None: + assoc_ei_insts[CCN]=rec + elif rec != None and (CCN in assoc_ei_insts.keys()): + logger.error("Got more than one record for '%s'", CCN) + return assoc_ei_insts, FAIL + + return assoc_ei_insts, PASS + + +def init_list_for_compare(server, virt): + c_list = [ 'ComputerSystem'] + curr_cim_rev, changeset = get_provider_version(virt, server) + if curr_cim_rev >= sae_assoc_with_input_graphics_rev: + c_list.append('PointingDevice' ) + c_list.append('DisplayController') + + init_list = {} + for name in c_list: + c_name = get_typed_class(virt, name) + ei_details = EnumInstances(server, c_name, ret_cim_inst=True) + init_list, status = get_dom_records(c_name, ei_details, init_list) + if status != PASS: + return init_list, FAIL + + return init_list, PASS + + +def verify_assoc(server, virt, an, assoc_info): + assoc_insts = {} + try: + assoc_insts, status = get_dom_records(an, assoc_info, assoc_insts) + if status != PASS or len(assoc_insts) != 3: + raise Exception("Failed to get insts for domain %s" % test_dom) + + in_list, status = init_list_for_compare(server, virt) + if status != PASS or len(in_list) != 3: + raise Exception("Failed to get init_list") + + in_list_keys = Set(in_list.keys()) + assoc_list_keys = Set(assoc_insts.keys()) + if len(in_list_keys & assoc_list_keys) != 3: + raise Exception("Mistmatching Class Names, expected %s, got %s" \ + % (in_list_keys, assoc_list_keys)) + + for cname, prop in in_list.iteritems(): + logger.info("Verifying Values for '%s'", cname) + exp_vals = in_list[cname].items() + res_vals = assoc_insts[cname].items() + for i in range(0, len(prop)): + if exp_vals[i][1] != res_vals[i][1]: + logger.error("'%s' val mismatch for '%s': " \ + "got '%s', expected '%s'", exp_vals[i][0], + cname, res_vals[i][1], exp_vals[i][1]) + return FAIL + + except Exception, details: + logger.error("Exception in fn verify_assoc()") + logger.error("Exception details: %s", details) + return FAIL + return PASS + +@do_main(sup_types) +def main(): + options = main.options + server = options.ip + virt = options.virt + status = FAIL + + virt_xml = vxml.get_class(virt) + cxml = virt_xml(test_dom) + ret = cxml.cim_define(server) + if not ret: + logger.error("Failed to define the dom: %s", test_dom) + return FAIL + + an = get_typed_class(virt, "ServiceAffectsElement") + + try: + cname = 'ConsoleRedirectionService' + classname = get_typed_class(virt, cname) + crs = EnumInstances(server, classname) + + if len(crs) != 1: + raise Exception("'%s' returned %i records, expected 1" \ + % (classname, len(crs))) + + crs_val = crs[0] + crs_cname = crs_val.CreationClassName + crs_sccn = crs_val.SystemCreationClassName + assoc_info = assoc.Associators(server, an, crs_cname, + CreationClassName=crs_cname, + Name=crs_val.Name, + SystemCreationClassName=crs_sccn, + SystemName=crs_val.SystemName) + status = verify_assoc(server, virt, an, assoc_info) + except Exception, detail : + logger.error("Exception : %s", detail) + status = FAIL + + cxml.undefine(server) + return status + +if __name__ == "__main__": + sys.exit(main())
participants (1)
-
Deepti B. Kalakeri