General Discussion

ZAPI+NMSDK works with OCUM details(ip/password/user)

neha_T
1,767 Views

when we communicate with array through ZAPI+ NMSDK  we use array credentials to login

 

if we have OCUM which has cluster added in it.. can we add OCUM ip/password as login credentails in ZAPI+NMSDK 

 

example:

 s = NaServer("<ip of array>", 1 , 32)

print "dir.. ",dir(s)

s.set_server_type("FILER")

s.set_transport_type("HTTPS")

s.set_port(443)

s.set_style("LOGIN")

s.set_admin_user("admin", "<password>")

s.set_vserver("SAN_IAFAS2552")

 

 

api = NaElement("lun-get-iter")

xi = NaElement("desired-attributes")

api.child_add(xi)

 

 

in s = NaServer("<ip of array>", 1 , 32)   in this can we use OCUM details?????

 

 

xi1 = NaElement("lun-info")

xi.child_add(xi1)

 

xi1.child_add_string("class","true")

xi1.child_add_string("online","true")

xi1.child_add_string("path","true")

xi1.child_add_string("serial-number","true")

xi1.child_add_string("volume","true")

xi1.child_add_string("key","true")

 

api.child_add_string("max-records","2")

 

xi2 = NaElement("query")

api.child_add(xi2)

 

 

xo = s.invoke_elem(api)

print "xo ",xo.sprintf()

1 REPLY 1

mbeattie
1,575 Views

Hi,

 

To close out this old thread yes you can connect to OCUM via ZAPI using Python. EG

 

import sys
sys.path.append("<path_to_nmsdk_root>/lib/python/NetApp")
from NaServer import *

s = NaServer("<ocum_server>", 1 , 0)
s.set_server_type("DFM")
s.set_transport_type("HTTPS")
s.set_port(443)
s.set_style("LOGIN")
s.set_admin_user("<username>", "<password>")

api = NaElement("lun-iter")
api.child_add_string("max-records","10")

xo = s.invoke_elem(api)
if (xo.results_status() == "failed") :
    print ("Error:\n")
    print (xo.sprintf())
    sys.exit (1)

print ("Received:\n")
print (xo.sprintf())

/Matt

 

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Public