Python Bindings Update

The python bindings are still very basic and cover just a few of the client features of openwsman, however, with just the limited functionality a lot can be done as can be seen in the newly checked in python code with CIM bindings.

The code can be found in subversion under the new sub-project pywsman. This is basically a simple wrapper around the bindings that full expose CIM data in a pythonic way. Code as simple as the following snippet yields useful data that can be reused in any python application:

  1. from OWsman import *
  2. from CIM import *
  3.  
  4.  
  5. cl = OpenWSMan.Client("192.168.1.4", 8889, "/wsman", "http", "wsman", "secret")
  6. cs = CIM_ComputerSystem(cl)
  7. instances = cs.Enumerate()
  8. for instance in instances:
  9. instance.dump()
The result:
  1. # python test.py
  2.  
  3. Instance of http:/schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem {
  4. Caption: Computer System
  5. Description: A class derived from ComputerSystem that represents the single node container of the Linux OS.
  6. ElementName: miska.home.planux.com
  7. Name: miska.home.planux.com
  8. Status: NULL
  9. EnabledState: 2
  10. OtherEnabledState: NULL
  11. RequestedState: 2
  12. EnabledDefault: 2
  13. CreationClassName: Linux_ComputerSystem
  14. NameFormat: IP
  15. PrimaryOwnerName: root
  16. PrimaryOwnerContact: root@miska.home.planux.com
  17. Dedicated: [ 0,]
  18. }

The CIM classes are all auto-generated and although some of the code is still experimental, it can be used in very complex scenarios.

Download the code from subversion and install openwsman with python support to try it out. More functionalty is being added every day to support additional openwman features in the bindings.

How to auto-generate the CIM classes?

> The CIM classes are all auto-generated
Are you planning on publishing the tool(s) to auto-generate them or are they available already?

Thanks,
Jan Parthey