Sha256: 64a0fa832dd6c4ac9c5ea39ed9297ff6cf33b54bb92ab7657b6644137b691b65
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
# # The controller class of ovs-ofctl. # # Author: Yasuhito Takamiya <yasuhito@gmail.com> # # Copyright (C) 2008-2012 NEC Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # require "trema/executables" require "trema/flow" module Trema class Ofctl def add_flow switch, options actions = options[ :actions ] options.delete :actions option_string = options.collect do | k, v | "#{ k }=#{ v }" end.join( "," ) sh "sudo #{ Executables.ovs_ofctl } add-flow #{ switch.network_device } #{ option_string },actions=#{ actions } 2>/dev/null" end def flows switch dump_flows( switch ).split( "\n" )[ 1..-1 ].collect do | each | Trema::Flow.parse( each ) end.compact end def users_flows switch flows( switch ).select( &:users_flow? ) end def dump_flows switch `sudo #{ Executables.ovs_ofctl } dump-flows #{ switch.network_device } 2>&1` end def bring_port_up switch, port_number `sudo #{ Executables.ovs_ofctl } mod-port #{ switch.network_device } #{ port_number } up 2>&1` end def bring_port_down switch, port_number `sudo #{ Executables.ovs_ofctl } mod-port #{ switch.network_device } #{ port_number } down 2>&1` end end end ### Local variables: ### mode: Ruby ### coding: utf-8-unix ### indent-tabs-mode: nil ### End:
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trema-0.3.9 | ruby/trema/ofctl.rb |