Class: OneviewSDK::API300::C7000::Switch

Inherits:
OneviewSDK::API200::Switch show all
Includes:
OneviewSDK::API300::C7000::Scope::ScopeHelperMethods
Defined in:
lib/oneview-sdk/resource/api300/c7000/switch.rb

Overview

Switch resource implementation

Direct Known Subclasses

OneviewSDK::API500::C7000::Switch

Constant Summary

Constants inherited from OneviewSDK::API200::Switch

OneviewSDK::API200::Switch::BASE_URI, OneviewSDK::API200::Switch::TYPE_URI, OneviewSDK::API200::Switch::UNIQUE_IDENTIFIERS

Constants inherited from Resource

Resource::BASE_URI, Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Instance Method Summary collapse

Methods included from OneviewSDK::API300::C7000::Scope::ScopeHelperMethods

#add_scope, #patch, #remove_scope, #replace_scopes

Methods inherited from OneviewSDK::API200::Switch

#create, #delete, #environmental_configuration, get_type, get_types, #refresh, #remove, #statistics, #update

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, #initialize, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file, #update

Constructor Details

This class inherits a constructor from OneviewSDK::Resource

Instance Method Details

#set_scope_uris(scope_uris) ⇒ Object

Parameters:

  • scope_uris (Array)

    Array of scope uri strings



25
26
27
# File 'lib/oneview-sdk/resource/api300/c7000/switch.rb', line 25

def set_scope_uris(scope_uris)
  patch('replace', '/scopeUris', scope_uris)
end

#update_port(portName, attributes) ⇒ Object

Note:

Only the ports under the management of OneView and those that are unlinked are supported for update

Updates the switch ports

Parameters:

  • portName (String)

    port name

  • attributes (Hash)

    hash with attributes and values to be changed



33
34
35
36
37
38
39
# File 'lib/oneview-sdk/resource/api300/c7000/switch.rb', line 33

def update_port(portName, attributes)
  ensure_uri
  port = @data['ports'].find { |p| p['portName'] == portName }
  attributes.each { |key, value| port[key.to_s] = value }
  response = @client.rest_put(@data['uri'] + '/update-ports', 'body' => [port])
  @client.response_handler(response)
end