Class: MistApi::BgpPeer

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

Overview

Only present when ‘bgp_peers` in `fields` query parameter

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(evpn_overlay = SKIP, for_overlay = SKIP, local_as = SKIP, neighbor = SKIP, neighbor_as = SKIP, neighbor_mac = SKIP, node = SKIP, rx_pkts = SKIP, rx_routes = SKIP, state = SKIP, timestamp = SKIP, tx_pkts = SKIP, tx_routes = SKIP, up = SKIP, uptime = SKIP, vrf_name = SKIP) ⇒ BgpPeer

Returns a new instance of BgpPeer.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/mist_api/models/bgp_peer.rb', line 132

def initialize(evpn_overlay = SKIP, for_overlay = SKIP, local_as = SKIP,
               neighbor = SKIP, neighbor_as = SKIP, neighbor_mac = SKIP,
               node = SKIP, rx_pkts = SKIP, rx_routes = SKIP, state = SKIP,
               timestamp = SKIP, tx_pkts = SKIP, tx_routes = SKIP,
               up = SKIP, uptime = SKIP, vrf_name = SKIP)
  @evpn_overlay = evpn_overlay unless evpn_overlay == SKIP
  @for_overlay = for_overlay unless for_overlay == SKIP
  @local_as = local_as unless local_as == SKIP
  @neighbor = neighbor unless neighbor == SKIP
  @neighbor_as = neighbor_as unless neighbor_as == SKIP
  @neighbor_mac = neighbor_mac unless neighbor_mac == SKIP
  @node = node unless node == SKIP
  @rx_pkts = rx_pkts unless rx_pkts == SKIP
  @rx_routes = rx_routes unless rx_routes == SKIP
  @state = state unless state == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @tx_pkts = tx_pkts unless tx_pkts == SKIP
  @tx_routes = tx_routes unless tx_routes == SKIP
  @up = up unless up == SKIP
  @uptime = uptime unless uptime == SKIP
  @vrf_name = vrf_name unless vrf_name == SKIP
end

Instance Attribute Details

#evpn_overlayTrueClass | FalseClass

If this is created for evpn overlay

Returns:

  • (TrueClass | FalseClass)


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

def evpn_overlay
  @evpn_overlay
end

#for_overlayTrueClass | FalseClass

If this is created for overlay

Returns:

  • (TrueClass | FalseClass)


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

def for_overlay
  @for_overlay
end

#local_asObject

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

Returns:

  • (Object)


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

def local_as
  @local_as
end

#neighborString

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

Returns:

  • (String)


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

def neighbor
  @neighbor
end

#neighbor_asObject

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

Returns:

  • (Object)


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

def neighbor_as
  @neighbor_as
end

#neighbor_macString

If it’s another device in the same org

Returns:

  • (String)


37
38
39
# File 'lib/mist_api/models/bgp_peer.rb', line 37

def neighbor_mac
  @neighbor_mac
end

#nodeString

Node0/node1

Returns:

  • (String)


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

def node
  @node
end

#rx_pktsInteger

Amount of packets received since connection

Returns:

  • (Integer)


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

def rx_pkts
  @rx_pkts
end

#rx_routesInteger

Number of received routes

Returns:

  • (Integer)


49
50
51
# File 'lib/mist_api/models/bgp_peer.rb', line 49

def rx_routes
  @rx_routes
end

#stateBgpStatsStateEnum

enum: ‘active`, `connect`, `established`, `idle`, `open_config`, `open_sent`

Returns:



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

def state
  @state
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


58
59
60
# File 'lib/mist_api/models/bgp_peer.rb', line 58

def timestamp
  @timestamp
end

#tx_pktsInteger

Amount of packets sent since connection

Returns:

  • (Integer)


62
63
64
# File 'lib/mist_api/models/bgp_peer.rb', line 62

def tx_pkts
  @tx_pkts
end

#tx_routesInteger

Amount of packets sent since connection

Returns:

  • (Integer)


66
67
68
# File 'lib/mist_api/models/bgp_peer.rb', line 66

def tx_routes
  @tx_routes
end

#upTrueClass | FalseClass

Amount of packets sent since connection

Returns:

  • (TrueClass | FalseClass)


70
71
72
# File 'lib/mist_api/models/bgp_peer.rb', line 70

def up
  @up
end

#uptimeInteger

Amount of packets sent since connection

Returns:

  • (Integer)


74
75
76
# File 'lib/mist_api/models/bgp_peer.rb', line 74

def uptime
  @uptime
end

#vrf_nameString

Amount of packets sent since connection

Returns:

  • (String)


78
79
80
# File 'lib/mist_api/models/bgp_peer.rb', line 78

def vrf_name
  @vrf_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  evpn_overlay = hash.key?('evpn_overlay') ? hash['evpn_overlay'] : SKIP
  for_overlay = hash.key?('for_overlay') ? hash['for_overlay'] : SKIP
  local_as = hash.key?('local_as') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:BgpAs), hash['local_as']
  ) : SKIP
  neighbor = hash.key?('neighbor') ? hash['neighbor'] : SKIP
  neighbor_as = hash.key?('neighbor_as') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:BgpAs), hash['neighbor_as']
  ) : SKIP
  neighbor_mac = hash.key?('neighbor_mac') ? hash['neighbor_mac'] : SKIP
  node = hash.key?('node') ? hash['node'] : SKIP
  rx_pkts = hash.key?('rx_pkts') ? hash['rx_pkts'] : SKIP
  rx_routes = hash.key?('rx_routes') ? hash['rx_routes'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  tx_pkts = hash.key?('tx_pkts') ? hash['tx_pkts'] : SKIP
  tx_routes = hash.key?('tx_routes') ? hash['tx_routes'] : SKIP
  up = hash.key?('up') ? hash['up'] : SKIP
  uptime = hash.key?('uptime') ? hash['uptime'] : SKIP
  vrf_name = hash.key?('vrf_name') ? hash['vrf_name'] : SKIP

  # Create object from extracted values.
  BgpPeer.new(evpn_overlay,
              for_overlay,
              local_as,
              neighbor,
              neighbor_as,
              neighbor_mac,
              node,
              rx_pkts,
              rx_routes,
              state,
              timestamp,
              tx_pkts,
              tx_routes,
              up,
              uptime,
              vrf_name)
end

.namesObject

A mapping from model property names to API property names.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/mist_api/models/bgp_peer.rb', line 81

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['evpn_overlay'] = 'evpn_overlay'
  @_hash['for_overlay'] = 'for_overlay'
  @_hash['local_as'] = 'local_as'
  @_hash['neighbor'] = 'neighbor'
  @_hash['neighbor_as'] = 'neighbor_as'
  @_hash['neighbor_mac'] = 'neighbor_mac'
  @_hash['node'] = 'node'
  @_hash['rx_pkts'] = 'rx_pkts'
  @_hash['rx_routes'] = 'rx_routes'
  @_hash['state'] = 'state'
  @_hash['timestamp'] = 'timestamp'
  @_hash['tx_pkts'] = 'tx_pkts'
  @_hash['tx_routes'] = 'tx_routes'
  @_hash['up'] = 'up'
  @_hash['uptime'] = 'uptime'
  @_hash['vrf_name'] = 'vrf_name'
  @_hash
end

.nullablesObject

An array for nullable fields



125
126
127
128
129
130
# File 'lib/mist_api/models/bgp_peer.rb', line 125

def self.nullables
  %w[
    rx_pkts
    tx_pkts
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    evpn_overlay
    for_overlay
    local_as
    neighbor
    neighbor_as
    neighbor_mac
    node
    rx_pkts
    rx_routes
    state
    timestamp
    tx_pkts
    tx_routes
    up
    uptime
    vrf_name
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (BgpPeer | Hash)

    value against the validation is performed.



202
203
204
205
206
207
208
# File 'lib/mist_api/models/bgp_peer.rb', line 202

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



221
222
223
224
225
226
227
228
229
230
# File 'lib/mist_api/models/bgp_peer.rb', line 221

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} evpn_overlay: #{@evpn_overlay.inspect}, for_overlay:"\
  " #{@for_overlay.inspect}, local_as: #{@local_as.inspect}, neighbor: #{@neighbor.inspect},"\
  " neighbor_as: #{@neighbor_as.inspect}, neighbor_mac: #{@neighbor_mac.inspect}, node:"\
  " #{@node.inspect}, rx_pkts: #{@rx_pkts.inspect}, rx_routes: #{@rx_routes.inspect}, state:"\
  " #{@state.inspect}, timestamp: #{@timestamp.inspect}, tx_pkts: #{@tx_pkts.inspect},"\
  " tx_routes: #{@tx_routes.inspect}, up: #{@up.inspect}, uptime: #{@uptime.inspect},"\
  " vrf_name: #{@vrf_name.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



211
212
213
214
215
216
217
218
# File 'lib/mist_api/models/bgp_peer.rb', line 211

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} evpn_overlay: #{@evpn_overlay}, for_overlay: #{@for_overlay}, local_as:"\
  " #{@local_as}, neighbor: #{@neighbor}, neighbor_as: #{@neighbor_as}, neighbor_mac:"\
  " #{@neighbor_mac}, node: #{@node}, rx_pkts: #{@rx_pkts}, rx_routes: #{@rx_routes}, state:"\
  " #{@state}, timestamp: #{@timestamp}, tx_pkts: #{@tx_pkts}, tx_routes: #{@tx_routes}, up:"\
  " #{@up}, uptime: #{@uptime}, vrf_name: #{@vrf_name}>"
end