Class: OneviewSDK::FCNetwork

Inherits:
Resource show all
Defined in:
lib/oneview-sdk/resource/fc_network.rb

Overview

FC network resource implementation

Validates collapse

VALID_FABRIC_TYPES =
%w(DirectAttach FabricAttach).freeze
(1..1800).freeze

Constant Summary collapse

BASE_URI =
'/rest/fc-networks'.freeze

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Validates collapse

Instance Method Summary collapse

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) ⇒ FCNetwork

Returns a new instance of FCNetwork.



6
7
8
9
10
11
12
13
# File 'lib/oneview-sdk/resource/fc_network.rb', line 6

def initialize(client, params = {}, api_ver = nil)
  super
  # Default values
  @data['autoLoginRedistribution'] ||= false
  @data['type'] ||= 'fc-networkV2'
  @data['linkStabilityTime'] ||= 30
  @data['fabricType'] ||= 'FabricAttach'
end

Instance Method Details

#validate_fabricType(value) ⇒ Object



18
19
20
# File 'lib/oneview-sdk/resource/fc_network.rb', line 18

def validate_fabricType(value)
  fail 'Invalid fabric type' unless VALID_FABRIC_TYPES.include?(value)
end

#validate_linkStabilityTime(value) ⇒ Object



23
24
25
26
# File 'lib/oneview-sdk/resource/fc_network.rb', line 23

def validate_linkStabilityTime(value)
  return unless @data['fabricType'] && @data['fabricType'] == 'FabricAttach'
  fail 'Link stability time out of range 1..1800' unless VALID_LINK_STABILITY_TIMES.include?(value)
end