Class: MistApi::GatewayOobIpConfig

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

Overview

Out-of-band (vme/em0/fxp0) IP config

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(gateway = SKIP, ip = SKIP, netmask = SKIP, node1 = SKIP, type = IpTypeEnum::DHCP, use_mgmt_vrf = false, use_mgmt_vrf_for_host_out = false, vlan_id = SKIP) ⇒ GatewayOobIpConfig

Returns a new instance of GatewayOobIpConfig.



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

def initialize(gateway = SKIP, ip = SKIP, netmask = SKIP, node1 = SKIP,
               type = IpTypeEnum::DHCP, use_mgmt_vrf = false,
               use_mgmt_vrf_for_host_out = false, vlan_id = SKIP)
  @gateway = gateway unless gateway == SKIP
  @ip = ip unless ip == SKIP
  @netmask = netmask unless netmask == SKIP
  @node1 = node1 unless node1 == SKIP
  @type = type unless type == SKIP
  @use_mgmt_vrf = use_mgmt_vrf unless use_mgmt_vrf == SKIP
  unless use_mgmt_vrf_for_host_out == SKIP
    @use_mgmt_vrf_for_host_out =
      use_mgmt_vrf_for_host_out
  end
  @vlan_id = vlan_id unless vlan_id == SKIP
end

Instance Attribute Details

#gatewayString

If ‘type`==`static`

Returns:

  • (String)


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

def gateway
  @gateway
end

#ipString

If ‘type`==`static`

Returns:

  • (String)


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

def ip
  @ip
end

#netmaskString

If ‘type`==`static`

Returns:

  • (String)


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

def netmask
  @netmask
end

#node1GatewayOobIpConfigNode1

For HA Cluster, node1 can have different IP Config



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

def node1
  @node1
end

#typeIpTypeEnum

enum: ‘dhcp`, `static`

Returns:



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

def type
  @type
end

#use_mgmt_vrfTrueClass | FalseClass

If supported on the platform. If enabled, DNS will be using this routing-instance, too

Returns:

  • (TrueClass | FalseClass)


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

def use_mgmt_vrf
  @use_mgmt_vrf
end

#use_mgmt_vrf_for_host_outTrueClass | FalseClass

For host-out traffic (NTP/TACPLUS/RADIUS/SYSLOG/SNMP), if alternative source network/ip is desired

Returns:

  • (TrueClass | FalseClass)


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

def use_mgmt_vrf_for_host_out
  @use_mgmt_vrf_for_host_out
end

#vlan_idObject

If WAN interface is on a VLAN. Can be the VLAN ID (i.e. “10”) or a Variable (i.e. “{myvar}”)

Returns:

  • (Object)


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

def vlan_id
  @vlan_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  gateway = hash.key?('gateway') ? hash['gateway'] : SKIP
  ip = hash.key?('ip') ? hash['ip'] : SKIP
  netmask = hash.key?('netmask') ? hash['netmask'] : SKIP
  node1 = GatewayOobIpConfigNode1.from_hash(hash['node1']) if hash['node1']
  type = hash['type'] ||= IpTypeEnum::DHCP
  use_mgmt_vrf = hash['use_mgmt_vrf'] ||= false
  use_mgmt_vrf_for_host_out = hash['use_mgmt_vrf_for_host_out'] ||= false
  vlan_id = hash.key?('vlan_id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:GatewayPortVlanIdWithVariable), hash['vlan_id']
  ) : SKIP

  # Create object from extracted values.
  GatewayOobIpConfig.new(gateway,
                         ip,
                         netmask,
                         node1,
                         type,
                         use_mgmt_vrf,
                         use_mgmt_vrf_for_host_out,
                         vlan_id)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/mist_api/models/gateway_oob_ip_config.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['gateway'] = 'gateway'
  @_hash['ip'] = 'ip'
  @_hash['netmask'] = 'netmask'
  @_hash['node1'] = 'node1'
  @_hash['type'] = 'type'
  @_hash['use_mgmt_vrf'] = 'use_mgmt_vrf'
  @_hash['use_mgmt_vrf_for_host_out'] = 'use_mgmt_vrf_for_host_out'
  @_hash['vlan_id'] = 'vlan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



76
77
78
# File 'lib/mist_api/models/gateway_oob_ip_config.rb', line 76

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mist_api/models/gateway_oob_ip_config.rb', line 62

def self.optionals
  %w[
    gateway
    ip
    netmask
    node1
    type
    use_mgmt_vrf
    use_mgmt_vrf_for_host_out
    vlan_id
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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

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.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} gateway: #{@gateway.inspect}, ip: #{@ip.inspect}, netmask:"\
  " #{@netmask.inspect}, node1: #{@node1.inspect}, type: #{@type.inspect}, use_mgmt_vrf:"\
  " #{@use_mgmt_vrf.inspect}, use_mgmt_vrf_for_host_out:"\
  " #{@use_mgmt_vrf_for_host_out.inspect}, vlan_id: #{@vlan_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} gateway: #{@gateway}, ip: #{@ip}, netmask: #{@netmask}, node1: #{@node1},"\
  " type: #{@type}, use_mgmt_vrf: #{@use_mgmt_vrf}, use_mgmt_vrf_for_host_out:"\
  " #{@use_mgmt_vrf_for_host_out}, vlan_id: #{@vlan_id}>"
end