Class: MistApi::SwitchBgpConfig

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

Overview

SwitchBgpConfig Model.

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(local_as = nil, type = nil, auth_key = SKIP, bfd_minimum_interval = SKIP, export_policy = SKIP, hold_time = SKIP, import_policy = SKIP, neighbors = SKIP, networks = SKIP) ⇒ SwitchBgpConfig

Returns a new instance of SwitchBgpConfig.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/mist_api/models/switch_bgp_config.rb', line 89

def initialize(local_as = nil, type = nil, auth_key = SKIP,
               bfd_minimum_interval = SKIP, export_policy = SKIP,
               hold_time = SKIP, import_policy = SKIP, neighbors = SKIP,
               networks = SKIP)
  @auth_key = auth_key unless auth_key == SKIP
  @bfd_minimum_interval = bfd_minimum_interval unless bfd_minimum_interval == SKIP
  @export_policy = export_policy unless export_policy == SKIP
  @hold_time = hold_time unless hold_time == SKIP
  @import_policy = import_policy unless import_policy == SKIP
  @local_as = local_as
  @neighbors = neighbors unless neighbors == SKIP
  @networks = networks unless networks == SKIP
  @type = type
end

Instance Attribute Details

#auth_keyString

TODO: Write general description for this method

Returns:

  • (String)


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

def auth_key
  @auth_key
end

#bfd_minimum_intervalInteger

Minimum interval in milliseconds for BFD hello packets. A neighbor is considered failed when the device stops receiving replies after the specified interval. Value must be between 1 and 255000.

Returns:

  • (Integer)


20
21
22
# File 'lib/mist_api/models/switch_bgp_config.rb', line 20

def bfd_minimum_interval
  @bfd_minimum_interval
end

#export_policyString

Export policy must match one of the policy names defined in the ‘routing_policies` property.

Returns:

  • (String)


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

def export_policy
  @export_policy
end

#hold_timeInteger

Hold time is three times the interval at which keepalive messages are sent. It indicates to the peer the length of time that it should consider the sender valid. Must be 0 or a number in the range 3-65535.

Returns:

  • (Integer)


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

def hold_time
  @hold_time
end

#import_policyString

Import policy must match one of the policy names defined in the ‘routing_policies` property.

Returns:

  • (String)


36
37
38
# File 'lib/mist_api/models/switch_bgp_config.rb', line 36

def import_policy
  @import_policy
end

#local_asObject

BGP AS, value in range 1-4294967294. Can be a Variable (e.g. ‘{bgp_as}` )

Returns:

  • (Object)


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

def local_as
  @local_as
end

#neighborsHash[String, SwitchBgpConfigNeighbor]

Property key is the BGP Neighbor IP Address.

Returns:



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

def neighbors
  @neighbors
end

#networksArray[String]

List of network names for BGP configuration. When a network is specified, a BGP group will be added to the VRF that network is part of.

Returns:

  • (Array[String])


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

def networks
  @networks
end

#typeSwitchBgpConfigTypeEnum

enum: ‘external`, `internal`



54
55
56
# File 'lib/mist_api/models/switch_bgp_config.rb', line 54

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



105
106
107
108
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
# File 'lib/mist_api/models/switch_bgp_config.rb', line 105

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  local_as = hash.key?('local_as') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:BgpAs5), hash['local_as']
  ) : nil
  type = hash.key?('type') ? hash['type'] : nil
  auth_key = hash.key?('auth_key') ? hash['auth_key'] : SKIP
  bfd_minimum_interval =
    hash.key?('bfd_minimum_interval') ? hash['bfd_minimum_interval'] : SKIP
  export_policy = hash.key?('export_policy') ? hash['export_policy'] : SKIP
  hold_time = hash.key?('hold_time') ? hash['hold_time'] : SKIP
  import_policy = hash.key?('import_policy') ? hash['import_policy'] : SKIP
  neighbors = SwitchBgpConfigNeighbor.from_hash(hash['neighbors']) if hash['neighbors']

  neighbors = SKIP unless hash.key?('neighbors')
  networks = hash.key?('networks') ? hash['networks'] : SKIP

  # Create object from extracted values.
  SwitchBgpConfig.new(local_as,
                      type,
                      auth_key,
                      bfd_minimum_interval,
                      export_policy,
                      hold_time,
                      import_policy,
                      neighbors,
                      networks)
end

.namesObject

A mapping from model property names to API property names.



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/mist_api/models/switch_bgp_config.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auth_key'] = 'auth_key'
  @_hash['bfd_minimum_interval'] = 'bfd_minimum_interval'
  @_hash['export_policy'] = 'export_policy'
  @_hash['hold_time'] = 'hold_time'
  @_hash['import_policy'] = 'import_policy'
  @_hash['local_as'] = 'local_as'
  @_hash['neighbors'] = 'neighbors'
  @_hash['networks'] = 'networks'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/mist_api/models/switch_bgp_config.rb', line 72

def self.optionals
  %w[
    auth_key
    bfd_minimum_interval
    export_policy
    hold_time
    import_policy
    neighbors
    networks
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (SwitchBgpConfig | Hash)

    value against the validation is performed.



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

def self.validate(value)
  if value.instance_of? self
    return (
      UnionTypeLookUp.get(:BgpAs5)
                     .validate(value.local_as) and
        APIHelper.valid_type?(value.type,
                              ->(val) { SwitchBgpConfigTypeEnum.validate(val) })
    )
  end

  return false unless value.instance_of? Hash

  (
    UnionTypeLookUp.get(:BgpAs5)
                   .validate(value['local_as']) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { SwitchBgpConfigTypeEnum.validate(val) })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



168
169
170
171
172
173
174
175
# File 'lib/mist_api/models/switch_bgp_config.rb', line 168

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_key: #{@auth_key.inspect}, bfd_minimum_interval:"\
  " #{@bfd_minimum_interval.inspect}, export_policy: #{@export_policy.inspect}, hold_time:"\
  " #{@hold_time.inspect}, import_policy: #{@import_policy.inspect}, local_as:"\
  " #{@local_as.inspect}, neighbors: #{@neighbors.inspect}, networks: #{@networks.inspect},"\
  " type: #{@type.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



159
160
161
162
163
164
165
# File 'lib/mist_api/models/switch_bgp_config.rb', line 159

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_key: #{@auth_key}, bfd_minimum_interval: #{@bfd_minimum_interval},"\
  " export_policy: #{@export_policy}, hold_time: #{@hold_time}, import_policy:"\
  " #{@import_policy}, local_as: #{@local_as}, neighbors: #{@neighbors}, networks:"\
  " #{@networks}, type: #{@type}>"
end