Skip to content

Commit

Permalink
Merge 7463385 into 26cfde1
Browse files Browse the repository at this point in the history
  • Loading branch information
Priyanka Sood committed Nov 15, 2019
2 parents 26cfde1 + 7463385 commit 5ad6180
Show file tree
Hide file tree
Showing 82 changed files with 1,844 additions and 243 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
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, $client_800, $client_800_synergy]
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, $client_1000, $client_1000_synergy]

Style/FrozenStringLiteralComment:
Enabled: false
Expand Down
10 changes: 7 additions & 3 deletions CHANGELOG.md
Expand Up @@ -2,17 +2,18 @@

#### Notes
This release removes the support for Ruby 2.2 and added support for Ruby 2.5.
Extends support of the SDK to OneView Rest API version 800 (OneView v4.10).
This release fixes one bug listed below.
Extends support of the SDK to OneView Rest API version 800/1000 (OneView v4.10/v4.20).
This release also fixes few bugs 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:
This release adds support to OneView Rest API version 800/1000 for the hardware variants C7000 and Synergy to the already existing features:
- Enclosure
- Enclosure Group
- Ethernet Network
- FC Network
- FCoE Network
- Interconnect
- Interconnect Type
- Logical Enclosure
- Logical Interconnect
- Logical Interconnect Group
Expand All @@ -21,11 +22,14 @@ This release adds support to OneView Rest API version 800 for the hardware varia
- Server Hardware
- Server Hardware Types
- Server Profile
- Server Profile Template
- Storage Pool
- Storage System
- Uplink Set
- Volume
- Volume Attachment
- Volume Template
- OS Deployment Plan

#### Bug fixes & Enhancements
- [#377](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/377) Travis build failed as Listen dependency does not support Ruby 2.2.x.
Expand Down
6 changes: 5 additions & 1 deletion README.md
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, 800]
OneviewSDK::SUPPORTED_API_VERSIONS # [200, 300, 500, 600, 800, 1000]
OneviewSDK::DEFAULT_API_VERSION # 200
OneviewSDK.api_version # 200
OneviewSDK.api_version_updated? # false
Expand Down Expand Up @@ -204,6 +204,10 @@ OneviewSDK::API800::DEFAULT_VARIANT # 'C7000'
OneviewSDK::API800.variant # 'C7000'
OneviewSDK::API800.variant_updated? # false

OneviewSDK::API1000::SUPPORTED_VARIANTS # ['C7000', 'Synergy']
OneviewSDK::API1000::DEFAULT_VARIANT # 'C7000'
OneviewSDK::API1000.variant # 'C7000'
OneviewSDK::API1000.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
449 changes: 224 additions & 225 deletions endpoints-support.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/api600/storage_system.rb
Expand Up @@ -56,10 +56,10 @@
# for StorageSystem with family StoreVirtual
# options = {
# credentials: {
# username: @storage_system_username,
# password: @storage_system_password
# username: @store_virtual_user,
# password: @store_virtual_password
# },
# hostname: @storage_system_ip,
# hostname: @store_virtual_ip,
# family: 'StoreVirtual'
# }

Expand Down
3 changes: 2 additions & 1 deletion examples/api600/volume.rb
Expand Up @@ -169,6 +169,7 @@
puts "\nVolume updated successfully! New name: #{item2['name']}."

puts "\nRemoving a snapshot..."
item3.retrieve!
item3.delete_snapshot(snapshot_name)
puts "\nSnapshot removed successfully!"

Expand All @@ -193,7 +194,7 @@
puts "\nExtra managed storage volume paths found: #{paths}"

puts "Remove extra presentations from the specified volume on the storage system: \nURI: #{paths['uri']}"
item1.repair
item2.repair
puts "\nExtra managed storage volume paths has been repaired"

puts "\nRemoving all volumes created in this sample..."
Expand Down
2 changes: 1 addition & 1 deletion examples/shared_samples/logical_interconnect.rb
Expand Up @@ -268,7 +268,7 @@
puts "\nOperations with scopes"
begin
# Scope class used in this sample
scope_class = OneviewSDK.resource_named('Scope', @client.api_version) unless @client.api_version.to_i <= 200 || client.api_version.to_i >= 600
scope_class = OneviewSDK.resource_named('Scope', @client.api_version) unless @client.api_version.to_i <= 200 || @client.api_version.to_i >= 600
# Creating scopes for this example
scope_1 = scope_class.new(@client, name: 'Scope 1')
scope_1.create!
Expand Down
1 change: 1 addition & 0 deletions examples/shared_samples/logical_interconnect_group.rb
Expand Up @@ -166,6 +166,7 @@

if variant == 'Synergy'
puts "\nAdding an internal network with uri = #{eth01['uri']}"
lig.retrieve!
lig.add_internal_network(eth01)
lig.update
lig.retrieve!
Expand Down
2 changes: 1 addition & 1 deletion lib/oneview-sdk.rb
Expand Up @@ -26,7 +26,7 @@ module OneviewSDK
env_i3s = %w[I3S_URL I3S_SSL_ENABLED]
ENV_VARS = env_sdk.concat(env_i3s).freeze

SUPPORTED_API_VERSIONS = [200, 300, 500, 600, 800].freeze
SUPPORTED_API_VERSIONS = [200, 300, 500, 600, 800, 1000].freeze
DEFAULT_API_VERSION = 200
@api_version = DEFAULT_API_VERSION
@api_version_updated = false # Whether or not the API version has been set by the user
Expand Down
66 changes: 66 additions & 0 deletions lib/oneview-sdk/resource/api1000.rb
@@ -0,0 +1,66 @@
# (c) Copyright 2017 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.

module OneviewSDK
# Module for API v1000
module API1000
SUPPORTED_VARIANTS = %w[C7000 Synergy].freeze
DEFAULT_VARIANT = 'C7000'.freeze
@variant = DEFAULT_VARIANT
@variant_updated = false # Whether or not the API variant has been set by the user

# Get resource class that matches the type given
# @param [String] type Name of the desired class type
# @param [String] variant Variant (C7000 or Synergy)
# @return [Class] Resource class or nil if not found
def self.resource_named(type, variant = @variant)
raise "API1000 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
new_type = type.to_s.downcase.gsub(/[ -_]/, '')
api_module = OneviewSDK::API1000.const_get(variant)
api_module.constants.each do |c|
klass = api_module.const_get(c)
next unless klass.is_a?(Class)
name = klass.name.split('::').last.downcase.delete('_').delete('-')
return klass if new_type =~ /^#{name}[s]?$/
end
nil
end

# Get the current API1000 variant
def self.variant
@variant
end

# Has the API1000 variant been set by the user?
# @return [TrueClass, FalseClass]
def self.variant_updated?
@variant_updated
end

# Sets the API1000 variant
def self.variant=(variant)
raise "API1000 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant)
@variant_updated = true
@variant = variant
end

# Helps redirect resources to the correct API1000 variant
def self.const_missing(const)
api1000_module = OneviewSDK::API1000.const_get(@variant.to_s)
api1000_module.const_get(const)
rescue NameError
raise NameError, "The #{const} method or resource does not exist for OneView API1000 variant #{@variant}."
end
end
end

# Load all API1000-specific resources:
Dir[File.dirname(__FILE__) + '/api1000/*.rb'].each { |file| require file }
27 changes: 27 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000.rb
@@ -0,0 +1,27 @@
# (c) Copyright 2017 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.

module OneviewSDK
module API1000
# Module for API1000 C7000
module C7000
# Get resource class that matches the type given
# @param [String] type Name of the desired class type
# @return [Class] Resource class or nil if not found
def self.resource_named(type)
OneviewSDK::API1000.resource_named(type, 'C7000')
end
end
end
end

# Load all API-specific resources:
Dir[File.dirname(__FILE__) + '/c7000/*.rb'].each { |file| require file }
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000/enclosure.rb
@@ -0,0 +1,22 @@
# (c) Copyright 2017 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/c7000/enclosure'

module OneviewSDK
module API1000
module C7000
# Enclosure resource implementation for API1000 C7000
class Enclosure < OneviewSDK::API800::C7000::Enclosure
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000/enclosure_group.rb
@@ -0,0 +1,22 @@
# (C) Copyright 2017 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/c7000/enclosure_group'

module OneviewSDK
module API1000
module C7000
# Enclosure group resource implementation on API1000 C7000
class EnclosureGroup < OneviewSDK::API800::C7000::EnclosureGroup
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000/ethernet_network.rb
@@ -0,0 +1,22 @@
# (C) Copyright 2017 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/c7000/ethernet_network'

module OneviewSDK
module API1000
module C7000
# Ethernet network resource implementation for API1000 C7000
class EthernetNetwork < OneviewSDK::API800::C7000::EthernetNetwork
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000/fc_network.rb
@@ -0,0 +1,22 @@
# (C) Copyright 2017 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 '../../api600/c7000/fc_network'

module OneviewSDK
module API1000
module C7000
# FC network resource implementation for API1000 C7000
class FCNetwork < OneviewSDK::API600::C7000::FCNetwork
end
end
end
end
23 changes: 23 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000/fcoe_network.rb
@@ -0,0 +1,23 @@
# (C) Copyright 2017 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/c7000/fcoe_network'

module OneviewSDK
module API1000
module C7000
# FCoE network resource implementation for API1000 C7000
class FCoENetwork < OneviewSDK::API800::C7000::FCoENetwork

end
end
end
end
23 changes: 23 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000/interconnect.rb
@@ -0,0 +1,23 @@
# (C) Copyright 2017 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/c7000/interconnect'

module OneviewSDK
module API1000
module C7000
# Interconnect resource implementation on API1000 C7000
class Interconnect < OneviewSDK::API800::C7000::Interconnect
include OneviewSDK::ResourceHelper::ConfigurationOperation
end
end
end
end
21 changes: 21 additions & 0 deletions lib/oneview-sdk/resource/api1000/c7000/lig_uplink_set.rb
@@ -0,0 +1,21 @@
# (C) Copyright 2017 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/c7000/lig_uplink_set'

module OneviewSDK
module API1000
module C7000
class LIGUplinkSet < OneviewSDK::API800::C7000::LIGUplinkSet
end
end
end
end

0 comments on commit 5ad6180

Please sign in to comment.