Class: MistApi::SwitchMgmt

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

Overview

Switch Management settings

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(ap_affinity_threshold = 10, cli_banner = SKIP, cli_idle_timeout = SKIP, config_revert_timer = 10, dhcp_option_fqdn = false, disable_oob_down_alarm = SKIP, fips_enabled = false, local_accounts = SKIP, mxedge_proxy_host = SKIP, mxedge_proxy_port = SKIP, protect_re = SKIP, radius = SKIP, remove_existing_configs = false, root_password = SKIP, tacacs = SKIP, use_mxedge_proxy = SKIP) ⇒ SwitchMgmt

Returns a new instance of SwitchMgmt.



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/mist_api/models/switch_mgmt.rb', line 141

def initialize(ap_affinity_threshold = 10, cli_banner = SKIP,
               cli_idle_timeout = SKIP, config_revert_timer = 10,
               dhcp_option_fqdn = false, disable_oob_down_alarm = SKIP,
               fips_enabled = false, local_accounts = SKIP,
               mxedge_proxy_host = SKIP, mxedge_proxy_port = SKIP,
               protect_re = SKIP, radius = SKIP,
               remove_existing_configs = false, root_password = SKIP,
               tacacs = SKIP, use_mxedge_proxy = SKIP)
  @ap_affinity_threshold = ap_affinity_threshold unless ap_affinity_threshold == SKIP
  @cli_banner = cli_banner unless cli_banner == SKIP
  @cli_idle_timeout = cli_idle_timeout unless cli_idle_timeout == SKIP
  @config_revert_timer = config_revert_timer unless config_revert_timer == SKIP
  @dhcp_option_fqdn = dhcp_option_fqdn unless dhcp_option_fqdn == SKIP
  @disable_oob_down_alarm = disable_oob_down_alarm unless disable_oob_down_alarm == SKIP
  @fips_enabled = fips_enabled unless fips_enabled == SKIP
  @local_accounts = local_accounts unless local_accounts == SKIP
  @mxedge_proxy_host = mxedge_proxy_host unless mxedge_proxy_host == SKIP
  @mxedge_proxy_port = mxedge_proxy_port unless mxedge_proxy_port == SKIP
  @protect_re = protect_re unless protect_re == SKIP
  @radius = radius unless radius == SKIP
  @remove_existing_configs = remove_existing_configs unless remove_existing_configs == SKIP
  @root_password = root_password unless root_password == SKIP
  @tacacs = tacacs unless tacacs == SKIP
  @use_mxedge_proxy = use_mxedge_proxy unless use_mxedge_proxy == SKIP
end

Instance Attribute Details

#ap_affinity_thresholdInteger

AP_affinity_threshold ap_affinity_threshold can be added as a field under site/setting. By default, this value is set to 12. If the field is set in both site/setting and org/setting, the value from site/setting will be used.

Returns:

  • (Integer)


17
18
19
# File 'lib/mist_api/models/switch_mgmt.rb', line 17

def ap_affinity_threshold
  @ap_affinity_threshold
end

#cli_bannerString

Set Banners for switches. Allows markup formatting

Returns:

  • (String)


21
22
23
# File 'lib/mist_api/models/switch_mgmt.rb', line 21

def cli_banner
  @cli_banner
end

#cli_idle_timeoutInteger

Sets timeout for switches

Returns:

  • (Integer)


25
26
27
# File 'lib/mist_api/models/switch_mgmt.rb', line 25

def cli_idle_timeout
  @cli_idle_timeout
end

#config_revert_timerInteger

Rollback timer for commit confirmed

Returns:

  • (Integer)


29
30
31
# File 'lib/mist_api/models/switch_mgmt.rb', line 29

def config_revert_timer
  @config_revert_timer
end

#dhcp_option_fqdnTrueClass | FalseClass

Enable to provide the FQDN with DHCP option 81

Returns:

  • (TrueClass | FalseClass)


33
34
35
# File 'lib/mist_api/models/switch_mgmt.rb', line 33

def dhcp_option_fqdn
  @dhcp_option_fqdn
end

#disable_oob_down_alarmTrueClass | FalseClass

Enable to provide the FQDN with DHCP option 81

Returns:

  • (TrueClass | FalseClass)


37
38
39
# File 'lib/mist_api/models/switch_mgmt.rb', line 37

def disable_oob_down_alarm
  @disable_oob_down_alarm
end

#fips_enabledTrueClass | FalseClass

Enable to provide the FQDN with DHCP option 81

Returns:

  • (TrueClass | FalseClass)


41
42
43
# File 'lib/mist_api/models/switch_mgmt.rb', line 41

def fips_enabled
  @fips_enabled
end

#local_accountsHash[String, ConfigSwitchLocalAccountsUser]

Property key is the user name. For Local user authentication

Returns:



45
46
47
# File 'lib/mist_api/models/switch_mgmt.rb', line 45

def local_accounts
  @local_accounts
end

#mxedge_proxy_hostString

IP Address or FQDN of the Mist Edge used to proxy the switch management traffic to the Mist Cloud

Returns:

  • (String)


50
51
52
# File 'lib/mist_api/models/switch_mgmt.rb', line 50

def mxedge_proxy_host
  @mxedge_proxy_host
end

#mxedge_proxy_portObject

Mist Edge port used to proxy the switch management traffic to the Mist Cloud. Value in range 1-65535

Returns:

  • (Object)


55
56
57
# File 'lib/mist_api/models/switch_mgmt.rb', line 55

def mxedge_proxy_port
  @mxedge_proxy_port
end

#protect_reProtectRe

Restrict inbound-traffic to host when enabled, all traffic that is not essential to our operation will be dropped e.g. ntp / dns / traffic to mist will be allowed by default, if dhcpd is enabled, we’ll make sure it works

Returns:



63
64
65
# File 'lib/mist_api/models/switch_mgmt.rb', line 63

def protect_re
  @protect_re
end

#radiusSwitchRadius

By default, ‘radius_config` will be used. if a different one has to be used set `use_different_radius

Returns:



68
69
70
# File 'lib/mist_api/models/switch_mgmt.rb', line 68

def radius
  @radius
end

#remove_existing_configsTrueClass | FalseClass

By default, only the configuration generated by Mist is cleaned up during the configuration process. If ‘true`, all the existing configuration will be removed.

Returns:

  • (TrueClass | FalseClass)


74
75
76
# File 'lib/mist_api/models/switch_mgmt.rb', line 74

def remove_existing_configs
  @remove_existing_configs
end

#root_passwordString

By default, only the configuration generated by Mist is cleaned up during the configuration process. If ‘true`, all the existing configuration will be removed.

Returns:

  • (String)


80
81
82
# File 'lib/mist_api/models/switch_mgmt.rb', line 80

def root_password
  @root_password
end

#tacacsTacacs

By default, only the configuration generated by Mist is cleaned up during the configuration process. If ‘true`, all the existing configuration will be removed.

Returns:



86
87
88
# File 'lib/mist_api/models/switch_mgmt.rb', line 86

def tacacs
  @tacacs
end

#use_mxedge_proxyTrueClass | FalseClass

To use mxedge as proxy

Returns:

  • (TrueClass | FalseClass)


90
91
92
# File 'lib/mist_api/models/switch_mgmt.rb', line 90

def use_mxedge_proxy
  @use_mxedge_proxy
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/mist_api/models/switch_mgmt.rb', line 168

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ap_affinity_threshold = hash['ap_affinity_threshold'] ||= 10
  cli_banner = hash.key?('cli_banner') ? hash['cli_banner'] : SKIP
  cli_idle_timeout =
    hash.key?('cli_idle_timeout') ? hash['cli_idle_timeout'] : SKIP
  config_revert_timer = hash['config_revert_timer'] ||= 10
  dhcp_option_fqdn = hash['dhcp_option_fqdn'] ||= false
  disable_oob_down_alarm =
    hash.key?('disable_oob_down_alarm') ? hash['disable_oob_down_alarm'] : SKIP
  fips_enabled = hash['fips_enabled'] ||= false
  local_accounts = ConfigSwitchLocalAccountsUser.from_hash(hash['local_accounts']) if
    hash['local_accounts']

  local_accounts = SKIP unless hash.key?('local_accounts')
  mxedge_proxy_host =
    hash.key?('mxedge_proxy_host') ? hash['mxedge_proxy_host'] : SKIP
  mxedge_proxy_port = hash.key?('mxedge_proxy_port') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:SwitchMgmtMxedgeProxyPort), hash['mxedge_proxy_port']
  ) : SKIP
  protect_re = ProtectRe.from_hash(hash['protect_re']) if hash['protect_re']
  radius = SwitchRadius.from_hash(hash['radius']) if hash['radius']
  remove_existing_configs = hash['remove_existing_configs'] ||= false
  root_password = hash.key?('root_password') ? hash['root_password'] : SKIP
  tacacs = Tacacs.from_hash(hash['tacacs']) if hash['tacacs']
  use_mxedge_proxy =
    hash.key?('use_mxedge_proxy') ? hash['use_mxedge_proxy'] : SKIP

  # Create object from extracted values.
  SwitchMgmt.new(ap_affinity_threshold,
                 cli_banner,
                 cli_idle_timeout,
                 config_revert_timer,
                 dhcp_option_fqdn,
                 disable_oob_down_alarm,
                 fips_enabled,
                 local_accounts,
                 mxedge_proxy_host,
                 mxedge_proxy_port,
                 protect_re,
                 radius,
                 remove_existing_configs,
                 root_password,
                 tacacs,
                 use_mxedge_proxy)
end

.namesObject

A mapping from model property names to API property names.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/mist_api/models/switch_mgmt.rb', line 93

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap_affinity_threshold'] = 'ap_affinity_threshold'
  @_hash['cli_banner'] = 'cli_banner'
  @_hash['cli_idle_timeout'] = 'cli_idle_timeout'
  @_hash['config_revert_timer'] = 'config_revert_timer'
  @_hash['dhcp_option_fqdn'] = 'dhcp_option_fqdn'
  @_hash['disable_oob_down_alarm'] = 'disable_oob_down_alarm'
  @_hash['fips_enabled'] = 'fips_enabled'
  @_hash['local_accounts'] = 'local_accounts'
  @_hash['mxedge_proxy_host'] = 'mxedge_proxy_host'
  @_hash['mxedge_proxy_port'] = 'mxedge_proxy_port'
  @_hash['protect_re'] = 'protect_re'
  @_hash['radius'] = 'radius'
  @_hash['remove_existing_configs'] = 'remove_existing_configs'
  @_hash['root_password'] = 'root_password'
  @_hash['tacacs'] = 'tacacs'
  @_hash['use_mxedge_proxy'] = 'use_mxedge_proxy'
  @_hash
end

.nullablesObject

An array for nullable fields



137
138
139
# File 'lib/mist_api/models/switch_mgmt.rb', line 137

def self.nullables
  []
end

.optionalsObject

An array for optional fields



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/mist_api/models/switch_mgmt.rb', line 115

def self.optionals
  %w[
    ap_affinity_threshold
    cli_banner
    cli_idle_timeout
    config_revert_timer
    dhcp_option_fqdn
    disable_oob_down_alarm
    fips_enabled
    local_accounts
    mxedge_proxy_host
    mxedge_proxy_port
    protect_re
    radius
    remove_existing_configs
    root_password
    tacacs
    use_mxedge_proxy
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (SwitchMgmt | Hash)

    value against the validation is performed.



219
220
221
222
223
224
225
# File 'lib/mist_api/models/switch_mgmt.rb', line 219

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.



241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/mist_api/models/switch_mgmt.rb', line 241

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_affinity_threshold: #{@ap_affinity_threshold.inspect}, cli_banner:"\
  " #{@cli_banner.inspect}, cli_idle_timeout: #{@cli_idle_timeout.inspect},"\
  " config_revert_timer: #{@config_revert_timer.inspect}, dhcp_option_fqdn:"\
  " #{@dhcp_option_fqdn.inspect}, disable_oob_down_alarm: #{@disable_oob_down_alarm.inspect},"\
  " fips_enabled: #{@fips_enabled.inspect}, local_accounts: #{@local_accounts.inspect},"\
  " mxedge_proxy_host: #{@mxedge_proxy_host.inspect}, mxedge_proxy_port:"\
  " #{@mxedge_proxy_port.inspect}, protect_re: #{@protect_re.inspect}, radius:"\
  " #{@radius.inspect}, remove_existing_configs: #{@remove_existing_configs.inspect},"\
  " root_password: #{@root_password.inspect}, tacacs: #{@tacacs.inspect}, use_mxedge_proxy:"\
  " #{@use_mxedge_proxy.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



228
229
230
231
232
233
234
235
236
237
238
# File 'lib/mist_api/models/switch_mgmt.rb', line 228

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_affinity_threshold: #{@ap_affinity_threshold}, cli_banner:"\
  " #{@cli_banner}, cli_idle_timeout: #{@cli_idle_timeout}, config_revert_timer:"\
  " #{@config_revert_timer}, dhcp_option_fqdn: #{@dhcp_option_fqdn}, disable_oob_down_alarm:"\
  " #{@disable_oob_down_alarm}, fips_enabled: #{@fips_enabled}, local_accounts:"\
  " #{@local_accounts}, mxedge_proxy_host: #{@mxedge_proxy_host}, mxedge_proxy_port:"\
  " #{@mxedge_proxy_port}, protect_re: #{@protect_re}, radius: #{@radius},"\
  " remove_existing_configs: #{@remove_existing_configs}, root_password: #{@root_password},"\
  " tacacs: #{@tacacs}, use_mxedge_proxy: #{@use_mxedge_proxy}>"
end