Class: MistApi::EvpnTopologySwitchConfig

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

Overview

EvpnTopologySwitchConfig 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(dhcpd_config = SKIP, networks = SKIP, other_ip_configs = SKIP, port_config = SKIP, port_usages = SKIP, router_id = SKIP, vrf_config = SKIP) ⇒ EvpnTopologySwitchConfig

Returns a new instance of EvpnTopologySwitchConfig.



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/mist_api/models/evpn_topology_switch_config.rb', line 73

def initialize(dhcpd_config = SKIP, networks = SKIP,
               other_ip_configs = SKIP, port_config = SKIP,
               port_usages = SKIP, router_id = SKIP, vrf_config = SKIP)
  @dhcpd_config = dhcpd_config unless dhcpd_config == SKIP
  @networks = networks unless networks == SKIP
  @other_ip_configs = other_ip_configs unless other_ip_configs == SKIP
  @port_config = port_config unless port_config == SKIP
  @port_usages = port_usages unless port_usages == SKIP
  @router_id = router_id unless router_id == SKIP
  @vrf_config = vrf_config unless vrf_config == SKIP
end

Instance Attribute Details

#dhcpd_configEvpnTopologySwitchConfigDhcpdConfig

TODO: Write general description for this method



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

def dhcpd_config
  @dhcpd_config
end

#networksHash[String, SwitchNetwork]

Property key is network name

Returns:



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

def networks
  @networks
end

#other_ip_configsHash[String, JunosOtherIpConfig]

Additional IP Addresses configured on the switch. Property key is the port network name

Returns:



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

def other_ip_configs
  @other_ip_configs
end

#port_configHash[String, JunosPortConfig]

Property key is the port name or range (e.g. “ge-0/0/0-10”)

Returns:



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

def port_config
  @port_config
end

#port_usagesHash[String, SwitchPortUsage]

Property key is the port usage name. Defines the profiles of port configuration configured on the switch

Returns:



32
33
34
# File 'lib/mist_api/models/evpn_topology_switch_config.rb', line 32

def port_usages
  @port_usages
end

#router_idString

Used for OSPF / BGP / EVPN

Returns:

  • (String)


36
37
38
# File 'lib/mist_api/models/evpn_topology_switch_config.rb', line 36

def router_id
  @router_id
end

#vrf_configEvpnTopologySwitchConfigVrfConfig

Used for OSPF / BGP / EVPN



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

def vrf_config
  @vrf_config
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/mist_api/models/evpn_topology_switch_config.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  dhcpd_config = EvpnTopologySwitchConfigDhcpdConfig.from_hash(hash['dhcpd_config']) if
    hash['dhcpd_config']
  networks = SwitchNetwork.from_hash(hash['networks']) if hash['networks']

  networks = SKIP unless hash.key?('networks')
  other_ip_configs = JunosOtherIpConfig.from_hash(hash['other_ip_configs']) if
    hash['other_ip_configs']

  other_ip_configs = SKIP unless hash.key?('other_ip_configs')
  port_config = JunosPortConfig.from_hash(hash['port_config']) if hash['port_config']

  port_config = SKIP unless hash.key?('port_config')
  port_usages = SwitchPortUsage.from_hash(hash['port_usages']) if hash['port_usages']

  port_usages = SKIP unless hash.key?('port_usages')
  router_id = hash.key?('router_id') ? hash['router_id'] : SKIP
  vrf_config = EvpnTopologySwitchConfigVrfConfig.from_hash(hash['vrf_config']) if
    hash['vrf_config']

  # Create object from extracted values.
  EvpnTopologySwitchConfig.new(dhcpd_config,
                               networks,
                               other_ip_configs,
                               port_config,
                               port_usages,
                               router_id,
                               vrf_config)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mist_api/models/evpn_topology_switch_config.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['dhcpd_config'] = 'dhcpd_config'
  @_hash['networks'] = 'networks'
  @_hash['other_ip_configs'] = 'other_ip_configs'
  @_hash['port_config'] = 'port_config'
  @_hash['port_usages'] = 'port_usages'
  @_hash['router_id'] = 'router_id'
  @_hash['vrf_config'] = 'vrf_config'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/mist_api/models/evpn_topology_switch_config.rb', line 56

def self.optionals
  %w[
    dhcpd_config
    networks
    other_ip_configs
    port_config
    port_usages
    router_id
    vrf_config
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} dhcpd_config: #{@dhcpd_config.inspect}, networks: #{@networks.inspect},"\
  " other_ip_configs: #{@other_ip_configs.inspect}, port_config: #{@port_config.inspect},"\
  " port_usages: #{@port_usages.inspect}, router_id: #{@router_id.inspect}, vrf_config:"\
  " #{@vrf_config.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



120
121
122
123
124
125
# File 'lib/mist_api/models/evpn_topology_switch_config.rb', line 120

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} dhcpd_config: #{@dhcpd_config}, networks: #{@networks}, other_ip_configs:"\
  " #{@other_ip_configs}, port_config: #{@port_config}, port_usages: #{@port_usages},"\
  " router_id: #{@router_id}, vrf_config: #{@vrf_config}>"
end