This case try add, modify, delete host bridge.
Signed-off-by: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
---
.../cimtest/HostNetwork/01_VESSMS_Bridge.py | 78 ++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
create mode 100644 suites/libvirt-cim/cimtest/HostNetwork/01_VESSMS_Bridge.py
diff --git a/suites/libvirt-cim/cimtest/HostNetwork/01_VESSMS_Bridge.py
b/suites/libvirt-cim/cimtest/HostNetwork/01_VESSMS_Bridge.py
new file mode 100644
index 0000000..0d4dd11
--- /dev/null
+++ b/suites/libvirt-cim/cimtest/HostNetwork/01_VESSMS_Bridge.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+#
+# Copyright 2012 IBM Corp.
+#
+# Authors:
+# Wenchao Xia (Wayne) <xiawenc(a)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 a soft virtual switch system
+#
+#
+
+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)
+
+ #add the bridge
+ inst = {'VirtualSystemIdentifier':host_network.bridge_name, 'Name':
host_network.bridge_name, 'STP': host_network.bridge_stp, 'Delay':
host_network.bridge_delay, 'DHCP': host_network.bridge_dhcp, 'AutoStart':
host_network.bridge_autostart}
+
+ ret = host_network.try_create_vs(cim, sys_mgmt_service, inst)
+ if ret != 1:
+ logger.error("Failed to add cim bridge")
+ return FAIL
+
+ inst["STP"] = host_network.bridge_stp_modify
+ ret = host_network.try_modify_vs(cim, sys_mgmt_service, inst)
+ if ret != 1:
+ logger.error("Failed to modify cim bridge")
+ return FAIL
+
+ ret = host_network.try_delete_vs(cim, sys_mgmt_service, inst)
+ if ret != 1:
+ logger.error("Failed to delete cim bridge")
+ return FAIL
+ return PASS
+
+# main()
+
+if __name__ == "__main__":
+ ret = main()
+ sys.exit(ret)
--
1.7.1
Show replies by date