Class: Y2Network::AutoinstProfile::RouteSection

Inherits:
Installation::AutoinstProfile::SectionWithAttributes
  • Object
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:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, parent = nil) ⇒ RouteSection

Clones a network route into an AutoYaST route section

Parameters:

  • parent (SectionWithAttributes, nil) (defaults to: nil)

    Parent section

  • route (Y2Network::Route)

    Network route

Returns:



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

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

Instance Method Details

#collection_nameString

Returns the collection name

Returns:

  • (String)

    "routes"



104
105
106
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 104

def collection_name
  "routes"
end

#init_from_hashes(hash) ⇒ Boolean

Method used by new_from_hashes to populate the attributes.

Parameters:

  • hash (Hash)

    see new_from_hashes

Returns:

  • (Boolean)


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

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)


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

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