Class: Y2Network::InterfaceConfigBuilders::Vlan

Inherits:
Y2Network::InterfaceConfigBuilder show all
Defined in:
src/lib/y2network/interface_config_builders/vlan.rb

Constant Summary

Constants inherited from Y2Network::InterfaceConfigBuilder

Y2Network::InterfaceConfigBuilder::NEW_DEVICES_COUNT

Instance Attribute Summary

Attributes inherited from Y2Network::InterfaceConfigBuilder

#connection_config, #firewall_zone, #interface, #name, #renaming_mechanism, #type

Instance Method Summary collapse

Methods inherited from Y2Network::InterfaceConfigBuilder

#aliases, #aliases=, #boot_protocol, #boot_protocol=, #configure_as_slave, #driver, #driver=, #drivers, for, #hostname, #hostname=, #hwinfo, #hwinfo_from, #ifplugd_priority, #ifplugd_priority=, #ip_address, #ip_address=, #mtu, #mtu=, #name_exists?, #name_valid_characters, #newly_added?, #proposed_names, #remote_ip, #remote_ip=, #rename_interface, #renamed_interface?, #save, #startmode=, #subnet_prefix, #subnet_prefix=, #valid_name?

Constructor Details

#initialize(config: nil) ⇒ Vlan


29
30
31
# File 'src/lib/y2network/interface_config_builders/vlan.rb', line 29

def initialize(config: nil)
  super(type: InterfaceType::VLAN, config: config)
end

Instance Method Details

#etherdeviceString


44
45
46
# File 'src/lib/y2network/interface_config_builders/vlan.rb', line 44

def etherdevice
  connection_config.parent_device
end

#etherdevice=(value) ⇒ Object


49
50
51
# File 'src/lib/y2network/interface_config_builders/vlan.rb', line 49

def etherdevice=(value)
  connection_config.parent_device = value
end

#possible_vlansHash<String, String>

Keys are ids for #etherdevice and value are label


55
56
57
58
59
60
61
62
63
64
65
# File 'src/lib/y2network/interface_config_builders/vlan.rb', line 55

def possible_vlans
  yast_config.interfaces.to_a.each_with_object({}) do |interface, result|
    next if interface.type.vlan? # does not make sense to have vlan of vlan

    result[interface.name] = if interface.hardware && interface.hardware.present?
      "#{interface.name} - #{interface.hardware.description}"
    else
      interface.name
    end
  end
end

#vlan_idInteger


34
35
36
# File 'src/lib/y2network/interface_config_builders/vlan.rb', line 34

def vlan_id
  connection_config.vlan_id || 0
end

#vlan_id=(value) ⇒ Object


39
40
41
# File 'src/lib/y2network/interface_config_builders/vlan.rb', line 39

def vlan_id=(value)
  connection_config.vlan_id = value
end