Class: MistApi::WlanDynamicPsk

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

Overview

For dynamic PSK where we get per_user PSK from Radius. dynamic_psk allows PSK to be selected at runtime depending on context (wlan/site/user/…) thus following configurations are assumed (currently) * PSK will come from RADIUS server * AP sends client MAC as username and password (i.e. ‘enable_mac_auth` is assumed) * AP sends BSSID:SSID as Caller-Station-ID

  • ‘auth_servers` is required * PSK will come from cloud WLC if source is

cloud_psks * default_psk will be used if cloud WLC is not available * ‘multi_psk_only` and `psk` is ignored * `pairwise` can only be wpa2-ccmp (for now, wpa3 support on the roadmap)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(default_psk = SKIP, default_vlan_id = SKIP, enabled = false, force_lookup = false, source = DynamicPskSourceEnum::RADIUS) ⇒ WlanDynamicPsk

Returns a new instance of WlanDynamicPsk.



68
69
70
71
72
73
74
75
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 68

def initialize(default_psk = SKIP, default_vlan_id = SKIP, enabled = false,
               force_lookup = false, source = DynamicPskSourceEnum::RADIUS)
  @default_psk = default_psk unless default_psk == SKIP
  @default_vlan_id = default_vlan_id unless default_vlan_id == SKIP
  @enabled = enabled unless enabled == SKIP
  @force_lookup = force_lookup unless force_lookup == SKIP
  @source = source unless source == SKIP
end

Instance Attribute Details

#default_pskString

Default PSK to use if cloud WLC is not available, 8-63 characters

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 22

def default_psk
  @default_psk
end

#default_vlan_idObject

Default PSK to use if cloud WLC is not available, 8-63 characters

Returns:

  • (Object)


26
27
28
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 26

def default_vlan_id
  @default_vlan_id
end

#enabledTrueClass | FalseClass

Default PSK to use if cloud WLC is not available, 8-63 characters

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 30

def enabled
  @enabled
end

#force_lookupTrueClass | FalseClass

When 11r is enabled, we’ll try to use the cached PMK, this can be disabled. ‘false` means auto

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 35

def force_lookup
  @force_lookup
end

#sourceDynamicPskSourceEnum

enum: ‘cloud_psks`, `radius`



39
40
41
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 39

def source
  @source
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  default_psk = hash.key?('default_psk') ? hash['default_psk'] : SKIP
  default_vlan_id = hash.key?('default_vlan_id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:VlanIdWithVariable9), hash['default_vlan_id']
  ) : SKIP
  enabled = hash['enabled'] ||= false
  force_lookup = hash['force_lookup'] ||= false
  source = hash['source'] ||= DynamicPskSourceEnum::RADIUS

  # Create object from extracted values.
  WlanDynamicPsk.new(default_psk,
                     default_vlan_id,
                     enabled,
                     force_lookup,
                     source)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['default_psk'] = 'default_psk'
  @_hash['default_vlan_id'] = 'default_vlan_id'
  @_hash['enabled'] = 'enabled'
  @_hash['force_lookup'] = 'force_lookup'
  @_hash['source'] = 'source'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
61
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 53

def self.optionals
  %w[
    default_psk
    default_vlan_id
    enabled
    force_lookup
    source
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (WlanDynamicPsk | Hash)

    value against the validation is performed.



100
101
102
103
104
105
106
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 100

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} default_psk: #{@default_psk.inspect}, default_vlan_id:"\
  " #{@default_vlan_id.inspect}, enabled: #{@enabled.inspect}, force_lookup:"\
  " #{@force_lookup.inspect}, source: #{@source.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
# File 'lib/mist_api/models/wlan_dynamic_psk.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} default_psk: #{@default_psk}, default_vlan_id: #{@default_vlan_id},"\
  " enabled: #{@enabled}, force_lookup: #{@force_lookup}, source: #{@source}>"
end