Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from HewlettPackard/API1800_serverhardware
API1800 support for server hardware and profile
- Loading branch information
Showing
22 changed files
with
470 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# (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/server_hardware' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module C7000 | ||
# Server Hardware resource implementation on API1800 C7000 | ||
class ServerHardware < OneviewSDK::API1600::C7000::ServerHardware | ||
# Create a resource object, associate it with a client, and set its properties. | ||
# @param [OneviewSDK::Client] client The client object for the OneView appliance | ||
# @param [Hash] params The options for this resource (key-value pairs) | ||
# @param [Integer] api_ver The api version to use when interracting with this resource. | ||
def initialize(client, params = {}, api_ver = nil) | ||
@data ||= {} | ||
# Default values | ||
@data['type'] ||= 'server-hardware-12' | ||
super | ||
end | ||
|
||
# Gets the local storage resource for the server, including storage controllers, | ||
# storage enclosures, physical drives, and logical drives. | ||
# @return [Hash] Contains the actual subresource data collected from the Management Processor | ||
def get_local_storage | ||
ensure_client && ensure_uri | ||
response = @client.rest_get(@data['uri'] + '/localStorage') | ||
@client.response_handler(response) | ||
end | ||
|
||
# Gets the updated version 2 local storage resource for the server, including storage controllers, | ||
# drives, and volumes. Starting with Gen 10 Plus, certain storage adapters will | ||
# provide /localStorageV2 instead of (or in addition to) /localStorage | ||
# @return [Hash] Contains the storage data based on the following schema. | ||
def get_local_storagev2 | ||
ensure_client && ensure_uri | ||
response = @client.rest_get(@data['uri'] + '/localStorageV2') | ||
@client.response_handler(response) | ||
end | ||
end | ||
end | ||
end | ||
end |
25 changes: 25 additions & 0 deletions
25
lib/oneview-sdk/resource/api1800/c7000/server_hardware_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 '../../api1600/c7000/server_hardware_type' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module C7000 | ||
# Server hardware type resource implementation for API1800 C7000 | ||
class ServerHardwareType < OneviewSDK::API1600::C7000::ServerHardwareType | ||
def self.api_version | ||
1800 | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '../../api1600/c7000/server_profile' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module C7000 | ||
# Server Profile resource implementation on API1800 C7000 | ||
class ServerProfile < OneviewSDK::API1600::C7000::ServerProfile | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
lib/oneview-sdk/resource/api1800/c7000/server_profile_template.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '../../api1600/c7000/server_profile_template' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module C7000 | ||
# Server Profile Template resource implementation on API1800 C7000 | ||
class ServerProfileTemplate < OneviewSDK::API1600::C7000::ServerProfileTemplate | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
lib/oneview-sdk/resource/api1800/synergy/server_hardware.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '../c7000/server_hardware' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module Synergy | ||
# Server Hardware resource implementation on API1800 Synergy | ||
class ServerHardware < OneviewSDK::API1800::C7000::ServerHardware | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
lib/oneview-sdk/resource/api1800/synergy/server_hardware_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '../c7000/server_hardware_type' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module Synergy | ||
# Server hardware type resource implementation for API1800 Synergy | ||
class ServerHardwareType < OneviewSDK::API1800::C7000::ServerHardwareType | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
lib/oneview-sdk/resource/api1800/synergy/server_profile.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '../c7000/server_profile' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module Synergy | ||
# Server profile resource implementation for API1800 Synergy | ||
class ServerProfile < OneviewSDK::API1800::C7000::ServerProfile | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
lib/oneview-sdk/resource/api1800/synergy/server_profile_template.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '../c7000/server_profile_template' | ||
|
||
module OneviewSDK | ||
module API1800 | ||
module Synergy | ||
# Server Profile Template resource implementation for API1800 Synergy | ||
class ServerProfileTemplate < OneviewSDK::API1800::C7000::ServerProfileTemplate | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# (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::API1800::C7000::ServerHardware do | ||
include_context 'shared context' | ||
|
||
it 'inherits from OneviewSDK::API1600::C7000::ServerHardware' do | ||
expect(described_class).to be < OneviewSDK::API1600::C7000::ServerHardware | ||
end | ||
|
||
before(:each) do | ||
@item = OneviewSDK::API1800::C7000::ServerHardware.new(@client_1800, uri: '/rest/fake') | ||
end | ||
|
||
describe '#initialize' do | ||
it 'sets the type correctly' do | ||
expect(@item[:type]).to eq('server-hardware-12') | ||
end | ||
end | ||
|
||
describe '#get_local_storage' do | ||
it 'Makes a GET call on local storage' do | ||
expect(@client_1800).to receive(:rest_get).with(@item['uri'] + '/localStorage') | ||
.and_return(FakeResponse.new({})) | ||
@item.get_local_storage | ||
end | ||
end | ||
|
||
describe '#get_local_storagev2' do | ||
it 'Makes a GET call on local storagev2' do | ||
expect(@client_1800).to receive(:rest_get).with(@item['uri'] + '/localStorageV2') | ||
.and_return(FakeResponse.new({})) | ||
@item.get_local_storagev2 | ||
end | ||
end | ||
end |
Oops, something went wrong.