Class: MistApi::UtilsShowRoute

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

Overview

UtilsShowRoute 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(duration = 0, interval = 0, neighbor = SKIP, node = SKIP, prefix = SKIP, protocol = UtilsShowRouteProtocol2Enum::BGP, route = SKIP, vrf = SKIP, additional_properties = nil) ⇒ UtilsShowRoute

Returns a new instance of UtilsShowRoute.



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

def initialize(duration = 0, interval = 0, neighbor = SKIP, node = SKIP,
               prefix = SKIP, protocol = UtilsShowRouteProtocol2Enum::BGP,
               route = SKIP, vrf = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @duration = duration unless duration == SKIP
  @interval = interval unless interval == SKIP
  @neighbor = neighbor unless neighbor == SKIP
  @node = node unless node == SKIP
  @prefix = prefix unless prefix == SKIP
  @protocol = protocol unless protocol == SKIP
  @route = route unless route == SKIP
  @vrf = vrf unless vrf == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#durationInteger

Duration in sec for which refresh is enabled. Should be set only if interval is configured to non-zero value.

Returns:

  • (Integer)


15
16
17
# File 'lib/mist_api/models/utils_show_route.rb', line 15

def duration
  @duration
end

#intervalInteger

Rate at which output will refresh

Returns:

  • (Integer)


19
20
21
# File 'lib/mist_api/models/utils_show_route.rb', line 19

def interval
  @interval
end

#neighborString

IP of the neighbor

Returns:

  • (String)


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

def neighbor
  @neighbor
end

#nodeHaClusterNode

IP of the neighbor

Returns:



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

def node
  @node
end

#prefixString

can be ip, ipv6 prefix

Returns:

  • (String)


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

def prefix
  @prefix
end

#protocolUtilsShowRouteProtocol2Enum

(optional) Supported only for bgp



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

def protocol
  @protocol
end

#routeString

if neighbor is specified, received / advertised; if not specified, both will be shown

* for SSR, show bgp neighbors 10.250.18.202

received-routes/advertised-routes

* for SRX and Switches, show route receive-protocol/advertise-protocol

bgp 192.168.255.12

Returns:

  • (String)


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

def route
  @route
end

#vrfString

VRF name

Returns:

  • (String)


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

def vrf
  @vrf
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
102
103
104
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
# File 'lib/mist_api/models/utils_show_route.rb', line 101

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  duration = hash['duration'] ||= 0
  interval = hash['interval'] ||= 0
  neighbor = hash.key?('neighbor') ? hash['neighbor'] : SKIP
  node = HaClusterNode.from_hash(hash['node']) if hash['node']
  prefix = hash.key?('prefix') ? hash['prefix'] : SKIP
  protocol = hash['protocol'] ||= UtilsShowRouteProtocol2Enum::BGP
  route = hash.key?('route') ? hash['route'] : SKIP
  vrf = hash.key?('vrf') ? hash['vrf'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UtilsShowRoute.new(duration,
                     interval,
                     neighbor,
                     node,
                     prefix,
                     protocol,
                     route,
                     vrf,
                     additional_properties)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/mist_api/models/utils_show_route.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['duration'] = 'duration'
  @_hash['interval'] = 'interval'
  @_hash['neighbor'] = 'neighbor'
  @_hash['node'] = 'node'
  @_hash['prefix'] = 'prefix'
  @_hash['protocol'] = 'protocol'
  @_hash['route'] = 'route'
  @_hash['vrf'] = 'vrf'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/mist_api/models/utils_show_route.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mist_api/models/utils_show_route.rb', line 65

def self.optionals
  %w[
    duration
    interval
    neighbor
    node
    prefix
    protocol
    route
    vrf
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



142
143
144
145
146
147
148
# File 'lib/mist_api/models/utils_show_route.rb', line 142

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} duration: #{@duration.inspect}, interval: #{@interval.inspect}, neighbor:"\
  " #{@neighbor.inspect}, node: #{@node.inspect}, prefix: #{@prefix.inspect}, protocol:"\
  " #{@protocol.inspect}, route: #{@route.inspect}, vrf: #{@vrf.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



134
135
136
137
138
139
# File 'lib/mist_api/models/utils_show_route.rb', line 134

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} duration: #{@duration}, interval: #{@interval}, neighbor: #{@neighbor},"\
  " node: #{@node}, prefix: #{@prefix}, protocol: #{@protocol}, route: #{@route}, vrf:"\
  " #{@vrf}, additional_properties: #{@additional_properties}>"
end