예제 #1
0
파일: apitest.py 프로젝트: raykuan/docs
# 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) :

    if(timeout > 0) :
        s.set_timeout(timeout)
    
# 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):

    if (timeout > 0):
        s.set_timeout(timeout)