Software Development Kit (SDK) and API Discussions

No elements in API request - NetApp Manageability SDK 5.2.1R1 on RHEL 6 with Python 3.3.5

salalonde
2,795 Views

Hi,

I'm just getting started with the SDK on Python 3.3.  If I try to return anything from a filer using the SDK I get:

Failed:

No elements in API request

This happens, for example, with the sample system_mode.py (that I have modified very slightly):

# $ID$
#
# system_mode.py
# This sample code prints the mode of the Storage system
# (7-Mode or Cluster-Mode)
#
# Copyright (c) 2011 NetApp, Inc. All rights reserved.
# Specifications subject to change without notice.
#
#============================================================
import sys
sys.path.append("/usr/local/bin/netapp-sdk/lib/python/NetApp")
from NaServer import *


storage = 'myfiler'
user = 'root'
password = 'mypassword'

s = NaServer(storage, 5, 2)
s.set_admin_user(user, password)
output = s.invoke("system-get-version")

if(output.results_errno() != 0):
    r = output.results_reason()
    print("Failed: \n" + str(r))
else :
    clustered = output.child_get_string("is-clustered")
    if(clustered == "true"):
        print("The Storage System " + storage + " is in \"Cluster Mode\"\n")
    else :
        print("The Storage System " + storage + " is in \"7 Mode\"\n")

##############################################################

[user@myserver]$ ./system_mode.py

Failed:

No elements in API request

Are there steps I need to perform on the filer itself to get this to work?  If I change the password in my script I do get an authentication error, so this does seem to be going through, I'm just not getting anything back.

Any ideas?


Thanks,

Sam

1 REPLY 1

sens
2,795 Views

Hi Sam,

One problem that I can see with this script is in the line:

           s = NaServer(storage, 5, 2)

5, 2 -> represents the major_version, minor_version of the Data ONTAP API version.

So, if the ONTAP API version is 1.17, major_version = 1 and minor_version = 17.

For all the ONTAP API versions released so far, major_version is always 1 (whereas in your script it is 5).

minor_version can be anything equal or lower than the actual API minor_version of target ONTAP system.

i.e. if the ONTAP API version is 1.17, the minor_version used in the NaServer constructor can be 17 or lower.

Thus it is safe to use major_version = 1 and minor_version = 0, when you are not sure of the actual ONTAP API version.

[If you want to use vfiler tunneling on 7-Mode ONTAP system, minimum version would be 1.7 and if want to use vserver tunneling on a Clustered ONTAP system, safe version would be 1.15].

Thus I would request you to run the same script after modifying the NaServer constructor to:

             s = NaServer(storage, 1, 0)

One more point, you can use the tool ZEDI (ZExplore Development Interface) [zexplore.exe or zexplore.jar] to test if the connection to the target storage system is working fine. You can also generate Python code automatically for any given API using ZEDI.

Please feel free to get back to us if you need any assistance with this.

Regards,

Sen.

Public