Skip to content

Commit

Permalink
Merge 47a14c5 into e8cf8cc
Browse files Browse the repository at this point in the history
  • Loading branch information
chebroluharika committed May 11, 2020
2 parents e8cf8cc + 47a14c5 commit 6af69e4
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 63 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Extends support of the SDK to OneView REST API version 1600 (OneView v5.20).

#### Features supported with the current release
- Certificates Server
- Enclosures
- Hypervisor Cluster Profiles
- Hypervisor Managers
- Interconnects
Expand All @@ -12,6 +13,7 @@ Extends support of the SDK to OneView REST API version 1600 (OneView v5.20).
- Logical Interconnect Groups
- Server Hardware
- Server Hardware Types
- Server Profiles

# 5.1.1

Expand Down
64 changes: 32 additions & 32 deletions endpoints-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@
|<sub>/rest/enclosure-groups/{id}/script</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosure-groups/{id}/script</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Enclosures**
|<sub>/rest/enclosures</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}</sub> | PATCH | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/configuration</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/environmentalConfiguration</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/environmentalConfiguration</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/refreshState</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/script</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/enclosures/{id}/sso</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/utilization</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/https/certificaterequest</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/https/certificaterequest</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/https/certificaterequest</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}</sub> | PATCH | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/configuration</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/environmentalConfiguration</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/environmentalConfiguration</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/refreshState</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/script</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/enclosures/{id}/sso</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/utilization</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/https/certificaterequest</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/https/certificaterequest</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/enclosures/{id}/https/certificaterequest</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Ethernet Networks**
|<sub>/rest/ethernet-networks</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/ethernet-networks</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Expand Down Expand Up @@ -250,23 +250,23 @@
|<sub>/rest/server-profile-templates/{id}/transformation</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates/available-networks</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Server Profiles**
|<sub>/rest/server-profiles</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/available-networks</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/available-servers</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/available-storage-system</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/available-storage-systems</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/available-targets</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/profile-ports</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | PATCH | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}/compliance-preview</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}/new-profile-template</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}/messages</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/{id}/transformation</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/available-networks</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/available-servers</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/available-storage-system</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/available-storage-systems</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/available-targets</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/profile-ports</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}</sub> | PATCH | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}/compliance-preview</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profiles/{id}/new-profile-template</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/{id}/messages</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
|<sub>/rest/server-profiles/{id}/transformation</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Storage Pools**
|<sub>/rest/storage-pools</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/storage-pools</sub> | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign:
Expand Down
18 changes: 10 additions & 8 deletions examples/enclosures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
# (C) Copyright [2020] Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,7 @@
"userName": "<username>",
"password": "<password>"
},
"api_version": "800",
"api_version": "<api_version>",
"enclosure_group_uri": "/rest/enclosure-groups/06475bf3-084b-4874",
"enclosure_hostname": "",
"enclosure_username": "",
Expand Down Expand Up @@ -106,12 +106,14 @@
print(e.msg)

# Get the enclosure script
print("Get the enclosure script")
try:
script = enclosure.get_script()
pprint(script)
except HPOneViewException as e:
print(e.msg)
# This method is available for API version 300
if oneview_client.api_version == 300:
print("Get the enclosure script")
try:
script = enclosure.get_script()
pprint(script)
except HPOneViewException as e:
print(e.msg)

# Buid the SSO URL parameters
print("Build the SSO (Single Sign-On) URL parameters for the enclosure")
Expand Down
53 changes: 31 additions & 22 deletions examples/server_profiles.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
# (C) Copyright [2020] Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -130,28 +130,32 @@
pprint(server_transformed)

print("Transformation complete. Updating server profile with the new configuration.")
profile_updated = profile.update(server_transformed)
profile_updated = profile.update(server_transformed['serverProfile'])
pprint(profile_updated.data)

# Create a new Server Profile Template based on an existing Server Profile
new_spt = profile.get_new_profile_template()
print('\nNew SPT generated:')
pprint(new_spt)
# This method works with all the API versions till 1200
if oneview_client.api_version <= 1200:
new_spt = profile.get_new_profile_template()
print('\nNew SPT generated:')
pprint(new_spt)

new_spt['name'] = 'spt_generated_from_sp'
new_spt = profile_templates.create(new_spt)
print('\nNew SPT created successfully.')
new_spt['name'] = 'spt_generated_from_sp'
new_spt = profile_templates.create(new_spt)
print('\nNew SPT created successfully.')

new_spt.delete()
print('\nDropped recently created SPT.')
new_spt.delete()
print('\nDropped recently created SPT.')

# Delete the created server profile
print("\nDelete the created server profile")
profile.delete()
print("The server profile was successfully deleted.")

# Delete the created server profile template
server_template.delete()
if server_template:
server_template.delete()
print("The server profile template was successfully deleted")

# Get profile ports
print("\nRetrieve the port model associated with a server hardware type and enclosure group")
Expand Down Expand Up @@ -187,21 +191,26 @@
print("No Server Profiles Group found.")

# Get the list of available servers
print("\nList all available servers associated with a server hardware type and enclosure group")
available_servers = server_profiles.get_available_servers(
enclosureGroupUri=enclosure_group.data["uri"],
serverHardwareTypeUri=hardware_type.data["uri"])
pprint(available_servers)
# This method works with all the API versions till 1200
if oneview_client.api_version <= 1200:
print("\nList all available servers associated with a server hardware type and enclosure group")
available_servers = server_profiles.get_available_servers(
enclosureGroupUri=enclosure_group.data["uri"],
serverHardwareTypeUri=hardware_type.data["uri"])
pprint(available_servers)

# List available storage systems
print("\nList available storage systems associated with the given enclosure group URI and server hardware type URI")
available_storage_systems = server_profiles.get_available_storage_systems(
count=25, start=0, enclosureGroupUri=enclosure_group.data["uri"],
serverHardwareTypeUri=hardware_type.data["uri"])
pprint(available_storage_systems)
# This method works with all the API versions till 500
if oneview_client.api_version <= 500:
print("\nList available storage systems associated with the given enclosure group URI and server hardware type URI")
available_storage_systems = server_profiles.get_available_storage_systems(
count=25, start=0, enclosureGroupUri=enclosure_group.data["uri"],
serverHardwareTypeUri=hardware_type.data["uri"])
pprint(available_storage_systems)

# Get a specific storage system
if storage_system_id:
# This method works with all the API versions till 500
if storage_system_id and oneview_client.api_version <= 500:
print("\nRetrieve a specific storage system associated with the given enclosure group URI, a server hardware"
" type URI and a storage system ID")
available_storage_system = server_profiles.get_available_storage_system(
Expand Down
3 changes: 2 additions & 1 deletion hpOneView/resources/servers/server_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class ServerProfiles(ResourcePatchMixin, ResourceSchemaMixin, Resource):
'600': {"type": "ServerProfileV8"},
'800': {"type": "ServerProfileV9"},
'1000': {"type": "ServerProfileV10"},
'1200': {"type": "ServerProfileV11"}
'1200': {"type": "ServerProfileV11"},
'1600': {"type": "ServerProfileV12"}
}

def __init__(self, connection, data=None):
Expand Down

0 comments on commit 6af69e4

Please sign in to comment.