From 1c5c626cdeccc3149494e0e88902214e3038be65 Mon Sep 17 00:00:00 2001 From: yuvirani Date: Thu, 10 Sep 2020 04:04:20 +0000 Subject: [PATCH 1/3] API2000 support for LIG --- CHANGELOG.md | 2 ++ endpoints-support.md | 16 ++++++------ lib/oneview-sdk/resource/api2000.rb | 2 +- .../resource/api2000/c7000/lig_uplink_set.rb | 21 ++++++++++++++++ .../c7000/logical_interconnect_group.rb | 25 +++++++++++++++++++ .../api2000/synergy/lig_uplink_set.rb | 21 ++++++++++++++++ .../synergy/logical_interconnect_group.rb | 25 +++++++++++++++++++ .../c7000/logical_interconnect_group_spec.rb | 20 +++++++++++++++ .../logical_interconnect_group_spec.rb | 20 +++++++++++++++ 9 files changed, 143 insertions(+), 9 deletions(-) create mode 100644 lib/oneview-sdk/resource/api2000/c7000/lig_uplink_set.rb create mode 100644 lib/oneview-sdk/resource/api2000/c7000/logical_interconnect_group.rb create mode 100644 lib/oneview-sdk/resource/api2000/synergy/lig_uplink_set.rb create mode 100644 lib/oneview-sdk/resource/api2000/synergy/logical_interconnect_group.rb create mode 100644 spec/unit/resource/api2000/c7000/logical_interconnect_group_spec.rb create mode 100644 spec/unit/resource/api2000/synergy/logical_interconnect_group_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 31ea0829c..3c96c604f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This release extends support to OneView Rest API version 2000 (OneView v5.40) fo - Ethernet Network - FC Network - FCOE Network +- LIG Uplink Set +- Logical Interconnect Group - Network Set #### Bug fixes & Enhancements: diff --git a/endpoints-support.md b/endpoints-support.md index 14c576738..a2225e189 100644 --- a/endpoints-support.md +++ b/endpoints-support.md @@ -180,14 +180,14 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove) |/rest/logical-enclosures/{id}/support-dumps | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |/rest/logical-enclosures/{id}/updateFromGroup | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | **Logical Interconnect Groups** | -|/rest/logical-interconnect-groups | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnect-groups | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnect-groups/defaultSettings | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnect-groups/{id} | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnect-groups/{id} | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnect-groups/{id} | PATCH | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | -|/rest/logical-interconnect-groups/{id} | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnect-groups/{id}/settings | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnect-groups | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnect-groups | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnect-groups/defaultSettings | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnect-groups/{id} | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnect-groups/{id} | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnect-groups/{id} | PATCH | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | +|/rest/logical-interconnect-groups/{id} | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnect-groups/{id}/settings | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | **Logical Interconnects** | |/rest/logical-interconnects | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | |/rest/logical-interconnects/locations/interconnects | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | diff --git a/lib/oneview-sdk/resource/api2000.rb b/lib/oneview-sdk/resource/api2000.rb index e4ee5b00e..7839573c8 100644 --- a/lib/oneview-sdk/resource/api2000.rb +++ b/lib/oneview-sdk/resource/api2000.rb @@ -13,7 +13,7 @@ module OneviewSDK # Module for API v2000 module API2000 SUPPORTED_VARIANTS = %w[C7000 Synergy].freeze - DEFAULT_VARIANT = 'C7000'.freeze + DEFAULT_VARIANT = 'Synergy'.freeze @variant = DEFAULT_VARIANT @variant_updated = false # Whether or not the API variant has been set by the user diff --git a/lib/oneview-sdk/resource/api2000/c7000/lig_uplink_set.rb b/lib/oneview-sdk/resource/api2000/c7000/lig_uplink_set.rb new file mode 100644 index 000000000..3669b62df --- /dev/null +++ b/lib/oneview-sdk/resource/api2000/c7000/lig_uplink_set.rb @@ -0,0 +1,21 @@ +# (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 '../../api1600/c7000/lig_uplink_set' + +module OneviewSDK + module API1800 + module C7000 + class LIGUplinkSet < OneviewSDK::API1600::C7000::LIGUplinkSet + end + end + end +end diff --git a/lib/oneview-sdk/resource/api2000/c7000/logical_interconnect_group.rb b/lib/oneview-sdk/resource/api2000/c7000/logical_interconnect_group.rb new file mode 100644 index 000000000..5ff09586e --- /dev/null +++ b/lib/oneview-sdk/resource/api2000/c7000/logical_interconnect_group.rb @@ -0,0 +1,25 @@ +# (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 '../../api1800/c7000/logical_interconnect_group' + +module OneviewSDK + module API2000 + module C7000 + # Logical interconnect group resource implementation on API2000 C7000 + class LogicalInterconnectGroup < OneviewSDK::API1800::C7000::LogicalInterconnectGroup + def self.api_version + 2000 + end + end + end + end +end diff --git a/lib/oneview-sdk/resource/api2000/synergy/lig_uplink_set.rb b/lib/oneview-sdk/resource/api2000/synergy/lig_uplink_set.rb new file mode 100644 index 000000000..30c91b4db --- /dev/null +++ b/lib/oneview-sdk/resource/api2000/synergy/lig_uplink_set.rb @@ -0,0 +1,21 @@ +# (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 '../../api1600/synergy/lig_uplink_set' + +module OneviewSDK + module API1800 + module Synergy + class LIGUplinkSet < OneviewSDK::API1600::Synergy::LIGUplinkSet + end + end + end +end diff --git a/lib/oneview-sdk/resource/api2000/synergy/logical_interconnect_group.rb b/lib/oneview-sdk/resource/api2000/synergy/logical_interconnect_group.rb new file mode 100644 index 000000000..c747c2065 --- /dev/null +++ b/lib/oneview-sdk/resource/api2000/synergy/logical_interconnect_group.rb @@ -0,0 +1,25 @@ +# (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 '../../api1800/synergy/logical_interconnect_group' + +module OneviewSDK + module API2000 + module Synergy + # Logical interconnect group resource implementation for API2000 Synergy + class LogicalInterconnectGroup < OneviewSDK::API1800::Synergy::LogicalInterconnectGroup + def self.api_version + 2000 + end + end + end + end +end diff --git a/spec/unit/resource/api2000/c7000/logical_interconnect_group_spec.rb b/spec/unit/resource/api2000/c7000/logical_interconnect_group_spec.rb new file mode 100644 index 000000000..f42d8ce62 --- /dev/null +++ b/spec/unit/resource/api2000/c7000/logical_interconnect_group_spec.rb @@ -0,0 +1,20 @@ +# (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 'spec_helper' + +RSpec.describe OneviewSDK::API2000::C7000::LogicalInterconnectGroup do + include_context 'shared context' + + it 'inherits from OneviewSDK::API1800::C7000::LogicalInterconnectGroup' do + expect(described_class).to be < OneviewSDK::API1800::C7000::LogicalInterconnectGroup + end +end diff --git a/spec/unit/resource/api2000/synergy/logical_interconnect_group_spec.rb b/spec/unit/resource/api2000/synergy/logical_interconnect_group_spec.rb new file mode 100644 index 000000000..a58b238a7 --- /dev/null +++ b/spec/unit/resource/api2000/synergy/logical_interconnect_group_spec.rb @@ -0,0 +1,20 @@ +# (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 'spec_helper' + +RSpec.describe OneviewSDK::API2000::Synergy::LogicalInterconnectGroup do + include_context 'shared context' + + it 'inherits from OneviewSDK::API1800::Synergy::LogicalInterconnectGroup' do + expect(described_class).to be < OneviewSDK::API1800::Synergy::LogicalInterconnectGroup + end +end From d0aba93415450baa72d91feb4fa0b446b9600657 Mon Sep 17 00:00:00 2001 From: yuvirani Date: Thu, 10 Sep 2020 09:53:04 +0000 Subject: [PATCH 2/3] Change variant to synergy --- examples/shared_samples/logical_interconnect_group.rb | 3 +++ lib/oneview-sdk/resource/api2000.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/shared_samples/logical_interconnect_group.rb b/examples/shared_samples/logical_interconnect_group.rb index 5631952ab..bedab7ed9 100644 --- a/examples/shared_samples/logical_interconnect_group.rb +++ b/examples/shared_samples/logical_interconnect_group.rb @@ -28,6 +28,9 @@ variant = OneviewSDK.const_get("API#{@client.api_version}").variant unless @client.api_version < 300 +# To set variant to Synergy as the default variant is C7000 +variant = 'Synergy' + # Ethernet network class used in this sample ethernet_class = OneviewSDK.resource_named('EthernetNetwork', @client.api_version) # Ethernet network class used in this sample diff --git a/lib/oneview-sdk/resource/api2000.rb b/lib/oneview-sdk/resource/api2000.rb index 7839573c8..e4ee5b00e 100644 --- a/lib/oneview-sdk/resource/api2000.rb +++ b/lib/oneview-sdk/resource/api2000.rb @@ -13,7 +13,7 @@ module OneviewSDK # Module for API v2000 module API2000 SUPPORTED_VARIANTS = %w[C7000 Synergy].freeze - DEFAULT_VARIANT = 'Synergy'.freeze + DEFAULT_VARIANT = 'C7000'.freeze @variant = DEFAULT_VARIANT @variant_updated = false # Whether or not the API variant has been set by the user From 7a63f615364f4d59bfab3c4afd81e1bc6915b87d Mon Sep 17 00:00:00 2001 From: yuvirani Date: Thu, 10 Sep 2020 13:03:15 +0000 Subject: [PATCH 3/3] Fix enclosure type for synergy --- examples/shared_samples/logical_interconnect_group.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/shared_samples/logical_interconnect_group.rb b/examples/shared_samples/logical_interconnect_group.rb index bedab7ed9..d13cc2019 100644 --- a/examples/shared_samples/logical_interconnect_group.rb +++ b/examples/shared_samples/logical_interconnect_group.rb @@ -26,7 +26,7 @@ # Resource Class used in this sample lig_class = OneviewSDK.resource_named('LogicalInterconnectGroup', @client.api_version) -variant = OneviewSDK.const_get("API#{@client.api_version}").variant unless @client.api_version < 300 +# variant = OneviewSDK.const_get("API#{@client.api_version}").variant unless @client.api_version < 300 # To set variant to Synergy as the default variant is C7000 variant = 'Synergy' @@ -121,6 +121,7 @@ if variant == 'Synergy' lig['redundancyType'] = 'Redundant' lig['interconnectBaySet'] = 3 + lig['enclosureType'] = 'SY12000' # Adds the following interconnects to the bays 3 and 6 with an Interconnect Type, respectively lig.add_interconnect(3, VIRTUAL_CONNECT_SE_40_SYNERGY) @@ -164,10 +165,11 @@ puts "#{type} was updated successfully:" puts lig.data +puts eth01['uri'] if variant == 'Synergy' puts "\nAdding an internal network with uri = #{eth01['uri']}" lig.retrieve! - lig.add_internal_network(eth01) + lig['internalNetworkUris'] = [eth01['uri']] lig.update lig.retrieve! puts "\nAdded an internal network with uri = #{eth01['uri']} successfully."