oneview-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +2 -0
- data/.gitignore +29 -0
- data/.rubocop.yml +73 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +2 -0
- data/LICENSE +201 -0
- data/README.md +317 -0
- data/Rakefile +90 -0
- data/bin/oneview-sdk-ruby +4 -0
- data/lib/oneview-sdk.rb +9 -0
- data/lib/oneview-sdk/cli.rb +407 -0
- data/lib/oneview-sdk/client.rb +163 -0
- data/lib/oneview-sdk/config_loader.rb +20 -0
- data/lib/oneview-sdk/resource.rb +313 -0
- data/lib/oneview-sdk/resource/enclosure.rb +169 -0
- data/lib/oneview-sdk/resource/enclosure_group.rb +98 -0
- data/lib/oneview-sdk/resource/ethernet_network.rb +60 -0
- data/lib/oneview-sdk/resource/fc_network.rb +31 -0
- data/lib/oneview-sdk/resource/fcoe_network.rb +25 -0
- data/lib/oneview-sdk/resource/firmware_bundle.rb +37 -0
- data/lib/oneview-sdk/resource/firmware_driver.rb +21 -0
- data/lib/oneview-sdk/resource/interconnect.rb +87 -0
- data/lib/oneview-sdk/resource/lig_uplink_set.rb +86 -0
- data/lib/oneview-sdk/resource/logical_enclosure.rb +84 -0
- data/lib/oneview-sdk/resource/logical_interconnect.rb +283 -0
- data/lib/oneview-sdk/resource/logical_interconnect_group.rb +92 -0
- data/lib/oneview-sdk/resource/server_hardware.rb +88 -0
- data/lib/oneview-sdk/resource/server_hardware_type.rb +27 -0
- data/lib/oneview-sdk/resource/server_profile.rb +37 -0
- data/lib/oneview-sdk/resource/server_profile_template.rb +24 -0
- data/lib/oneview-sdk/resource/storage_pool.rb +41 -0
- data/lib/oneview-sdk/resource/storage_system.rb +63 -0
- data/lib/oneview-sdk/resource/uplink_set.rb +119 -0
- data/lib/oneview-sdk/resource/volume.rb +188 -0
- data/lib/oneview-sdk/resource/volume_snapshot.rb +27 -0
- data/lib/oneview-sdk/resource/volume_template.rb +106 -0
- data/lib/oneview-sdk/rest.rb +163 -0
- data/lib/oneview-sdk/ssl_helper.rb +75 -0
- data/lib/oneview-sdk/version.rb +4 -0
- data/oneview-sdk.gemspec +31 -0
- metadata +204 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Logical enclosure group resource implementation
|
3
|
+
class LogicalInterconnectGroup < Resource
|
4
|
+
BASE_URI = '/rest/logical-interconnect-groups'.freeze
|
5
|
+
attr_reader :bay_count
|
6
|
+
|
7
|
+
def initialize(client, params = {}, api_ver = nil)
|
8
|
+
super
|
9
|
+
# Default values:
|
10
|
+
@data['enclosureType'] ||= 'C7000'
|
11
|
+
@data['state'] ||= 'Active'
|
12
|
+
@data['uplinkSets'] ||= []
|
13
|
+
@data['type'] ||= 'logical-interconnect-groupV3'
|
14
|
+
@data['interconnectMapTemplate'] ||= {}
|
15
|
+
@data['interconnectMapTemplate']['interconnectMapEntryTemplates'] ||= []
|
16
|
+
|
17
|
+
# User friendly values:
|
18
|
+
@bay_count = 8
|
19
|
+
|
20
|
+
# Create all entries if empty
|
21
|
+
parse_interconnect_map_template if @data['interconnectMapTemplate']['interconnectMapEntryTemplates'] == []
|
22
|
+
end
|
23
|
+
|
24
|
+
# Add an interconnect
|
25
|
+
# @param [Fixnum] bay Bay number
|
26
|
+
# @param [String] type Interconnect type
|
27
|
+
def add_interconnect(bay, type)
|
28
|
+
@data['interconnectMapTemplate']['interconnectMapEntryTemplates'].each do |entry|
|
29
|
+
entry['logicalLocation']['locationEntries'].each do |location|
|
30
|
+
if location['type'] == 'Bay' && location['relativeValue'] == bay
|
31
|
+
entry['permittedInterconnectTypeUri'] = OneviewSDK::Interconnect.get_type(@client, type)['uri']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
rescue StandardError
|
36
|
+
list = OneviewSDK::Interconnect.get_types(@client).map { |t| t['name'] }
|
37
|
+
raise "Interconnect type #{type} not found! Supported types: #{list}"
|
38
|
+
end
|
39
|
+
|
40
|
+
# Add an uplink set
|
41
|
+
# @param [OneviewSDK::LIGUplinkSet] uplink_set
|
42
|
+
def add_uplink_set(uplink_set)
|
43
|
+
@data['uplinkSets'] << uplink_set.data
|
44
|
+
end
|
45
|
+
|
46
|
+
# Get the default settings
|
47
|
+
def get_default_settings
|
48
|
+
get_uri = self.class::BASE_URI + '/defaultSettings'
|
49
|
+
response = @client.rest_get(get_uri, @api_version)
|
50
|
+
@client.response_handler(response)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Get settings
|
54
|
+
def get_settings
|
55
|
+
get_uri = @data['uri'] + '/settings'
|
56
|
+
response = @client.rest_get(get_uri, @api_version)
|
57
|
+
@client.response_handler(response)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Saves the current data attributes to the Logical Interconnect Group
|
61
|
+
# @return Updated instance of the Logical Interconnect Group
|
62
|
+
def update(attributes = {})
|
63
|
+
set_all(attributes)
|
64
|
+
update_options = {
|
65
|
+
'If-Match' => @data.delete('eTag'),
|
66
|
+
'Body' => @data
|
67
|
+
}
|
68
|
+
response = @client.rest_put(@data['uri'], update_options, @api_version)
|
69
|
+
body = @client.response_handler(response)
|
70
|
+
set_all(body)
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def parse_interconnect_map_template
|
76
|
+
1.upto(@bay_count) do |bay_number|
|
77
|
+
entry = {
|
78
|
+
'logicalDownlinkUri' => nil,
|
79
|
+
'logicalLocation' => {
|
80
|
+
'locationEntries' => [
|
81
|
+
{ 'relativeValue' => bay_number, 'type' => 'Bay' },
|
82
|
+
{ 'relativeValue' => 1, 'type' => 'Enclosure' }
|
83
|
+
]
|
84
|
+
},
|
85
|
+
'permittedInterconnectTypeUri' => nil
|
86
|
+
}
|
87
|
+
@data['interconnectMapTemplate']['interconnectMapEntryTemplates'] << entry
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Server hardware resource implementation
|
3
|
+
class ServerHardware < Resource
|
4
|
+
BASE_URI = '/rest/server-hardware'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values
|
9
|
+
@data['type'] ||= 'server-hardware-4'
|
10
|
+
end
|
11
|
+
|
12
|
+
# @!group Validates
|
13
|
+
|
14
|
+
VALID_LICENSING_INTENTS = ['OneView', 'OneViewNoiLO', 'OneViewStandard', nil].freeze
|
15
|
+
def validate_licensingIntent(value)
|
16
|
+
fail 'Invalid licensingIntent' unless VALID_LICENSING_INTENTS.include?(value)
|
17
|
+
end
|
18
|
+
|
19
|
+
VALID_CONFIGURATION_STATES = ['Managed', 'Monitored', nil].freeze
|
20
|
+
def validate_configurationState(value)
|
21
|
+
fail 'Invalid configurationState' unless VALID_CONFIGURATION_STATES.include?(value)
|
22
|
+
end
|
23
|
+
|
24
|
+
# @!endgroup
|
25
|
+
|
26
|
+
def create
|
27
|
+
ensure_client
|
28
|
+
required_attributes = %w(hostname username password licensingIntent)
|
29
|
+
required_attributes.each { |k| fail "Missing required attribute: '#{k}'" unless @data.key?(k) }
|
30
|
+
|
31
|
+
optional_attrs = %w(configurationState force restore)
|
32
|
+
temp_data = @data.select { |k, _v| required_attributes.include?(k) || optional_attrs.include?(k) }
|
33
|
+
response = @client.rest_post(self.class::BASE_URI, { 'body' => temp_data }, @api_version)
|
34
|
+
body = @client.response_handler(response)
|
35
|
+
set_all(body)
|
36
|
+
%w(username password hostname).each { |k| @data.delete(k) } # These are no longer needed
|
37
|
+
self
|
38
|
+
end
|
39
|
+
|
40
|
+
def update(*)
|
41
|
+
fail 'Method not available for this resource!'
|
42
|
+
end
|
43
|
+
|
44
|
+
# Power on the server hardware
|
45
|
+
# @param [String] force Use 'PressAndHold' action
|
46
|
+
# @return [Boolean] Whether or not server was powered on
|
47
|
+
def power_on(force = false)
|
48
|
+
set_power_state('on', force)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Power off the server hardware
|
52
|
+
# @param [String] force Use 'PressAndHold' action
|
53
|
+
# @return [Boolean] Whether or not server was powered off
|
54
|
+
def power_off(force = false)
|
55
|
+
set_power_state('off', force)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
# Set power state. Takes into consideration the current state and does the right thing
|
61
|
+
def set_power_state(state, force)
|
62
|
+
refresh
|
63
|
+
return true if @data['powerState'].downcase == state
|
64
|
+
@logger.debug "Powering #{state} server hardware '#{@data['name']}'. Current state: '#{@data['powerState']}'"
|
65
|
+
|
66
|
+
action = 'PressAndHold' if force
|
67
|
+
action ||= case @data['powerState'].downcase
|
68
|
+
when 'poweringon', 'poweringoff' # Wait
|
69
|
+
sleep 5
|
70
|
+
return set_power_state(state, force)
|
71
|
+
when 'resetting'
|
72
|
+
if state == 'on' # Wait
|
73
|
+
sleep 5
|
74
|
+
return set_power_state(state, force)
|
75
|
+
end
|
76
|
+
'PressAndHold'
|
77
|
+
when 'unknown' then state == 'on' ? 'ColdBoot' : 'PressAndHold'
|
78
|
+
else 'MomentaryPress'
|
79
|
+
end
|
80
|
+
options = { 'body' => { powerState: state.capitalize, powerControl: action } }
|
81
|
+
response = @client.rest_put("#{@data['uri']}/powerState", options)
|
82
|
+
body = @client.response_handler(response)
|
83
|
+
set_all(body)
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Server hardware type resource implementation
|
3
|
+
class ServerHardwareType < Resource
|
4
|
+
BASE_URI = '/rest/server-hardware-types'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values
|
9
|
+
@data['type'] ||= 'server-hardware-type-4'
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
unavailable_method
|
14
|
+
end
|
15
|
+
|
16
|
+
def update(attributes = {})
|
17
|
+
set_all(attributes)
|
18
|
+
ensure_client && ensure_uri
|
19
|
+
data = @data.select { |k, _v| %w(name description).include?(k) }
|
20
|
+
data['description'] ||= ''
|
21
|
+
response = @client.rest_put(@data['uri'], { 'body' => data }, @api_version)
|
22
|
+
@client.response_handler(response)
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Server profile resource implementation
|
3
|
+
class ServerProfile < Resource
|
4
|
+
BASE_URI = '/rest/server-profiles'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values
|
9
|
+
@data['type'] ||= 'ServerProfileV5'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Get available server hardware for this template
|
13
|
+
# @return [Array<OneviewSDK::ServerHardware>] Array of ServerHardware resources that matches this
|
14
|
+
# profile's server hardware type and enclosure group and who's state is 'NoProfileApplied'
|
15
|
+
def available_hardware
|
16
|
+
ensure_client
|
17
|
+
fail 'Must set @data[\'serverHardwareTypeUri\']' unless @data['serverHardwareTypeUri']
|
18
|
+
fail 'Must set @data[\'enclosureGroupUri\']' unless @data['enclosureGroupUri']
|
19
|
+
params = {
|
20
|
+
state: 'NoProfileApplied',
|
21
|
+
serverHardwareTypeUri: @data['serverHardwareTypeUri'],
|
22
|
+
serverGroupUri: @data['enclosureGroupUri']
|
23
|
+
}
|
24
|
+
OneviewSDK::ServerHardware.find_by(@client, params)
|
25
|
+
rescue StandardError => e
|
26
|
+
raise "Failed to get available hardware. Message: #{e.message}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate_serverProfileTemplateUri(*)
|
30
|
+
fail "Templates only exist on api version >= 200. Resource version: #{@api_version}" if @api_version < 200
|
31
|
+
end
|
32
|
+
|
33
|
+
def validate_templateCompliance(*)
|
34
|
+
fail "Templates only exist on api version >= 200. Resource version: #{@api_version}" if @api_version < 200
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Server profile template resource implementation
|
3
|
+
class ServerProfileTemplate < Resource
|
4
|
+
BASE_URI = '/rest/server-profile-templates'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values
|
9
|
+
@data['type'] ||= 'ServerProfileTemplateV1'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Create ServerProfile using this template
|
13
|
+
# @param [String] name Name of new server profile
|
14
|
+
# @return [ServerProfile] New server profile from template.
|
15
|
+
# Temporary object only; call .create to actually create resource on OneView.
|
16
|
+
def new_profile(name = nil)
|
17
|
+
ensure_client && ensure_uri
|
18
|
+
options = @client.rest_get("#{@data['uri']}/new-profile")
|
19
|
+
profile = OneviewSDK::ServerProfile.new(@client, options)
|
20
|
+
profile[:name] = name if name && name.size > 0
|
21
|
+
profile
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Storage pool resource implementation
|
3
|
+
class StoragePool < Resource
|
4
|
+
BASE_URI = '/rest/storage-pools'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values:
|
9
|
+
@data['type'] ||= 'StoragePoolV2'
|
10
|
+
end
|
11
|
+
|
12
|
+
# @!group Validates
|
13
|
+
|
14
|
+
VALID_REFRESH_STATES = %w(NotRefreshing RefreshFailed RefreshPending Refreshing).freeze
|
15
|
+
# Validate refreshState
|
16
|
+
# @param [String] value NotRefreshing, RefreshFailed, RefreshPending, Refreshing
|
17
|
+
def validate_refreshState(value)
|
18
|
+
fail 'Invalid refresh state' unless VALID_REFRESH_STATES.include?(value)
|
19
|
+
end
|
20
|
+
|
21
|
+
VALID_STATUSES = %w(OK Disabled Warning Critical Unknown).freeze
|
22
|
+
# Validate status
|
23
|
+
# @param [String] value OK, Disabled, Warning, Critical, Unknown
|
24
|
+
def validate_status(value)
|
25
|
+
fail 'Invalid status' unless VALID_STATUSES.include?(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
# @!endgroup
|
29
|
+
|
30
|
+
# Set storage system
|
31
|
+
# @param [StorageSystem] storage_system
|
32
|
+
def set_storage_system(storage_system)
|
33
|
+
set('storageSystemUri', storage_system['uri'])
|
34
|
+
end
|
35
|
+
|
36
|
+
def update
|
37
|
+
unavailable_method
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Storage system resource implementation
|
3
|
+
class StorageSystem < Resource
|
4
|
+
BASE_URI = '/rest/storage-systems'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values:
|
9
|
+
@data['type'] ||= 'StorageSystemV3'
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
ensure_client
|
14
|
+
task = @client.rest_post(self.class::BASE_URI, { 'body' => self['credentials'] }, @api_version)
|
15
|
+
temp = @data.clone
|
16
|
+
task = @client.wait_for(task['uri'] || task['location'])
|
17
|
+
@data['uri'] = task['associatedResource']['resourceUri']
|
18
|
+
refresh
|
19
|
+
temp.delete('credentials')
|
20
|
+
update(temp)
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def retrieve!
|
25
|
+
if @data['name']
|
26
|
+
super
|
27
|
+
else
|
28
|
+
ip_hostname = self['credentials'][:ip_hostname] || self['credentials']['ip_hostname']
|
29
|
+
results = self.class.find_by(@client, credentials: { ip_hostname: ip_hostname })
|
30
|
+
return false unless results.size == 1
|
31
|
+
set_all(results[0].data)
|
32
|
+
true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Get host types for storage system resource
|
37
|
+
# @param [Client] client client handle REST calls to OV instance
|
38
|
+
# @return [String] response body
|
39
|
+
def self.get_host_types(client)
|
40
|
+
response = client.rest_get(BASE_URI + '/host-types')
|
41
|
+
response.body
|
42
|
+
end
|
43
|
+
|
44
|
+
# List of storage pools
|
45
|
+
def get_storage_pools
|
46
|
+
response = @client.rest_get(@data['uri'] + '/storage-pools')
|
47
|
+
response.body
|
48
|
+
end
|
49
|
+
|
50
|
+
# List of all managed target ports for the specified storage system
|
51
|
+
# or only the one specified
|
52
|
+
# @param [String] port Target port
|
53
|
+
def get_managed_ports(port = nil)
|
54
|
+
response = if port.nil?
|
55
|
+
@client.rest_get("#{@data['uri']}/managedPorts")
|
56
|
+
else
|
57
|
+
@client.rest_get("#{@data['uri']}/managedPorts/#{port}")
|
58
|
+
end
|
59
|
+
response.body
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Uplink set resource implementation
|
3
|
+
class UplinkSet < Resource
|
4
|
+
BASE_URI = '/rest/uplink-sets'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values
|
9
|
+
@data['fcNetworkUris'] ||= []
|
10
|
+
@data['fcoeNetworkUris'] ||= []
|
11
|
+
@data['networkUris'] ||= []
|
12
|
+
@data['portConfigInfos'] ||= []
|
13
|
+
@data['primaryPortLocation'] = nil
|
14
|
+
@data['type'] ||= 'uplink-setV3'
|
15
|
+
end
|
16
|
+
|
17
|
+
# @!group Validates
|
18
|
+
|
19
|
+
VALID_ETHERNET_NETWORK_TYPES = %w(NotApplicable Tagged Tunnel Unknown Untagged).freeze
|
20
|
+
# Validate ethernetNetworkType
|
21
|
+
# @param [String] value NotApplicable, Tagged, Tunnel, Unknown, Untagged
|
22
|
+
def validate_ethernetNetworkType(value)
|
23
|
+
fail 'Invalid ethernet network type' unless VALID_ETHERNET_NETWORK_TYPES.include?(value)
|
24
|
+
end
|
25
|
+
|
26
|
+
VALID_LACP_TIMERS = %w(Short Long).freeze
|
27
|
+
# Validate lacpTimer
|
28
|
+
# @param [String] value Short, Long
|
29
|
+
def validate_lacpTimer(value)
|
30
|
+
return if value.to_s.empty?
|
31
|
+
fail 'Invalid lacp timer' unless %w(Short Long).include?(value)
|
32
|
+
end
|
33
|
+
|
34
|
+
VALID_MANUAL_LOGIN_REDISTRIBUTION_STATES = %w(Distributed Distributing DistributionFailed NotSupported Supported).freeze
|
35
|
+
# Validate manualLoginRedistributionState
|
36
|
+
# @param [String] value Distributed, Distributing, DistributionFailed, NotSupported, Supported
|
37
|
+
def validate_manualLoginRedistributionState(value)
|
38
|
+
fail 'Invalid manual login redistribution state' unless VALID_MANUAL_LOGIN_REDISTRIBUTION_STATES.include?(value)
|
39
|
+
end
|
40
|
+
|
41
|
+
VALID_NETWORK_TYPES = %w(Ethernet FibreChannel).freeze
|
42
|
+
# Validate networkType
|
43
|
+
# @param [String] value Ethernet, FibreChannel
|
44
|
+
def validate_networkType(value)
|
45
|
+
fail 'Invalid network type' unless VALID_NETWORK_TYPES.include?(value)
|
46
|
+
end
|
47
|
+
|
48
|
+
VALID_LOCATION_ENTRIES_TYPES = %w(Bay Enclosure Ip Password Port StackingDomainId StackingMemberId UserId).freeze
|
49
|
+
# Validate locationEntriesType
|
50
|
+
# @param [String] value Bay Enclosure Ip Password Port StackingDomainId StackingMemberId UserId
|
51
|
+
def validate_locationEntriesType(value)
|
52
|
+
fail 'Invalid location entry type' unless VALID_LOCATION_ENTRIES_TYPES.include?(value)
|
53
|
+
end
|
54
|
+
|
55
|
+
VALID_REACHABILITIES = ['NotReachable', 'Reachable', 'RedundantlyReachable', 'Unknown', nil].freeze
|
56
|
+
# Validate ethernetNetworkType request
|
57
|
+
# @param [String] value NotReachable Reachable RedundantlyReachable Unknown
|
58
|
+
def validate_reachability(value)
|
59
|
+
fail 'Invalid reachability' unless VALID_REACHABILITIES.include?(value)
|
60
|
+
end
|
61
|
+
|
62
|
+
VALID_STATUSES = %w(OK Disabled Warning Critical Unknown).freeze
|
63
|
+
# Validate ethernetNetworkType request
|
64
|
+
# @param [String] value OK Disabled Warning Critical Unknown
|
65
|
+
def validate_status(value)
|
66
|
+
fail 'Invalid status' unless VALID_STATUSES.include?(value)
|
67
|
+
end
|
68
|
+
|
69
|
+
# @!endgroup
|
70
|
+
|
71
|
+
# Add portConfigInfos to the array
|
72
|
+
# @param [String] portUri
|
73
|
+
# @param [String] speed
|
74
|
+
# @param [Hash] locationEntries
|
75
|
+
def add_port_config(portUri, speed, locationEntries)
|
76
|
+
entry = {
|
77
|
+
'portUri' => portUri,
|
78
|
+
'desiredSpeed' => speed,
|
79
|
+
'location' => {
|
80
|
+
'locationEntries' => locationEntries
|
81
|
+
}
|
82
|
+
}
|
83
|
+
@data['portConfigInfos'] << entry
|
84
|
+
end
|
85
|
+
|
86
|
+
# Set logical interconnect uri
|
87
|
+
# @param [OneviewSDK::LogicalInterconnect, Hash] logical_interconnect
|
88
|
+
def set_logical_interconnect(logical_interconnect)
|
89
|
+
uri = logical_interconnect[:uri] || logical_interconnect['uri']
|
90
|
+
fail 'Invalid object' unless uri
|
91
|
+
@data['logicalInterconnectUri'] = uri
|
92
|
+
end
|
93
|
+
|
94
|
+
# Add an uri to networkUris array
|
95
|
+
# @param [OneviewSDK::EthernetNetwork, Hash] network
|
96
|
+
def add_network(network)
|
97
|
+
uri = network[:uri] || network['uri']
|
98
|
+
fail 'Invalid object' unless uri
|
99
|
+
@data['networkUris'].push(uri)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Add an uri to fcnetworkUris array
|
103
|
+
# @param [OneviewSDK::FCNetwork, Hash] network must accept hash syntax
|
104
|
+
def add_fcnetwork(network)
|
105
|
+
uri = network[:uri] || network['uri']
|
106
|
+
fail 'Invalid object' unless uri
|
107
|
+
@data['fcNetworkUris'].push(uri)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Add an uri to fcoenetworkUris array
|
111
|
+
# @param [OneviewSDK::FCoENetwork, Hash] network must accept hash syntax
|
112
|
+
def add_fcoenetwork(network)
|
113
|
+
uri = network[:uri] || network['uri']
|
114
|
+
fail 'Invalid object' unless uri
|
115
|
+
@data['fcoeNetworkUris'].push(uri)
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
end
|