Skip to content

Commit

Permalink
Merge pull request #149 from Rainforest/bugfix/managed-san
Browse files Browse the repository at this point in the history
Bugfix/managed san
  • Loading branch information
Thiago Miotto committed Jul 29, 2016
2 parents d567820 + e98eeed commit 05e7494
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 12 deletions.
38 changes: 38 additions & 0 deletions spec/integration/resource/managed_san/create_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# (C) Copyright 2016 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'

klass = OneviewSDK::ManagedSAN
RSpec.describe klass, integration: true, type: CREATE, sequence: seq(klass) do
include_context 'integration context'

let(:fc_options) do
{
connectionTemplateUri: nil,
autoLoginRedistribution: true,
fabricType: 'FabricAttach'
}
end

describe 'Import SANs' do
it 'create fc networks' do
OneviewSDK::ManagedSAN.find_by($client, deviceManagerName: $secrets['san_manager_ip']).each do |san|
options = fc_options
options[:name] = "FC_#{san['name']}"
options[:managedSanUri] = san['uri']
fc = OneviewSDK::FCNetwork.new($client, options)
fc.create
expect(fc['uri']).to be
end
end
end
end
27 changes: 27 additions & 0 deletions spec/integration/resource/managed_san/delete_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# (C) Copyright 2016 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'

klass = OneviewSDK::ManagedSAN
RSpec.describe klass, integration: true, type: DELETE, sequence: rseq(klass) do
include_context 'integration context'

describe 'Remove FC Networks' do
it 'Remove' do
OneviewSDK::ManagedSAN.find_by($client, deviceManagerName: $secrets['san_manager_ip']).each do |san|
fc = OneviewSDK::FCNetwork.new($client, name: "FC_#{san['name']}")
fc.retrieve!
fc.delete
end
end
end
end
27 changes: 16 additions & 11 deletions spec/integration/resource/managed_san/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@
include_context 'integration context'

before :each do
@item = OneviewSDK::ManagedSAN.find_by($client, {}).first
@item = OneviewSDK::ManagedSAN.find_by($client, state: 'Managed').first
end

describe 'Check if SANs were imported' do
it 'check if SAN was imported' do
OneviewSDK::ManagedSAN.find_by($client, deviceManagerName: $secrets['san_manager_ip']).each do |san|
expect(san['state']).to eq('Managed')
end
end
end

describe '#get_endpoints' do
Expand All @@ -34,19 +42,16 @@
it 'Update public attributes' do
attributes = [
{
name: 'MetaSan',
value: 'Neon SAN',
valueType: 'String',
valueFormat: 'None'
'name' => 'MetaSan',
'value' => 'Neon SAN',
'valueType' => 'String',
'valueFormat' => 'None',
'displayName' => nil,
'required' => false
}
]
expect { @item.set_public_attributes(attributes) }.not_to raise_error
item_attributes = @item['publicAttributes']
attributes.each_with_index do |attr, index|
attr.each do |key, value|
expect(value).to eq(item_attributes[index][key.to_s])
end
end
expect(@item['publicAttributes']).to eq(attributes)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/resource/san_manager/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

describe '#self.get_default_connection_info' do
it 'Retrieve connection info for provider' do
expect { OneviewSDK::SANManager.get_default_connection_info($client, SAN_PROVIDER1_NAME) }
expect { OneviewSDK::SANManager.get_default_connection_info($client, SAN_PROVIDER1_NAME) }.to_not raise_error
end
end
end
Binary file not shown.

0 comments on commit 05e7494

Please sign in to comment.