# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1213263349 25200
# Node ID bb5f359be87cb3883b45301c8c7a056278d453a0
# Parent dfb6d5b51653712ed15387b76e3ddf89098d92d2
[TEST] Updating the tc to use the rasd_init_list() fn of rasd.py.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r dfb6d5b51653 -r bb5f359be87c
suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py
--- a/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Thu Jun 12 02:33:29 2008
-0700
+++ b/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Thu Jun 12 02:35:49 2008
-0700
@@ -57,6 +57,9 @@
from XenKvmLib.const import CIM_REV
from CimTest.Globals import logger
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib import rasd
+from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
+verify_diskrasd_values, verify_memrasd_values, rasd_init_list
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -64,44 +67,18 @@
test_vcpus = 1
test_mem = 128
test_mac = "00:11:22:33:44:aa"
-prev = 531
-mrev = 529
-
-def init_list(xml, disk, virt="Xen"):
- """
- Creating the lists that will be used for comparisons.
- """
- procrasd = {
- "InstanceID" : '%s/%s' % (test_dom, "proc"),
- "ResourceType" : 3,
- "CreationClassName" : get_typed_class(virt, rasd.pasd_cn)}
- netrasd = {
- "InstanceID" : '%s/%s' % (test_dom,test_mac),
- "ResourceType" : 10 ,
- "ntype1" : "bridge",
- "ntype2" : "ethernet",
- "CreationClassName" : get_typed_class(virt, rasd.nasd_cn)}
- address = xml.xml_get_disk_source()
- diskrasd = {
- "InstanceID" : '%s/%s' % (test_dom, disk),
- "ResourceType" : 17,
- "Address" : address,
- "CreationClassName" : get_typed_class(virt, rasd.dasd_cn)}
- memrasd = {
- "InstanceID" : '%s/%s' % (test_dom, "mem"),
- "ResourceType" : 4,
- "AllocationUnits" : "KiloBytes",
- "VirtualQuantity" : (test_mem * 1024),
- "CreationClassName" : get_typed_class(virt, rasd.masd_cn)}
- if CIM_REV < prev:
- procrasd['InstanceID'] = '%s/0' % test_dom
- if CIM_REV < mrev:
- memrasd['AllocationUnits'] = 'MegaBytes'
-
- return procrasd, netrasd, diskrasd, memrasd
def assoc_values(assoc_info, xml, disk, virt="Xen"):
- procrasd, netrasd, diskrasd, memrasd = init_list(xml, disk, virt)
+ status, rasd_values = rasd_init_list(xml, virt, disk, test_dom,
+ test_mac, test_mem)
+ if status != PASS:
+ return status
+
+ procrasd = rasd_values['%s' %rasd.proc_cn]
+ netrasd = rasd_values['%s' %rasd.net_cn]
+ diskrasd = rasd_values['%s' %rasd.disk_cn]
+ memrasd = rasd_values['%s' %rasd.mem_cn]
+
if virt == 'LXC':
proc_status = 0
disk_status = 0
diff -r dfb6d5b51653 -r bb5f359be87c suites/libvirt-cim/cimtest/RASD/02_enum.py
--- a/suites/libvirt-cim/cimtest/RASD/02_enum.py Thu Jun 12 02:33:29 2008 -0700
+++ b/suites/libvirt-cim/cimtest/RASD/02_enum.py Thu Jun 12 02:35:49 2008 -0700
@@ -37,6 +37,10 @@
from XenKvmLib.const import CIM_REV
from CimTest.Globals import logger
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib import rasd
+from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
+verify_diskrasd_values, verify_memrasd_values, rasd_init_list
+
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -44,41 +48,6 @@
test_vcpus = 1
test_mem = 128
test_mac = "00:11:22:33:44:aa"
-prev = 531
-mrev = 529
-
-def init_list(virt):
- """
- Creating the lists that will be used for comparisons.
- """
- proc = {
- "InstanceID" : '%s/%s' % (test_dom, "proc"),
- "ResourceType" : 3,
- "CreationClassName" : get_typed_class(virt, rasd.pasd_cn)}
- net = {
- "InstanceID" : '%s/%s' % (test_dom,test_mac),
- "ResourceType" : 10 ,
- "ntype1" : "bridge",
- "ntype2" : "ethernet",
- "CreationClassName" : get_typed_class(virt, rasd.nasd_cn)}
- address = vsxml.xml_get_disk_source()
- disk = {
- "InstanceID" : '%s/%s' % (test_dom, test_disk),
- "ResourceType" : 17,
- "Address" : address,
- "CreationClassName" : get_typed_class(virt, rasd.dasd_cn)}
- mem = {
- "InstanceID" : '%s/%s' % (test_dom, "mem"),
- "ResourceType" : 4,
- "AllocationUnits" : "KiloBytes",
- "VirtualQuantity" : (test_mem * 1024),
- "CreationClassName" : get_typed_class(virt, rasd.masd_cn)}
- if CIM_REV < prev:
- proc['InstanceID'] = '%s/0' % test_dom
- if CIM_REV < mrev:
- mem['AllocationUnits'] = 'MegaBytes'
-
- return proc, net, disk, mem
def get_inst_from_list(server, classname, rasd_list, filter_name, exp_val):
status = PASS
@@ -125,7 +94,7 @@
for rasd_instance in rasd_values_info:
CCName = rasd_instance.classname
if rasd.pasd_cn in CCName :
- status = rasd.verify_procrasd_values(rasd_instance, procrasd,)
+ status = rasd.verify_procrasd_values(rasd_instance, procrasd)
elif rasd.nasd_cn in CCName :
status = rasd.verify_netrasd_values(rasd_instance, netrasd)
elif rasd.dasd_cn in CCName:
@@ -176,8 +145,15 @@
logger.error("Exception : %s", details)
return FAIL
- status = PASS
- procrasd, netrasd, diskrasd, memrasd = init_list(virt)
+ status, rasd_values_list = rasd_init_list(vsxml, virt, test_disk, test_dom,
+ test_mac, test_mem)
+ if status != PASS:
+ return status
+
+ procrasd = rasd_values_list['%s' %rasd.proc_cn]
+ netrasd = rasd_values_list['%s' %rasd.net_cn]
+ diskrasd = rasd_values_list['%s' %rasd.disk_cn]
+ memrasd = rasd_values_list['%s' %rasd.mem_cn]
# For each loop
# 1) Enumerate one RASD type
diff -r dfb6d5b51653 -r bb5f359be87c suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
--- a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Thu Jun 12 02:33:29 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Thu Jun 12 02:35:49 2008 -0700
@@ -51,8 +51,9 @@
from XenKvmLib import assoc
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
+from XenKvmLib import rasd
from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
-verify_diskrasd_values, verify_memrasd_values
+verify_diskrasd_values, verify_memrasd_values, rasd_init_list
from XenKvmLib.const import CIM_REV
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -87,44 +88,6 @@
logger.error("Exception : %s", details)
return FAIL, vsxml_info
return PASS, vsxml_info
-
-def init_list(virt):
- """
- Creating the lists that will be used for comparisons.
- """
- procrasd = {
- "InstanceID" : '%s/%s' %(test_dom, "proc"),
- "ResourceType" : 3,
- "CreationClassName": get_typed_class(virt,
'ProcResourceAllocationSettingData')
- }
- if CIM_REV < proc_rev:
- procrasd['InstanceID'] = '%s/%s' %(test_dom, "0")
-
- netrasd = {
- "InstanceID" : '%s/%s' %(test_dom,test_mac),
- "ResourceType" : 10 ,
- "ntype1": "bridge",
- "ntype2": "ethernet",
- "CreationClassName": get_typed_class(virt,
'NetResourceAllocationSettingData')
- }
-
- address = vsxml.xml_get_disk_source()
- diskrasd = {
- "InstanceID" : '%s/%s' %(test_dom, test_disk),
- "ResourceType" : 17,
- "Address" : address,
- "CreationClassName": get_typed_class(virt,
'DiskResourceAllocationSettingData')
- }
- memrasd = {
- "InstanceID" : '%s/%s' %(test_dom, "mem"),
- "ResourceType" : 4,
- "AllocationUnits" : "KiloBytes",
- "VirtualQuantity" : (test_mem * 1024),
- "CreationClassName": get_typed_class(virt,
'MemResourceAllocationSettingData')
- }
- if CIM_REV < mem_rev:
- memrasd['AllocationUnits'] = "MegaBytes"
- return procrasd, netrasd, diskrasd, memrasd
def get_inst_from_list(classname, vssd_list, filter_name, exp_val):
status = PASS
@@ -199,7 +162,16 @@
return status, vssdc_assoc_info
def verify_rasd_values(rasd_values_info):
- procrasd, netrasd, diskrasd, memrasd = init_list(virt)
+ status, rasd_values = rasd_init_list(vsxml, virt, test_disk, test_dom,
+ test_mac, test_mem)
+ if status != PASS:
+ return status
+
+ procrasd = rasd_values['%s' %rasd.proc_cn]
+ netrasd = rasd_values['%s' %rasd.net_cn]
+ diskrasd = rasd_values['%s' %rasd.disk_cn]
+ memrasd = rasd_values['%s' %rasd.mem_cn]
+
try:
for rasd_instance in rasd_values_info:
CCName = rasd_instance.classname