Class: NetworkApi::BgpPeerGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/pnap_network_api/models/bgp_peer_group.rb

Overview

The Border Gateway Protocol (BGP) Peer Group.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BgpPeerGroup

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 117

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `NetworkApi::BgpPeerGroup` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpPeerGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'location')
    self.location = attributes[:'location']
  else
    self.location = nil
  end

  if attributes.key?(:'ipv4_prefixes')
    if (value = attributes[:'ipv4_prefixes']).is_a?(Array)
      self.ipv4_prefixes = value
    end
  else
    self.ipv4_prefixes = nil
  end

  if attributes.key?(:'target_asn_details')
    self.target_asn_details = attributes[:'target_asn_details']
  else
    self.target_asn_details = nil
  end

  if attributes.key?(:'active_asn_details')
    self.active_asn_details = attributes[:'active_asn_details']
  end

  if attributes.key?(:'password')
    self.password = attributes[:'password']
  else
    self.password = nil
  end

  if attributes.key?(:'advertised_routes')
    self.advertised_routes = attributes[:'advertised_routes']
  else
    self.advertised_routes = nil
  end

  if attributes.key?(:'rpki_roa_origin_asn')
    self.rpki_roa_origin_asn = attributes[:'rpki_roa_origin_asn']
  else
    self.rpki_roa_origin_asn = nil
  end

  if attributes.key?(:'e_bgp_multi_hop')
    self.e_bgp_multi_hop = attributes[:'e_bgp_multi_hop']
  else
    self.e_bgp_multi_hop = nil
  end

  if attributes.key?(:'peering_loopbacks_v4')
    if (value = attributes[:'peering_loopbacks_v4']).is_a?(Array)
      self.peering_loopbacks_v4 = value
    end
  else
    self.peering_loopbacks_v4 = nil
  end

  if attributes.key?(:'keep_alive_timer_seconds')
    self.keep_alive_timer_seconds = attributes[:'keep_alive_timer_seconds']
  else
    self.keep_alive_timer_seconds = nil
  end

  if attributes.key?(:'hold_timer_seconds')
    self.hold_timer_seconds = attributes[:'hold_timer_seconds']
  else
    self.hold_timer_seconds = nil
  end

  if attributes.key?(:'created_on')
    self.created_on = attributes[:'created_on']
  end

  if attributes.key?(:'last_updated_on')
    self.last_updated_on = attributes[:'last_updated_on']
  end
end

Instance Attribute Details

#active_asn_detailsObject

Returns the value of attribute active_asn_details.



33
34
35
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 33

def active_asn_details
  @active_asn_details
end

#advertised_routesObject

The Advertised routes for the BGP Peer Group. Can have one of the following values: ‘DEFAULT` and `NONE`.



39
40
41
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 39

def advertised_routes
  @advertised_routes
end

#created_onObject

Date and time of creation.



57
58
59
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 57

def created_on
  @created_on
end

#e_bgp_multi_hopObject

The eBGP Multi-hop of the BGP Peer Group.



45
46
47
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 45

def e_bgp_multi_hop
  @e_bgp_multi_hop
end

#hold_timer_secondsObject

The Hold Timer in seconds of the BGP Peer Group.



54
55
56
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 54

def hold_timer_seconds
  @hold_timer_seconds
end

#idObject

The unique identifier of the BGP Peer Group.



20
21
22
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 20

def id
  @id
end

#ipv4_prefixesObject

The List of the BGP Peer Group IPv4 prefixes.



29
30
31
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 29

def ipv4_prefixes
  @ipv4_prefixes
end

#keep_alive_timer_secondsObject

The Keep Alive Timer in seconds of the BGP Peer Group.



51
52
53
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 51

def keep_alive_timer_seconds
  @keep_alive_timer_seconds
end

#last_updated_onObject

Date and time of last update.



60
61
62
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 60

def last_updated_on
  @last_updated_on
end

#locationObject

The BGP Peer Group location. Can have one of the following values: ‘PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`.



26
27
28
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 26

def location
  @location
end

#passwordObject

The BGP Peer Group password.



36
37
38
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 36

def password
  @password
end

#peering_loopbacks_v4Object

The IPv4 Peering Loopback addresses of the BGP Peer Group. Valid IP formats are IPv4 addresses.



48
49
50
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 48

def peering_loopbacks_v4
  @peering_loopbacks_v4
end

#rpki_roa_origin_asnObject

The RPKI ROA Origin ASN of the BGP Peer Group based on location.



42
43
44
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 42

def rpki_roa_origin_asn
  @rpki_roa_origin_asn
end

#statusObject

The BGP Peer Group status. Can have one of the following values: ‘PENDING`, `ON_HOLD`, `BUSY`, `READY`, `ERROR`, `PENDING_DELETION` and `DELETING`.



23
24
25
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 23

def status
  @status
end

#target_asn_detailsObject

Returns the value of attribute target_asn_details.



31
32
33
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 31

def target_asn_details
  @target_asn_details
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 394

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = NetworkApi.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



84
85
86
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 84

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 63

def self.attribute_map
  {
    :'id' => :'id',
    :'status' => :'status',
    :'location' => :'location',
    :'ipv4_prefixes' => :'ipv4Prefixes',
    :'target_asn_details' => :'targetAsnDetails',
    :'active_asn_details' => :'activeAsnDetails',
    :'password' => :'password',
    :'advertised_routes' => :'advertisedRoutes',
    :'rpki_roa_origin_asn' => :'rpkiRoaOriginAsn',
    :'e_bgp_multi_hop' => :'eBgpMultiHop',
    :'peering_loopbacks_v4' => :'peeringLoopbacksV4',
    :'keep_alive_timer_seconds' => :'keepAliveTimerSeconds',
    :'hold_timer_seconds' => :'holdTimerSeconds',
    :'created_on' => :'createdOn',
    :'last_updated_on' => :'lastUpdatedOn'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 370

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



110
111
112
113
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 110

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 89

def self.openapi_types
  {
    :'id' => :'String',
    :'status' => :'String',
    :'location' => :'String',
    :'ipv4_prefixes' => :'Array<BgpIPv4Prefix>',
    :'target_asn_details' => :'AsnDetails',
    :'active_asn_details' => :'AsnDetails',
    :'password' => :'String',
    :'advertised_routes' => :'String',
    :'rpki_roa_origin_asn' => :'Integer',
    :'e_bgp_multi_hop' => :'Integer',
    :'peering_loopbacks_v4' => :'Array<String>',
    :'keep_alive_timer_seconds' => :'Integer',
    :'hold_timer_seconds' => :'Integer',
    :'created_on' => :'String',
    :'last_updated_on' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 335

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      status == o.status &&
      location == o.location &&
      ipv4_prefixes == o.ipv4_prefixes &&
      target_asn_details == o.target_asn_details &&
      active_asn_details == o.active_asn_details &&
      password == o.password &&
      advertised_routes == o.advertised_routes &&
      rpki_roa_origin_asn == o.rpki_roa_origin_asn &&
      e_bgp_multi_hop == o.e_bgp_multi_hop &&
      peering_loopbacks_v4 == o.peering_loopbacks_v4 &&
      keep_alive_timer_seconds == o.keep_alive_timer_seconds &&
      hold_timer_seconds == o.hold_timer_seconds &&
      created_on == o.created_on &&
      last_updated_on == o.last_updated_on
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 465

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


357
358
359
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 357

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



363
364
365
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 363

def hash
  [id, status, location, ipv4_prefixes, target_asn_details, active_asn_details, password, advertised_routes, rpki_roa_origin_asn, e_bgp_multi_hop, peering_loopbacks_v4, keep_alive_timer_seconds, hold_timer_seconds, created_on, last_updated_on].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 221

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @location.nil?
    invalid_properties.push('invalid value for "location", location cannot be nil.')
  end

  if @ipv4_prefixes.nil?
    invalid_properties.push('invalid value for "ipv4_prefixes", ipv4_prefixes cannot be nil.')
  end

  if @target_asn_details.nil?
    invalid_properties.push('invalid value for "target_asn_details", target_asn_details cannot be nil.')
  end

  if @password.nil?
    invalid_properties.push('invalid value for "password", password cannot be nil.')
  end

  if @password.to_s.length > 32
    invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 32.')
  end

  if @password.to_s.length < 8
    invalid_properties.push('invalid value for "password", the character length must be great than or equal to 8.')
  end

  pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
  if @password !~ pattern
    invalid_properties.push("invalid value for \"password\", must conform to the pattern #{pattern}.")
  end

  if @advertised_routes.nil?
    invalid_properties.push('invalid value for "advertised_routes", advertised_routes cannot be nil.')
  end

  if @rpki_roa_origin_asn.nil?
    invalid_properties.push('invalid value for "rpki_roa_origin_asn", rpki_roa_origin_asn cannot be nil.')
  end

  if @e_bgp_multi_hop.nil?
    invalid_properties.push('invalid value for "e_bgp_multi_hop", e_bgp_multi_hop cannot be nil.')
  end

  if @peering_loopbacks_v4.nil?
    invalid_properties.push('invalid value for "peering_loopbacks_v4", peering_loopbacks_v4 cannot be nil.')
  end

  if @keep_alive_timer_seconds.nil?
    invalid_properties.push('invalid value for "keep_alive_timer_seconds", keep_alive_timer_seconds cannot be nil.')
  end

  if @hold_timer_seconds.nil?
    invalid_properties.push('invalid value for "hold_timer_seconds", hold_timer_seconds cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



441
442
443
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 441

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 447

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



435
436
437
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 435

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 290

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @status.nil?
  return false if @location.nil?
  return false if @ipv4_prefixes.nil?
  return false if @target_asn_details.nil?
  return false if @password.nil?
  return false if @password.to_s.length > 32
  return false if @password.to_s.length < 8
  return false if @password !~ Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/)
  return false if @advertised_routes.nil?
  return false if @rpki_roa_origin_asn.nil?
  return false if @e_bgp_multi_hop.nil?
  return false if @peering_loopbacks_v4.nil?
  return false if @keep_alive_timer_seconds.nil?
  return false if @hold_timer_seconds.nil?
  true
end