hpeOneView.resources package
Subpackages
- hpeOneView.resources.activity package
- hpeOneView.resources.data_services package
- hpeOneView.resources.facilities package
- Submodules
- hpeOneView.resources.facilities.datacenters module
- hpeOneView.resources.facilities.power_devices module
PowerDevices
PowerDevices.URI
PowerDevices.add()
PowerDevices.add_ipdu()
PowerDevices.get()
PowerDevices.get_all()
PowerDevices.get_by()
PowerDevices.get_power_state()
PowerDevices.get_uid_state()
PowerDevices.get_utilization()
PowerDevices.remove()
PowerDevices.remove_synchronous()
PowerDevices.update()
PowerDevices.update_power_state()
PowerDevices.update_refresh_state()
PowerDevices.update_uid_state()
- hpeOneView.resources.facilities.racks module
- Module contents
- hpeOneView.resources.fc_sans package
- hpeOneView.resources.hypervisors package
- hpeOneView.resources.networking package
- Submodules
- hpeOneView.resources.networking.connection_templates module
- hpeOneView.resources.networking.ethernet_networks module
EthernetNetworks
EthernetNetworks.BULK_DEFAULT_VALUES
EthernetNetworks.DEFAULT_VALUES
EthernetNetworks.URI
EthernetNetworks.create_bulk()
EthernetNetworks.delete_bulk()
EthernetNetworks.dissociate_values_or_ranges()
EthernetNetworks.get_associated_profiles()
EthernetNetworks.get_associated_uplink_groups()
EthernetNetworks.get_range()
- hpeOneView.resources.networking.fabrics module
- hpeOneView.resources.networking.fc_networks module
- hpeOneView.resources.networking.fcoe_networks module
- hpeOneView.resources.networking.interconnect_link_topologies module
- hpeOneView.resources.networking.interconnect_types module
- hpeOneView.resources.networking.interconnects module
Interconnects
Interconnects.URI
Interconnects.get_name_servers()
Interconnects.get_pluggable_module_information()
Interconnects.get_port()
Interconnects.get_ports()
Interconnects.get_statistics()
Interconnects.get_subport_statistics()
Interconnects.reset_port_protection()
Interconnects.update_configuration()
Interconnects.update_port()
Interconnects.update_ports()
- hpeOneView.resources.networking.internal_link_sets module
- hpeOneView.resources.networking.logical_downlinks module
- hpeOneView.resources.networking.logical_interconnect_groups module
- hpeOneView.resources.networking.logical_interconnects module
LogicalInterconnects
LogicalInterconnects.FIRMWARE_PATH
LogicalInterconnects.FORWARDING_INFORMATION_PATH
LogicalInterconnects.PORT_MONITOR_PATH
LogicalInterconnects.QOS_AGGREGATED_CONFIGURATION
LogicalInterconnects.SETTINGS_DEFAULT_VALUES
LogicalInterconnects.SETTINGS_ETHERNET_DEFAULT_VALUES
LogicalInterconnects.SETTINGS_TELEMETRY_CONFIG_DEFAULT_VALUES
LogicalInterconnects.SNMP_CONFIGURATION_PATH
LogicalInterconnects.URI
LogicalInterconnects.bulk_inconsistency_validate()
LogicalInterconnects.create()
LogicalInterconnects.create_forwarding_information_base()
LogicalInterconnects.delete()
LogicalInterconnects.get_all()
LogicalInterconnects.get_by_name()
LogicalInterconnects.get_ethernet_settings()
LogicalInterconnects.get_firmware()
LogicalInterconnects.get_forwarding_information_base()
LogicalInterconnects.get_igmp_settings()
LogicalInterconnects.get_internal_vlans()
LogicalInterconnects.get_port_monitor()
LogicalInterconnects.get_qos_aggregated_configuration()
LogicalInterconnects.get_snmp_configuration()
LogicalInterconnects.get_telemetry_configuration()
LogicalInterconnects.get_unassigned_ports()
LogicalInterconnects.get_unassigned_uplink_ports()
LogicalInterconnects.install_firmware()
LogicalInterconnects.update()
LogicalInterconnects.update_compliance()
LogicalInterconnects.update_configuration()
LogicalInterconnects.update_ethernet_settings()
LogicalInterconnects.update_igmp_settings()
LogicalInterconnects.update_internal_networks()
LogicalInterconnects.update_port_flap_settings()
LogicalInterconnects.update_port_monitor()
LogicalInterconnects.update_qos_aggregated_configuration()
LogicalInterconnects.update_settings()
LogicalInterconnects.update_snmp_configuration()
LogicalInterconnects.update_telemetry_configurations()
- hpeOneView.resources.networking.logical_switch_groups module
- hpeOneView.resources.networking.logical_switches module
- hpeOneView.resources.networking.network_sets module
- hpeOneView.resources.networking.sas_interconnect_types module
- hpeOneView.resources.networking.sas_interconnects module
- hpeOneView.resources.networking.sas_logical_interconnect_groups module
- hpeOneView.resources.networking.sas_logical_interconnects module
SasLogicalInterconnects
SasLogicalInterconnects.URI
SasLogicalInterconnects.create()
SasLogicalInterconnects.delete()
SasLogicalInterconnects.get_all()
SasLogicalInterconnects.get_firmware()
SasLogicalInterconnects.replace_drive_enclosure()
SasLogicalInterconnects.update()
SasLogicalInterconnects.update_compliance()
SasLogicalInterconnects.update_compliance_all()
SasLogicalInterconnects.update_configuration()
SasLogicalInterconnects.update_firmware()
- hpeOneView.resources.networking.switch_types module
- hpeOneView.resources.networking.switches module
- hpeOneView.resources.networking.uplink_sets module
- Module contents
- hpeOneView.resources.search package
- hpeOneView.resources.security package
- Submodules
- hpeOneView.resources.security.certificate_authority module
- hpeOneView.resources.security.certificate_rabbitmq module
- hpeOneView.resources.security.certificates_server module
- hpeOneView.resources.security.login_details module
- hpeOneView.resources.security.roles module
- hpeOneView.resources.security.users module
Users
Users.URI
Users.add_role_to_userName()
Users.change_password()
Users.create_multiple_user()
Users.delete_multiple_user()
Users.get_by_userName()
Users.get_role_associated_with_userName()
Users.get_user_by_role()
Users.query_filter()
Users.remove_role_from_username()
Users.update()
Users.update_role_to_userName()
Users.validate_full_name()
Users.validate_user_name()
- Module contents
- hpeOneView.resources.servers package
- Submodules
- hpeOneView.resources.servers.connections module
- hpeOneView.resources.servers.enclosure_groups module
- hpeOneView.resources.servers.enclosures module
Enclosures
Enclosures.URI
Enclosures.add()
Enclosures.generate_csr()
Enclosures.get_all()
Enclosures.get_by_hostname()
Enclosures.get_csr()
Enclosures.get_environmental_configuration()
Enclosures.get_sso()
Enclosures.import_certificate()
Enclosures.refresh_state()
Enclosures.remove()
Enclosures.update_configuration()
Enclosures.update_environmental_configuration()
- hpeOneView.resources.servers.id_pools module
- hpeOneView.resources.servers.id_pools_ipv4_ranges module
- hpeOneView.resources.servers.id_pools_ipv4_subnets module
- hpeOneView.resources.servers.id_pools_ranges module
- hpeOneView.resources.servers.logical_enclosures module
- hpeOneView.resources.servers.migratable_vc_domains module
- hpeOneView.resources.servers.rack_manager module
RackManager
RackManager.URI
RackManager.add()
RackManager.get_a_specific_resource()
RackManager.get_all_chassis()
RackManager.get_all_managers()
RackManager.get_all_partitions()
RackManager.get_associated_chassis()
RackManager.get_associated_managers()
RackManager.get_associated_partitions()
RackManager.get_environmental_configuration()
RackManager.get_remote_support_settings()
RackManager.remove()
- hpeOneView.resources.servers.server_hardware module
ServerHardware
ServerHardware.URI
ServerHardware.add()
ServerHardware.add_multiple_servers()
ServerHardware.check_firmware_compliance()
ServerHardware.get_all_firmwares()
ServerHardware.get_bios()
ServerHardware.get_environmental_configuration()
ServerHardware.get_firmware()
ServerHardware.get_ilo_sso_url()
ServerHardware.get_java_remote_console_url()
ServerHardware.get_local_storage()
ServerHardware.get_physical_server_hardware()
ServerHardware.get_remote_console_url()
ServerHardware.perform_firmware_update()
ServerHardware.refresh_state()
ServerHardware.remove()
ServerHardware.update_environmental_configuration()
ServerHardware.update_mp_firware_version()
ServerHardware.update_power_state()
ServerHardware.validate_server_hardware_for_firmware_update()
- hpeOneView.resources.servers.server_hardware_types module
- hpeOneView.resources.servers.server_profile_templates module
ServerProfileTemplate
ServerProfileTemplate.DEFAULT_VALUES
ServerProfileTemplate.TRANSFORMATION_PATH
ServerProfileTemplate.URI
ServerProfileTemplate.create()
ServerProfileTemplate.get_all()
ServerProfileTemplate.get_available_networks()
ServerProfileTemplate.get_new_profile()
ServerProfileTemplate.get_transformation()
ServerProfileTemplate.update()
- hpeOneView.resources.servers.server_profiles module
ServerProfiles
ServerProfiles.DEFAULT_VALUES
ServerProfiles.URI
ServerProfiles.create()
ServerProfiles.delete_all()
ServerProfiles.get_available_networks()
ServerProfiles.get_available_servers()
ServerProfiles.get_available_storage_system()
ServerProfiles.get_available_storage_systems()
ServerProfiles.get_available_targets()
ServerProfiles.get_compliance_preview()
ServerProfiles.get_messages()
ServerProfiles.get_new_profile_template()
ServerProfiles.get_profile_ports()
ServerProfiles.get_transformation()
ServerProfiles.update()
- Module contents
- hpeOneView.resources.settings package
- Submodules
- hpeOneView.resources.settings.appliance_configuration_timeconfig module
- hpeOneView.resources.settings.appliance_device_read_community module
- hpeOneView.resources.settings.appliance_device_snmp_v1_trap_destinations module
- hpeOneView.resources.settings.appliance_device_snmp_v3_trap_destinations module
- hpeOneView.resources.settings.appliance_device_snmp_v3_users module
- hpeOneView.resources.settings.appliance_health_status module
- hpeOneView.resources.settings.appliance_network_interfaces module
- hpeOneView.resources.settings.appliance_node_information module
- hpeOneView.resources.settings.appliance_proxy_configuration module
- hpeOneView.resources.settings.appliance_ssh_access module
- hpeOneView.resources.settings.appliance_time_and_locale_configuration module
- hpeOneView.resources.settings.backups module
- hpeOneView.resources.settings.firmware_bundles module
- hpeOneView.resources.settings.firmware_drivers module
- hpeOneView.resources.settings.ha_nodes module
- hpeOneView.resources.settings.licenses module
- hpeOneView.resources.settings.repositories module
- hpeOneView.resources.settings.restores module
- hpeOneView.resources.settings.scopes module
- hpeOneView.resources.settings.versions module
- Module contents
- hpeOneView.resources.storage package
- Submodules
- hpeOneView.resources.storage.drive_enclosures module
- hpeOneView.resources.storage.sas_logical_jbod_attachments module
- hpeOneView.resources.storage.sas_logical_jbods module
- hpeOneView.resources.storage.storage_pools module
- hpeOneView.resources.storage.storage_systems module
StorageSystems
StorageSystems.URI
StorageSystems.add()
StorageSystems.get_by_hostname()
StorageSystems.get_by_ip_hostname()
StorageSystems.get_host_types()
StorageSystems.get_managed_ports()
StorageSystems.get_reachable_ports()
StorageSystems.get_storage_pools()
StorageSystems.get_templates()
StorageSystems.remove()
- hpeOneView.resources.storage.storage_volume_attachments module
- hpeOneView.resources.storage.storage_volume_templates module
- hpeOneView.resources.storage.volumes module
VolumeSnapshots
Volumes
Volumes.URI
Volumes.add_from_existing()
Volumes.create_from_snapshot()
Volumes.create_snapshot()
Volumes.delete()
Volumes.get_attachable_volumes()
Volumes.get_extra_managed_storage_volume_paths()
Volumes.get_snapshot_by()
Volumes.get_snapshot_by_name()
Volumes.get_snapshot_by_uri()
Volumes.get_snapshots()
Volumes.repair()
- Module contents
- hpeOneView.resources.uncategorized package
Submodules
hpeOneView.resources.resource module
- class hpeOneView.resources.resource.EnsureResourceClient(method=None, update_data=False)[source]
Bases:
object
Decorator class to update the resource data.
- class hpeOneView.resources.resource.Resource(connection, data=None)[source]
Bases:
object
Base class for OneView resources.
- Parameters
connection – OneView connection object
data – Resource data
- DEFAULT_VALUES = {}
- UNIQUE_IDENTIFIERS = ['uri', 'name']
- URI = '/rest'
- create(data=None, uri=None, timeout=-1, custom_headers=None, force=False)[source]
Makes a POST request to create a resource when a request body is required.
- Parameters
data – Additional fields can be passed to create the resource.
uri – Resouce uri
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.
custom_headers – Allows set specific HTTP headers.
- Returns
Created resource.
- delete(**kwargs)
- ensure_resource_data(update_data=False)[source]
Retrieves data from OneView and updates resource object.
- Parameters
update_data – Flag to update resource data when it is required.
- get_all(start=0, count=-1, filter='', sort='')[source]
Gets all items according with the given arguments.
- 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 (default).
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.
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
A list of items matching the specified filter.
- Return type
list
- get_by(field, value)[source]
Get the resource by passing a field and its value.
Note
This function uses get_all passing a filter.The search is case-insensitive.
- Parameters
field – Field name to filter.
value – Value to filter.
- Returns
dict
- get_by_field(field, value)[source]
Retrieves a resource by its field.
- Parameters
field – Resource field name.
value – Resource field value.
- Returns
Resource object or None if resource does not exist.
- get_by_id(id)[source]
Retrieves a resource by its id.
- Parameters
id – id of Resource
- Returns
Resource object or None if resource does not exist.
- get_by_name(name)[source]
Retrieves a resource by its name.
- Parameters
name – Resource name.
- Returns
Resource object or None if resource does not exist.
- get_by_uri(uri)[source]
Retrieves a resource by its URI
- Parameters
uri – URI of the resource
- Returns
Resource object
- refresh(**kwargs)
- class hpeOneView.resources.resource.ResourceClient(con, uri)[source]
Bases:
object
This class implements common functions for HpOneView API rest
- build_query_uri(start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris='')[source]
Builds the URI given the parameters.
More than one request can be send to get the items, regardless the query parameter ‘count’, because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note
Single quote - “’” - inside a query parameter is not supported by OneView API.
- 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 (default).
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 single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
view – Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources).
fields – Name of the fields.
uri – A specific URI (optional)
scope_uris – An expression to restrict the resources returned according to the scopes to which they are assigned.
- Returns
The complete uri
- Return type
uri
- build_subresource_uri(resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path='')[source]
- create(resource, uri=None, timeout=-1, custom_headers=None, default_values={})[source]
Makes a POST request to create a resource when a request body is required.
- Parameters
resource – OneView resource dictionary.
uri – Can be either the resource ID or the resource URI.
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.
custom_headers – Allows set specific HTTP headers.
default_values –
Dictionary with default values grouped by OneView API version. This dictionary will be be merged with the resource dictionary only if the dictionary does not contain the keys. This argument is optional and the default value is an empty dictionary. Ex.:
- default_values = {
‘200’: {“type”: “logical-switch-group”}, ‘300’: {“type”: “logical-switch-groupV300”}
}
- Returns
Created resource.
- create_report(uri, timeout=-1)[source]
Creates a report and returns the output.
- Parameters
uri – URI
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.
- Return type
list
- create_with_zero_body(uri=None, timeout=-1, custom_headers=None)[source]
Makes a POST request to create a resource when no request body is required.
- Parameters
uri – Can be either the resource ID or the resource URI.
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.
custom_headers – Allows set specific HTTP headers.
- Returns
Created resource.
- delete_all(filter, force=False, timeout=-1)[source]
Deletes all resources from the appliance that match the provided filter.
- Parameters
filter – A general filter/query string to narrow the list of items deleted.
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
Indicates if the resources were successfully deleted.
- Return type
bool
- download(uri, file_path)[source]
Downloads the contents of the requested URI to a stream.
- Parameters
uri – URI
file_path – File path destination
- Returns
Indicates if the file was successfully downloaded.
- Return type
bool
- get(id_or_uri)[source]
- Parameters
id_or_uri – Can be either the resource ID or the resource URI.
- Returns
The requested resource.
- get_all(start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris='')[source]
Gets all items according with the given arguments.
- 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 (default).
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 single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
view – Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources).
fields – Name of the fields.
uri – A specific URI (optional)
scope_uris – An expression to restrict the resources returned according to the scopes to which they are assigned.
- Returns
A list of items matching the specified filter.
- Return type
list
- get_by(field, value, uri=None)[source]
This function uses get_all passing a filter.
The search is case-insensitive.
- Parameters
field – Field name to filter.
value – Value to filter.
uri – Resource uri.
- Returns
dict
- get_by_name(name)[source]
Retrieve a resource by its name.
- Parameters
name – Resource name.
- Returns
dict
- get_collection(id_or_uri, filter='')[source]
Retrieves a collection of resources.
Use this function when the ‘start’ and ‘count’ parameters are not allowed in the GET call. Otherwise, use get_all instead.
Optional filtering criteria may be specified.
- Parameters
id_or_uri – Can be either the resource ID or the resource URI.
filter (list or str) – General filter/query string.
- Returns
Collection of the requested resource.
- get_utilization(id_or_uri, fields=None, filter=None, refresh=False, view=None)[source]
Retrieves historical utilization data for the specified resource, metrics, and time span.
- Parameters
id_or_uri – Resource identification
fields – Name of the supported metric(s) to be retrieved in the format METRIC[,METRIC]… If unspecified, all metrics supported are returned.
filter (list or str) –
Filters should be in the format FILTER_NAME=VALUE[,FILTER_NAME=VALUE]… E.g.: ‘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 has, 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 iLO. 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
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 iLO. 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
dict
- patch(id_or_uri, operation, path, value, timeout=-1, custom_headers=None)[source]
Uses the PATCH to update a resource.
Only one operation can be performed in each PATCH call.
- Parameters
id_or_uri – Can be either the resource ID or the resource URI.
operation – Patch operation
path – Path
value – Value
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 resource.
- patch_request(id_or_uri, body, timeout=-1, custom_headers=None)[source]
Uses the PATCH to update a resource.
Only one operation can be performed in each PATCH call.
- Parameters
id_or_uri – Can be either the resource ID or the resource URI.
body – Patch request body
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 resource.
- update(resource, uri=None, force=False, timeout=-1, custom_headers=None, default_values={})[source]
Makes a PUT request to update a resource when a request body is required.
- Parameters
resource – OneView resource dictionary.
uri – Can be either the resource ID or the resource URI.
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.
custom_headers – Allows set specific HTTP headers.
default_values –
Dictionary with default values grouped by OneView API version. This dictionary will be be merged with the resource dictionary only if the dictionary does not contain the keys. This argument is optional and the default value is an empty dictionary. Ex.:
- default_values = {
‘200’: {“type”: “logical-switch-group”}, ‘300’: {“type”: “logical-switch-groupV300”}
}
- Returns
Updated resource.
- update_with_zero_body(uri, timeout=-1, custom_headers=None)[source]
Makes a PUT request to update a resource when no request body is required.
- Parameters
uri – Can be either the resource ID or the resource URI.
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.
custom_headers – Allows set specific HTTP headers.
- Returns
Updated resource.
- upload(file_path, uri=None, timeout=-1)[source]
Makes a multipart request.
- Parameters
file_path – File to upload.
uri – A specific URI (optional).
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
Response body.
- Return type
dict
- class hpeOneView.resources.resource.ResourceFileHandlerMixin[source]
Bases:
object
- download(uri, file_path)[source]
Downloads the contents of the requested URI to a stream.
- Parameters
uri – URI
file_path – File path destination
- Returns
Indicates if the file was successfully downloaded.
- Return type
bool
- upload(file_path, uri=None, timeout=-1)[source]
Makes a multipart request.
- Parameters
file_path – File to upload.
uri – A specific URI (optional).
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
Response body.
- Return type
dict
- class hpeOneView.resources.resource.ResourceHelper(base_uri, connection, task_monitor)[source]
Bases:
object
- add_new_fields(data_to_add)[source]
Update resource data with new fields.
- Parameters
data – resource data
data_to_update – dict of data to update resource data
- Returnes:
Returnes dict
- build_query_uri(uri=None, start=0, count=-1, filter='', query='', sort='', view='', fields='', scope_uris='', name_prefix='', category=[], childLimit=0, topCount=0)[source]
Builds the URI from given parameters.
More than one request can be send to get the items, regardless the query parameter ‘count’, because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note
Single quote - “’” - inside a query parameter is not supported by OneView API.
- 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 (default).
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 single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
view – Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources).
fields – Name of the fields.
uri – A specific URI (optional)
scope_uris – An expression to restrict the resources returned according to the scopes to which they are assigned.
name_prefix – Filters the resource returned by the given prefix.
- Returns
The complete uri
- Return type
uri
- build_subresource_uri(resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path='')[source]
Helps to build a URI with resource path and its sub resource path.
- Parameters
resoure_id_or_uri – ID/URI of the main resource.
subresource_id__or_uri – ID/URI of the sub resource.
subresource_path – Sub resource path to be added with the URI.
- Returns
Returns URI
- build_uri(id_or_uri)[source]
Helps to build the URI from resource id and validate the URI.
- Parameters
id_or_uri – ID/URI of the resource.
- Returns
Returns a valid resource URI
- create(data=None, uri=None, timeout=-1, custom_headers=None, force=False)[source]
Makes a POST request to create a resource when a request body is required.
- Parameters
data – Additional fields can be passed to create the resource.
uri – Resouce uri
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.
custom_headers – Allows set specific HTTP headers.
- Returns
Created resource.
- create_report(uri, timeout=-1)[source]
Creates a report and returns the output.
- Parameters
uri – URI
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.
- Return type
list
- delete(uri, force=False, timeout=-1, custom_headers=None)[source]
Deletes current resource.
- Parameters
force – Flag to delete the resource forcefully, default is False.
timeout – Timeout in seconds.
custom_headers – Allows to set custom http headers.
- delete_all(filter, force=False, timeout=-1)[source]
Deletes all resources from the appliance that match the provided filter.
- Parameters
filter – A general filter/query string to narrow the list of items deleted.
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
Indicates if the resources were successfully deleted.
- Return type
bool
- do_get(uri)[source]
Helps to make get requests
- Parameters
uri – URI of the resource
- Returns
Returns the resource data
- Return type
Returns
- do_post(uri, resource, timeout, custom_headers)[source]
Helps to make post requests.
- Parameters
uri – URI of the resource.
resource – Resource data to post.
timeout – Time out for the request in seconds.
cutom_headers – Allows to add custom http headers.
- Returns
Retunrs Task object.
- do_put(uri, resource, timeout, custom_headers)[source]
Helps to make put requests.
- Parameters
uri – URI of the resource
timeout – Time out for the request in seconds.
custom_headers – Allows to set custom http headers.
- Retuns:
Returns Task object
- do_requests_to_getall(uri, requested_count, custom_headers=None)[source]
Helps to make http request for get_all method.
Note
This method will be checking for the pagination URI in the response and make request to pagination URI to get all the resources.
- get_all(start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris='', custom_headers=None, name_prefix='', category=[], childLimit=0, topCount=0)[source]
Gets all items according with the given arguments.
- 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 (default).
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 single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
view – Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources).
fields – Name of the fields.
uri – A specific URI (optional)
scope_uris – An expression to restrict the resources returned according to the scopes to which they are assigned.
custom_headers – custom headers
- Returns
A list of items matching the specified filter.
- Return type
list
- get_collection(uri=None, filter='', path='')[source]
Retrieves a collection of resources.
Use this function when the ‘start’ and ‘count’ parameters are not allowed in the GET call. Otherwise, use get_all instead.
Optional filtering criteria may be specified.
- Parameters
filter (list or str) – General filter/query string.
path (str) – path to be added with base URI
- Returns
Collection of the requested resource.
- update(resource, uri=None, force=False, timeout=-1, custom_headers=None)[source]
Makes a PUT request to update a resource when a request body is required.
- Parameters
resource – Data to update the resource.
uri – Resource uri
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.
custom_headers – Allows to add custom HTTP headers.
- Returns
A dict with the updated resource data.
- update_resource_fields(data, data_to_add)[source]
Update resource data with new fields.
- Parameters
data – resource data
data_to_update – dict of data to update resource data
- Returnes:
Returnes dict
- update_with_zero_body(uri, timeout=-1, custom_headers=None)[source]
Makes a PUT request to update a resource when no request body is required.
- Parameters
uri – Allows to use a different URI other than resource URI
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.
custom_headers – Allows to set custom HTTP headers.
- Returns
A dict with updated resource data.
- class hpeOneView.resources.resource.ResourcePatchMixin[source]
Bases:
object
- patch(**kwargs)
- patch_request(uri, body, custom_headers=None, timeout=-1)[source]
Uses the PATCH to update a resource.
Only one operation can be performed in each PATCH call.
- Parameters
body (list) – Patch request body
timeout (int) – 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.
custom_headers (dict) – Allows to add custom http headers.
- Returns
Updated resource.
- class hpeOneView.resources.resource.ResourceUtilizationMixin[source]
Bases:
object
- get_utilization(fields=None, filter=None, refresh=False, view=None)[source]
Retrieves historical utilization data for the specified resource, metrics, and time span.
- Parameters
fields – Name of the supported metric(s) to be retrieved in the format METRIC[,METRIC]… If unspecified, all metrics supported are returned.
filter (list or str) –
Filters should be in the format FILTER_NAME=VALUE[,FILTER_NAME=VALUE]… E.g.: ‘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 has, 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 iLO. 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
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 iLO. 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
dict
- class hpeOneView.resources.resource.ResourceZeroBodyMixin[source]
Bases:
object
- create_with_zero_body(uri=None, timeout=-1, custom_headers=None)[source]
Makes a POST request to create a resource when no request body is required.
- Parameters
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.
custom_headers – Allows set specific HTTP headers.
- Returns
Created resource.
- update_with_zero_body(uri=None, timeout=-1, custom_headers=None)[source]
Makes a PUT request to update a resource when no request body is required.
- Parameters
uri – Allows to use a different URI other than resource URI
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.
custom_headers – Allows to set custom HTTP headers.
- Returns
A dict with updated resource data.
- hpeOneView.resources.resource.ensure_resource_client
alias of
EnsureResourceClient
- hpeOneView.resources.resource.extract_id_from_uri(id_or_uri)[source]
Extract ID from the end of the URI
- Parameters
id_or_uri – ID or URI of the OneView resources.
- Returns
The string founded after the last “/”
- Return type
str
- hpeOneView.resources.resource.merge_default_values(resource_list, default_values)[source]
Generate a new list where each item of original resource_list will be merged with the default_values.
- Parameters
resource_list – list with items to be merged
default_values – properties to be merged with each item list. If the item already contains some property the original value will be maintained.
- Returns
list containing each item merged with default_values
- Return type
list
- hpeOneView.resources.resource.merge_resources(resource1, resource2)[source]
Updates a copy of resource1 with resource2 values and returns the merged dictionary.
- Parameters
resource1 – original resource
resource2 – resource to update resource1
- Returns
merged resource
- Return type
dict
- hpeOneView.resources.resource.transform_list_to_dict(list)[source]
Transforms a list into a dictionary, putting values as keys
- Parameters
id –
- Returns
dictionary built
- Return type
dict
Raise an exception if method is not available for the resource.
hpeOneView.resources.task_monitor module
- class hpeOneView.resources.task_monitor.TaskMonitor(con)[source]
Bases:
object
- CONNECTION_FAILURE_ERROR_NUMBERS = [8, 22, 101, 110, 104, 103, 101, 100, 111]
- CONNECTION_FAILURE_TIMEOUT = 90
- get(task)[source]
Retrieve a task by its uri.
- Parameters
task – task dict, must have ‘uri’ key.
- Returns
task dict
- get_associated_resource(task)[source]
Retrieve a resource associated with a task.
- Parameters
task – task dict
- Returns
task (updated), the entity found (dict)
- Return type
tuple
- get_completed_task(task, timeout=-1)[source]
Waits until the task is completed and returns the task resource.
- Parameters
task – TaskResource
timeout – Timeout in seconds
- Returns
TaskResource
- Return type
dict
- is_task_running(task, connection_failure_control=None)[source]
Check if a task is running according to: TASK_PENDING_STATES [‘New’, ‘Starting’, ‘Pending’, ‘Running’, ‘Suspended’, ‘Stopping’]
- Parameters
task (dict) – OneView Task resource.
connection_failure_control (dict) – A dictionary instance that contains last_success for error tolerance control.
Examples
>>> connection_failure_control = dict(last_success=int(time.time())) >>> while self.is_task_running(task, connection_failure_control): >>> pass
- Returns
True when in TASK_PENDING_STATES; False when not.