Class: MistApi::MxclusterTuntermHostsSelectionEnum

Inherits:
Object
  • Object
show all
Defined in:
lib/mist_api/models/mxcluster_tunterm_hosts_selection_enum.rb

Overview

Ordering of tunterm_hosts for mxedge within the same mxcluster. enum: * ‘shuffle`: the ordering of tunterm_hosts is randomized by the device”s MAC

* `shuffle-by-site`: shuffle by site_id+tunnel_id (so when client connects

to a specific Tunnel, it will go to the same (order of) mxedge, and we load-balancing between tunnels) * ‘ordered`: order decided by tunterm_hosts_order

Constant Summary collapse

MXCLUSTER_TUNTERM_HOSTS_SELECTION_ENUM =
[
  # TODO: Write general description for ORDERED
  ORDERED = 'ordered'.freeze,

  # TODO: Write general description for SHUFFLE
  SHUFFLE = 'shuffle'.freeze,

  # TODO: Write general description for SHUFFLEBYSITE
  SHUFFLEBYSITE = 'shuffle-by-site'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ORDERED) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mist_api/models/mxcluster_tunterm_hosts_selection_enum.rb', line 31

def self.from_value(value, default_value = ORDERED)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'ordered' then ORDERED
  when 'shuffle' then SHUFFLE
  when 'shufflebysite' then SHUFFLEBYSITE
  else
    default_value
  end
end

.validate(value) ⇒ Object



25
26
27
28
29
# File 'lib/mist_api/models/mxcluster_tunterm_hosts_selection_enum.rb', line 25

def self.validate(value)
  return false if value.nil?

  MXCLUSTER_TUNTERM_HOSTS_SELECTION_ENUM.include?(value)
end