Class: MistApi::UtilsTraceroute

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

Overview

UtilsTraceroute 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(host = SKIP, network = 'internal', node = SKIP, port = 33434, protocol = UtilsTracerouteProtocolEnum::UDP, timeout = 60, use_ipv6 = false, vrf = SKIP, additional_properties = nil) ⇒ UtilsTraceroute

Returns a new instance of UtilsTraceroute.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/mist_api/models/utils_traceroute.rb', line 78

def initialize(host = SKIP, network = 'internal', node = SKIP, port = 33434,
               protocol = UtilsTracerouteProtocolEnum::UDP, timeout = 60,
               use_ipv6 = false, vrf = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @host = host unless host == SKIP
  @network = network unless network == SKIP
  @node = node unless node == SKIP
  @port = port unless port == SKIP
  @protocol = protocol unless protocol == SKIP
  @timeout = timeout unless timeout == SKIP
  @use_ipv6 = use_ipv6 unless use_ipv6 == SKIP
  @vrf = vrf unless vrf == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#hostString

can be ip, ipv6, hostname

Returns:

  • (String)


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

def host
  @host
end

#networkString

For SSR, optional, the source to initiate traceroute from

Returns:

  • (String)


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

def network
  @network
end

#nodeHaClusterNodeEnum

only for HA. enum: ‘node0`, `node1`

Returns:



22
23
24
# File 'lib/mist_api/models/utils_traceroute.rb', line 22

def node
  @node
end

#portInteger

When ‘protocol`==`udp`, not supported in SSR. The udp port to use

Returns:

  • (Integer)


26
27
28
# File 'lib/mist_api/models/utils_traceroute.rb', line 26

def port
  @port
end

#protocolUtilsTracerouteProtocolEnum

enum: ‘icmp` (Only supported by AP/MxEdge), `udp`



30
31
32
# File 'lib/mist_api/models/utils_traceroute.rb', line 30

def protocol
  @protocol
end

#timeoutInteger

Not supported in SSR. Maximum time in seconds to wait for the response

Returns:

  • (Integer)


34
35
36
# File 'lib/mist_api/models/utils_traceroute.rb', line 34

def timeout
  @timeout
end

#use_ipv6TrueClass | FalseClass

applicable when host is hostname

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/mist_api/models/utils_traceroute.rb', line 38

def use_ipv6
  @use_ipv6
end

#vrfString

For SRX, optional, the source to initiate traceroute from. by default, master VRF/RI is assumed

Returns:

  • (String)


43
44
45
# File 'lib/mist_api/models/utils_traceroute.rb', line 43

def vrf
  @vrf
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
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
# File 'lib/mist_api/models/utils_traceroute.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  host = hash.key?('host') ? hash['host'] : SKIP
  network = hash['network'] ||= 'internal'
  node = hash.key?('node') ? hash['node'] : SKIP
  port = hash['port'] ||= 33434
  protocol = hash['protocol'] ||= UtilsTracerouteProtocolEnum::UDP
  timeout = hash['timeout'] ||= 60
  use_ipv6 = hash['use_ipv6'] ||= false
  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.
  UtilsTraceroute.new(host,
                      network,
                      node,
                      port,
                      protocol,
                      timeout,
                      use_ipv6,
                      vrf,
                      additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/mist_api/models/utils_traceroute.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['host'] = 'host'
  @_hash['network'] = 'network'
  @_hash['node'] = 'node'
  @_hash['port'] = 'port'
  @_hash['protocol'] = 'protocol'
  @_hash['timeout'] = 'timeout'
  @_hash['use_ipv6'] = 'use_ipv6'
  @_hash['vrf'] = 'vrf'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/utils_traceroute.rb', line 60

def self.optionals
  %w[
    host
    network
    node
    port
    protocol
    timeout
    use_ipv6
    vrf
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
# File 'lib/mist_api/models/utils_traceroute.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} host: #{@host.inspect}, network: #{@network.inspect}, node:"\
  " #{@node.inspect}, port: #{@port.inspect}, protocol: #{@protocol.inspect}, timeout:"\
  " #{@timeout.inspect}, use_ipv6: #{@use_ipv6.inspect}, vrf: #{@vrf.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



129
130
131
132
133
134
# File 'lib/mist_api/models/utils_traceroute.rb', line 129

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} host: #{@host}, network: #{@network}, node: #{@node}, port: #{@port},"\
  " protocol: #{@protocol}, timeout: #{@timeout}, use_ipv6: #{@use_ipv6}, vrf: #{@vrf},"\
  " additional_properties: #{@additional_properties}>"
end