HPE OneView

HP oneview python SDK

 
mzkhann
Occasional Contributor

HP oneview python SDK

How do I get scope attached to piece of server hardware.

 

I cannot tie them as there is  nothing common betweeen the scopes and the scopes assigned to a server hardwware.

I found scopesUri but they are very different between the two.

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

 

def usage():

    if len(sys.argv) < 2:

       print("You have specified too few arguments","Usage >>"+ sys.argv[0]+ " oneviewIP [sample 19.14.3.210]")

       print("FYI: This works on the basis of account readonly/readonly existing with the local domain of the appliance")

       sys.exit()

    try:

        socket.inet_aton(sys.argv[1])

    except socket.error:

       print("You have an invalid IP Parameter","Usage >>"+ sys.argv[0]+ " oneviewIP [sample 19.14.3.210]")

       sys.exit()

 

 

 

 

def parseandSetLoginParams():

    #This is config json sample with all the attribs

    #https://github.com/HewlettPackard/oneview-python/blob/master/examples/config-rename.json

    config = {

         "ip": sys.argv[1],

         "credentials": {

             "userName":"readonly",

             "password":"readonly",

             "authLoginDomain":"local"

         }

    }

    return config

 

 

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

#Create Session

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

def OneViewAttribs(lconfig):

    try:

        oneview_client = OneViewClient(lconfig)

    except HPOneViewException:

       print("ERROR:Cannot Connect  OV: >>"+ sys.argv[1]+ " oneviewIP [sample: 19.14.3.210]")

       sys.exit()

    return oneview_client

 

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

#Off of the oneView object return , ov_scopes, server_hardwares and the dict pf scope->resource 

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

def returnobjectree(object):

    oneview_client2=object

    server_hardwares = oneview_client2.server_hardware

    server_hardware_all = server_hardwares.get_all()

    print("seer_hardware_all ")

    pprint(server_hardware_all)

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

    # Get  scopes

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

    #Step A

    ov_scopes=oneview_client2.scopes

    retlistdict=ov_scopes.get_all()

    

    print ("retlistdict .ovscopes ---> ")

    pprint(retlistdict)

    return (retlistdict,server_hardware_all)

 

 

if __name__ == "__main__":

    usage()

    returnobjectree(OneViewAttribs(parseandSetLoginParams()))

 

 

1 REPLY 1
ChrisLynch
HPE Pro

Re: HP oneview python SDK

I would suggest you post this on the HPE OneView Python SDK issue tracker.


I am an HPE employee

Accept or Kudo