Skip to content
Jack Garcia edited this page May 25, 2017 · 1 revision

It is assumed that a rest/redfish object has been created and a login session has been initiated as mentioned in Quick Start section.

Example 26: Get registry

The method ex26_get_registry takes an instance of rest object , iLO host/ip address, iLO login user name, iLO login password and registry prefix as arguments.

def ex26_get_registry(restobj, host, login_account, login_password,registry_prefix):

The collection method is a generator function that returns collection members. In this example, the collection uri passed as an argument to collection() method is '/rest/v1/Registries' and it yields the inline items if present else yields the member links for each schema in the systems collection at /rest/v1/Registries.

for status, headers, registryptr, memberuri in collection(restobj, host,
                                                         '/rest/v1/Registries', None,
                                                         login_account, login_password):

Expected schema file type is verified against version 0 and 1.

assert (get_type(registryptr) == 'SchemaFile.0' or get_type(registryptr) ==
       'SchemaFile.1')

For each registries in the collection find the link for the registry prefix that is requested. Please note that this is an extref rather than an href because the actual registries lie outside the data model.

if ('Schema' in registryptr and registryptr['Schema'].startswith(registry_prefix)):
    for location in registryptr['Location']:
        extref_uri = location['Uri']['extref']

Get the schema with the requested registry prefix through GET request.

status, headers, registry = rest_get(restobj, extref_uri, None)
if status == 200:
   print '\tFound ' + registry_prefix + ' at ' + extref_uri
   return extref_uri, registry
else:
   print '\t' + registry_prefix + ' not found at ' + extref_uri
   return None, None
Clone this wiki locally