Class: MistApi::WxlanTunnel

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

Overview

WxLAn Tunnel

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(name = nil, created_time = SKIP, dmvpn = SKIP, for_mgmt = false, for_site = SKIP, hello_interval = 60, hello_retries = 7, hostname = SKIP, id = SKIP, ipsec = SKIP, is_static = false, modified_time = SKIP, mtu = 0, org_id = SKIP, peers = SKIP, router_id = SKIP, secret = SKIP, sessions = SKIP, site_id = SKIP, udp_port = SKIP, use_udp = false, additional_properties = nil) ⇒ WxlanTunnel

Returns a new instance of WxlanTunnel.



167
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
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 167

def initialize(name = nil, created_time = SKIP, dmvpn = SKIP,
               for_mgmt = false, for_site = SKIP, hello_interval = 60,
               hello_retries = 7, hostname = SKIP, id = SKIP, ipsec = SKIP,
               is_static = false, modified_time = SKIP, mtu = 0,
               org_id = SKIP, peers = SKIP, router_id = SKIP, secret = SKIP,
               sessions = SKIP, site_id = SKIP, udp_port = SKIP,
               use_udp = false, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @created_time = created_time unless created_time == SKIP
  @dmvpn = dmvpn unless dmvpn == SKIP
  @for_mgmt = for_mgmt unless for_mgmt == SKIP
  @for_site = for_site unless for_site == SKIP
  @hello_interval = hello_interval unless hello_interval == SKIP
  @hello_retries = hello_retries unless hello_retries == SKIP
  @hostname = hostname unless hostname == SKIP
  @id = id unless id == SKIP
  @ipsec = ipsec unless ipsec == SKIP
  @is_static = is_static unless is_static == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @mtu = mtu unless mtu == SKIP
  @name = name
  @org_id = org_id unless org_id == SKIP
  @peers = peers unless peers == SKIP
  @router_id = router_id unless router_id == SKIP
  @secret = secret unless secret == SKIP
  @sessions = sessions unless sessions == SKIP
  @site_id = site_id unless site_id == SKIP
  @udp_port = udp_port unless udp_port == SKIP
  @use_udp = use_udp unless use_udp == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


14
15
16
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 14

def created_time
  @created_time
end

#dmvpnWxlanTunnelDmvpn

Dynamic Multipoint VPN configurations

Returns:



18
19
20
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 18

def dmvpn
  @dmvpn
end

#for_mgmtTrueClass | FalseClass

Determined during creation time and cannot be toggled. A management tunnel cannot be used by wxlan rule or by wlan

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 23

def for_mgmt
  @for_mgmt
end

#for_siteTrueClass | FalseClass

Determined during creation time and cannot be toggled. A management tunnel cannot be used by wxlan rule or by wlan

Returns:

  • (TrueClass | FalseClass)


28
29
30
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 28

def for_site
  @for_site
end

#hello_intervalInteger

In seconds, used as heartbeat to detect if a tunnel is alive. AP will try another peer after missing N hellos specified by hello_retries.

Returns:

  • (Integer)


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

def hello_interval
  @hello_interval
end

#hello_retriesInteger

In seconds, used as heartbeat to detect if a tunnel is alive. AP will try another peer after missing N hellos specified by hello_retries.

Returns:

  • (Integer)


38
39
40
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 38

def hello_retries
  @hello_retries
end

#hostnameString

Optional, overwrite the hostname in SCCRQ control message, default is or null, %H and %M can be used, which will be replace with corresponding values:

* %H: name of the ap if provided (and will be stripped so it can be used

for hostname) and fallbacks to MAC

* %M: MAC (e.g. 5c5b350e0060)

Returns:

  • (String)


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

def hostname
  @hostname
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


51
52
53
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 51

def id
  @id
end

#ipsecWxlanTunnelIpsec

IPSec-related configurations; requires DMVPN be enabled

Returns:



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

def ipsec
  @ipsec
end

#is_staticTrueClass | FalseClass

Whether it’s static/unmanaged (i.e. no control session). As the session configurations are not compatible, cannot be toggled.

Returns:

  • (TrueClass | FalseClass)


60
61
62
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 60

def is_static
  @is_static
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


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

def modified_time
  @modified_time
end

#mtuInteger

0 to enable PMTU, 552-1500 to start PMTU with a lower MTU

Returns:

  • (Integer)


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

def mtu
  @mtu
end

#nameString

The name of the tunnel

Returns:

  • (String)


72
73
74
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 72

def name
  @name
end

#org_idUUID | String

The name of the tunnel

Returns:

  • (UUID | String)


76
77
78
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 76

def org_id
  @org_id
end

#peersArray[String]

List of remote peers’ IP or hostname

Returns:

  • (Array[String])


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

def peers
  @peers
end

#router_idString

Optional, overwrite the router-id in SCCRQ control message, default is “” or null, can also be an IPv4 address

Returns:

  • (String)


85
86
87
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 85

def router_id
  @router_id
end

#secretString

Secret, ‘’ if no auth is used

Returns:

  • (String)


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

def secret
  @secret
end

#sessionsArray[WxlanTunnelSession]

Sessions to be established with the tunnel. Has to be >= 1 in order for this tunnel to be useful. For management tunnel, it can only have 1

Returns:



94
95
96
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 94

def sessions
  @sessions
end

#site_idUUID | String

Sessions to be established with the tunnel. Has to be >= 1 in order for this tunnel to be useful. For management tunnel, it can only have 1

Returns:

  • (UUID | String)


99
100
101
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 99

def site_id
  @site_id
end

#udp_portInteger

UDP port if ‘use_udp`==`true`

Returns:

  • (Integer)


103
104
105
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 103

def udp_port
  @udp_port
end

#use_udpTrueClass | FalseClass

Whether to use UDP instead of IP (proto=115, which is default of L2TPv3)

Returns:

  • (TrueClass | FalseClass)


107
108
109
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 107

def use_udp
  @use_udp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 202

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  dmvpn = WxlanTunnelDmvpn.from_hash(hash['dmvpn']) if hash['dmvpn']
  for_mgmt = hash['for_mgmt'] ||= false
  for_site = hash.key?('for_site') ? hash['for_site'] : SKIP
  hello_interval = hash['hello_interval'] ||= 60
  hello_retries = hash['hello_retries'] ||= 7
  hostname = hash.key?('hostname') ? hash['hostname'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  ipsec = WxlanTunnelIpsec.from_hash(hash['ipsec']) if hash['ipsec']
  is_static = hash['is_static'] ||= false
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  mtu = hash['mtu'] ||= 0
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  peers = hash.key?('peers') ? hash['peers'] : SKIP
  router_id = hash.key?('router_id') ? hash['router_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  # Parameter is an array, so we need to iterate through it
  sessions = nil
  unless hash['sessions'].nil?
    sessions = []
    hash['sessions'].each do |structure|
      sessions << (WxlanTunnelSession.from_hash(structure) if structure)
    end
  end

  sessions = SKIP unless hash.key?('sessions')
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  udp_port = hash.key?('udp_port') ? hash['udp_port'] : SKIP
  use_udp = hash['use_udp'] ||= false

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  WxlanTunnel.new(name,
                  created_time,
                  dmvpn,
                  for_mgmt,
                  for_site,
                  hello_interval,
                  hello_retries,
                  hostname,
                  id,
                  ipsec,
                  is_static,
                  modified_time,
                  mtu,
                  org_id,
                  peers,
                  router_id,
                  secret,
                  sessions,
                  site_id,
                  udp_port,
                  use_udp,
                  additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 110

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_time'] = 'created_time'
  @_hash['dmvpn'] = 'dmvpn'
  @_hash['for_mgmt'] = 'for_mgmt'
  @_hash['for_site'] = 'for_site'
  @_hash['hello_interval'] = 'hello_interval'
  @_hash['hello_retries'] = 'hello_retries'
  @_hash['hostname'] = 'hostname'
  @_hash['id'] = 'id'
  @_hash['ipsec'] = 'ipsec'
  @_hash['is_static'] = 'is_static'
  @_hash['modified_time'] = 'modified_time'
  @_hash['mtu'] = 'mtu'
  @_hash['name'] = 'name'
  @_hash['org_id'] = 'org_id'
  @_hash['peers'] = 'peers'
  @_hash['router_id'] = 'router_id'
  @_hash['secret'] = 'secret'
  @_hash['sessions'] = 'sessions'
  @_hash['site_id'] = 'site_id'
  @_hash['udp_port'] = 'udp_port'
  @_hash['use_udp'] = 'use_udp'
  @_hash
end

.nullablesObject

An array for nullable fields



163
164
165
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 163

def self.nullables
  []
end

.optionalsObject

An array for optional fields



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 137

def self.optionals
  %w[
    created_time
    dmvpn
    for_mgmt
    for_site
    hello_interval
    hello_retries
    hostname
    id
    ipsec
    is_static
    modified_time
    mtu
    org_id
    peers
    router_id
    secret
    sessions
    site_id
    udp_port
    use_udp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 282

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time.inspect}, dmvpn: #{@dmvpn.inspect}, for_mgmt:"\
  " #{@for_mgmt.inspect}, for_site: #{@for_site.inspect}, hello_interval:"\
  " #{@hello_interval.inspect}, hello_retries: #{@hello_retries.inspect}, hostname:"\
  " #{@hostname.inspect}, id: #{@id.inspect}, ipsec: #{@ipsec.inspect}, is_static:"\
  " #{@is_static.inspect}, modified_time: #{@modified_time.inspect}, mtu: #{@mtu.inspect},"\
  " name: #{@name.inspect}, org_id: #{@org_id.inspect}, peers: #{@peers.inspect}, router_id:"\
  " #{@router_id.inspect}, secret: #{@secret.inspect}, sessions: #{@sessions.inspect},"\
  " site_id: #{@site_id.inspect}, udp_port: #{@udp_port.inspect}, use_udp:"\
  " #{@use_udp.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



270
271
272
273
274
275
276
277
278
279
# File 'lib/mist_api/models/wxlan_tunnel.rb', line 270

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time}, dmvpn: #{@dmvpn}, for_mgmt: #{@for_mgmt},"\
  " for_site: #{@for_site}, hello_interval: #{@hello_interval}, hello_retries:"\
  " #{@hello_retries}, hostname: #{@hostname}, id: #{@id}, ipsec: #{@ipsec}, is_static:"\
  " #{@is_static}, modified_time: #{@modified_time}, mtu: #{@mtu}, name: #{@name}, org_id:"\
  " #{@org_id}, peers: #{@peers}, router_id: #{@router_id}, secret: #{@secret}, sessions:"\
  " #{@sessions}, site_id: #{@site_id}, udp_port: #{@udp_port}, use_udp: #{@use_udp},"\
  " additional_properties: #{@additional_properties}>"
end