Class: OneviewSDK::UplinkSet
- Defined in:
- lib/oneview-sdk/resource/uplink_set.rb
Overview
Uplink set resource implementation
Validates collapse
- VALID_ETHERNET_NETWORK_TYPES =
%w(NotApplicable Tagged Tunnel Unknown Untagged).freeze
- VALID_LACP_TIMERS =
%w(Short Long).freeze
- VALID_MANUAL_LOGIN_REDISTRIBUTION_STATES =
%w(Distributed Distributing DistributionFailed NotSupported Supported).freeze
- VALID_NETWORK_TYPES =
%w(Ethernet FibreChannel).freeze
- VALID_LOCATION_ENTRIES_TYPES =
%w(Bay Enclosure Ip Password Port StackingDomainId StackingMemberId UserId).freeze
- VALID_REACHABILITIES =
['NotReachable', 'Reachable', 'RedundantlyReachable', 'Unknown', nil].freeze
- VALID_STATUSES =
%w(OK Disabled Warning Critical Unknown).freeze
Constant Summary collapse
- BASE_URI =
'/rest/uplink-sets'.freeze
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Validates collapse
-
#validate_ethernetNetworkType(value) ⇒ Object
Validate ethernetNetworkType.
-
#validate_lacpTimer(value) ⇒ Object
Validate lacpTimer.
-
#validate_locationEntriesType(value) ⇒ Object
Validate locationEntriesType.
-
#validate_manualLoginRedistributionState(value) ⇒ Object
Validate manualLoginRedistributionState.
-
#validate_networkType(value) ⇒ Object
Validate networkType.
-
#validate_reachability(value) ⇒ Object
Validate ethernetNetworkType request.
-
#validate_status(value) ⇒ Object
Validate ethernetNetworkType request.
Instance Method Summary collapse
-
#add_fcnetwork(network) ⇒ Object
Add an uri to fcnetworkUris array.
-
#add_fcoenetwork(network) ⇒ Object
Add an uri to fcoenetworkUris array.
-
#add_network(network) ⇒ Object
Add an uri to networkUris array.
-
#add_port_config(portUri, speed, locationEntries) ⇒ Object
Add portConfigInfos to the array.
-
#initialize(client, params = {}, api_ver = nil) ⇒ UplinkSet
constructor
A new instance of UplinkSet.
-
#set_logical_interconnect(logical_interconnect) ⇒ Object
Set logical interconnect uri.
Methods inherited from Resource
#==, #[], #[]=, #create, #create!, #delete, #each, #eql?, #exists?, find_by, from_file, get_all, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ UplinkSet
Returns a new instance of UplinkSet.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 6 def initialize(client, params = {}, api_ver = nil) super # Default values @data['fcNetworkUris'] ||= [] @data['fcoeNetworkUris'] ||= [] @data['networkUris'] ||= [] @data['portConfigInfos'] ||= [] @data['primaryPortLocation'] = nil @data['type'] ||= 'uplink-setV3' end |
Instance Method Details
#add_fcnetwork(network) ⇒ Object
Add an uri to fcnetworkUris array
104 105 106 107 108 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 104 def add_fcnetwork(network) uri = network[:uri] || network['uri'] fail 'Invalid object' unless uri @data['fcNetworkUris'].push(uri) end |
#add_fcoenetwork(network) ⇒ Object
Add an uri to fcoenetworkUris array
112 113 114 115 116 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 112 def add_fcoenetwork(network) uri = network[:uri] || network['uri'] fail 'Invalid object' unless uri @data['fcoeNetworkUris'].push(uri) end |
#add_network(network) ⇒ Object
Add an uri to networkUris array
96 97 98 99 100 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 96 def add_network(network) uri = network[:uri] || network['uri'] fail 'Invalid object' unless uri @data['networkUris'].push(uri) end |
#add_port_config(portUri, speed, locationEntries) ⇒ Object
Add portConfigInfos to the array
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 75 def add_port_config(portUri, speed, locationEntries) entry = { 'portUri' => portUri, 'desiredSpeed' => speed, 'location' => { 'locationEntries' => locationEntries } } @data['portConfigInfos'] << entry end |
#set_logical_interconnect(logical_interconnect) ⇒ Object
Set logical interconnect uri
88 89 90 91 92 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 88 def set_logical_interconnect(logical_interconnect) uri = logical_interconnect[:uri] || logical_interconnect['uri'] fail 'Invalid object' unless uri @data['logicalInterconnectUri'] = uri end |
#validate_ethernetNetworkType(value) ⇒ Object
Validate ethernetNetworkType
22 23 24 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 22 def validate_ethernetNetworkType(value) fail 'Invalid ethernet network type' unless VALID_ETHERNET_NETWORK_TYPES.include?(value) end |
#validate_lacpTimer(value) ⇒ Object
Validate lacpTimer
29 30 31 32 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 29 def validate_lacpTimer(value) return if value.to_s.empty? fail 'Invalid lacp timer' unless %w(Short Long).include?(value) end |
#validate_locationEntriesType(value) ⇒ Object
Validate locationEntriesType
51 52 53 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 51 def validate_locationEntriesType(value) fail 'Invalid location entry type' unless VALID_LOCATION_ENTRIES_TYPES.include?(value) end |
#validate_manualLoginRedistributionState(value) ⇒ Object
Validate manualLoginRedistributionState
37 38 39 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 37 def validate_manualLoginRedistributionState(value) fail 'Invalid manual login redistribution state' unless VALID_MANUAL_LOGIN_REDISTRIBUTION_STATES.include?(value) end |
#validate_networkType(value) ⇒ Object
Validate networkType
44 45 46 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 44 def validate_networkType(value) fail 'Invalid network type' unless VALID_NETWORK_TYPES.include?(value) end |
#validate_reachability(value) ⇒ Object
Validate ethernetNetworkType request
58 59 60 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 58 def validate_reachability(value) fail 'Invalid reachability' unless VALID_REACHABILITIES.include?(value) end |
#validate_status(value) ⇒ Object
Validate ethernetNetworkType request
65 66 67 |
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 65 def validate_status(value) fail 'Invalid status' unless VALID_STATUSES.include?(value) end |