Class: MintPress::Infrastructure::NetworkInterface

Inherits:
Object
  • Object
show all
Includes:
MintLogger, Mixins::GenericProvider, Mixins::Properties
Defined in:
src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb

Overview

This defines a network interface on a host object

Properties (Read/Write)

  • #name ⇒ String
    Naming

    Property Attributes
    
    
    13
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 13
    
    property :name, type: String
  • #postfix ⇒ String
    'Postfix for network adapter - "-mgt" for example'

    Property Attributes
    
    
    14
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 14
    
    property :postfix, type: String, description: 'Postfix for network adapter - "-mgt" for example'
  • #public_postfix ⇒ String (Default Value: Proc.new { self.postfix })
    'Postfix for the public IP - -pub for example'

    Property Attributes
    • defaultProc.new { self.postfix }
    
    
    15
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 15
    
    property :public_postfix, type: String, description: 'Postfix for the public IP - -pub for example', default: Proc.new { self.postfix }
  • #dns_domain ⇒ String (Default Value: Proc.new { host.dns_domain})
    'DNS Domain - mintpress.io, for example. Will use the domain of the parent machine if nil'

    Property Attributes
    • defaultProc.new { host.dns_domain}
    
    
    16
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 16
    
    property :dns_domain, type: String, default: Proc.new { host.dns_domain}, description: 'DNS Domain - mintpress.io, for example.  Will use the domain of the parent machine if nil'
  • #hostname ⇒ String (Default Value: '#{host.hostname}#{postfix}')

    Property Attributes
    • default'#{host.hostname}#{postfix}'
    
    
    17
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 17
    
    property :hostname, type: String, default: '#{host.hostname}#{postfix}'
  • #fqdn ⇒ String (Default Value: '#{hostname}.#{dns_domain}')

    Property Attributes
    • default'#{hostname}.#{dns_domain}'
    
    
    18
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 18
    
    property :fqdn, type: String, default: '#{hostname}.#{dns_domain}'
  • #public_fqdn ⇒ String (Default Value: '#{host.hostname}#{public_postfix}.#{dns_domain}')

    Property Attributes
    • default'#{host.hostname}#{public_postfix}.#{dns_domain}'
    
    
    19
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 19
    
    property :public_fqdn, type: String, default: '#{host.hostname}#{public_postfix}.#{dns_domain}'
  • #enabled ⇒ [TrueClass, FalseClass]
    'If the interface is virtual, this will control if it is connected or unplugged'

    Property Attributes
    
    
    22
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 22
    
    property :enabled, type: [TrueClass, FalseClass], description: 'If the interface is virtual, this will control if it is connected or unplugged'
  • #ip_count ⇒ Integer (Default Value: 1)
    'Number of IPs to allocate. Not all providers support this'

    Property Attributes
    • default1
    
    
    24
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 24
    
    property :ip_count, type: Integer, default: 1, description: 'Number of IPs to allocate.  Not all providers support this'
  • #public_ip_count ⇒ Integer (Default Value: 1)
    'Number of Public IPs to allocate. Not all providers support this.'

    Property Attributes
    • default1
    
    
    25
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 25
    
    property :public_ip_count, type: Integer, default: 1, description: 'Number of Public IPs to allocate.  Not all providers support this.'
  • #connected_network ⇒ String (Default Value: nil)
    'A string representing which network to connect to upstream.'

    Property Attributes
    • defaultnil
    
    
    26
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 26
    
    property :connected_network, type: String, default: nil, description: 'A string representing which network to connect to upstream.'
  • #ip ⇒ Array of ⇒ IPAddr (Default Value: Proc.new { self.discover_ip })
    'A list of all of the IP addresses to attach to this interfaces, if static allocation is sellected or has been harvested'

    Property Attributes
    • fromString
    • defaultProc.new { self.discover_ip }
    • cached_proctrue
    
    
    28
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 28
    
    property :ip, type: IPAddr, array: true, from: String, description: 'A list of all of the IP addresses to attach to this interfaces, if static allocation is sellected or has been harvested', default: Proc.new { self.discover_ip }, cached_proc: true
  • #public_ip ⇒ Array of ⇒ IPAddr (Default Value: Proc.new { self.discover_public_ip })
    'The public IPs attached to this interface'

    Property Attributes
    • fromString
    • defaultProc.new { self.discover_public_ip }
    • cached_proctrue
    
    
    29
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 29
    
    property :public_ip, type: IPAddr, array: true, from: String, description: 'The public IPs attached to this interface', default: Proc.new { self.discover_public_ip }, cached_proc: true
  • #netmask ⇒ Array of ⇒ IPAddr (Default Value: Proc.new { self.discover_netmask })
    'Netmask of this interface. If there are multiple local IPs, you must specify the same number of netmasks'

    Property Attributes
    • fromString
    • defaultProc.new { self.discover_netmask }
    
    
    30
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 30
    
    property :netmask, type: IPAddr, from: String, default: Proc.new { self.discover_netmask }, description: 'Netmask of this interface.  If there are multiple local IPs, you must specify the same number of netmasks', array: true
  • #static_routes ⇒ Hash of ⇒ IPAddr
    'A hash of network routes - format is router => iprange'

    Property Attributes
    • fromString
    • key_typeIPAddr
    
    
    31
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 31
    
    property :static_routes, type: IPAddr, hash: true, from: String, key_type: IPAddr, description: 'A hash of network routes - format is router => iprange'
  • #gateway ⇒ IPAddr (Default Value: Proc.new { self.discover_gateway })
    "Usual Gateway of host"

    Property Attributes
    • fromString
    • defaultProc.new { self.discover_gateway }
    • cached_proctrue
    
    
    32
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 32
    
    property :gateway, type: IPAddr, from: String, description: "Usual Gateway of host", default: Proc.new { self.discover_gateway }, cached_proc: true
  • #routes ⇒ Array of ⇒ IPAddr
    "IP ranges that go through the usual gateway"

    Property Attributes
    • fromString
    
    
    33
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 33
    
    property :routes, type: IPAddr, array: true, description: "IP ranges that go through the usual gateway", from: String
  • #static_ip ⇒ [TrueClass, FalseClass] (Default Value: false)

    Property Attributes
    • defaultfalse
    
    
    35
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 35
    
    property :static_ip, type: [TrueClass, FalseClass], default: false
  • #mac_address ⇒ String (Default Value: Proc.new { self.discover_mac_address })
    MAC address of the interface

    Property Attributes
    • defaultProc.new { self.discover_mac_address }
    • cached_proctrue
    
    
    38
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 38
    
    property :mac_address, type: String, default: Proc.new { self.discover_mac_address }, cached_proc: true
  • #allocator ⇒ [Symbol, MintPress::Infrastructure::IPAllocator] (Default Value: :auto)
    'IP Allocation strategy - options are :auto, :dhcp, :static, or a pointer to an IPAllocator class'

    Property Attributes
    • default:auto
    
    
    41
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 41
    
    property :allocator, type: [Symbol, MintPress::Infrastructure::IPAllocator], default: :auto, description: 'IP Allocation strategy - options are :auto, :dhcp, :static, or a pointer to an IPAllocator class'
  • #interface_type ⇒ Array of ⇒ String (Default Value: "public")
    'The semantic interface type - standard options are public and private, but some applicaitons can use additional metadata here - for example, storage, cluster or rac-private'

    Property Attributes
    • default"public"
    
    
    44
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 44
    
    property :interface_type, type: String, array: true, default: "public", description: 'The semantic interface type - standard options are public and private, but some applicaitons can use additional metadata here - for example, storage, cluster or rac-private'
  • #use_provided_dns ⇒ [TrueClass, FalseClass] (Default Value: true)

    Property Attributes
    • defaulttrue
    
    
    46
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 46
    
    property :use_provided_dns, type: [TrueClass, FalseClass], default: true
  • #device_index ⇒ Integer
    Order to attach - if this is not specified, we'll attach them in any order we feel like Note that the provisioners should fill in enough data that the bootstrap modules can correctly associate them inside the OS

    Property Attributes
    
    
    51
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 51
    
    property :device_index, type: Integer
  • #os_device ⇒ String (Default Value: Proc.new { self.find_os_device })

    Property Attributes
    • defaultProc.new { self.find_os_device }
    • cached_proctrue
    
    
    53
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 53
    
    property :os_device, type: String, default: Proc.new { self.find_os_device }, cached_proc: true
  • #host ⇒ MintPress::Infrastructure::Host

    Property Attributes
    • canonicaltrue
    
    
    55
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 55
    
    property :host, type: MintPress::Infrastructure::Host, canonical: true
  • #auto_created ⇒ [TrueClass, FalseClass] (Default Value: false)
    Was this network interface internally created? Some provisioners change their behaviour based on this...

    Property Attributes
    • defaultfalse
    
    
    58
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/network_interface.rb', line 58
    
    property :auto_created, type: [TrueClass, FalseClass], default: false

Properties (Read Only)

Constant Summary

Constants included from MintLogger

MintLogger::DEBUG, MintLogger::ERROR, MintLogger::FATAL, MintLogger::INFO, MintLogger::UNKNOWN, MintLogger::VERBOSE, MintLogger::WARN

Instance Attribute Summary

Attributes included from Mixins::Properties

#autopush_set_cache, #dynamic_create, #harvest_on_access, #harvest_undefined_only, #harvested, #tree_root

Instance Method Summary collapse

Methods included from Mixins::GenericProvider

included, #register_provider, #register_sub_provider

Methods included from MintLogger::Utils::Common

#boolean_val, #has_value?, #no_value?, #nvl, #path_as_symbol, #ruby_level_to_send

Methods included from Mixins::Properties

#[], #[]=, #add_validate_report_result, #armour_set_property, #array_contains?, #array_is_a?, #check_autopush, #check_stack_overflow, #clone_property_object, #cloner_handle_single_property, #coerce_single, #contains_as_string?, #display_validate_report_result, #double_initialize?, #dump_to_hash, #find_parent, #find_parent_by_identity, #generate_accessor_functions, #get_canonical_renamed, #get_from_opts, #get_my_name, #get_property, #get_property_item, #has?, included, #initialize_validate_report, #inspect, #is_cloned_object?, #is_mintpress_object?, #is_probably_canonical?, #is_set?, #local_debug, #local_info, #local_verbose, #mintpress_property_definitions, #place_object_by_identity, #process_properties, #prop_set?, #property, #property_definitions, #property_details, #property_is_simple_object?, #push_root!, #require_property, #require_update, #retrieve_docstring, #sanitize, #set_map_dirty, #set_property, #set_property_item, #show_short_array, #strip_defaults!, #synchronize, #uncloned_property_definitions, #update_map, #validate, #validate_generic, #validate_properties, #validate_property, #validate_required, #version_allowed?, #weakref

Constructor Details

#initialize(opts = {}) ⇒ NetworkInterface

Returns a new instance of NetworkInterface.

Instance Method Details

#add_routes_to_systemObject

#configure_osObject

#discover_gatewayObject

#discover_ipObject

#discover_mac_addressObject

#discover_netmaskObject

#discover_public_ipObject

#find_os_deviceObject