hpOneView.resources.facilities package

Submodules

hpOneView.resources.facilities.datacenters module

class hpOneView.resources.facilities.datacenters.Datacenters(con)[source]

Bases: object

Datacenters API client.

URI = u'/rest/datacenters'
add(information, timeout=-1)[source]

Adds a data center resource based upon the attributes specified.

Parameters:
  • information – Data center information
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Added data center.

Return type:

dict

get(id_or_uri)[source]

Gets a single data center resource based upon its ID or URI.

Parameters:id_or_uri – Can be either the data center id or the data center uri.
Returns:The data center.
Return type:dict
get_all(start=0, count=-1, filter=u'', query=u'', sort=u'')[source]

Gets a set of data center resources according to the specified parameters. Filters can be used to get a specific set of data centers.

Parameters:
  • start

    The first item to return, using 0-based indexing.

    If not specified, the default is 0 - start with the first available item.

  • count – The number of resources to return. A count of -1 requests all items. The actual number of items in the response might differ from the requested count if the sum of start and count exceeds the total number of items.
  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • query – A general query string to narrow the list of resources returned. The default is no query - all resources are returned.
  • sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
Returns:

List of data centers.

Return type:

list

get_by(field, value)[source]

Gets all data centers that match the filter.

The search is case-insensitive.

Parameters:
  • field – Field name to filter.
  • value – Value to filter.
Returns:

List of data centers.

Return type:

list

get_visual_content(id_or_uri)[source]

Gets a list of visual content objects describing each rack within the data center. The response aggregates data center and rack data with a specified metric (peak24HourTemp) to provide simplified access to display data for the data center.

Parameters:id_or_uri – Can be either the resource ID or the resource URI.
Returns:List of visual content objects.
Return type:list
remove(resource, force=False, timeout=-1)[source]

Deletes the resource specified.

Parameters:
  • resource (dict) – Object to remove.
  • force – If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The default is false.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.

Returns: Result status.

remove_all(filter, force=False, timeout=-1)[source]

Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set of resources to be deleted.

Parameters:
  • filter – A general filter/query string to narrow the list of items that will be removed.
  • force – If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The default is false.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

operation success

Return type:

bool

update(resource, timeout=-1)[source]

Updates the specified data center resource.

Parameters:
  • resource (dict) – Object to update.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Updated data center.

Return type:

dict

hpOneView.resources.facilities.power_devices module

class hpOneView.resources.facilities.power_devices.PowerDevices(con)[source]

Bases: object

Power Devices API client.

URI = u'/rest/power-devices'
add(information, timeout=-1)[source]

Adds a power delivery device resource based upon the attributes specified. Use this method to create a representation of power delivery devices that provide power to other resources but cannot otherwise be discovered by the management appliance.

Parameters:
  • information – power device information
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

added power device.

Return type:

dict

add_ipdu(information, timeout=-1)[source]

Add an HP iPDU and bring all components under management by discovery of its management module. Bring the management module under exclusive management by the appliance, configure any management or data collection settings, and create a private set of administrative credentials to enable ongoing communication and management of the iPDU. Use “force” to claim the device, even if claimed by another management appliance

Parameters:
  • resource – power device information
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

added power device.

Return type:

dict

get(id_or_uri)[source]

Gets a single power delivery device resource based upon its uri or id.

Parameters:id_or_uri – Can be either the power device id or the uri
Returns:The power device
Return type:dict
get_all(start=0, count=-1, filter=u'', query=u'', sort=u'')[source]

Gets a set of power delivery device resources according to the specified parameters. Filters can be used to get a specific set of power delivery devices. With no filters specified, the API returns a potentially paginated list of all the power delivery device resources subject to start/count/sort parameters.

Parameters:
  • start – The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item.
  • count – The number of resources to return. A count of -1 requests all items. The actual number of items in the response might differ from the requested count if the sum of start and count exceeds the total number of items.
  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • query – A general query string to narrow the list of resources returned. The default is no query - all resources are returned.
  • sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
Returns:

list of power devices

get_by(field, value)[source]

Gets all power devices that match the filter The search is case-insensitive

Parameters:
  • field – field name to filter
  • value – value to filter
Returns:

power devices

Return type:

dict

get_power_state(id_or_uri)[source]

Gets the power state (on, off or unknown) of the specified power delivery device that supports power control. The device must be an HP Intelligent Outlet.

Parameters:id_or_uri – Can be either the power device id or the uri
Returns:The power state
Return type:str
get_uid_state(id_or_uri)[source]

Retrieves the unit identification (UID) state (on, off, unknown) of the specified power outlet or extension bar resource. The device must be an HP iPDU component with a locator light (HP Intelligent Load Segment, HP AC Module, HP Intelligent Outlet Bar, or HP Intelligent Outlet).

Parameters:id_or_uri – Can be either the power device id or the uri
Returns:unit identification (UID) state
Return type:str
get_utilization(id_or_uri, fields=None, filter=None, refresh=False, view=None)[source]

Retrieves historical utilization data for the specified metrics and time span. The device must be a component of an HPE iPDU.

Parameters:
  • id_or_uri – The power device id or the resource uri
  • fields

    Name of the metric(s) to be retrieved in the format METRIC[,METRIC]…If unspecified, all metrics supported are returned. Power delivery devices support the following utilization metrics:

    • AveragePower
      Average power consumption in Watts during this sample interval.
    • PeakPower
      Peak power consumption in Watts during this sample interval.
  • filter (list or str) –

    Filters should be in the format: FILTER_NAME=VALUE[,FILTER_NAME=VALUE]…

    For Example: ‘startDate=2016-05-30T11:20:44.541Z,endDate=2016-05-30T19:20:44.541Z’

    startDate:
    Start date of requested starting time range in ISO 8601 format. If omitted, the startDate is determined by the endDate minus 24 hours.
    endDate:
    End date of requested starting time range in ISO 8601 format. When omitted the endDate includes the latest data sample available.

    If an excessive number of samples would otherwise be returned, the results will be segmented. The caller is responsible for comparing the returned sliceStartTime with the requested startTime in the response. If the sliceStartTime is greater than the oldestSampleTime and the requested start time, the caller is responsible for repeating the request with endTime set to sliceStartTime to obtain the next segment. This process is repeated until the full data set is retrieved.

    If the resource has no data, the UtilizationData is still returned, but will contain no samples and sliceStartTime/sliceEndTime will be equal. oldestSampleTime/newestSampleTime will still be set appropriately (null if no data is available). If the filter does not happen to overlap the data that a resource does have, then the metric history service will return null sample values for any missing samples.

  • refresh – Specifies that if necessary, an additional request will be queued to obtain the most recent utilization data from the enclosure. The response will not include any refreshed data. To track the availability of the newly collected data, monitor the TaskResource identified by the refreshTaskUri property in the response. If null, no refresh was queued.
  • view

    Specifies the resolution interval length of the samples to be retrieved. This is reflected in the resolution in the returned response. Utilization data is automatically purged to stay within storage space constraints. Supported views are listed below:

    native (DEFAULT)
    Resolution of the samples returned will be one sample for each 5-minute time period. This is the default view and matches the resolution of the data returned by the enclosure. Samples at this resolution are retained up to one year.
    hour
    Resolution of the samples returned will be one sample for each 60-minute time period. Samples are calculated by averaging the available 5-minute data samples that occurred within the hour, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the hour. Samples at this resolution are retained up to three years.
    day
    Resolution of the samples returned will be one sample for each 24-hour time period. One day is a 24-hour period that starts at midnight GMT regardless of the time zone in which the appliance or client is located. Samples are calculated by averaging the available 5-minute data samples that occurred during the day, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the day. Samples at this resolution are retained up to three years.
Returns:

Utilization data

Return type:

dict

remove(resource, force=False, timeout=-1)[source]

Deletes the set of power-devices according to the specified parameters. A filter is required to identify the set of resources to be deleted.

Parameters:
  • resource – dict object to remove
  • force – If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The default is false.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

operation success

Return type:

bool

remove_synchronous(resource, force=False, timeout=-1)[source]

Deletes the resource specified by {id} synchronously.

Parameters:
  • resource – dict object to remove
  • force – If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The default is false.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

operation success

Return type:

bool

update(resource, timeout=-1)[source]

Updates the resource for the specified {id}. The properties that are omitted (not included as part of the the request body) are reset to their respective default values. The id and uuid properties are required and cannot be changed.

Parameters:
  • resource (dict) – Object to update
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Updated power device

Return type:

dict

update_power_state(id_or_uri, power_state)[source]

Sets the power state of the specified power delivery device. The device must be an HP Intelligent Outlet.

Parameters:
  • id_or_uri – Can be either the power device id or the uri
  • power_state – {“powerState”:”On|Off”}
Returns:

The power state

Return type:

str

update_refresh_state(id_or_uri, refresh_state_data)[source]

Refreshes a given intelligent power delivery device.

Parameters:
  • id_or_uri – Can be either the power device id or the uri
  • refresh_state_data – Power device refresh request
Returns:

The power state

Return type:

str

update_uid_state(id_or_uri, refresh_state_data)[source]

Sets the unit identification (UID) light state of the specified power delivery device. The device must be an HP iPDU component with a locator light (HP Intelligent Load Segment, HP AC Module, HP Intelligent Outlet Bar, or HP Intelligent Outlet)

Parameters:
  • id_or_uri – Can be either the power device id or the uri
  • refresh_state_data – Power device refresh request
Returns:

The UID state

Return type:

str

hpOneView.resources.facilities.racks module

class hpOneView.resources.facilities.racks.Racks(con)[source]

Bases: object

Racks API client.

URI = u'/rest/racks'
add(information, timeout=-1)[source]

Adds a rack resource based upon the attributes specified. All attributes without default values must be specified in the POST body. The response contains the rack resource as added to the appliance with default and assigned properties expanded. The id and uri are assigned by the management appliance and are used to uniquely identify this particular resource.

Parameters:
  • information – Rack information
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Added rack.

Return type:

dict

get(id_or_uri)[source]

Gets a rack with the specified ID or URI.

Parameters:id_or_uri – Can be either the rack id or the rack uri.
Returns:The rack.
Return type:dict
get_all(start=0, count=-1, filter=u'', query=u'', sort=u'')[source]

Gets a set of rack resources according to the specified parameters. Filters can be used to get a specific set of racks. With no filters specified, the API returns a potentially paginated list of all the racks subject to start/count/sort parameters.

Parameters:
  • start

    The first item to return, using 0-based indexing.

    If not specified, the default is 0 - start with the first available item.

  • count – The number of resources to return. A count of -1 requests all items. The actual number of items in the response might differ from the requested count if the sum of start and count exceeds the total number of items.
  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • query – A general query string to narrow the list of resources returned. The default is no query - all resources are returned.
  • sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
Returns:

List of racks.

Return type:

list

get_by(field, value)[source]

Gets all racks that match the filter.

The search is case-insensitive.

Parameters:
  • field – Field name to filter.
  • value – Value to filter.
Returns:

List of racks.

Return type:

list

get_device_topology(id_or_uri)[source]

Retrieves the topology information for the rack resource specified by ID or URI.

Parameters:id_or_uri – Can be either the resource ID or the resource URI.
Returns:Device topology.
Return type:dict
remove(resource, force=False, timeout=-1)[source]

Removes the specified rack.

Parameters:
  • resource (dict) – Object to remove.
  • force – If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The default is false.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.

Returns: Result status.

update(resource, timeout=-1)[source]

Updates the specified rack resource. The properties that are omitted (not included as part of the request body) are reset to their respective default values. The id and uuid properties are required and cannot be changed. To update existing racks first perform a get() request to retrieve the current properties, update the desired properties, and then update() the request body containing the new representation of the resource.

Parameters:
  • resource (dict) – Object to update.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Updated rack.

Return type:

dict

Module contents