Class: MistApi::RadiusConfig

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

Overview

Junos Radius config

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(acct_interim_interval = 0, acct_servers = SKIP, auth_servers = SKIP, auth_servers_retries = 3, auth_servers_timeout = 5, coa_enabled = false, coa_port = 3799, network = SKIP, source_ip = SKIP) ⇒ RadiusConfig

Returns a new instance of RadiusConfig.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/radius_config.rb', line 93

def initialize(acct_interim_interval = 0, acct_servers = SKIP,
               auth_servers = SKIP, auth_servers_retries = 3,
               auth_servers_timeout = 5, coa_enabled = false,
               coa_port = 3799, network = SKIP, source_ip = SKIP)
  @acct_interim_interval = acct_interim_interval unless acct_interim_interval == SKIP
  @acct_servers = acct_servers unless acct_servers == SKIP
  @auth_servers = auth_servers unless auth_servers == SKIP
  @auth_servers_retries = auth_servers_retries unless auth_servers_retries == SKIP
  @auth_servers_timeout = auth_servers_timeout unless auth_servers_timeout == SKIP
  @coa_enabled = coa_enabled unless coa_enabled == SKIP
  @coa_port = coa_port unless coa_port == SKIP
  @network = network unless network == SKIP
  @source_ip = source_ip unless source_ip == SKIP
end

Instance Attribute Details

#acct_interim_intervalInteger

How frequently should interim accounting be reported, 60-65535. default is 0 (use one specified in Access-Accept request from RADIUS Server). Very frequent messages can affect the performance of the radius server, 600 and up is recommended when enabled

Returns:

  • (Integer)


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

def acct_interim_interval
  @acct_interim_interval
end

#acct_serversArray[RadiusAcctServer]

How frequently should interim accounting be reported, 60-65535. default is 0 (use one specified in Access-Accept request from RADIUS Server). Very frequent messages can affect the performance of the radius server, 600 and up is recommended when enabled

Returns:



24
25
26
# File 'lib/mist_api/models/radius_config.rb', line 24

def acct_servers
  @acct_servers
end

#auth_serversArray[RadiusAuthServer]

How frequently should interim accounting be reported, 60-65535. default is 0 (use one specified in Access-Accept request from RADIUS Server). Very frequent messages can affect the performance of the radius server, 600 and up is recommended when enabled

Returns:



31
32
33
# File 'lib/mist_api/models/radius_config.rb', line 31

def auth_servers
  @auth_servers
end

#auth_servers_retriesInteger

radius auth session retries

Returns:

  • (Integer)


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

def auth_servers_retries
  @auth_servers_retries
end

#auth_servers_timeoutInteger

radius auth session timeout

Returns:

  • (Integer)


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

def auth_servers_timeout
  @auth_servers_timeout
end

#coa_enabledTrueClass | FalseClass

radius auth session timeout

Returns:

  • (TrueClass | FalseClass)


43
44
45
# File 'lib/mist_api/models/radius_config.rb', line 43

def coa_enabled
  @coa_enabled
end

#coa_portInteger

radius auth session timeout

Returns:

  • (Integer)


47
48
49
# File 'lib/mist_api/models/radius_config.rb', line 47

def coa_port
  @coa_port
end

#networkString

use ‘network`or `source_ip`, which network the RADIUS server resides, if there’s static IP for this network, we’d use it as source-ip

Returns:

  • (String)


52
53
54
# File 'lib/mist_api/models/radius_config.rb', line 52

def network
  @network
end

#source_ipString

use ‘network`or `source_ip`

Returns:

  • (String)


56
57
58
# File 'lib/mist_api/models/radius_config.rb', line 56

def source_ip
  @source_ip
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/mist_api/models/radius_config.rb', line 109

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  acct_interim_interval = hash['acct_interim_interval'] ||= 0
  # Parameter is an array, so we need to iterate through it
  acct_servers = nil
  unless hash['acct_servers'].nil?
    acct_servers = []
    hash['acct_servers'].each do |structure|
      acct_servers << (RadiusAcctServer.from_hash(structure) if structure)
    end
  end

  acct_servers = SKIP unless hash.key?('acct_servers')
  # Parameter is an array, so we need to iterate through it
  auth_servers = nil
  unless hash['auth_servers'].nil?
    auth_servers = []
    hash['auth_servers'].each do |structure|
      auth_servers << (RadiusAuthServer.from_hash(structure) if structure)
    end
  end

  auth_servers = SKIP unless hash.key?('auth_servers')
  auth_servers_retries = hash['auth_servers_retries'] ||= 3
  auth_servers_timeout = hash['auth_servers_timeout'] ||= 5
  coa_enabled = hash['coa_enabled'] ||= false
  coa_port = hash['coa_port'] ||= 3799
  network = hash.key?('network') ? hash['network'] : SKIP
  source_ip = hash.key?('source_ip') ? hash['source_ip'] : SKIP

  # Create object from extracted values.
  RadiusConfig.new(acct_interim_interval,
                   acct_servers,
                   auth_servers,
                   auth_servers_retries,
                   auth_servers_timeout,
                   coa_enabled,
                   coa_port,
                   network,
                   source_ip)
end

.namesObject

A mapping from model property names to API property names.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/radius_config.rb', line 59

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['acct_interim_interval'] = 'acct_interim_interval'
  @_hash['acct_servers'] = 'acct_servers'
  @_hash['auth_servers'] = 'auth_servers'
  @_hash['auth_servers_retries'] = 'auth_servers_retries'
  @_hash['auth_servers_timeout'] = 'auth_servers_timeout'
  @_hash['coa_enabled'] = 'coa_enabled'
  @_hash['coa_port'] = 'coa_port'
  @_hash['network'] = 'network'
  @_hash['source_ip'] = 'source_ip'
  @_hash
end

.nullablesObject

An array for nullable fields



89
90
91
# File 'lib/mist_api/models/radius_config.rb', line 89

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/mist_api/models/radius_config.rb', line 74

def self.optionals
  %w[
    acct_interim_interval
    acct_servers
    auth_servers
    auth_servers_retries
    auth_servers_timeout
    coa_enabled
    coa_port
    network
    source_ip
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



163
164
165
166
167
168
169
170
# File 'lib/mist_api/models/radius_config.rb', line 163

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} acct_interim_interval: #{@acct_interim_interval.inspect}, acct_servers:"\
  " #{@acct_servers.inspect}, auth_servers: #{@auth_servers.inspect}, auth_servers_retries:"\
  " #{@auth_servers_retries.inspect}, auth_servers_timeout: #{@auth_servers_timeout.inspect},"\
  " coa_enabled: #{@coa_enabled.inspect}, coa_port: #{@coa_port.inspect}, network:"\
  " #{@network.inspect}, source_ip: #{@source_ip.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



154
155
156
157
158
159
160
# File 'lib/mist_api/models/radius_config.rb', line 154

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} acct_interim_interval: #{@acct_interim_interval}, acct_servers:"\
  " #{@acct_servers}, auth_servers: #{@auth_servers}, auth_servers_retries:"\
  " #{@auth_servers_retries}, auth_servers_timeout: #{@auth_servers_timeout}, coa_enabled:"\
  " #{@coa_enabled}, coa_port: #{@coa_port}, network: #{@network}, source_ip: #{@source_ip}>"
end