
test case for 802.1.q virtual vlan child port on host Signed-off-by: Wayne Xia <xiawenc@linux.vnet.ibm.com> --- .../cimtest/HostNetwork/02_VESSMS_EASD_EA.py | 84 ++++++++++++++++++++ 1 files changed, 84 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..2963afc --- /dev/null +++ b/suites/libvirt-cim/cimtest/HostNetwork/02_VESSMS_EASD_EA.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python + +# +# Copyright 2011 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 + #global 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 FAIL + + inst = {'Parent': pNIC, 'VLanID':10, 'ReorderHdr':1, 'Ingress':"1:2 2:3", 'Egress':'2:4'} + 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['ReorderHdr'] = 0 + inst['Ingress'] = "0:1 1:2 2:3 3:4 4:5 5:6 6:7 7:0" + inst['Egress'] = "0:0 1:0 2:4 3:0 4:0 5:0 6:0 7:0" + 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.6