0 Replies Last post: May 13, 2008 3:23 AM by jim crumpler  
Click to view jim crumpler's profile Novice 3 posts since
Mar 11, 2008

May 13, 2008 3:23 AM

An unofficial Python API

 

Hi Folks.. I've written my own Python interface for the Data ONTAP API. Its not an official NetApp product (infact its far from it) and its not well tested, so it comes with the usual disclaimers, however it might be useful for others out there who prefer Python over other languages. This is its first venture beyond my primative test environment - so be careful.

 

 

That being said, I find it useful for building quick tools for automated provisioning, configuration management, auditing, design-rule compliance tests, lab builds, etc. The interface design is similar to the Java class model in the SDK.. Its completely independent of the SDK, but you'll still need documentation for the actual Data ONTAP API from the SDK.

 

 

Here's an example of a simple Python program using the API to print some system info.

 


 

#!/usr/bin/python from ontapi.NaServer import * from ontapi.NaElement import *

 

 

server = NaServer('filer1', 1, 6) server.setAdminUser('root', 'passwd')

 

 

cmd = NaElement('system-get-info') results = server.invokeElem(cmd)

 

 

for name, value in results.getChildByName('system-info').getChildrenFlattened().items():

 

print '%s=%s' % (name, value)
pass


 

Assuming I can work out how this communities interface work, a tar file should appear attached here somewhere..

 

 

Feedback welcome.

 

 

Jim Crumpler...

 

 

 

 

Attachments:

More Like This

  • Retrieving data ...