Kaitlin Rupert wrote:
Deepti B. Kalakeri wrote:
> # HG changeset patch
> # User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
> # Date 1224748128 25200
> # Node ID 2c77be4e041a0a8669d234d6219e1f207b6d4ed5
> # Parent 73be202634a52607d5ab54ca62a2706ec7aca23b
> [TEST] Adding new tc 02_enum_crscap.py to verify
> ConsoleRedirectionServiceCapabilities fields.
>
> Tested on KVM with current sources.
>
> Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
>
> +
> +sup_types = ['Xen', 'KVM', 'XenFV']
Needs LXC support.
> +@do_main(sup_types)
> +def main():
> + virt = main.options.virt
> + server = main.options.ip
> + cname = 'ConsoleRedirectionServiceCapabilities'
> + cap_name = 'ConsoleRedirectionCapabilities'
> + classname = get_typed_class(virt, cname)
> + try:
> + crs = EnumInstances(server, classname)
> + crs_val = crs[0]
Need to verify the length here before accessing the array.
> + if crs_val.InstanceID != cap_name:
> + logger.error("InstanceID Mismatch")
> + logger.error("Got '%s', Expected '%s'",
crs_val.InstanceID, +
> cap_name)
> + return FAIL
> +
> + if crs_val.ElementName != cap_name:
> + logger.error("ElementName Mismatch")
> + logger.error("Got '%s', Expected '%s'",
crs_val.ElementName, +
> cap_name)
> + return FAIL
> + + mode_supp = crs_val.SharingModeSupported[0]
> + if mode_supp != 3:
Can you declare the 3 as a variable (in all caps) at the start of the
test. Makes it a little clear that 3 is a CIM defined value. Also, if
this changes later on, it's easier to update the test.
> + logger.error("SharingModeSupported Mismatch")
> + logger.error("Got '%s', Expected '%s'", mode_supp, 3)
Instead of using 3 here, can you use the variable suggested above?
Patch with modification submitted.
Thanks for the review.
Regards,
Deepti.