trema 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/trema +17 -0
- data/features/.nav +1 -0
- data/features/trema_commands/port_up.feature +74 -0
- data/ruby/trema/command.rb +1 -0
- data/ruby/trema/command/port_up.rb +43 -0
- data/ruby/trema/ofctl.rb +5 -0
- data/ruby/trema/open-vswitch.rb +5 -0
- data/ruby/trema/path.rb +2 -2
- data/ruby/trema/version.rb +1 -1
- data/vendor/.gitignore +2 -2
- data/vendor/README.md +9 -0
- data/vendor/oflops-0.03.trema1.tar.gz +0 -0
- data/vendor/{oflops_no_snmp+1.0.0.patch → oflops_no_snmp+1.0.0.diff} +0 -0
- data/vendor/openvswitch-1.2.2.trema1.tar.gz +0 -0
- data/vendor/openvswitch-1.2.2_librt-check.diff +21 -0
- metadata +10 -7
- data/vendor/oflops-0.03.tar.gz +0 -0
- data/vendor/openvswitch-1.2.2.tar.gz +0 -0
data/bin/trema
CHANGED
@@ -148,6 +148,23 @@ command :send_packets do | c |
|
|
148
148
|
end
|
149
149
|
|
150
150
|
|
151
|
+
desc "Brings a switch's specified port up"
|
152
|
+
command :port_up do | c |
|
153
|
+
c.desc "switch name"
|
154
|
+
c.flag [ :s, :switch ]
|
155
|
+
|
156
|
+
c.desc "port"
|
157
|
+
c.flag [ :p, :port ]
|
158
|
+
|
159
|
+
c.action do | global_options, options, args |
|
160
|
+
raise "--switch option is mandatory" if options[ :switch ].nil?
|
161
|
+
raise "--port option is mandatory" if options[ :port ].nil?
|
162
|
+
|
163
|
+
trema_port_up options[ :switch ], options[ :port ]
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
|
151
168
|
desc "Brings a switch's specified port down"
|
152
169
|
command :port_down do | c |
|
153
170
|
c.desc "switch name"
|
data/features/.nav
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
Feature: port_up command
|
2
|
+
|
3
|
+
Use this command to ensure that your controller detects network
|
4
|
+
topology changes i.e., failures in switches.
|
5
|
+
|
6
|
+
Trema emulated network offers a set of commands that can change the
|
7
|
+
status of any arbitrary switch port. The `trema port_up` is one such
|
8
|
+
command and its command syntax is as follows:
|
9
|
+
|
10
|
+
$ trema port_up --switch DATAPATH_ID --port PORT_NUMBER
|
11
|
+
|
12
|
+
The above command brings the switch's specified port up. By using
|
13
|
+
this command one can easily test the :port_status handler defined in
|
14
|
+
controllers.
|
15
|
+
|
16
|
+
Background:
|
17
|
+
Given a file named "sample.conf" with:
|
18
|
+
"""
|
19
|
+
vswitch { datapath_id 0x1 }
|
20
|
+
vswitch { datapath_id 0x2 }
|
21
|
+
|
22
|
+
link "0x1", "0x2"
|
23
|
+
"""
|
24
|
+
And a file named "port-observer.rb" with:
|
25
|
+
"""
|
26
|
+
class PortObserver < Controller
|
27
|
+
def switch_ready dpid
|
28
|
+
info "Switch %#x is UP", dpid
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def port_status dpid, message
|
33
|
+
if message.phy_port.up?
|
34
|
+
info "Port #{ message.phy_port.number } (Switch %#x) is UP", dpid
|
35
|
+
elsif message.phy_port.down?
|
36
|
+
info "Port #{ message.phy_port.number } (Switch %#x) is DOWN", dpid
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
"""
|
41
|
+
|
42
|
+
@slow_process
|
43
|
+
Scenario: trema port_up --switch 0x1 --port 1
|
44
|
+
Given I run `trema run ./port-observer.rb -c sample.conf` interactively
|
45
|
+
And I wait for output to contain "Switch 0x1 is UP"
|
46
|
+
And I run `trema port_down --switch 0x1 --port 1`
|
47
|
+
And I wait for output to contain "Port 1 (Switch 0x1) is DOWN"
|
48
|
+
When I run `trema port_up --switch 0x1 --port 1`
|
49
|
+
Then the output should contain "Port 1 (Switch 0x1) is UP" within the timeout period
|
50
|
+
|
51
|
+
@slow_process
|
52
|
+
Scenario: trema port_up --switch UNKNOWN --port 1 (unknown switch error)
|
53
|
+
Given I run `trema run ./port-observer.rb -c sample.conf -d`
|
54
|
+
When I run `trema port_up --switch UNKNOWN --port 1`
|
55
|
+
Then the output should contain "error: unknown switch: UNKNOWN"
|
56
|
+
|
57
|
+
@slow_process
|
58
|
+
Scenario: trema port_up --switch 0x1 --port 100 (unknown port error)
|
59
|
+
Given I run `trema run ./port-observer.rb -c sample.conf -d`
|
60
|
+
When I run `trema port_up --switch 0x1 --port 100`
|
61
|
+
Then the output should contain "error: ovs-ofctl: vsw_0x1: couldn't find port `100'"
|
62
|
+
|
63
|
+
@slow_process
|
64
|
+
Scenario: trema port_up --switch 0x1 (no --port option error)
|
65
|
+
Given I run `trema run ./port-observer.rb -c sample.conf -d`
|
66
|
+
When I run `trema port_up --switch 0x1`
|
67
|
+
Then the output should contain "error: --port option is mandatory"
|
68
|
+
|
69
|
+
@slow_process
|
70
|
+
Scenario: trema port_up --port 1 (no --switch option error)
|
71
|
+
Given I run `trema run ./port-observer.rb -c sample.conf -d`
|
72
|
+
When I run `trema port_up --port 1`
|
73
|
+
Then the output should contain "error: --switch option is mandatory"
|
74
|
+
|
data/ruby/trema/command.rb
CHANGED
@@ -22,6 +22,7 @@ require "trema/command/dump_flows"
|
|
22
22
|
require "trema/command/kill"
|
23
23
|
require "trema/command/killall"
|
24
24
|
require "trema/command/netns"
|
25
|
+
require "trema/command/port_up"
|
25
26
|
require "trema/command/port_down"
|
26
27
|
require "trema/command/reset_stats"
|
27
28
|
require "trema/command/ruby"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2008-2012 NEC Corporation
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License, version 2, as
|
6
|
+
# published by the Free Software Foundation.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
#
|
17
|
+
|
18
|
+
|
19
|
+
require "trema/cli"
|
20
|
+
require "trema/util"
|
21
|
+
|
22
|
+
|
23
|
+
module Trema
|
24
|
+
module Command
|
25
|
+
include Trema::Util
|
26
|
+
|
27
|
+
|
28
|
+
def trema_port_up switch_name, port
|
29
|
+
switch = find_switch_by_name( switch_name )
|
30
|
+
raise "unknown switch: #{ switch_name }" if switch.nil?
|
31
|
+
|
32
|
+
error = switch.bring_port_up( port.to_i )
|
33
|
+
raise error if $?.exitstatus != 0
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
### Local variables:
|
40
|
+
### mode: Ruby
|
41
|
+
### coding: utf-8
|
42
|
+
### indent-tabs-mode: nil
|
43
|
+
### End:
|
data/ruby/trema/ofctl.rb
CHANGED
@@ -53,6 +53,11 @@ module Trema
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
+
def bring_port_up switch, port_number
|
57
|
+
`sudo #{ Executables.ovs_ofctl } mod-port #{ switch.network_device } #{ port_number } up 2>&1`
|
58
|
+
end
|
59
|
+
|
60
|
+
|
56
61
|
def bring_port_down switch, port_number
|
57
62
|
`sudo #{ Executables.ovs_ofctl } mod-port #{ switch.network_device } #{ port_number } down 2>&1`
|
58
63
|
end
|
data/ruby/trema/open-vswitch.rb
CHANGED
data/ruby/trema/path.rb
CHANGED
@@ -66,10 +66,10 @@ module Trema
|
|
66
66
|
dir :tmp, "pid"
|
67
67
|
dir :tmp, "sock"
|
68
68
|
dir :vendor, "cmockery-20110428", :vendor_cmockery
|
69
|
-
dir :vendor, "oflops-0.03", :vendor_oflops
|
69
|
+
dir :vendor, "oflops-0.03.trema1", :vendor_oflops
|
70
70
|
dir :vendor, "openflow-1.0.0", :vendor_openflow
|
71
71
|
dir :vendor, "openflow.git", :vendor_openflow_git
|
72
|
-
dir :vendor, "openvswitch-1.2.2", :vendor_openvswitch
|
72
|
+
dir :vendor, "openvswitch-1.2.2.trema1", :vendor_openvswitch
|
73
73
|
dir :vendor, "phost", :vendor_phost
|
74
74
|
dir :vendor, "ruby-ifconfig-1.2", :vendor_ruby_ifconfig
|
75
75
|
file :cmockery, "include/google/cmockery.h"
|
data/ruby/trema/version.rb
CHANGED
data/vendor/.gitignore
CHANGED
data/vendor/README.md
CHANGED
@@ -18,3 +18,12 @@ of this OpenFlow controller platform, we disabled the functions. In addition,
|
|
18
18
|
because there are some issues on OpenFlow messages that cbench (a performance
|
19
19
|
measurement tool for OpenFlow controllers) sends, we fixed them. Any changes
|
20
20
|
from the repository of oflops can be found in oflops_no_snmp+1.0.0.patch.
|
21
|
+
|
22
|
+
Notes on Open vSwitch (vendor/openvswitch)
|
23
|
+
------------------------------------------
|
24
|
+
|
25
|
+
In the recent glibc, we need to link librt to use POSIX timer functions
|
26
|
+
such as "timer_create" or "timer_settime". To use openvswitch-1.2.2
|
27
|
+
on distributions with the recent glibc, we modified "configure" to
|
28
|
+
search librt and Open vSwitch tarball distributed with Trema contains
|
29
|
+
the fix. The change can be found in openvswitch-1.2.2_librt-check.diff.
|
Binary file
|
File without changes
|
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
diff --git a/configure.ac b/configure.ac
|
2
|
+
index 99ed8f0..de43aae 100644
|
3
|
+
--- a/configure.ac
|
4
|
+
+++ b/configure.ac
|
5
|
+
@@ -13,7 +13,7 @@
|
6
|
+
# limitations under the License.
|
7
|
+
|
8
|
+
AC_PREREQ(2.64)
|
9
|
+
-AC_INIT(openvswitch, 1.2.2, ovs-bugs@openvswitch.org)
|
10
|
+
+AC_INIT(openvswitch, 1.2.2.trema1, ovs-bugs@openvswitch.org)
|
11
|
+
NX_BUILDNR
|
12
|
+
AC_CONFIG_SRCDIR([datapath/datapath.c])
|
13
|
+
AC_CONFIG_MACRO_DIR([m4])
|
14
|
+
@@ -41,6 +41,7 @@ AC_SYS_LARGEFILE
|
15
|
+
|
16
|
+
AC_SEARCH_LIBS([pow], [m])
|
17
|
+
AC_SEARCH_LIBS([clock_gettime], [rt])
|
18
|
+
+AC_SEARCH_LIBS([timer_create], [rt])
|
19
|
+
|
20
|
+
OVS_CHECK_COVERAGE
|
21
|
+
OVS_CHECK_NDEBUG
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 9
|
10
|
+
version: 0.3.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yasuhito Takamiya
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: .
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-02-
|
18
|
+
date: 2013-02-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- features/trema_commands/kill.feature
|
164
164
|
- features/trema_commands/killall.feature
|
165
165
|
- features/trema_commands/port_down.feature
|
166
|
+
- features/trema_commands/port_up.feature
|
166
167
|
- features/trema_commands/reset_stats.feature
|
167
168
|
- features/trema_commands/run.feature
|
168
169
|
- features/trema_commands/send_packets.feature
|
@@ -190,6 +191,7 @@ files:
|
|
190
191
|
- ruby/trema/command/killall.rb
|
191
192
|
- ruby/trema/command/netns.rb
|
192
193
|
- ruby/trema/command/port_down.rb
|
194
|
+
- ruby/trema/command/port_up.rb
|
193
195
|
- ruby/trema/command/reset_stats.rb
|
194
196
|
- ruby/trema/command/ruby.rb
|
195
197
|
- ruby/trema/command/run.rb
|
@@ -689,11 +691,12 @@ files:
|
|
689
691
|
- vendor/.gitignore
|
690
692
|
- vendor/README.md
|
691
693
|
- vendor/cmockery-20110428.tar.gz
|
692
|
-
- vendor/oflops-0.03.tar.gz
|
693
|
-
- vendor/oflops_no_snmp+1.0.0.
|
694
|
+
- vendor/oflops-0.03.trema1.tar.gz
|
695
|
+
- vendor/oflops_no_snmp+1.0.0.diff
|
694
696
|
- vendor/openflow-1.0.0.tar.gz
|
695
697
|
- vendor/openflow.git.tar.gz
|
696
|
-
- vendor/openvswitch-1.2.2.tar.gz
|
698
|
+
- vendor/openvswitch-1.2.2.trema1.tar.gz
|
699
|
+
- vendor/openvswitch-1.2.2_librt-check.diff
|
697
700
|
- vendor/packet-openflow.diff
|
698
701
|
- vendor/phost/doc/COPYING
|
699
702
|
- vendor/phost/doc/README
|
data/vendor/oflops-0.03.tar.gz
DELETED
Binary file
|
Binary file
|