class OneviewSDK::API200::EthernetNetwork

Ethernet network resource implementation

Constants

BASE_URI

Public Class Methods

bulk_create(client, options) click to toggle source

Bulk create the ethernet networks @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] options information necessary to create networks @return [Array] list of ethernet networks created

# File lib/oneview-sdk/resource/api200/ethernet_network.rb, line 35
def self.bulk_create(client, options)
  range = options[:vlanIdRange].split('-').map(&:to_i)
  options[:type] = 'bulk-ethernet-network'
  response = client.rest_post(BASE_URI + '/bulk', { 'body' => options }, client.api_version)
  client.response_handler(response)
  network_names = []
  range[0].upto(range[1]) { |i| network_names << "#{options[:namePrefix]}_#{i}" }
  OneviewSDK::EthernetNetwork.get_all(client).select { |network| network_names.include?(network['name']) }
end
new(client, params = {}, api_ver = nil) click to toggle source

Create a resource object, associate it with a client, and set its properties. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] params The options for this resource (key-value pairs) @param [Integer] api_ver The api version to use when interracting with this resource.

Calls superclass method OneviewSDK::Resource::new
# File lib/oneview-sdk/resource/api200/ethernet_network.rb, line 24
def initialize(client, params = {}, api_ver = nil)
  super
  # Default values:
  @data['ethernetNetworkType'] ||= 'Tagged'
  @data['type'] ||= 'ethernet-networkV3'
end

Public Instance Methods

get_associated_profiles() click to toggle source

Gets the associated profiles

# File lib/oneview-sdk/resource/api200/ethernet_network.rb, line 46
def get_associated_profiles
  ensure_client && ensure_uri
  response = @client.rest_get("#{@data['uri']}/associatedProfiles", {}, @api_version)
  response.body
end