Class: Y2Network::AutoinstProfile::RouteSection

Inherits:
SectionWithAttributes show all
Defined in:
src/lib/y2network/autoinst_profile/route_section.rb

Overview

This class represents an AutoYaST section under

192.168.1.0 eth0 foo - -

See Also:

Constant Summary

Constants inherited from SectionWithAttributes

SectionWithAttributes::VALUES_TO_SKIP

Instance Attribute Summary collapse

Attributes inherited from SectionWithAttributes

#parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SectionWithAttributes

#attribute_key, #attribute_name, #attribute_scalar, #attribute_skip?, #attribute_value, #attributes, define_attr_accessors, #init_scalars_from_hash, #initialize, new_from_hashes, #section_name, #to_hashes

Constructor Details

This class inherits a constructor from Y2Network::AutoinstProfile::SectionWithAttributes

Instance Attribute Details

#destinationString

Returns Route destination.

Returns:

  • (String)

    Route destination


# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 48

#deviceString

Returns Interface name.

Returns:

  • (String)

    Interface name


# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 51

#extraparaString

Returns Route options.

Returns:

  • (String)

    Route options


# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 54

#gatewayString

Returns Route gateway.

Returns:

  • (String)

    Route gateway


# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 57

#netmaskString

Returns Netmask.

Returns:

  • (String)

    Netmask


# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 60

Class Method Details

.attributesObject


36
37
38
39
40
41
42
43
44
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 36

def self.attributes
  [
    { name: :destination },
    { name: :netmask },
    { name: :device },
    { name: :gateway },
    { name: :extrapara }
  ]
end

.new_from_network(route) ⇒ RouteSection

Clones a network route into an AutoYaST route section

Parameters:

Returns:


67
68
69
70
71
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 67

def self.new_from_network(route)
  result = new
  result.init_from_route(route)
  result
end

Instance Method Details

#init_from_hashes(hash) ⇒ Boolean

Method used by SectionWithAttributes.new_from_hashes to populate the attributes.

Parameters:

Returns:

  • (Boolean)

77
78
79
80
81
82
83
84
85
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 77

def init_from_hashes(hash)
  @destination = destination_from_hash(hash)
  @gateway = gateway_from_hash(hash)
  @netmask = netmask_from_hash(hash)
  @device = device_from_hash(hash)
  @extrapara = hash["extrapara"]

  true
end

#init_from_route(route) ⇒ Boolean

Method used by new_from_network to populate the attributes when cloning a network route

Parameters:

Returns:

  • (Boolean)

91
92
93
94
95
96
97
98
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 91

def init_from_route(route)
  @destination = destination_from_route(route)
  @netmask = netmask_from_route(route)
  @device = device_from_route(route)
  @gateway = gateway_from_route(route)
  @extrapara = extrapara_from_route(route)
  true
end