Class: NutanixVmm::VmmV40AhvConfigNicNetworkInfo

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb

Overview

Network information for a NIC.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ VmmV40AhvConfigNicNetworkInfo

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 109

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `NutanixVmm::VmmV40AhvConfigNicNetworkInfo` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `NutanixVmm::VmmV40AhvConfigNicNetworkInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'nic_type')
    self.nic_type = attributes[:'nic_type']
  end

  if attributes.key?(:'network_function_chain')
    self.network_function_chain = attributes[:'network_function_chain']
  end

  if attributes.key?(:'network_function_nic_type')
    self.network_function_nic_type = attributes[:'network_function_nic_type']
  end

  if attributes.key?(:'subnet')
    self.subnet = attributes[:'subnet']
  end

  if attributes.key?(:'vlan_mode')
    self.vlan_mode = attributes[:'vlan_mode']
  end

  if attributes.key?(:'trunked_vlans')
    if (value = attributes[:'trunked_vlans']).is_a?(Array)
      self.trunked_vlans = value
    end
  end

  if attributes.key?(:'should_allow_unknown_macs')
    self.should_allow_unknown_macs = attributes[:'should_allow_unknown_macs']
  end

  if attributes.key?(:'ipv4_config')
    self.ipv4_config = attributes[:'ipv4_config']
  end

  if attributes.key?(:'ipv4_info')
    self.ipv4_info = attributes[:'ipv4_info']
  end
end

Instance Attribute Details

#ipv4_configObject

Returns the value of attribute ipv4_config.



35
36
37
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 35

def ipv4_config
  @ipv4_config
end

#ipv4_infoObject

Returns the value of attribute ipv4_info.



37
38
39
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 37

def ipv4_info
  @ipv4_info
end

#network_function_chainObject

Returns the value of attribute network_function_chain.



21
22
23
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 21

def network_function_chain
  @network_function_chain
end

#network_function_nic_typeObject

Returns the value of attribute network_function_nic_type.



23
24
25
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 23

def network_function_nic_type
  @network_function_nic_type
end

#nic_typeObject

Returns the value of attribute nic_type.



19
20
21
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 19

def nic_type
  @nic_type
end

#should_allow_unknown_macsObject

Indicates whether an unknown unicast traffic is forwarded to this NIC or not. This is applicable only for the NICs on the overlay subnets.



33
34
35
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 33

def should_allow_unknown_macs
  @should_allow_unknown_macs
end

#subnetObject

Returns the value of attribute subnet.



25
26
27
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 25

def subnet
  @subnet
end

#trunked_vlansObject

List of networks to trunk if VLAN mode is marked as TRUNKED. If empty and VLAN mode is set to TRUNKED, all the VLANs are trunked.



30
31
32
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 30

def trunked_vlans
  @trunked_vlans
end

#vlan_modeObject

Returns the value of attribute vlan_mode.



27
28
29
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 27

def vlan_mode
  @vlan_mode
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



77
78
79
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 77

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



82
83
84
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 82

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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

def self.attribute_map
  {
    :'nic_type' => :'nicType',
    :'network_function_chain' => :'networkFunctionChain',
    :'network_function_nic_type' => :'networkFunctionNicType',
    :'subnet' => :'subnet',
    :'vlan_mode' => :'vlanMode',
    :'trunked_vlans' => :'trunkedVlans',
    :'should_allow_unknown_macs' => :'shouldAllowUnknownMacs',
    :'ipv4_config' => :'ipv4Config',
    :'ipv4_info' => :'ipv4Info'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 236

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



102
103
104
105
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 102

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 87

def self.openapi_types
  {
    :'nic_type' => :'VmmV40AhvConfigNicType',
    :'network_function_chain' => :'VmmV40AhvConfigNetworkFunctionChainReference',
    :'network_function_nic_type' => :'VmmV40AhvConfigNetworkFunctionNicType',
    :'subnet' => :'VmmV40AhvConfigSubnetReference',
    :'vlan_mode' => :'VmmV40AhvConfigVlanMode',
    :'trunked_vlans' => :'Array<Integer>',
    :'should_allow_unknown_macs' => :'Boolean',
    :'ipv4_config' => :'VmmV40AhvConfigIpv4Config',
    :'ipv4_info' => :'VmmV40AhvConfigIpv4Info'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 207

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      nic_type == o.nic_type &&
      network_function_chain == o.network_function_chain &&
      network_function_nic_type == o.network_function_nic_type &&
      subnet == o.subnet &&
      vlan_mode == o.vlan_mode &&
      trunked_vlans == o.trunked_vlans &&
      should_allow_unknown_macs == o.should_allow_unknown_macs &&
      ipv4_config == o.ipv4_config &&
      ipv4_info == o.ipv4_info
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


223
224
225
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 223

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



229
230
231
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 229

def hash
  [nic_type, network_function_chain, network_function_nic_type, subnet, vlan_mode, trunked_vlans, should_allow_unknown_macs, ipv4_config, ipv4_info].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 164

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@trunked_vlans.nil? && @trunked_vlans.length > 4095
    invalid_properties.push('invalid value for "trunked_vlans", number of items must be less than or equal to 4095.')
  end

  if !@trunked_vlans.nil? && @trunked_vlans.length < 0
    invalid_properties.push('invalid value for "trunked_vlans", number of items must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 258

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



180
181
182
183
184
185
# File 'lib/nutanix_vmm/models/vmm_v40_ahv_config_nic_network_info.rb', line 180

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@trunked_vlans.nil? && @trunked_vlans.length > 4095
  return false if !@trunked_vlans.nil? && @trunked_vlans.length < 0
  true
end