Class: NetworkApi::BgpPeerGroup

Inherits:
ApiModelBase 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

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ BgpPeerGroup

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 132

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
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_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: " + acceptable_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?(:'ip_prefixes')
    if (value = attributes[:'ip_prefixes']).is_a?(Array)
      self.ip_prefixes = value
    end
  else
    self.ip_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?(:'peering_loopbacks_v6')
    if (value = attributes[:'peering_loopbacks_v6']).is_a?(Array)
      self.peering_loopbacks_v6 = value
    end
  else
    self.peering_loopbacks_v6 = 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.



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

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`.



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

def advertised_routes
  @advertised_routes
end

#created_onObject

Date and time of creation.



63
64
65
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 63

def created_on
  @created_on
end

#e_bgp_multi_hopObject

The eBGP Multi-hop of the BGP Peer Group.



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

def e_bgp_multi_hop
  @e_bgp_multi_hop
end

#hold_timer_secondsObject

The Hold Timer in seconds of the BGP Peer Group.



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

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

#ip_prefixesObject

The List of the BGP Peer Group IP prefixes.



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

def ip_prefixes
  @ip_prefixes
end

#ipv4_prefixesObject

The List of the BGP Peer Group IPv4 prefixes. Deprecated in favour of generic ipPrefixes.



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.



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

def keep_alive_timer_seconds
  @keep_alive_timer_seconds
end

#last_updated_onObject

Date and time of last update.



66
67
68
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 66

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` and `SEA`.



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.



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

def password
  @password
end

#peering_loopbacks_v4Object

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



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

def peering_loopbacks_v4
  @peering_loopbacks_v4
end

#peering_loopbacks_v6Object

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



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

def peering_loopbacks_v6
  @peering_loopbacks_v6
end

#rpki_roa_origin_asnObject

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



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

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.



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

def target_asn_details
  @target_asn_details
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



92
93
94
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 92

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



97
98
99
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 97

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 69

def self.attribute_map
  {
    :'id' => :'id',
    :'status' => :'status',
    :'location' => :'location',
    :'ipv4_prefixes' => :'ipv4Prefixes',
    :'ip_prefixes' => :'ipPrefixes',
    :'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',
    :'peering_loopbacks_v6' => :'peeringLoopbacksV6',
    :'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



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 544

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



125
126
127
128
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 125

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

.openapi_typesObject

Attribute type mapping.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 102

def self.openapi_types
  {
    :'id' => :'String',
    :'status' => :'String',
    :'location' => :'String',
    :'ipv4_prefixes' => :'Array<BgpIPv4Prefix>',
    :'ip_prefixes' => :'Array<BgpIpPrefix>',
    :'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>',
    :'peering_loopbacks_v6' => :'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



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 507

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 &&
      ip_prefixes == o.ip_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 &&
      peering_loopbacks_v6 == o.peering_loopbacks_v6 &&
      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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


531
532
533
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 531

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



537
538
539
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 537

def hash
  [id, status, location, ipv4_prefixes, ip_prefixes, target_asn_details, active_asn_details, password, advertised_routes, rpki_roa_origin_asn, e_bgp_multi_hop, peering_loopbacks_v4, peering_loopbacks_v6, 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



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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 253

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 @ip_prefixes.nil?
    invalid_properties.push('invalid value for "ip_prefixes", ip_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 greater 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 @peering_loopbacks_v6.nil?
    invalid_properties.push('invalid value for "peering_loopbacks_v6", peering_loopbacks_v6 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_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 566

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/pnap_network_api/models/bgp_peer_group.rb', line 330

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 @ip_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 @peering_loopbacks_v6.nil?
  return false if @keep_alive_timer_seconds.nil?
  return false if @hold_timer_seconds.nil?
  true
end