Class: MistApi::SwitchVrfInstance

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

Overview

SwitchVrfInstance 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(aggregate_routes = SKIP, aggregate_routes6 = SKIP, evpn_auto_loopback_subnet = SKIP, evpn_auto_loopback_subnet6 = SKIP, extra_routes = SKIP, extra_routes6 = SKIP, networks = SKIP) ⇒ SwitchVrfInstance

Returns a new instance of SwitchVrfInstance.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/mist_api/models/switch_vrf_instance.rb', line 71

def initialize(aggregate_routes = SKIP, aggregate_routes6 = SKIP,
               evpn_auto_loopback_subnet = SKIP,
               evpn_auto_loopback_subnet6 = SKIP, extra_routes = SKIP,
               extra_routes6 = SKIP, networks = SKIP)
  @aggregate_routes = aggregate_routes unless aggregate_routes == SKIP
  @aggregate_routes6 = aggregate_routes6 unless aggregate_routes6 == SKIP
  unless evpn_auto_loopback_subnet == SKIP
    @evpn_auto_loopback_subnet =
      evpn_auto_loopback_subnet
  end
  unless evpn_auto_loopback_subnet6 == SKIP
    @evpn_auto_loopback_subnet6 =
      evpn_auto_loopback_subnet6
  end
  @extra_routes = extra_routes unless extra_routes == SKIP
  @extra_routes6 = extra_routes6 unless extra_routes6 == SKIP
  @networks = networks unless networks == SKIP
end

Instance Attribute Details

#aggregate_routesHash[String, AggregateRoute]

Property key is the destination subnet (e.g. “172.16.3.0/24”)

Returns:



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

def aggregate_routes
  @aggregate_routes
end

#aggregate_routes6Hash[String, AggregateRoute]

Property key is the destination subnet (e.g. “2a02:1234:420a:10c9::/64”)

Returns:



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

def aggregate_routes6
  @aggregate_routes6
end

#evpn_auto_loopback_subnetString

Property key is the destination subnet (e.g. “2a02:1234:420a:10c9::/64”)

Returns:

  • (String)


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

def evpn_auto_loopback_subnet
  @evpn_auto_loopback_subnet
end

#evpn_auto_loopback_subnet6String

Property key is the destination subnet (e.g. “2a02:1234:420a:10c9::/64”)

Returns:

  • (String)


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

def evpn_auto_loopback_subnet6
  @evpn_auto_loopback_subnet6
end

#extra_routesHash[String, VrfExtraRoute]

Property key is the destination CIDR (e.g. “10.0.0.0/8”)

Returns:



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

def extra_routes
  @extra_routes
end

#extra_routes6Hash[String, VrfExtraRoute]

Property key is the destination CIDR (e.g. “2a02:1234:420a:10c9::/64”)

Returns:



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

def extra_routes6
  @extra_routes6
end

#networksArray[String]

Property key is the destination CIDR (e.g. “2a02:1234:420a:10c9::/64”)

Returns:

  • (Array[String])


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

def networks
  @networks
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
118
119
120
121
122
123
# File 'lib/mist_api/models/switch_vrf_instance.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  aggregate_routes = AggregateRoute.from_hash(hash['aggregate_routes']) if
    hash['aggregate_routes']

  aggregate_routes = SKIP unless hash.key?('aggregate_routes')
  aggregate_routes6 = AggregateRoute.from_hash(hash['aggregate_routes6']) if
    hash['aggregate_routes6']

  aggregate_routes6 = SKIP unless hash.key?('aggregate_routes6')
  evpn_auto_loopback_subnet =
    hash.key?('evpn_auto_loopback_subnet') ? hash['evpn_auto_loopback_subnet'] : SKIP
  evpn_auto_loopback_subnet6 =
    hash.key?('evpn_auto_loopback_subnet6') ? hash['evpn_auto_loopback_subnet6'] : SKIP
  extra_routes = VrfExtraRoute.from_hash(hash['extra_routes']) if hash['extra_routes']

  extra_routes = SKIP unless hash.key?('extra_routes')
  extra_routes6 = VrfExtraRoute.from_hash(hash['extra_routes6']) if hash['extra_routes6']

  extra_routes6 = SKIP unless hash.key?('extra_routes6')
  networks = hash.key?('networks') ? hash['networks'] : SKIP

  # Create object from extracted values.
  SwitchVrfInstance.new(aggregate_routes,
                        aggregate_routes6,
                        evpn_auto_loopback_subnet,
                        evpn_auto_loopback_subnet6,
                        extra_routes,
                        extra_routes6,
                        networks)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mist_api/models/switch_vrf_instance.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['aggregate_routes'] = 'aggregate_routes'
  @_hash['aggregate_routes6'] = 'aggregate_routes6'
  @_hash['evpn_auto_loopback_subnet'] = 'evpn_auto_loopback_subnet'
  @_hash['evpn_auto_loopback_subnet6'] = 'evpn_auto_loopback_subnet6'
  @_hash['extra_routes'] = 'extra_routes'
  @_hash['extra_routes6'] = 'extra_routes6'
  @_hash['networks'] = 'networks'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/mist_api/models/switch_vrf_instance.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/mist_api/models/switch_vrf_instance.rb', line 54

def self.optionals
  %w[
    aggregate_routes
    aggregate_routes6
    evpn_auto_loopback_subnet
    evpn_auto_loopback_subnet6
    extra_routes
    extra_routes6
    networks
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
142
# File 'lib/mist_api/models/switch_vrf_instance.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} aggregate_routes: #{@aggregate_routes.inspect}, aggregate_routes6:"\
  " #{@aggregate_routes6.inspect}, evpn_auto_loopback_subnet:"\
  " #{@evpn_auto_loopback_subnet.inspect}, evpn_auto_loopback_subnet6:"\
  " #{@evpn_auto_loopback_subnet6.inspect}, extra_routes: #{@extra_routes.inspect},"\
  " extra_routes6: #{@extra_routes6.inspect}, networks: #{@networks.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} aggregate_routes: #{@aggregate_routes}, aggregate_routes6:"\
  " #{@aggregate_routes6}, evpn_auto_loopback_subnet: #{@evpn_auto_loopback_subnet},"\
  " evpn_auto_loopback_subnet6: #{@evpn_auto_loopback_subnet6}, extra_routes:"\
  " #{@extra_routes}, extra_routes6: #{@extra_routes6}, networks: #{@networks}>"
end