Sha256: f0a7c2c014a783072835cdf9925ca20fe3feb01649370586647d087ea3608e39
Contents?: true
Size: 1.83 KB
Versions: 16
Compression:
Stored size: 1.83 KB
Contents
# # 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/openflow-switch" module Trema # # Hardware switch that supports OpenFlow protocol. # class HardwareSwitch # # The name of this switch # # @example # switch.name #=> "My expensive OpenFlow switch" # # @return [String] # attr_reader :name # # Creates a new HardwareSwitch from {DSL::Switch} # # @example # switch = Trema::HardwareSwitch.new( stanza ) # # @return [HardwareSwitch] # def initialize stanza stanza.validate @name = stanza.name @stanza = stanza OpenflowSwitch.add self end # # Returns datapath id in long format # # @example # switch.dpid_long #=> "0000000000000abc" # # @return [String] # def dpid_long @stanza.fetch :dpid_long end # # Returns datapath id prefixed with "0x" # # @example # switch.dpid_short #=> "0xabc" # # @return [String] # def dpid_short @stanza.fetch :dpid_short end end end ### Local variables: ### mode: Ruby ### coding: utf-8-unix ### indent-tabs-mode: nil ### End:
Version data entries
16 entries across 16 versions & 1 rubygems