Exemplo n.º 1
0
        sys.exit (2)

# Set the login and password used for authenticating when
# an ONTAPI API is invoked.
# When Host_equiv is  set,dont set username ,password

if(host_equiv != 1 and use_cba != 1):
    s.set_admin_user(user, password)


# Set the name of the vfiler on which the API
# commands need to be invoked.
#

if (dovfiler):
    s.set_vfiler(vfiler_name)

if (send_oid):
    s.set_originator_id(originator_id)

# Set the Type of API Server.
#
response = s.set_server_type(server_type)

if (response and response.results_errno() != 0) :
    r = response.results_reason()
    print ("Unable to set server transport" + r + "\n")
    sys.exit (2)

if(set_timeout == 1) :
Exemplo n.º 2
0
    else:
        print_usage()

else:
    vfiler  = opt
    filer = sys.argv[2]
    user = sys.argv[3]
    password = sys.argv[4] 
    arguments = sys.argv[5:]


# open server
server = NaServer(filer, 1, 7)

if(not server.set_vfiler(vfiler)):
    print ("Error: ONTAPI version must be at least 1.7 to send API to a vfiler\n")
    sys.exit (2)

server.set_admin_user(user, password)

if (dossl) :
    resp = server.set_transport_type("HTTPS")
    
    if (resp and resp.results_errno() != 0) :
        r = resp.results_reason()
        print ("Unable to set HTTPS transport " + r + "\n")
        sys.exit (2)

if(len(arguments) > 0):
    # invoke the api with api name and any supplied key-value pairs
        print("Unable to set HTTPS transport" + r + "\n")
        sys.exit(2)

# Set the login and password used for authenticating when
# an ONTAPI API is invoked.
# When Host_equiv is  set,dont set username ,password

if (host_equiv != 1 and use_cba != 1):
    s.set_admin_user(user, password)

# Set the name of the vfiler on which the API
# commands need to be invoked.
#

if (dovfiler):
    s.set_vfiler(vfiler_name)

if (send_oid):
    s.set_originator_id(originator_id)

# Set the Type of API Server.
#
response = s.set_server_type(server_type)

if (response and response.results_errno() != 0):
    r = response.results_reason()
    print("Unable to set server transport" + r + "\n")
    sys.exit(2)

if (set_timeout == 1):
    print "\n"
    return figures


#svms=['svm-dev-clones','svm-dev-01','svm-corp-01','svm-prod-01','svm-prod-02','svm-prod-ad','svm-stby-ad']
#svms=['svm-dev-clones']
svms = [sys.argv[2]]

for mysvm in svms:
    myfiler = 'cdotclusterurl'
    user = '******'
    password = '******'
    cmd = '/usr/local/src/lease_expire/netapp-manageability-sdk-5.3/src/sample/Data_ONTAP/Python/apitest.py'
    s = NaServer(myfiler, 1, 7)
    s.set_admin_user(user, password)
    s.set_vfiler(mysvm)
    x = NaElement('volume-get-iter')
    x.child_add(NaElement('query', 'is-sis-volume=False'))
    x.child_add_string('max-records', 10000)

    if 'stat' in sys.argv[1]:
        print "\n********* Current status of SVM '" + mysvm + "'\n"
        print_status(x)

    elif 'eff' in sys.argv[1]:
        print "\n********* Current status of SVM '" + mysvm + "'\n"
        figures = print_status(x)
        for key, value in figures.iteritems():
            if 'root' in key or 'true' in value:
                pass
            else: