Skip to content

Commit

Permalink
Merge pull request #369 from HewlettPackard/api800/support
Browse files Browse the repository at this point in the history
Api800/support
  • Loading branch information
Sowmyahsg authored Feb 13, 2019
2 parents a4c1605 + c34948c commit b611bf3
Show file tree
Hide file tree
Showing 79 changed files with 1,449 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Metrics/PerceivedComplexity:
Enabled: false

Style/GlobalVars:
AllowedVariables: [$config, $secrets, $client, $client_120, $client_300, $client_300_synergy, $config_synergy, $secrets_synergy, $config_i3s, $client_i3s_300, $client_500, $client_500_synergy, $client_i3s_500, $client_600, $client_600_synergy, $client_i3s_600]
AllowedVariables: [$config, $secrets, $client, $client_120, $client_300, $client_300_synergy, $config_synergy, $secrets_synergy, $config_i3s, $client_i3s_300, $client_500, $client_500_synergy, $client_i3s_500, $client_600, $client_600_synergy, $client_i3s_600, $client_800, $client_800_synergy]

Style/FrozenStringLiteralComment:
Enabled: false
Expand Down
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
## v5.6.1(Unreleased)
## v5.7.0(Unreleased)

#### Notes
This release fixes few bugs listed below
Extends support of the SDK to OneView Rest API version 800 (OneView v4.10).
This release fix one bug listed below.

#### Features Supported
This release adds support to OneView Rest API version 800 for the hardware variants C7000 and Synergy to the already existing features:
- Hypervisor Cluster Profile
- Hypervisor Manager
- Server Profile Template

#### Bug fixes & Enhancements
- [#366](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/366) Query parameters not working for get_attachable_volumes endpoint
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ You may notice resource classes being accessed in a few different ways; for exam
require 'oneview-sdk'

# Show defaults:
OneviewSDK::SUPPORTED_API_VERSIONS # [200, 300, 500, 600]
OneviewSDK::SUPPORTED_API_VERSIONS # [200, 300, 500, 600, 800]
OneviewSDK::DEFAULT_API_VERSION # 200
OneviewSDK.api_version # 200
OneviewSDK.api_version_updated? # false
Expand All @@ -183,7 +183,7 @@ OneviewSDK.api_version = 300
OneviewSDK.api_version # 300
OneviewSDK.api_version_updated? # true

# The API200 module has no variants, but API300, API500 and API600 has 2 (C7000 & Synergy):
# The API200 module has no variants, but API300 and above has 2 (C7000 & Synergy):
OneviewSDK::API300::SUPPORTED_VARIANTS # ['C7000', 'Synergy']
OneviewSDK::API300::DEFAULT_VARIANT # 'C7000'
OneviewSDK::API300.variant # 'C7000'
Expand All @@ -199,6 +199,11 @@ OneviewSDK::API600::DEFAULT_VARIANT # 'C7000'
OneviewSDK::API600.variant # 'C7000'
OneviewSDK::API600.variant_updated? # false

OneviewSDK::API800::SUPPORTED_VARIANTS # ['C7000', 'Synergy']
OneviewSDK::API800::DEFAULT_VARIANT # 'C7000'
OneviewSDK::API800.variant # 'C7000'
OneviewSDK::API800.variant_updated? # false

# Therefore, there is 1 more namespace level to the real resource class name
OneviewSDK::EthernetNetwork # OneviewSDK::API300::C7000::EthernetNetwork
OneviewSDK::API300::EthernetNetwork # OneviewSDK::API300::C7000::EthernetNetwork
Expand Down
33 changes: 23 additions & 10 deletions endpoints-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove)

## HPE OneView

| Endpoints | Verb | V200 | V300 | V500 | V600 |
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :------------------: | :------------------: |
| Endpoints | Verb | V200 | V300 | V500 | V600 | V800
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :------------------: | :------------------: | :------------------: |
| **Alerts** |
|<sub>/rest/alerts</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/alerts</sub> |DELETE | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |
Expand Down Expand Up @@ -139,6 +139,19 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove)
|<sub>/rest/firmware-drivers</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/firmware-drivers/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/firmware-drivers/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Hypervisor Managers** |
|<sub>/rest/hypervisor-managers</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-managers</sub> | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-managers/{id}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-managers/{id}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-managers/{id}</sub> | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
| **Hypervisor Cluster Profiles** |
|<sub>/rest/hypervisor-cluster-profiles</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles</sub> | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}/compliance-preview</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
| **ID Pools** |
|<sub>/rest/id-pools/{poolType}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/id-pools/{poolType}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Expand Down Expand Up @@ -444,14 +457,14 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove)
|<sub>/rest/server-hardware-types/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-hardware-types/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Server Profile Templates** |
|<sub>/rest/server-profile-templates</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/server-profile-templates</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/server-profile-templates/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/server-profile-templates/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/server-profile-templates/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/server-profile-templates/{id}/new-profile</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/server-profile-templates/{id}/transformation</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark:
|<sub>/rest/server-profile-templates/available-networks | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark:
|<sub>/rest/server-profile-templates</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates/{id}/new-profile</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates/{id}/transformation</sub> | GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/server-profile-templates/available-networks | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
| **Server Profiles** |
|<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:
Expand Down
14 changes: 13 additions & 1 deletion examples/_client.rb.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require 'pry'

# This setting allows for use of the shortened name of the resources, like OneviewSDK::<Resource_name>,
# when referring to OneviewSDK::<API_version>::Synergy::<Resource_name>
# Versions supported: [200, 300, 500, 600]
# Versions supported: [200, 300, 500, 600, 800]
# Variants supported[C7000, Synergy]
# OneviewSDK::API<version>.variant='Synergy'

Expand Down Expand Up @@ -54,3 +54,15 @@ puts "Connected to OneView appliance at #{@client.url}\n\n"
# @logical_switch_ssh_password = "dcs"
# @logical_switch_community_string = "public"
# @logical_interconnect_name = 'Encl1-LogicalInterconnectGroup_1'
# @hypervisor_manager_ip = '172.18.13.11'
# @hypervisor_manager_username ='dcs'
# @hypervisor_manager_password ='dcs'
# @hypervisor_cluster_profile_name = "Cluster5"
# @hypervisor_path = "DC2"
# @hypervisor_server_password = "dcs"
# @hypervisor_host_prefix = "Test-Cluster-host"
# @hypervisor_hypervisorType = "Vmware"
# @hypervisor_type = "HypervisorClusterProfileV3"
# @hypervisor_manager_uri = "/rest/hypervisor-managers/befc6bd9-0366-4fd9-a3fc-c92ab0df3603"
# @hypervisor_serverProfileTemplateUri = "/rest/server-profile-templates/c865a62c-8fd8-414c-8c16-3f7ca75ab2ba"
# @hypervisor_deploymentPlanUri = "/rest/os-deployment-plans/c54e1dab-cc14-48fa-92bf-d301671fb0cf"
71 changes: 71 additions & 0 deletions examples/shared_samples/hypervisor_cluster_profile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# (C) Copyright 2018 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.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

require_relative '../_client' # Gives access to @client

# Example: Create/Update/Delete hypervisor cluster profile
# NOTE: This will create a hypervisor cluster profile named 'cluster5', update it and then delete it.
#
# Supported APIs:
# - API800 for C7000
# - API800 for Synergy

# Resources that can be created according to parameters:
# api_version = 800 & variant = C7000 to OneviewSDK::API800::C7000::HypervisorClusterProfile
# api_version = 800 & variant = Synergy to OneviewSDK::API800::Synergy::HypervisorClusterProfile

# Resource Class used in this sample
hypervisor_cluster_profile_class = OneviewSDK.resource_named('HypervisorClusterProfile', @client.api_version)

options = {
type: @hypervisor_type,
name: @hypervisor_cluster_profile_name,
hypervisorManagerUri: @hypervisor_manager_uri,
path: @hypervisor_path,
hypervisorType: @hypervisor_hypervisorType,
hypervisorHostProfileTemplate: {
serverProfileTemplateUri: @hypervisor_serverProfileTemplateUri,
deploymentPlan: {
deploymentPlanUri: @hypervisor_deploymentPlanUri,
serverPassword: @hypervisor_server_password
},
hostprefix: @hypervisor_host_prefix
}
}

hcp = hypervisor_cluster_profile_class.new(@client, options)
hcp.create!
puts "\nCreated hypervisor-cluster_profile '#{hcp[:name]}' sucessfully.\n uri = '#{hcp[:uri]}'"

# Lists all the hypervisor cluster profiles present
puts "\nListing all the available cluster profiles\n"
hypervisor_cluster_profile_class.find_by(@client, {}).each do |profile|
puts "#{profile['name']} was found."
end

# Find cluster profile by name
hcp_by_name = hypervisor_cluster_profile_class.find_by(@client, name: hypervisor_cluster_profile_class.find_by(@client, {}).first[:name]).first
puts "\nFound hypervisor cluster profile by name: '#{hcp_by_name[:name]}'.\n uri : '#{hcp_by_name[:uri]}'"

# Update a hypervisor cluster profile
hcp2 = hypervisor_cluster_profile_class.find_by(@client, {}).first
data = { description: 'New Description' }
puts "\nCluster profile description before update : '#{hcp2[:description]}'"
hcp2.update(data)
puts "Cluster profile description after update : '#{hcp2[:description]}'\n"

# Listing compliance details of the previously updated cluster profile
cp = hcp2.compliance_preview
puts "\nCompliance preview details are :\n#{cp}\n"

# Deletes the created hypervisor cluster profile
hcp.delete
puts "\nSuccesfully deleted the cluster profile"
67 changes: 67 additions & 0 deletions examples/shared_samples/hypervisor_manager.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# (C) Copyright 2018 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.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

require_relative '../_client' # Gives access to @client

# Example: Create/Update/Delete hypervisor manager
# NOTE: This will create a hypervisor manager named 'vcenter.corp.com', update it and then delete it.
#
# Supported APIs:
# - API800 for C7000
# - API800 for Synergy

# Resources that can be created according to parameters:
# api_version = 800 & variant = C7000 to OneviewSDK::API800::C7000::HypervisorManager
# api_version = 800 & variant = Synergy to OneviewSDK::API800::Synergy::HypervisorManager

raise 'ERROR: Must set @hypervisor_manager_ip in _client.rb' unless @hypervisor_manager_ip
raise 'ERROR: Must set @hypervisor_manager_username in _client.rb' unless @hypervisor_manager_username
raise 'ERROR: Must set @hypervisor_manager_password in _client.rb' unless @hypervisor_manager_password

# Resource Class used in this sample
hypervisor_manager_class = OneviewSDK.resource_named('HypervisorManager', @client.api_version)

options = {
name: @hypervisor_manager_ip,
username: @hypervisor_manager_username,
password: @hypervisor_manager_password
}

hm = hypervisor_manager_class.new(@client, options)
hm.create!
puts "\nCreated hypervisor-manager '#{hm[:name]}' sucessfully.\n uri = '#{hm[:uri]}'"

# Find recently created hypervisor manager by name
matches = hypervisor_manager_class.find_by(@client, name: hm[:name])
hm2 = matches.first
puts "\nFound hypervisor-manager by name: '#{hm2[:name]}'.\n uri = '#{hm2[:uri]}'"

# Retrieve recently created hypervisor manager
hm3 = hypervisor_manager_class.new(@client, name: hm[:name])
hm3.retrieve!
puts "\nRetrieved hypervisor-manager data by name: '#{hm3[:name]}'.\n uri = '#{hm3[:uri]}'"

# Update hypervisor manager registration
attribute = { name: @hypervisor_manager_ip }
hm2.update(attribute)
puts "\nUpdated hypervisor-manager: '#{hm2[:name]}'.\n uri = '#{hm2[:uri]}'"
puts "with attribute: #{attribute}"

# Example: List all hypervisor managers certain attributes
attributes = { name: @hypervisor_manager_ip }
puts "\nHypervisor manager with #{attributes}"
hypervisor_manager_class.find_by(@client, attributes).each do |hypervisor_manager|
puts " #{hypervisor_manager[:name]}"
end

# Delete this hypervisor manager
hm.delete
puts "\nSucessfully deleted hypervisor-manager '#{hm[:name]}'."
Loading

0 comments on commit b611bf3

Please sign in to comment.