Class: OneviewSDK::API200::UplinkSet
- Defined in:
- lib/oneview-sdk/resource/api200/uplink_set.rb
Overview
Uplink set resource implementation
Direct Known Subclasses
OneviewSDK::API300::C7000::UplinkSet, OneviewSDK::API300::Synergy::UplinkSet
Constant Summary collapse
- BASE_URI =
'/rest/uplink-sets'.freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#add_fcnetwork(network) ⇒ Object
Adds an fc network to the uplink set.
-
#add_fcoenetwork(network) ⇒ Object
Adds an fcoe network to the uplink set.
-
#add_network(network) ⇒ Object
Adds an ethernet network to the uplink set.
-
#add_port_config(portUri, speed, locationEntries) ⇒ Object
Adds the portConfigInfos to the array.
-
#get_unassigned_ports ⇒ Array
Gets the unassigned uplink ports.
-
#initialize(client, params = {}, api_ver = nil) ⇒ UplinkSet
constructor
Create a resource object, associate it with a client, and set its properties.
-
#set_logical_interconnect(logical_interconnect) ⇒ Object
Sets the logical interconnect uri.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ UplinkSet
Create a resource object, associate it with a client, and set its properties.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/oneview-sdk/resource/api200/uplink_set.rb', line 24 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
Adds an fc network to the uplink set
68 69 70 71 72 |
# File 'lib/oneview-sdk/resource/api200/uplink_set.rb', line 68 def add_fcnetwork(network) uri = network[:uri] || network['uri'] raise IncompleteResource, 'Must set network uri attribute' unless uri @data['fcNetworkUris'].push(uri) end |
#add_fcoenetwork(network) ⇒ Object
Adds an fcoe network to the uplink set
76 77 78 79 80 |
# File 'lib/oneview-sdk/resource/api200/uplink_set.rb', line 76 def add_fcoenetwork(network) uri = network[:uri] || network['uri'] raise IncompleteResource, 'Must set network uri attribute' unless uri @data['fcoeNetworkUris'].push(uri) end |
#add_network(network) ⇒ Object
Adds an ethernet network to the uplink set
60 61 62 63 64 |
# File 'lib/oneview-sdk/resource/api200/uplink_set.rb', line 60 def add_network(network) uri = network[:uri] || network['uri'] raise IncompleteResource, 'Must set network uri attribute' unless uri @data['networkUris'].push(uri) end |
#add_port_config(portUri, speed, locationEntries) ⇒ Object
Adds the portConfigInfos to the array
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/oneview-sdk/resource/api200/uplink_set.rb', line 39 def add_port_config(portUri, speed, locationEntries) entry = { 'portUri' => portUri, 'desiredSpeed' => speed, 'location' => { 'locationEntries' => locationEntries } } @data['portConfigInfos'] << entry end |
#get_unassigned_ports ⇒ Array
Gets the unassigned uplink ports
84 85 86 87 88 89 |
# File 'lib/oneview-sdk/resource/api200/uplink_set.rb', line 84 def get_unassigned_ports ensure_client && ensure_uri response = @client.rest_post(BASE_URI + '/unassignedUplinkPorts', { 'body' => @data }, @api_version) result = @client.response_handler(response) result['members'] end |
#set_logical_interconnect(logical_interconnect) ⇒ Object
Sets the logical interconnect uri
52 53 54 55 56 |
# File 'lib/oneview-sdk/resource/api200/uplink_set.rb', line 52 def set_logical_interconnect(logical_interconnect) uri = logical_interconnect[:uri] || logical_interconnect['uri'] raise IncompleteResource, 'Invalid object' unless uri @data['logicalInterconnectUri'] = uri end |