Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
HarikaChebrolu committed May 26, 2020
2 parents e1e1fc2 + ec5b0b2 commit 1d0737e
Show file tree
Hide file tree
Showing 98 changed files with 1,736 additions and 152 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@
This release extends support of the SDK to OneView REST API version 1600 (OneView v5.20).

#### Features supported
- Artifact Bundle
- Deployment Group
- Deployment Plan
- Enclosure
- Enclosure Group
- Ethernet Network
- FC Network
- FCOE Network
- Hypervisor Manager
- Interconnects
- Logical Enclosure
- OS Deployment Plan
- Server Hardware
- Server Hardware Type
- Server Profile
- Server Profile Template

## v5.11.0

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ OneviewSDK::API300.variant # 'Synergy'
OneviewSDK::API300.variant_updated? # true
OneviewSDK::EthernetNetwork # OneviewSDK::API300::Synergy::EthernetNetwork
OneviewSDK::API300::EthernetNetwork # OneviewSDK::API300::Synergy::EthernetNetwork

# Likewise, we can set a new default variant for the API1600 module:
OneviewSDK::API1600.variant = 'Synergy'
OneviewSDK::API1600.variant # 'Synergy'
OneviewSDK::API1600.variant_updated? # true
OneviewSDK::EthernetNetwork # OneviewSDK::API1600::Synergy::EthernetNetwork
OneviewSDK::API1600::EthernetNetwork # OneviewSDK::API1600::Synergy::EthernetNetwork
```

We understand that this can be confusing, so to avoid any confusion or unexpected behavior, we recommend specifying the full namespace identifier in your code. At the very least, set defaults explicitly using `OneviewSDK.api_version = <ver>` and `OneviewSDK::API300.variant = <variant>`, as the defaults may change.
Expand Down
236 changes: 118 additions & 118 deletions endpoints-support.md

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions examples/image-streamer/artifact_bundle.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# (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.
# 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 'tempfile'
require_relative '../_client_i3s' # Gives access to @client

# Supported APIs:
# - 300, 500, 600, 800, 1000, 1020, 1600

# Resources that can be created according to parameters:
# api_version = 300 & variant = Synergy to OneviewSDK::ImageStreamer::API300::ArtifactBundle
# api_version = 500 & variant = Synergy to OneviewSDK::ImageStreamer::API500::ArtifactBundle
# api_version = 600 & variant = Synergy to OneviewSDK::ImageStreamer::API600::ArtifactBundle
# api_version = 800 & variant = Synergy to OneviewSDK::ImageStreamer::API800::ArtifactBundle
# api_version = 1000 & variant = Synergy to OneviewSDK::ImageStreamer::API1000::ArtifactBundle
# api_version = 1020 & variant = Synergy to OneviewSDK::ImageStreamer::API1020::ArtifactBundle
# api_version = 1600 & variant = Synergy to OneviewSDK::ImageStreamer::API1600::ArtifactBundle

# Example:
# - Create, update, download, upload, extract and delete an artifact bundle for an Image Streamer
# - Create, download, upload an backup bundle for an Image Streamer
# NOTE: It needs a DeploymentGroup and a PlanScript created already

deployment_group_class = OneviewSDK::ImageStreamer.resource_named('DeploymentGroup', @client.api_version)
deployment_group = deployment_group_class.get_all(@client).first
plan_script_class = OneviewSDK::ImageStreamer.resource_named('PlanScript', @client.api_version)
plan_script = plan_script_class.get_all(@client).first
artifact_bundle_class = OneviewSDK::ImageStreamer.resource_named('ArtifactBundle', @client.api_version)

options = {
name: 'ArtifactBundle Name',
description: 'Description of ArtifactBundle'
}

puts "\nCreating an artifact bundle with plan script"
item = artifact_bundle_class.new(@client, options)
item.add_plan_script(plan_script, false)
item.create
puts "Artifact Bundle with name #{item['name']} and uri #{item['uri']} created successfully."
puts 'Data:', item.data

puts "\nUpdating the name of the artifact bundle"
item.update_name("#{item['name']}_Updated")
puts "Artifact Bundle with name #{item['name']} and uri #{item['uri']} updated successfully."

puts "\nListing all artifact bundles"
all_items = artifact_bundle_class.get_all(@client)
all_items.each { |each_item| puts each_item['name'] }

download_file = Tempfile.new(['artifact-bundle', '.zip'])
download_path = download_file.path
puts "\nDownloading artifact bundle file and saving at #{download_path}"
item.download(download_path)
puts 'Downloaded successfully.' if File.exist?(download_path)

puts "\nCreating artifact bundle from zip file"
item_uploaded = artifact_bundle_class.create_from_file(@client, download_path, 'ArtifactBundle Uploaded')
puts "Artifact Bundle with name #{item_uploaded['name']} and uri #{item_uploaded['uri']} created successfully."

puts "\nExtracting artifact bundle uploaded"
puts 'Artifact Bundle extracted successfully.' if item_uploaded.extract

puts "\nCreating a backup associated to deployment group with name='#{deployment_group['name']}' and uri='#{deployment_group['uri']}'"
puts artifact_bundle_class.create_backup(@client, deployment_group)

puts "\nListing backups"
backups = artifact_bundle_class.get_backups(@client)
backups.each { |bkp| puts bkp['name'] }

backup_download_file = Tempfile.new(['backup-bundle', '.zip'])
backup_download_path = backup_download_file.path
puts "\nDownloading backup bundle file and saving at #{backup_download_path}"
artifact_bundle_class.download_backup(@client, backup_download_path, backups.first)
puts 'Downloaded successfully.' if File.exist?(backup_download_path)

puts "\nUploading backup bundle"
puts artifact_bundle_class.create_backup_from_file!(@client, deployment_group, backup_download_path, 'Backup Bundle')

puts "\nExtracting backup bundle uploaded"
backup = artifact_bundle_class.get_backups(@client).first
puts artifact_bundle_class.extract_backup(@client, deployment_group, backup)
puts 'Backup extracted successfully'

puts "\nDeleting the artifact bundles"
item.delete
item_uploaded.delete
puts "#{item['name']} deleted successfully" unless item.retrieve!
puts "#{item_uploaded['name']} deleted successfully" unless item_uploaded.retrieve!
35 changes: 35 additions & 0 deletions examples/image-streamer/deployment_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# (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.
# 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_i3s' # Gives access to @client

# Supported APIs:
# - 300, 500, 600, 800, 1000, 1020, 1600

# Resources that can be created according to parameters:
# api_version = 300 & variant = Synergy to OneviewSDK::ImageStreamer::API300::DeploymentGroup
# api_version = 500 & variant = Synergy to OneviewSDK::ImageStreamer::API500::DeploymentGroup
# api_version = 600 & variant = Synergy to OneviewSDK::ImageStreamer::API600::DeploymentGroup
# api_version = 800 & variant = Synergy to OneviewSDK::ImageStreamer::API800::DeploymentGroup
# api_version = 1000 & variant = Synergy to OneviewSDK::ImageStreamer::API1000::DeploymentGroup
# api_version = 1020 & variant = Synergy to OneviewSDK::ImageStreamer::API1020::DeploymentGroup
# api_version = 1600 & variant = Synergy to OneviewSDK::ImageStreamer::API1600::DeploymentGroup

# Example:
# - Gets the Deployment Groups
# NOTE: It needs an existing DeploymentGroup

deployment_group_class = OneviewSDK::ImageStreamer.resource_named('DeploymentGroup', @client.api_version)

# List all deployments
list = deployment_group_class.get_all(@client)
puts "\n#Listing all Deployment Groups:"
list.each { |p| puts " #{p['name']}" }
3 changes: 2 additions & 1 deletion examples/image-streamer/deployment_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

require_relative '../_client_i3s' # Gives access to @client
# Supported APIs:
# - 300, 500, 600, 800, 1000, 1020
# - 300, 500, 600, 800, 1000, 1020, 1600

# Resources that can be created according to parameters:
# api_version = 300 & variant = Synergy to OneviewSDK::ImageStreamer::API300::DeploymentPlan
Expand All @@ -20,6 +20,7 @@
# api_version = 800 & variant = Synergy to OneviewSDK::ImageStreamer::API800::DeploymentPlan
# api_version = 1000 & variant = Synergy to OneviewSDK::ImageStreamer::API1000::DeploymentPlan
# api_version = 1020 & variant = Synergy to OneviewSDK::ImageStreamer::API1020::DeploymentPlan
# api_version = 1600 & variant = Synergy to OneviewSDK::ImageStreamer::API1600::DeploymentPlan

# Example: Create a deployment plan for an Image Streamer
# NOTE: This will create a deployment plan named 'Deployment_Plan_1', then delete it.
Expand Down
12 changes: 10 additions & 2 deletions examples/shared_samples/enclosure_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# NOTE: This will create an enclosure group named 'OneViewSDK Test Enclosure Group', then delete it.
#
# Supported APIs:
# - 200, 300, 500, 600
# - 200, 300, 500, 600, 800, 1200, and 1600.

# Resources that can be created according to parameters:
# api_version = 200 & variant = any to OneviewSDK::API200::EnclosureGroup
Expand All @@ -25,11 +25,19 @@
# api_version = 500 & variant = Synergy to OneviewSDK::API500::Synergy::EnclosureGroup
# api_version = 600 & variant = C7000 to OneviewSDK::API600::C7000::EnclosureGroup
# api_version = 600 & variant = Synergy to OneviewSDK::API600::Synergy::EnclosureGroup
# api_version = 800 & variant = C7000 to OneviewSDK::API800::C7000::EnclosureGroup
# api_version = 800 & variant = Synergy to OneviewSDK::API800::Synergy::EnclosureGroup
# api_version = 1000 & variant = C7000 to OneviewSDK::API1000::C7000::EnclosureGroup
# api_version = 1000 & variant = Synergy to OneviewSDK::API1000::Synergy::EnclosureGroup
# api_version = 1200 & variant = C7000 to OneviewSDK::API1200::C7000::EnclosureGroup
# api_version = 1200 & variant = Synergy to OneviewSDK::API1200::Synergy::EnclosureGroup
# api_version = 1600 & variant = C7000 to OneviewSDK::API1600::C7000::EnclosureGroup
# api_version = 1600 & variant = Synergy to OneviewSDK::API1600::Synergy::EnclosureGroup

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

# LogicalInterconnectGroup class used in this sample
# LogicalInterconnectGroup class used in this sample.
lig_class = OneviewSDK.resource_named('LogicalInterconnectGroup', @client.api_version)

type = 'enclosure group'
Expand Down
2 changes: 1 addition & 1 deletion examples/shared_samples/fc_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
connectionTemplateUri: nil,
autoLoginRedistribution: true,
fabricType: 'FabricAttach',
initialScopeUris: ['/rest/scopes/a5f8ca3d-2cea-4f82-b880-344572eb7271', '/rest/scopes/e0f6b95a-67a6-4718-b42c-1f7d426b730c']
initialScopeUris: ['/rest/scopes/e025d93b-b08a-42cb-af56-b67a750c65b7', '/rest/scopes/92517890-87e4-47b5-9b33-ba78bd878293']
}

fc = fc_network_class.new(@client, options)
Expand Down
6 changes: 5 additions & 1 deletion examples/shared_samples/hypervisor_manager.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2018 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 All @@ -21,6 +21,8 @@
# - API1000 for Synergy
# - API1200 for C7000
# - API1200 for Synergy
# - API1600 for C7000
# - API1600 for Synergy

# Resources that can be created according to parameters:
# api_version = 800 & variant = C7000 to OneviewSDK::API800::C7000::HypervisorManager
Expand All @@ -29,6 +31,8 @@
# api_version = 1000 & variant = Synergy to OneviewSDK::API1000::Synergy::HypervisorManager
# api_version = 1200 & variant = C7000 to OneviewSDK::API1200::C7000::HypervisorManager
# api_version = 1200 & variant = Synergy to OneviewSDK::API1200::Synergy::HypervisorManager
# api_version = 1600 & variant = C7000 to OneviewSDK::API1600::C7000::HypervisorManager
# api_version = 1600 & variant = Synergy to OneviewSDK::API1600::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
Expand Down
11 changes: 10 additions & 1 deletion examples/shared_samples/logical_enclosure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# To run this test with Synergy you must have an enclosureGroup with enclosure count = 3.
#
# Supported APIs:
# - 200, 300, 500, 600
# - 200, 300, 500, 600, 800, 1000, 1200, and 1600.

# Resources that can be created according to parameters:
# api_version = 200 & variant = any to OneviewSDK::API200::LogicalEnclosure
Expand All @@ -26,6 +26,15 @@
# api_version = 500 & variant = Synergy to OneviewSDK::API500::Synergy::LogicalEnclosure
# api_version = 600 & variant = C7000 to OneviewSDK::API600::C7000::LogicalEnclosure
# api_version = 600 & variant = Synergy to OneviewSDK::API600::Synergy::LogicalEnclosure
# api_version = 800 & variant = C7000 to OneviewSDK::API800::C7000::LogicalEnclosure
# api_version = 800 & variant = Synergy to OneviewSDK::API800::Synergy::LogicalEnclosure
# api_version = 1000 & variant = C7000 to OneviewSDK::API1000::C7000::LogicalEnclosure
# api_version = 1000 & variant = Synergy to OneviewSDK::API1000::Synergy::LogicalEnclosure
# api_version = 1200 & variant = C7000 to OneviewSDK::API1200::C7000::LogicalEnclosure
# api_version = 1200 & variant = Synergy to OneviewSDK::API1200::Synergy::LogicalEnclosure
# api_version = 1600 & variant = C7000 to OneviewSDK::API1600::C7000::LogicalEnclosure
# api_version = 1600 & variant = Synergy to OneviewSDK::API1600::Synergy::LogicalEnclosure


# Resource Class used in this sample
logical_enclosure_class = OneviewSDK.resource_named('LogicalEnclosure', @client.api_version)
Expand Down
16 changes: 5 additions & 11 deletions examples/shared_samples/server_hardware.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2017 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 All @@ -18,17 +18,11 @@
# @server_hardware_username
# @server_hardware_password
#
# Supported APIs:
# - 200, 300, 500, 600

# Resources that can be created according to parameters:
# api_version = 200 & variant = any to OneviewSDK::API200::ServerHardware
# api_version = 300 & variant = C7000 to OneviewSDK::API300::C7000::ServerHardware
# api_version = 300 & variant = Synergy to OneviewSDK::API300::Synergy::ServerHardware
# api_version = 500 & variant = C7000 to OneviewSDK::API500::C7000::ServerHardware
# api_version = 500 & variant = Synergy to OneviewSDK::API500::Synergy::ServerHardware
# api_version = 600 & variant = C7000 to OneviewSDK::API600::C7000::ServerHardware
# api_version = 600 & variant = Synergy to OneviewSDK::API600::Synergy::ServerHardware
# Supported APIs:
# - 200, 300, 500, 600, 800, 1000, 1200, 1600
# Supported Variants:
# C7000 and Synergy for all api-versions

# Resource Class used in this sample
server_harware_class = OneviewSDK.resource_named('ServerHardware', @client.api_version)
Expand Down
13 changes: 3 additions & 10 deletions examples/shared_samples/server_hardware_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,9 @@
# Example: Actions with a Server Hardware Type
#
# Supported APIs:
# - 200, 300, 500, 600

# Resources that can be created according to parameters:
# api_version = 200 & variant = any to OneviewSDK::API200::ServerHardwareType
# api_version = 300 & variant = C7000 to OneviewSDK::API300::C7000::ServerHardwareType
# api_version = 300 & variant = Synergy to OneviewSDK::API300::Synergy::ServerHardwareType
# api_version = 500 & variant = C7000 to OneviewSDK::API500::C7000::ServerHardwareType
# api_version = 500 & variant = Synergy to OneviewSDK::API500::Synergy::ServerHardwareType
# api_version = 600 & variant = C7000 to OneviewSDK::API600::C7000::ServerHardwareType
# api_version = 600 & variant = Synergy to OneviewSDK::API600::Synergy::ServerHardwareType
# - 200, 300, 500, 600, 800, 1000, 1200, 1600
# Supported API variants:
# C7000, Synergy

# Resource Class used in this sample
shw_type_class = OneviewSDK.resource_named('ServerHardwareType', @client.api_version)
Expand Down
10 changes: 8 additions & 2 deletions examples/shared_samples/server_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@
item3.retrieve!
puts "\nServer Profile updated successfully! Name: #{item3['name']}"

# This method supports till OneView REST API Version 1200
puts "\nGetting the available servers"
servers = server_profile_class.get_available_servers(@client)
puts "\nAvailable servers: \n#{servers}"
begin
servers = server_profile_class.get_available_servers(@client)
puts "\nAvailable servers: \n#{servers}"
rescue OneviewSDK::MethodUnavailable
puts "\nThe method #get_available_servers is available for API version <= 1200"
end

puts "\nGetting the available networks"
query_options = {
Expand Down Expand Up @@ -109,6 +114,7 @@
item2.update_from_template
puts "\nServer Profile updated successfully!"

# This method supports till OneView REST API Version 1200
puts "\nGetting a new profile template of a given server profile"
begin
new_template = item2.get_profile_template
Expand Down
8 changes: 7 additions & 1 deletion examples/shared_samples/server_profile_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
require_relative '../_client' # Gives access to @client

# Supported APIs:
# - 200, 300, 500, 600, 800
# - 200, 300, 500, 600, 800, 1000, 1200, and 1600.

# Resources that can be created according to parameters:
# api_version = 200 & variant = any to OneviewSDK::API200::ServerProfileTemplate
Expand All @@ -24,6 +24,12 @@
# api_version = 600 & variant = Synergy to OneviewSDK::API600::Synergy::ServerProfileTemplate
# api_version = 800 & variant = C7000 to OneviewSDK::API800::C7000::ServerProfileTemplate
# api_version = 800 & variant = Synergy to OneviewSDK::API800::Synergy::ServerProfileTemplate
# api_version = 1000 & variant = C7000 to OneviewSDK::API1000::C7000::ServerProfileTemplate
# api_version = 1000 & variant = Synergy to OneviewSDK::API1000::Synergy::ServerProfileTemplate
# api_version = 1200 & variant = C7000 to OneviewSDK::API1200::C7000::ServerProfileTemplate
# api_version = 1200 & variant = Synergy to OneviewSDK::API1200::Synergy::ServerProfileTemplate
# api_version = 1600 & variant = C7000 to OneviewSDK::API1600::C7000::ServerProfileTemplate
# api_version = 1600 & variant = Synergy to OneviewSDK::API1600::Synergy::ServerProfileTemplate

# Resource Class used in this sample
server_profile_template_class = OneviewSDK.resource_named('ServerProfileTemplate', @client.api_version)
Expand Down
22 changes: 22 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api1000/artifact_bundle.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (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.
# 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 '../api800/artifact_bundle'

module OneviewSDK
module ImageStreamer
module API1000
# Artifact Bundle resource implementation for Image Streamer
class ArtifactBundle < OneviewSDK::ImageStreamer::API800::ArtifactBundle
end
end
end
end
Loading

0 comments on commit 1d0737e

Please sign in to comment.