Class: MistApi::BgpStats

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

Overview

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

Returns a new instance of BgpStats.



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

def initialize(evpn_overlay = SKIP, for_overlay = SKIP, local_as = SKIP,
               mac = SKIP, model = SKIP, neighbor = SKIP,
               neighbor_as = SKIP, neighbor_mac = SKIP, node = SKIP,
               org_id = SKIP, rx_pkts = SKIP, rx_routes = SKIP,
               site_id = 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
  @mac = mac unless mac == SKIP
  @model = model unless model == 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
  @org_id = org_id unless org_id == SKIP
  @rx_pkts = rx_pkts unless rx_pkts == SKIP
  @rx_routes = rx_routes unless rx_routes == SKIP
  @site_id = site_id unless site_id == 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_stats.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_stats.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_stats.rb', line 23

def local_as
  @local_as
end

#macString

Router mac address

Returns:

  • (String)


27
28
29
# File 'lib/mist_api/models/bgp_stats.rb', line 27

def mac
  @mac
end

#modelString

Router mac address

Returns:

  • (String)


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

def model
  @model
end

#neighborString

Router mac address

Returns:

  • (String)


35
36
37
# File 'lib/mist_api/models/bgp_stats.rb', line 35

def neighbor
  @neighbor
end

#neighbor_asObject

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

Returns:

  • (Object)


40
41
42
# File 'lib/mist_api/models/bgp_stats.rb', line 40

def neighbor_as
  @neighbor_as
end

#neighbor_macString

If it’s another device in the same org

Returns:

  • (String)


44
45
46
# File 'lib/mist_api/models/bgp_stats.rb', line 44

def neighbor_mac
  @neighbor_mac
end

#nodeString

Node0/node1

Returns:

  • (String)


48
49
50
# File 'lib/mist_api/models/bgp_stats.rb', line 48

def node
  @node
end

#org_idUUID | String

Node0/node1

Returns:

  • (UUID | String)


52
53
54
# File 'lib/mist_api/models/bgp_stats.rb', line 52

def org_id
  @org_id
end

#rx_pktsInteger

Amount of packets received since connection

Returns:

  • (Integer)


56
57
58
# File 'lib/mist_api/models/bgp_stats.rb', line 56

def rx_pkts
  @rx_pkts
end

#rx_routesInteger

Number of received routes

Returns:

  • (Integer)


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

def rx_routes
  @rx_routes
end

#site_idUUID | String

Number of received routes

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#stateBgpStatsStateEnum

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

Returns:



69
70
71
# File 'lib/mist_api/models/bgp_stats.rb', line 69

def state
  @state
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


73
74
75
# File 'lib/mist_api/models/bgp_stats.rb', line 73

def timestamp
  @timestamp
end

#tx_pktsInteger

Amount of packets sent since connection

Returns:

  • (Integer)


77
78
79
# File 'lib/mist_api/models/bgp_stats.rb', line 77

def tx_pkts
  @tx_pkts
end

#tx_routesInteger

Amount of packets sent since connection

Returns:

  • (Integer)


81
82
83
# File 'lib/mist_api/models/bgp_stats.rb', line 81

def tx_routes
  @tx_routes
end

#upTrueClass | FalseClass

Amount of packets sent since connection

Returns:

  • (TrueClass | FalseClass)


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

def up
  @up
end

#uptimeInteger

Amount of packets sent since connection

Returns:

  • (Integer)


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

def uptime
  @uptime
end

#vrf_nameString

Amount of packets sent since connection

Returns:

  • (String)


93
94
95
# File 'lib/mist_api/models/bgp_stats.rb', line 93

def vrf_name
  @vrf_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  model = hash.key?('model') ? hash['model'] : 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
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  rx_pkts = hash.key?('rx_pkts') ? hash['rx_pkts'] : SKIP
  rx_routes = hash.key?('rx_routes') ? hash['rx_routes'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : 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.
  BgpStats.new(evpn_overlay,
               for_overlay,
               local_as,
               mac,
               model,
               neighbor,
               neighbor_as,
               neighbor_mac,
               node,
               org_id,
               rx_pkts,
               rx_routes,
               site_id,
               state,
               timestamp,
               tx_pkts,
               tx_routes,
               up,
               uptime,
               vrf_name)
end

.namesObject

A mapping from model property names to API property names.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/mist_api/models/bgp_stats.rb', line 96

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['evpn_overlay'] = 'evpn_overlay'
  @_hash['for_overlay'] = 'for_overlay'
  @_hash['local_as'] = 'local_as'
  @_hash['mac'] = 'mac'
  @_hash['model'] = 'model'
  @_hash['neighbor'] = 'neighbor'
  @_hash['neighbor_as'] = 'neighbor_as'
  @_hash['neighbor_mac'] = 'neighbor_mac'
  @_hash['node'] = 'node'
  @_hash['org_id'] = 'org_id'
  @_hash['rx_pkts'] = 'rx_pkts'
  @_hash['rx_routes'] = 'rx_routes'
  @_hash['site_id'] = 'site_id'
  @_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



148
149
150
151
152
153
# File 'lib/mist_api/models/bgp_stats.rb', line 148

def self.nullables
  %w[
    rx_pkts
    tx_pkts
  ]
end

.optionalsObject

An array for optional fields



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/mist_api/models/bgp_stats.rb', line 122

def self.optionals
  %w[
    evpn_overlay
    for_overlay
    local_as
    mac
    model
    neighbor
    neighbor_as
    neighbor_mac
    node
    org_id
    rx_pkts
    rx_routes
    site_id
    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 (BgpStats | Hash)

    value against the validation is performed.



239
240
241
242
243
244
245
# File 'lib/mist_api/models/bgp_stats.rb', line 239

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.



259
260
261
262
263
264
265
266
267
268
269
# File 'lib/mist_api/models/bgp_stats.rb', line 259

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}, mac: #{@mac.inspect}, model:"\
  " #{@model.inspect}, neighbor: #{@neighbor.inspect}, neighbor_as: #{@neighbor_as.inspect},"\
  " neighbor_mac: #{@neighbor_mac.inspect}, node: #{@node.inspect}, org_id:"\
  " #{@org_id.inspect}, rx_pkts: #{@rx_pkts.inspect}, rx_routes: #{@rx_routes.inspect},"\
  " site_id: #{@site_id.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.



248
249
250
251
252
253
254
255
256
# File 'lib/mist_api/models/bgp_stats.rb', line 248

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