[PATCH V2 3/4] cimtest - vlan extention - vlan 802.1.q

This case covers 802.1.q port allocation via EASD-EA. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> --- .../cimtest/HostNetwork/02_VESSMS_EASD_EA.py | 83 ++++++++++++++++++++ 1 files changed, 83 insertions(+), 0 deletions(-) create mode 100644 suites/libvirt-cim/cimtest/HostNetwork/02_VESSMS_EASD_EA.py diff --git a/suites/libvirt-cim/cimtest/HostNetwork/02_VESSMS_EASD_EA.py b/suites/libvirt-cim/cimtest/HostNetwork/02_VESSMS_EASD_EA.py new file mode 100644 index 0000000..964e0e0 --- /dev/null +++ b/suites/libvirt-cim/cimtest/HostNetwork/02_VESSMS_EASD_EA.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python + +# +# Copyright 2012 IBM Corp. +# +# Authors: +# Wenchao Xia (Wayne) <xiawenc@cn.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 +# + +# +# Create, Modify, Delete IEEE802.1.q child port +# +# + +import sys +import os +import pywbem + +from CimTest.ReturnCodes import PASS, FAIL, XFAIL, SKIP +from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS +from XenKvmLib.const import do_main +from XenKvmLib.classes import get_typed_class +from XenKvmLib.vxml import get_class +from XenKvmLib import host_network + +cim = None +sys_mgmt_service = None +supported = ['KVM',] + + +@do_main(supported) +def main(): + options = main.options + server = options.ip + server_url = "http://%s" % server + #get cim + cim = pywbem.WBEMConnection(server_url, (CIM_USER, CIM_PASS), CIM_NS) + + sys_mgmt_service = host_network.get_vessms(cim) + pNIC = host_network.FoundOnePNIC(cim) + if pNIC == None : + logger.error("Failed to find any pNIC on the host.") + return XFAIL + + inst = {'Parent': pNIC, 'VLanID':10, 'DHCP': 0, 'AutoStart': 0} + ret = host_network.try_add_ea(cim, sys_mgmt_service, inst) + if ret != 1: + logger.error("Failed to add 802.1.q ea") + return FAIL + + inst['DHCP'] = 1 + inst['AutoStart'] = 1 + ret = host_network.try_mod_ea(cim, sys_mgmt_service, inst) + if ret != 1: + logger.error("Failed to mod 802.1.q ea") + return FAIL + + ret = host_network.try_del_ea(cim, sys_mgmt_service, inst) + if ret != 1: + logger.error("Failed to remove 802.1.q ea") + return FAIL + + return PASS + +# main() + +if __name__ == "__main__": + ret = main() + sys.exit(ret) -- 1.7.1
participants (1)
-
Wenchao Xia