Class: Trema::OpenVswitch
- Inherits:
-
HardwareSwitch
- Object
- HardwareSwitch
- Trema::OpenVswitch
- Includes:
- Daemon
- Defined in:
- ruby/trema/open-vswitch.rb
Overview
Open vSwitch support (openvswitch.org)
Constant Summary collapse
- DEFAULT_PORT =
6633
Instance Attribute Summary
Attributes inherited from HardwareSwitch
Instance Method Summary collapse
-
#<<(interface) ⇒ Array
Add a network interface used for a virtual port.
- #bring_port_down(port_number) ⇒ Object
- #bring_port_up(port_number) ⇒ Object
-
#flows ⇒ Array
Returns flow entries.
-
#initialize(stanza, port = DEFAULT_PORT) ⇒ OpenVswitch
constructor
Creates a new Open vSwitch from DSL::Vswitch.
-
#network_device ⇒ String
Returns the network device name associated with the datapath’s local port.
Methods included from Daemon
#pid_file, #restart!, #run, #run!, #running?, #shutdown, #shutdown!
Methods inherited from HardwareSwitch
Constructor Details
#initialize(stanza, port = DEFAULT_PORT) ⇒ OpenVswitch
Creates a new Open vSwitch from DSL::Vswitch
49 50 51 52 53 |
# File 'ruby/trema/open-vswitch.rb', line 49 def initialize stanza, port = DEFAULT_PORT super stanza @port = port @interfaces = [] end |
Instance Method Details
#<<(interface) ⇒ Array
Add a network interface used for a virtual port
64 65 66 67 68 |
# File 'ruby/trema/open-vswitch.rb', line 64 def << interface @interfaces << interface restart! @interfaces end |
#bring_port_down(port_number) ⇒ Object
103 104 105 |
# File 'ruby/trema/open-vswitch.rb', line 103 def bring_port_down port_number Ofctl.new.bring_port_down self, port_number end |
#bring_port_up(port_number) ⇒ Object
98 99 100 |
# File 'ruby/trema/open-vswitch.rb', line 98 def bring_port_up port_number Ofctl.new.bring_port_up self, port_number end |
#flows ⇒ Array
Returns flow entries
93 94 95 |
# File 'ruby/trema/open-vswitch.rb', line 93 def flows Ofctl.new.users_flows( self ) end |
#network_device ⇒ String
Returns the network device name associated with the datapath’s local port
80 81 82 |
# File 'ruby/trema/open-vswitch.rb', line 80 def network_device "vsw_#{ @stanza.fetch :dpid_short }" end |