trema 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/Doxyfile +1 -1
- data/Gemfile +18 -6
- data/README.md +112 -5
- data/Rakefile +3 -1
- data/Rantfile +88 -1
- data/bin/trema +248 -0
- data/bin/trema-config +59 -0
- data/cruise.rb +1 -1
- data/features/example.dumper.feature +45 -65
- data/features/example.hello_trema.feature +21 -0
- data/features/example.learning_switch.feature +26 -28
- data/features/example.list_switches.feature +19 -33
- data/features/example.message.echo_reply.feature +10 -10
- data/features/example.message.echo_request.feature +2 -2
- data/features/example.message.features_request.feature +6 -5
- data/features/example.message.hello.feature +47 -13
- data/features/example.message.set_config.feature +4 -4
- data/features/example.message.vendor-action.feature +23 -0
- data/features/example.multi_learning_switch.feature +14 -42
- data/features/example.packet_in.feature +31 -0
- data/features/example.packetin_filter_config.feature +11 -7
- data/features/example.patch_panel.feature +29 -0
- data/features/example.repeater_hub.feature +43 -40
- data/features/example.switch_info.feature +51 -0
- data/features/example.switch_monitor.feature +24 -42
- data/features/packetin_filter.feature +28 -22
- data/features/step_definitions/misc_steps.rb +19 -8
- data/features/step_definitions/send_packets_steps.rb +1 -10
- data/features/step_definitions/stats_steps.rb +4 -4
- data/features/support/env.rb +2 -1
- data/features/support/hooks.rb +35 -2
- data/features/switch_manager.feature +18 -12
- data/features/trema-config.feature +26 -39
- data/features/trema.dump_flows.feature +26 -12
- data/features/trema.help.feature +26 -0
- data/features/trema.kill.feature +39 -41
- data/features/trema.killall.feature +23 -23
- data/features/trema.reset_stats.feature +50 -10
- data/features/trema.run.feature +28 -39
- data/features/trema.send_packets.feature +29 -40
- data/features/trema.show_stats.feature +30 -33
- data/features/trema.up.feature +33 -0
- data/features/trema.version.feature +9 -0
- data/ruby/extconf.rb +7 -0
- data/ruby/trema/aggregate-stats-reply.rb +3 -3
- data/ruby/trema/app.rb +5 -1
- data/ruby/trema/barrier-request.c +55 -30
- data/ruby/trema/cli.rb +8 -8
- data/ruby/trema/command.rb +1 -3
- data/ruby/trema/command/dump_flows.rb +5 -24
- data/ruby/trema/command/kill.rb +31 -36
- data/ruby/trema/command/killall.rb +1 -19
- data/{features/step_definitions/kill_steps.rb → ruby/trema/command/netns.rb} +13 -5
- data/ruby/trema/command/reset_stats.rb +3 -23
- data/ruby/trema/command/ruby.rb +2 -19
- data/ruby/trema/command/run.rb +6 -27
- data/ruby/trema/command/send_packets.rb +6 -90
- data/ruby/trema/command/show_stats.rb +21 -40
- data/ruby/trema/command/up.rb +5 -26
- data/ruby/trema/command/version.rb +1 -5
- data/ruby/trema/controller.c +14 -16
- data/ruby/trema/custom-switch.rb +56 -0
- data/ruby/trema/desc-stats-reply.rb +5 -5
- data/ruby/trema/dsl/configuration.rb +4 -0
- data/{features/step_definitions/up_steps.rb → ruby/trema/dsl/custom-switch.rb} +18 -4
- data/ruby/trema/dsl/netns.rb +78 -0
- data/ruby/trema/dsl/parser.rb +2 -0
- data/ruby/trema/dsl/runner.rb +8 -0
- data/ruby/trema/dsl/syntax.rb +18 -0
- data/ruby/trema/echo-reply.h +2 -2
- data/ruby/trema/echo-request.c +3 -5
- data/ruby/trema/enqueue.rb +2 -2
- data/ruby/trema/error.c +3 -3
- data/ruby/trema/executables.rb +26 -2
- data/ruby/trema/features-request.c +3 -5
- data/ruby/trema/flow-removed.c +6 -6
- data/ruby/trema/flow-stats-reply.rb +6 -8
- data/ruby/trema/flow.rb +12 -1
- data/ruby/trema/get-config-request.c +55 -28
- data/ruby/trema/hello.c +3 -5
- data/ruby/trema/host.rb +8 -0
- data/ruby/trema/list-switches-reply.c +1 -1
- data/ruby/trema/mac.rb +1 -1
- data/ruby/trema/match.c +15 -14
- data/ruby/trema/monkey-patch/module/deprecation.rb +0 -2
- data/ruby/trema/netns.rb +127 -0
- data/ruby/trema/ordered-hash.rb +5 -4
- data/ruby/trema/packet-in.c +136 -113
- data/ruby/trema/packet-queue.rb +9 -9
- data/ruby/trema/packetin-filter.rb +1 -1
- data/ruby/trema/phost.rb +16 -7
- data/ruby/trema/port-mod.c +6 -5
- data/ruby/trema/port-stats-reply.rb +2 -2
- data/ruby/trema/process.rb +29 -0
- data/ruby/trema/queue-stats-reply.rb +2 -4
- data/ruby/trema/send-out-port.rb +5 -3
- data/ruby/trema/set-eth-addr.rb +4 -0
- data/ruby/trema/set-ip-addr.rb +4 -2
- data/ruby/trema/set-ip-dst-addr.rb +2 -1
- data/ruby/trema/set-ip-src-addr.rb +2 -1
- data/ruby/trema/set-ip-tos.rb +3 -2
- data/ruby/trema/set-transport-port.rb +3 -2
- data/ruby/trema/set-vlan-priority.rb +3 -2
- data/ruby/trema/set-vlan-vid.rb +5 -4
- data/ruby/trema/shell/reset_stats.rb +2 -1
- data/ruby/trema/shell/run.rb +1 -1
- data/ruby/trema/shell/send_packets.rb +1 -1
- data/ruby/trema/shell/show_stats.rb +1 -1
- data/ruby/trema/stats-helper.rb +3 -3
- data/ruby/trema/stats-reply.c +26 -17
- data/ruby/trema/stats-request.c +39 -41
- data/ruby/trema/switch-daemon.rb +36 -31
- data/ruby/trema/switch.c +1 -1
- data/ruby/trema/table-stats-reply.rb +1 -1
- data/ruby/trema/timers.rb +13 -13
- data/ruby/trema/trema.c +3 -3
- data/ruby/trema/tremashark.rb +9 -2
- data/ruby/trema/util.rb +39 -15
- data/ruby/trema/vendor-action.rb +8 -3
- data/ruby/trema/vendor-stats-reply.rb +4 -6
- data/ruby/trema/vendor.c +1 -1
- data/ruby/trema/version.rb +1 -1
- data/spec/trema/barrier-request_spec.rb +47 -37
- data/spec/trema/controller_spec.rb +1 -0
- data/spec/trema/dsl/runner_spec.rb +8 -3
- data/spec/trema/dsl/vhost_spec.rb +8 -8
- data/spec/trema/echo-request_spec.rb +1 -0
- data/spec/trema/features-request_spec.rb +1 -0
- data/spec/trema/flow-removed_spec.rb +9 -9
- data/spec/trema/get-config-request_spec.rb +51 -39
- data/spec/trema/match_spec.rb +1 -1
- data/spec/trema/openflow-error_spec.rb +11 -11
- data/spec/trema/packet-out_spec.rb +5 -5
- data/spec/trema/queue-get-config-reply_spec.rb +1 -1
- data/spec/trema/queue-get-config-request_spec.rb +1 -1
- data/spec/trema/set-eth-dst-addr_spec.rb +1 -1
- data/spec/trema/set-eth-src-addr_spec.rb +1 -1
- data/spec/trema/set-ip-dst-addr_spec.rb +1 -0
- data/spec/trema/set-ip-src-addr_spec.rb +1 -0
- data/spec/trema/set-ip-tos_spec.rb +1 -0
- data/spec/trema/set-transport-dst-port_spec.rb +1 -0
- data/spec/trema/set-transport-src-port_spec.rb +1 -0
- data/spec/trema/set-vlan-priority_spec.rb +1 -0
- data/spec/trema/set-vlan-vid_spec.rb +2 -1
- data/spec/trema/stats-reply_spec.rb +38 -36
- data/spec/trema/stats-request_spec.rb +6 -6
- data/spec/trema/strip-vlan-header_spec.rb +1 -0
- data/spec/trema/util_spec.rb +3 -2
- data/spec/trema/vendor-action_spec.rb +9 -8
- data/src/examples/dumper/dumper.c +8 -6
- data/src/examples/dumper/dumper.rb +1 -1
- data/{features/step_definitions/killall_steps.rb → src/examples/hello_trema/hello-trema.rb} +6 -5
- data/src/examples/hello_trema/hello_trema.c +4 -4
- data/src/examples/learning_switch/learning_switch.c +1 -1
- data/src/examples/list_switches/list_switches.c +2 -2
- data/src/examples/match_compare/match-compare.rb +2 -2
- data/src/examples/multi_learning_switch/multi-learning-switch.rb +1 -1
- data/src/examples/multi_learning_switch/multi_learning_switch.c +3 -3
- data/src/examples/openflow_message/README +1 -1
- data/src/examples/openflow_message/echo-request.rb +1 -1
- data/src/examples/openflow_message/features_request.c +21 -21
- data/src/examples/openflow_message/hello.c +1 -3
- data/src/examples/openflow_message/hello.rb +9 -24
- data/src/examples/{hello_trema/hello_trema.rb → openflow_message/vendor-action.rb} +17 -7
- data/src/examples/openflow_message/vendor_action.c +105 -0
- data/src/examples/openflow_switch/hello_switch.c +81 -0
- data/src/examples/packet_in/packet-in.rb +9 -13
- data/src/examples/packetin_filter_config/packetin_filter_config.c +2 -2
- data/src/examples/patch_panel/network.conf +14 -0
- data/src/examples/patch_panel/patch-panel.conf +1 -0
- data/{features/step_definitions/show_stats_steps.rb → src/examples/patch_panel/patch-panel.rb} +29 -13
- data/src/examples/switch_info/{switch_info.rb → switch-info.rb} +2 -2
- data/src/examples/switch_info/switch_info.c +4 -4
- data/src/examples/switch_monitor/switch_monitor.c +3 -3
- data/src/examples/traffic_monitor/counter.c +9 -9
- data/src/examples/traffic_monitor/fdb.c +9 -9
- data/src/lib/arp.h +1 -1
- data/src/lib/buffer.c +4 -3
- data/src/lib/byteorder.c +31 -5
- data/src/lib/byteorder.h +2 -2
- data/src/lib/chibach.c +8 -6
- data/src/lib/daemon.c +29 -3
- data/src/lib/doubly_linked_list.c +6 -1
- data/src/lib/ether.c +1 -1
- data/src/lib/ether.h +1 -1
- data/src/lib/event_handler.c +3 -3
- data/src/lib/hash_table.c +1 -1
- data/src/lib/linked_list.c +50 -2
- data/src/lib/linked_list.h +2 -2
- data/src/lib/log.c +122 -22
- data/src/lib/log.h +13 -9
- data/src/lib/management_interface.c +361 -0
- data/src/lib/management_interface.h +42 -0
- data/src/lib/management_service_interface.c +104 -0
- data/src/lib/management_service_interface.h +136 -0
- data/src/lib/match_table.c +5 -5
- data/src/lib/message_queue.c +5 -3
- data/src/lib/message_queue.h +1 -1
- data/src/lib/messenger.c +73 -39
- data/src/lib/messenger.h +3 -2
- data/src/lib/openflow_application_interface.c +17 -17
- data/src/lib/openflow_message.c +175 -23
- data/src/lib/openflow_message.h +2 -1
- data/src/lib/openflow_switch_interface.c +12 -12
- data/src/lib/packet_parser.c +11 -32
- data/src/lib/packetin_filter_interface.c +5 -5
- data/src/lib/persistent_storage.c +7 -7
- data/src/lib/secure_channel.c +6 -6
- data/src/lib/secure_channel.h +1 -1
- data/src/lib/stat.c +54 -17
- data/src/lib/stat.h +9 -0
- data/src/lib/timer.c +11 -10
- data/src/lib/trema.c +38 -9
- data/src/lib/trema.h +1 -0
- data/src/lib/trema_private.h +6 -0
- data/src/lib/trema_wrapper.c +4 -4
- data/src/lib/trema_wrapper.h +10 -10
- data/src/lib/utility.c +6 -6
- data/src/management/application.c +224 -0
- data/src/management/echo.c +185 -0
- data/src/management/set_logging_level.c +153 -0
- data/src/management/show_stats.c +150 -0
- data/src/management/trema_manager +184 -0
- data/src/packetin_filter/packetin_filter.c +31 -29
- data/src/switch_manager/cookie_table.c +7 -7
- data/src/switch_manager/dpid_table.c +3 -3
- data/src/switch_manager/dpid_table.h +0 -1
- data/src/switch_manager/management_interface.h +0 -1
- data/src/switch_manager/ofpmsg_recv.c +3 -3
- data/src/switch_manager/ofpmsg_recv.h +0 -1
- data/src/switch_manager/ofpmsg_send.c +2 -2
- data/src/switch_manager/ofpmsg_send.h +0 -1
- data/src/switch_manager/secure_channel_listener.c +2 -2
- data/src/switch_manager/secure_channel_receiver.c +2 -2
- data/src/switch_manager/secure_channel_receiver.h +0 -1
- data/src/switch_manager/secure_channel_sender.c +8 -1
- data/src/switch_manager/service_interface.c +5 -4
- data/src/switch_manager/switch.c +79 -53
- data/src/switch_manager/switch_manager.c +24 -22
- data/src/switch_manager/xid_table.c +6 -6
- data/src/switch_manager/xid_table.h +0 -1
- data/src/tremashark/README +4 -3
- data/src/tremashark/packet_capture.c +11 -9
- data/src/tremashark/pcap_queue.c +2 -2
- data/src/tremashark/pcap_queue.h +2 -2
- data/src/tremashark/plugin/packet-trema/Makefile +1 -1
- data/src/tremashark/plugin/packet-trema/Makefile.common +1 -1
- data/src/tremashark/plugin/packet-trema/packet-trema.c +50 -37
- data/src/tremashark/queue.c +5 -4
- data/src/tremashark/queue.h +1 -1
- data/src/tremashark/stdin_relay.c +10 -8
- data/src/tremashark/syslog_relay.c +14 -12
- data/src/tremashark/tremashark.c +15 -18
- data/trema +2 -96
- data/trema-config +2 -52
- data/trema.gemspec +12 -1
- data/unittests/cmockery_trema.h +14 -13
- data/unittests/lib/buffer_test.c +1 -1
- data/unittests/lib/byteorder_test.c +108 -25
- data/unittests/lib/daemon_test.c +141 -5
- data/unittests/lib/doubly_linked_list_test.c +5 -1
- data/unittests/lib/ether_test.c +4 -4
- data/unittests/lib/hash_table_test.c +5 -3
- data/unittests/lib/linked_list_test.c +82 -4
- data/unittests/lib/log_test.c +96 -5
- data/unittests/lib/management_interface_test.c +240 -0
- data/unittests/lib/management_service_interface_test.c +319 -0
- data/unittests/lib/message_queue_test.c +6 -2
- data/unittests/lib/messenger_test.c +167 -2
- data/unittests/lib/openflow_application_interface_test.c +16 -22
- data/unittests/lib/openflow_message_test.c +721 -24
- data/unittests/lib/packet_info_test.c +2 -2
- data/unittests/lib/packet_parser_test.c +15 -16
- data/unittests/lib/packetin_filter_interface_test.c +6 -6
- data/unittests/lib/persistent_storage_test.c +11 -11
- data/unittests/lib/stat_test.c +151 -7
- data/unittests/lib/timer_test.c +1 -1
- data/unittests/lib/trema_private_test.c +2 -2
- data/unittests/lib/trema_test.c +40 -12
- data/unittests/lib/utility_test.c +3 -3
- data/unittests/lib/wrapper_test.c +3 -3
- data/unittests/packetin_filter/packetin_filter_test.c +12 -11
- data/unittests/switch_manager/switch_manager_test.c +29 -22
- metadata +99 -20
- data/features/step_definitions/log_steps.rb +0 -90
- data/features/step_definitions/run_steps.rb +0 -91
- data/features/trema.feature +0 -27
- data/features/tutorial.hello_trema.feature +0 -27
- data/features/tutorial.packet_in.feature +0 -47
- data/features/tutorial.switch_info.feature +0 -55
- data/ruby/trema/command/usage.rb +0 -63
data/bin/trema-config
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Trema compile helper.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008-2012 NEC Corporation
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License, version 2, as
|
9
|
+
# published by the Free Software Foundation.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License along
|
17
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
#
|
20
|
+
|
21
|
+
|
22
|
+
$LOAD_PATH.unshift( File.expand_path( File.dirname( __FILE__ ) + "/../ruby" ) )
|
23
|
+
|
24
|
+
|
25
|
+
require "fileutils"
|
26
|
+
require "optparse"
|
27
|
+
require "trema/path"
|
28
|
+
|
29
|
+
|
30
|
+
$opts = OptionParser.new
|
31
|
+
|
32
|
+
FileUtils.cd Trema.home do
|
33
|
+
$opts.banner = "Usage: #{ File.basename $0 } [OPTIONS ...]"
|
34
|
+
|
35
|
+
$opts.on( "-c", "--cflags" ) do
|
36
|
+
$cflags = true
|
37
|
+
end
|
38
|
+
$opts.on( "-l", "--libs" ) do
|
39
|
+
$libs = true
|
40
|
+
end
|
41
|
+
|
42
|
+
$opts.parse! ARGV
|
43
|
+
|
44
|
+
output = []
|
45
|
+
if $cflags
|
46
|
+
output << "-I#{ Trema.home }/src/lib -I#{ Trema.openflow }"
|
47
|
+
end
|
48
|
+
if $libs
|
49
|
+
output << "-L#{ Trema.objects }/lib -ltrema -lrt -lpthread -lsqlite3 -ldl"
|
50
|
+
end
|
51
|
+
print output.join( " " )
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
### Local variables:
|
56
|
+
### mode: Ruby
|
57
|
+
### coding: utf-8
|
58
|
+
### indent-tabs-mode: nil
|
59
|
+
### End:
|
data/cruise.rb
CHANGED
@@ -1,87 +1,67 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: "Dumper" sample application
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
In order to learn how to dump miscellaneous OpenFlow messages
|
4
|
+
As a developer using Trema
|
5
|
+
I want to execute "Dumper" sample application
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Given I try trema run "./objects/examples/dumper/dumper" with following configuration (backgrounded):
|
7
|
+
Background:
|
8
|
+
Given a file named "dumper.conf" with:
|
10
9
|
"""
|
11
|
-
vswitch("dumper") { datapath_id
|
10
|
+
vswitch("dumper") { datapath_id 0xabc }
|
12
11
|
|
13
|
-
vhost("host1")
|
14
|
-
|
15
|
-
mac "00:00:00:00:00:01"
|
16
|
-
}
|
17
|
-
vhost("host2") {
|
18
|
-
ip "192.168.0.2"
|
19
|
-
mac "00:00:00:00:00:02"
|
20
|
-
}
|
12
|
+
vhost("host1")
|
13
|
+
vhost("host2")
|
21
14
|
|
22
15
|
link "dumper", "host1"
|
23
16
|
link "dumper", "host2"
|
24
17
|
"""
|
25
|
-
And wait until "dumper" is up
|
26
|
-
When I try to run "./trema send_packets --source host1 --dest host2 --length=0"
|
27
|
-
And I terminated all trema services
|
28
|
-
Then the output should include:
|
29
|
-
"""
|
30
|
-
[packet_in]
|
31
|
-
datapath_id: 0xabc
|
32
|
-
"""
|
33
|
-
|
34
18
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
19
|
+
@slow_process
|
20
|
+
Scenario: Run "Dumper" C example
|
21
|
+
Given I run `trema run ../../objects/examples/dumper/dumper -c dumper.conf -d`
|
22
|
+
And wait until "dumper" is up
|
23
|
+
When I send 1 packet from host1 to host2
|
24
|
+
Then the file "../../tmp/log/dumper.log" should contain "[switch_ready]"
|
25
|
+
And the file "../../tmp/log/dumper.log" should contain "[packet_in]"
|
26
|
+
And the file "../../tmp/log/dumper.log" should contain "datapath_id: 0xabc"
|
39
27
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
28
|
+
@slow_process
|
29
|
+
Scenario: Run "Dumper" Ruby example
|
30
|
+
Given I run `trema run ../../src/examples/dumper/dumper.rb -c dumper.conf -d`
|
31
|
+
And wait until "Dumper" is up
|
32
|
+
When I send 1 packet from host1 to host2
|
33
|
+
Then the file "../../tmp/log/Dumper.log" should contain "[switch_ready]"
|
34
|
+
And the file "../../tmp/log/Dumper.log" should contain "[packet_in]"
|
35
|
+
And the file "../../tmp/log/Dumper.log" should contain "datapath_id: 0xabc"
|
48
36
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
And wait until "Dumper" is up
|
53
|
-
When I try to run "./trema send_packets --source host1 --dest host2 --length=0"
|
54
|
-
And I terminated all trema services
|
55
|
-
Then the output should include:
|
56
|
-
"""
|
57
|
-
[packet_in]
|
58
|
-
datapath_id: 0xabc
|
59
|
-
"""
|
60
|
-
|
61
|
-
|
62
|
-
Scenario: dumper --help
|
63
|
-
When I try to run "./objects/examples/dumper/dumper --help" (log = "dumper_help.log")
|
64
|
-
Then the log file "dumper_help.log" should be:
|
37
|
+
Scenario: "dumper --help"
|
38
|
+
When I run `../../objects/examples/dumper/dumper --help`
|
39
|
+
Then the output should contain exactly:
|
65
40
|
"""
|
66
41
|
OpenFlow Event Dumper.
|
67
42
|
Usage: dumper [OPTION]...
|
68
43
|
|
69
|
-
-n, --name=SERVICE_NAME
|
70
|
-
-d, --daemonize
|
71
|
-
-l, --logging_level=LEVEL
|
72
|
-
-
|
73
|
-
|
44
|
+
-n, --name=SERVICE_NAME service name
|
45
|
+
-d, --daemonize run in the background
|
46
|
+
-l, --logging_level=LEVEL set logging level
|
47
|
+
-g, --syslog output log messages to syslog
|
48
|
+
-f, --logging_facility=FACILITY set syslog facility
|
49
|
+
-h, --help display this help and exit
|
74
50
|
|
51
|
+
"""
|
75
52
|
|
76
|
-
Scenario: dumper -h
|
77
|
-
When I
|
78
|
-
Then the
|
53
|
+
Scenario: "dumper -h"
|
54
|
+
When I run `../../objects/examples/dumper/dumper -h`
|
55
|
+
Then the output should contain exactly:
|
79
56
|
"""
|
80
57
|
OpenFlow Event Dumper.
|
81
58
|
Usage: dumper [OPTION]...
|
82
59
|
|
83
|
-
-n, --name=SERVICE_NAME
|
84
|
-
-d, --daemonize
|
85
|
-
-l, --logging_level=LEVEL
|
86
|
-
-
|
60
|
+
-n, --name=SERVICE_NAME service name
|
61
|
+
-d, --daemonize run in the background
|
62
|
+
-l, --logging_level=LEVEL set logging level
|
63
|
+
-g, --syslog output log messages to syslog
|
64
|
+
-f, --logging_facility=FACILITY set syslog facility
|
65
|
+
-h, --help display this help and exit
|
66
|
+
|
87
67
|
"""
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: "Hello Trema!" sample application
|
2
|
+
|
3
|
+
In order to learn how to write minimum Trema application
|
4
|
+
As a developer using Trema
|
5
|
+
I want to execute "Hello Trema" sample application
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given a file named "hello.conf" with:
|
9
|
+
"""
|
10
|
+
vswitch { datapath_id "0xabc" }
|
11
|
+
"""
|
12
|
+
|
13
|
+
@slow_process
|
14
|
+
Scenario: Run "Hello Trema!" C example
|
15
|
+
When I run `trema run ../../objects/examples/hello_trema/hello_trema -c hello.conf`
|
16
|
+
Then the output should contain exactly "Hello 0xabc!\n"
|
17
|
+
|
18
|
+
@slow_process
|
19
|
+
Scenario: Run "Hello Trema!" Ruby example
|
20
|
+
When I run `trema run ../../src/examples/hello_trema/hello-trema.rb -c hello.conf`
|
21
|
+
Then the output should contain exactly "Hello 0xabc!\n"
|
@@ -1,39 +1,37 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: "Learning Switch" sample application
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
In order to learn how to implement software L2 switch
|
4
|
+
As a developer using Trema
|
5
|
+
I want to execute "Learning Switch" sample application
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Given I try trema run "learning_switch" example with following configuration (backgrounded):
|
7
|
+
Background:
|
8
|
+
Given a file named "learning_switch.conf" with:
|
10
9
|
"""
|
11
10
|
vswitch("learning") { datapath_id "0xabc" }
|
12
11
|
|
13
|
-
vhost("host1")
|
14
|
-
vhost("host2")
|
12
|
+
vhost("host1") { ip "192.168.0.1" }
|
13
|
+
vhost("host2") { ip "192.168.0.2" }
|
15
14
|
|
16
15
|
link "learning", "host1"
|
17
16
|
link "learning", "host2"
|
18
17
|
"""
|
19
|
-
When I send 1 packet from host1 to host2
|
20
|
-
And I try to run "./trema show_stats host1 --tx" (log = "host1.learning_switch.log")
|
21
|
-
And I try to run "./trema show_stats host2 --rx" (log = "host2.learning_switch.log")
|
22
|
-
Then the content of "host1.learning_switch.log" and "host2.learning_switch.log" should be identical
|
23
|
-
|
24
|
-
|
25
|
-
Scenario: Send and receive packets (in Ruby)
|
26
|
-
Given I try trema run "learning-switch.rb" example with following configuration (backgrounded):
|
27
|
-
"""
|
28
|
-
vswitch("learning") { datapath_id "0xabc" }
|
29
18
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
19
|
+
@slow_process
|
20
|
+
Scenario: Run "Learning Switch" C example
|
21
|
+
Given I run `trema run ../../objects/examples/learning_switch/learning_switch -c learning_switch.conf -d`
|
22
|
+
And wait until "learning_switch" is up
|
23
|
+
When I send 1 packet from host1 to host2
|
24
|
+
And I run `trema show_stats host1 --tx`
|
25
|
+
And I run `trema show_stats host2 --rx`
|
26
|
+
Then the output from "trema show_stats host1 --tx" should contain "192.168.0.2,1,192.168.0.1,1,1,50"
|
27
|
+
And the output from "trema show_stats host2 --rx" should contain "192.168.0.2,1,192.168.0.1,1,1,50"
|
28
|
+
|
29
|
+
@slow_process
|
30
|
+
Scenario: Run "Learning Switch" Ruby example
|
31
|
+
Given I run `trema run ../../src/examples/learning_switch/learning-switch.rb -c learning_switch.conf -d`
|
32
|
+
And wait until "LearningSwitch" is up
|
36
33
|
When I send 1 packet from host1 to host2
|
37
|
-
|
38
|
-
|
39
|
-
Then the
|
34
|
+
And I run `trema show_stats host1 --tx`
|
35
|
+
And I run `trema show_stats host2 --rx`
|
36
|
+
Then the output from "trema show_stats host1 --tx" should contain "192.168.0.2,1,192.168.0.1,1,1,50"
|
37
|
+
And the output from "trema show_stats host2 --rx" should contain "192.168.0.2,1,192.168.0.1,1,1,50"
|
@@ -1,38 +1,24 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: "List Switches" sample application
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
In order to learn how to get the list of OpenFlow switches
|
4
|
+
As a developer using Trema
|
5
|
+
I want to execute "List Switches" sample application
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Given I try trema run "./objects/examples/list_switches/list_switches" with following configuration (backgrounded):
|
10
|
-
"""
|
11
|
-
vswitch { datapath_id "0x1" }
|
12
|
-
vswitch { datapath_id "0x2" }
|
13
|
-
vswitch { datapath_id "0x3" }
|
14
|
-
vswitch { datapath_id "0x4" }
|
7
|
+
Background:
|
8
|
+
Given a file named "list_switches.conf" with:
|
15
9
|
"""
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
"""
|
21
|
-
switches = 0x1, 0x2, 0x3, 0x4
|
10
|
+
vswitch { datapath_id 0x1 }
|
11
|
+
vswitch { datapath_id 0x2 }
|
12
|
+
vswitch { datapath_id 0x3 }
|
13
|
+
vswitch { datapath_id 0x4 }
|
22
14
|
"""
|
23
15
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
And *** sleep 2 ***
|
34
|
-
And I terminated all trema services
|
35
|
-
Then the output should include:
|
36
|
-
"""
|
37
|
-
switches = 0x1, 0x2, 0x3, 0x4
|
38
|
-
"""
|
16
|
+
@slow_process
|
17
|
+
Scenario: Run "List Switches" C example
|
18
|
+
Given I run `trema run ../../objects/examples/list_switches/list_switches -c list_switches.conf`
|
19
|
+
Then the file "../../tmp/log/list_switches.log" should contain "switches = 0x1, 0x2, 0x3, 0x4"
|
20
|
+
|
21
|
+
@slow_process
|
22
|
+
Scenario: Run "List Switches" Ruby example
|
23
|
+
Given I run `trema run ../../src/examples/list_switches/list-switches.rb -c list_switches.conf`
|
24
|
+
Then the file "../../tmp/log/ListSwitches.log" should contain "switches = 0x1, 0x2, 0x3, 0x4"
|
@@ -4,7 +4,7 @@ Feature: Send echo reply messages
|
|
4
4
|
I want to send echo reply messages to openflow switches
|
5
5
|
Because I want to reply to echo requests from openflow switches
|
6
6
|
|
7
|
-
|
7
|
+
@wip
|
8
8
|
Scenario: Send echo reply x 10
|
9
9
|
When I try trema run "./objects/examples/openflow_message/echo_reply 10" with following configuration (backgrounded):
|
10
10
|
"""
|
@@ -14,13 +14,13 @@ Feature: Send echo reply messages
|
|
14
14
|
And *** sleep 2 ***
|
15
15
|
Then the log file "openflowd.echo_reply.log" should include "received: OFPT_ECHO_REPLY" x 10
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
@wip
|
18
|
+
Scenario: Send echo reply x 10 in Ruby
|
19
|
+
When I try trema run "./src/examples/openflow_message/echo-reply.rb 0xabc, 10" with following configuration (backgrounded):
|
20
|
+
"""
|
21
|
+
vswitch("echo-reply") { datapath_id "0xabc" }
|
22
|
+
"""
|
23
|
+
And wait until "EchoReplyController" is up
|
24
|
+
And *** sleep 2 ***
|
25
|
+
Then the log file "openflowd.echo-reply.log" should include "received: OFPT_ECHO_REPLY" x 10
|
26
26
|
|
@@ -4,7 +4,7 @@ Feature: Send echo request messages
|
|
4
4
|
I want to send echo request messages to openflow switches
|
5
5
|
So that I can receive echo reply messages from openflow switches
|
6
6
|
|
7
|
-
|
7
|
+
@wip
|
8
8
|
Scenario: Send echo request x 10
|
9
9
|
When I try trema run "./objects/examples/openflow_message/echo_request 10" with following configuration (backgrounded):
|
10
10
|
"""
|
@@ -14,7 +14,7 @@ Feature: Send echo request messages
|
|
14
14
|
And *** sleep 2 ***
|
15
15
|
Then the log file "openflowd.echo_request.log" should include "received: OFPT_ECHO_REQUEST" x 10
|
16
16
|
|
17
|
-
|
17
|
+
@wip
|
18
18
|
Scenario: Send echo request x 10 in Ruby
|
19
19
|
When I try trema run "./src/examples/openflow_message/echo-request.rb 0xabc, 10" with following configuration (backgrounded):
|
20
20
|
"""
|
@@ -4,14 +4,14 @@ Feature: Send a features request message
|
|
4
4
|
I want to send a features request message to openflow switches
|
5
5
|
So that I can get the list of switch features
|
6
6
|
|
7
|
-
|
8
|
-
Scenario: Send a features request
|
7
|
+
@wip
|
8
|
+
Scenario: Send a features request
|
9
9
|
When I try trema run "./objects/examples/openflow_message/features_request" with following configuration (backgrounded):
|
10
10
|
"""
|
11
11
|
vswitch( "features_request" ) { datapath_id "0xabc" }
|
12
12
|
"""
|
13
13
|
And wait until "features_request" is up
|
14
|
-
And I
|
14
|
+
And I run `trema killall`
|
15
15
|
Then the output should include:
|
16
16
|
"""
|
17
17
|
datapath_id: 0xabc
|
@@ -44,13 +44,14 @@ Feature: Send a features request message
|
|
44
44
|
peer = 0
|
45
45
|
"""
|
46
46
|
|
47
|
-
|
47
|
+
@wip
|
48
|
+
Scenario: Send a features request in Ruby
|
48
49
|
When I try trema run "./src/examples/openflow_message/features-request.rb" with following configuration (backgrounded):
|
49
50
|
"""
|
50
51
|
vswitch( "features-request" ) { datapath_id "0xabc" }
|
51
52
|
"""
|
52
53
|
And wait until "FeaturesRequestController" is up
|
53
|
-
And I
|
54
|
+
And I run `trema killall`
|
54
55
|
Then the output should include:
|
55
56
|
"""
|
56
57
|
datapath_id: 0xabc
|
@@ -1,25 +1,59 @@
|
|
1
1
|
Feature: Send hello messages
|
2
2
|
|
3
|
+
In order to start conversations with switches
|
3
4
|
As a Trema user
|
4
5
|
I want to send hello messages to openflow switches
|
5
|
-
So that I can start transactions with switches
|
6
6
|
|
7
|
-
|
8
|
-
Scenario: Hello
|
9
|
-
|
7
|
+
@slow_process
|
8
|
+
Scenario: Hello message in C
|
9
|
+
Given a file named "hello.conf" with:
|
10
10
|
"""
|
11
|
-
|
11
|
+
custom_switch("hello") {
|
12
|
+
datapath_id "0xabc"
|
13
|
+
path "./objects/examples/openflow_switch/hello_switch"
|
14
|
+
}
|
12
15
|
"""
|
16
|
+
When I run `trema run "../../objects/examples/openflow_message/hello 10" -c hello.conf -d`
|
13
17
|
And wait until "hello" is up
|
14
|
-
And I
|
15
|
-
Then the
|
16
|
-
|
18
|
+
And I run `trema killall`
|
19
|
+
Then the file "../../tmp/log/customswitch.hello.log" should contain:
|
20
|
+
"""
|
21
|
+
received: OFPT_HELLO
|
22
|
+
received: OFPT_HELLO
|
23
|
+
received: OFPT_HELLO
|
24
|
+
received: OFPT_HELLO
|
25
|
+
received: OFPT_HELLO
|
26
|
+
received: OFPT_HELLO
|
27
|
+
received: OFPT_HELLO
|
28
|
+
received: OFPT_HELLO
|
29
|
+
received: OFPT_HELLO
|
30
|
+
received: OFPT_HELLO
|
31
|
+
received: OFPT_HELLO
|
32
|
+
"""
|
17
33
|
|
18
|
-
|
19
|
-
|
34
|
+
@slow_process
|
35
|
+
Scenario: Hello message in Ruby
|
36
|
+
Given a file named "hello-r.conf" with:
|
20
37
|
"""
|
21
|
-
|
38
|
+
custom_switch("hello-r") {
|
39
|
+
datapath_id "0xabc"
|
40
|
+
path "./objects/examples/openflow_switch/hello_switch"
|
41
|
+
}
|
22
42
|
"""
|
43
|
+
When I run `trema run "../../src/examples/openflow_message/hello.rb 10" -c hello-r.conf -d`
|
23
44
|
And wait until "HelloController" is up
|
24
|
-
And I
|
25
|
-
Then the
|
45
|
+
And I run `trema killall`
|
46
|
+
Then the file "../../tmp/log/customswitch.hello-r.log" should contain:
|
47
|
+
"""
|
48
|
+
received: OFPT_HELLO
|
49
|
+
received: OFPT_HELLO
|
50
|
+
received: OFPT_HELLO
|
51
|
+
received: OFPT_HELLO
|
52
|
+
received: OFPT_HELLO
|
53
|
+
received: OFPT_HELLO
|
54
|
+
received: OFPT_HELLO
|
55
|
+
received: OFPT_HELLO
|
56
|
+
received: OFPT_HELLO
|
57
|
+
received: OFPT_HELLO
|
58
|
+
received: OFPT_HELLO
|
59
|
+
"""
|