Class: Layer3Interface
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Layer3Interface
- Defined in:
- lib/antfarm/layer3_interface.rb
Overview
Layer3Interface class that wraps the layer3_interfaces table in the ANTFARM database.
-
has many traffic entries (defined as outbound_traffic)
-
has many traffic entries (defined as inbound_traffic)
-
has one IP interface
-
belongs to a layer 3 network
-
belongs to a layer 2 interface
The node_name and node_device_type attributes are only applicable when an existing node is not specified.
The node and layer2_interface_media_type attributes are only applicable when an existing layer 2 interface is not specified.
The layer3_network_protocol attribute is only applicable when an existing layer 3 network is not specified.
Instance Attribute Summary collapse
-
#layer2_interface_media_type ⇒ Object
writeonly
Media type of the layer 2 interface automatically creted for this layer 3 interface.
-
#layer3_network_protocol ⇒ Object
writeonly
Protocol of the layer 3 network automatically created for this layer 3 interface.
-
#node ⇒ Object
writeonly
Existing node the layer 2 interface automatically created for this layer 3 interface should belong to.
-
#node_device_type ⇒ Object
writeonly
Device type of the node automatically created by the layer 2 interface created for this layer 3 interface.
-
#node_name ⇒ Object
writeonly
Name of the node automatically created by the layer 2 interface created for this layer 3 interface.
Class Method Summary collapse
-
.interface_addressed(ip_addr_str) ⇒ Object
Find and return the layer 3 interface with the given IP address.
Instance Method Summary collapse
-
#to_label ⇒ Object
This is for ActiveScaffold.
Instance Attribute Details
#layer2_interface_media_type=(value) ⇒ Object (writeonly)
Media type of the layer 2 interface automatically creted for this layer 3 interface.
56 57 58 |
# File 'lib/antfarm/layer3_interface.rb', line 56 def layer2_interface_media_type=(value) @layer2_interface_media_type = value end |
#layer3_network_protocol=(value) ⇒ Object (writeonly)
Protocol of the layer 3 network automatically created for this layer 3 interface.
52 53 54 |
# File 'lib/antfarm/layer3_interface.rb', line 52 def layer3_network_protocol=(value) @layer3_network_protocol = value end |
#node=(value) ⇒ Object (writeonly)
Existing node the layer 2 interface automatically created for this layer 3 interface should belong to.
60 61 62 |
# File 'lib/antfarm/layer3_interface.rb', line 60 def node=(value) @node = value end |
#node_device_type=(value) ⇒ Object (writeonly)
Device type of the node automatically created by the layer 2 interface created for this layer 3 interface.
68 69 70 |
# File 'lib/antfarm/layer3_interface.rb', line 68 def node_device_type=(value) @node_device_type = value end |
#node_name=(value) ⇒ Object (writeonly)
Name of the node automatically created by the layer 2 interface created for this layer 3 interface.
64 65 66 |
# File 'lib/antfarm/layer3_interface.rb', line 64 def node_name=(value) @node_name = value end |
Class Method Details
.interface_addressed(ip_addr_str) ⇒ Object
Find and return the layer 3 interface with the given IP address.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/antfarm/layer3_interface.rb', line 74 def self.interface_addressed(ip_addr_str) unless ip_addr_str raise(ArgumentError, "nil argument supplied", caller) end ip_ifs = IpInterface.find(:all) for ip_if in ip_ifs if Antfarm::IPAddrExt.new(ip_addr_str) == Antfarm::IPAddrExt.new(ip_if.address) return Layer3Interface.find(ip_if.id) end end return nil end |
Instance Method Details
#to_label ⇒ Object
This is for ActiveScaffold
90 91 92 93 |
# File 'lib/antfarm/layer3_interface.rb', line 90 def to_label #:nodoc: return "#{id} -- #{ip_interface.address}" if ip_interface return "#{id} -- Generic Layer3 Interface" end |