Class: Port
- Inherits:
-
Object
- Object
- Port
- Defined in:
- rlib/port.rb
Overview
Port class, for holding port status, and characteristics for the switches in the Switch class.
Instance Attribute Summary (collapse)
-
- (Object) bridge_port
Returns the value of attribute bridge_port.
-
- (Object) expected_remote_mac
Returns the value of attribute expected_remote_mac.
-
- (Object) expected_remote_port_name
Returns the value of attribute expected_remote_port_name.
-
- (Object) expected_remote_port_number
Returns the value of attribute expected_remote_port_number.
-
- (Object) expected_remote_switch_name
Returns the value of attribute expected_remote_switch_name.
-
- (Object) port_arp
Returns the value of attribute port_arp.
-
- (Object) port_name
Returns the value of attribute port_name.
-
- (Object) port_number
Returns the value of attribute port_number.
-
- (Object) remote_mac
Returns the value of attribute remote_mac.
-
- (Object) remote_port_name
Returns the value of attribute remote_port_name.
-
- (Object) remote_port_number
Returns the value of attribute remote_port_number.
-
- (Object) remote_switch_name
Returns the value of attribute remote_switch_name.
-
- (Object) up
Returns the value of attribute up.
Instance Method Summary (collapse)
-
- (Port) initialize(port_number)
constructor
Create instance of Port.
-
- (String) to_s
Return key attributes as a string (Primary use is debugging).
Constructor Details
- (Port) initialize(port_number)
Create instance of Port
11 12 13 14 15 |
# File 'rlib/port.rb', line 11 def initialize(port_number) @port_number = port_number @bridge_port = false @port_arp = [] #Array of MAC addresses seen on this port end |
Instance Attribute Details
- (Object) bridge_port
Returns the value of attribute bridge_port
3 4 5 |
# File 'rlib/port.rb', line 3 def bridge_port @bridge_port end |
- (Object) expected_remote_mac
Returns the value of attribute expected_remote_mac
4 5 6 |
# File 'rlib/port.rb', line 4 def expected_remote_mac @expected_remote_mac end |
- (Object) expected_remote_port_name
Returns the value of attribute expected_remote_port_name
4 5 6 |
# File 'rlib/port.rb', line 4 def expected_remote_port_name @expected_remote_port_name end |
- (Object) expected_remote_port_number
Returns the value of attribute expected_remote_port_number
4 5 6 |
# File 'rlib/port.rb', line 4 def expected_remote_port_number @expected_remote_port_number end |
- (Object) expected_remote_switch_name
Returns the value of attribute expected_remote_switch_name
4 5 6 |
# File 'rlib/port.rb', line 4 def expected_remote_switch_name @expected_remote_switch_name end |
- (Object) port_arp
Returns the value of attribute port_arp
6 7 8 |
# File 'rlib/port.rb', line 6 def port_arp @port_arp end |
- (Object) port_name
Returns the value of attribute port_name
3 4 5 |
# File 'rlib/port.rb', line 3 def port_name @port_name end |
- (Object) port_number
Returns the value of attribute port_number
3 4 5 |
# File 'rlib/port.rb', line 3 def port_number @port_number end |
- (Object) remote_mac
Returns the value of attribute remote_mac
3 4 5 |
# File 'rlib/port.rb', line 3 def remote_mac @remote_mac end |
- (Object) remote_port_name
Returns the value of attribute remote_port_name
3 4 5 |
# File 'rlib/port.rb', line 3 def remote_port_name @remote_port_name end |
- (Object) remote_port_number
Returns the value of attribute remote_port_number
3 4 5 |
# File 'rlib/port.rb', line 3 def remote_port_number @remote_port_number end |
- (Object) remote_switch_name
Returns the value of attribute remote_switch_name
3 4 5 |
# File 'rlib/port.rb', line 3 def remote_switch_name @remote_switch_name end |
- (Object) up
Returns the value of attribute up
5 6 7 |
# File 'rlib/port.rb', line 5 def up @up end |
Instance Method Details
- (String) to_s
Return key attributes as a string (Primary use is debugging)
19 20 21 22 23 24 25 |
# File 'rlib/port.rb', line 19 def to_s if @bridge_port == true "Bridge: [#{@port_name}, #{@remote_switch_name}, #{@remote_port_name}, #{@remote_port_number}]" else "Std Port: [#{@port_name}, [ #{@port_arp.join(',')} ] ]" end end |