trema 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,51 +1,33 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: "Switch Monitor" sample application
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
In order to learn how to listen switch UP/DOWN event
|
|
4
|
+
As a developer using Trema
|
|
5
|
+
I want to execute "Switch Monitor" sample application
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Given I try trema run "./src/examples/switch_monitor/switch-monitor.rb" with following configuration (backgrounded):
|
|
7
|
+
Background:
|
|
8
|
+
Given a file named "switch_monitor.conf" with:
|
|
10
9
|
"""
|
|
11
10
|
vswitch { datapath_id 0x1 }
|
|
12
11
|
vswitch { datapath_id 0x2 }
|
|
13
12
|
vswitch { datapath_id 0x3 }
|
|
14
13
|
"""
|
|
15
|
-
And *** sleep 2 ***
|
|
16
|
-
And wait until "SwitchMonitor" is up
|
|
17
|
-
When I try trema kill "0x3"
|
|
18
|
-
And *** sleep 2 ***
|
|
19
|
-
Then the log file "SwitchMonitor.log" should match:
|
|
20
|
-
"""
|
|
21
|
-
Switch 0x3 is DOWN
|
|
22
|
-
"""
|
|
23
|
-
When I try trema up "0x3"
|
|
24
|
-
And *** sleep 10 ***
|
|
25
|
-
Then the log file "SwitchMonitor.log" should match:
|
|
26
|
-
"""
|
|
27
|
-
All switches = 0x1, 0x2, 0x3
|
|
28
|
-
"""
|
|
29
14
|
|
|
15
|
+
@slow_process
|
|
16
|
+
Scenario: Run "Switch Monitor" C example
|
|
17
|
+
Given I run `trema run ../../objects/examples/switch_monitor/switch_monitor -c switch_monitor.conf -d`
|
|
18
|
+
And wait until "switch_monitor" is up
|
|
19
|
+
When I run `trema kill 0x3`
|
|
20
|
+
Then the file "../../tmp/log/switch_monitor.log" should contain "Switch 0x3 is DOWN"
|
|
21
|
+
When I run `trema up 0x3`
|
|
22
|
+
And *** sleep 10 ***
|
|
23
|
+
Then the file "../../tmp/log/switch_monitor.log" should contain "All switches = 0x1, 0x2, 0x3"
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
When I try trema kill "0x3"
|
|
41
|
-
And *** sleep 2 ***
|
|
42
|
-
Then the log file "switch_monitor.log" should match:
|
|
43
|
-
"""
|
|
44
|
-
Switch 0x3 is DOWN
|
|
45
|
-
"""
|
|
46
|
-
When I try trema up "0x3"
|
|
47
|
-
And *** sleep 10 ***
|
|
48
|
-
Then the log file "switch_monitor.log" should match:
|
|
49
|
-
"""
|
|
50
|
-
All switches = 0x1, 0x2, 0x3
|
|
51
|
-
"""
|
|
25
|
+
@slow_process
|
|
26
|
+
Scenario: Run "Switch Monitor" Ruby example
|
|
27
|
+
Given I run `trema run ../../src/examples/switch_monitor/switch-monitor.rb -c switch_monitor.conf -d`
|
|
28
|
+
And wait until "SwitchMonitor" is up
|
|
29
|
+
When I run `trema kill 0x3`
|
|
30
|
+
Then the file "../../tmp/log/SwitchMonitor.log" should contain "Switch 0x3 is DOWN"
|
|
31
|
+
When I run `trema up 0x3`
|
|
32
|
+
And *** sleep 10 ***
|
|
33
|
+
Then the file "../../tmp/log/SwitchMonitor.log" should contain "All switches = 0x1, 0x2, 0x3"
|
|
@@ -4,46 +4,52 @@ Feature: packetin_filter help
|
|
|
4
4
|
I want to see the help message of packetin_filter command
|
|
5
5
|
So that I can learn how to use packetin_filter
|
|
6
6
|
|
|
7
|
+
@wip
|
|
7
8
|
Scenario: packetin_filter --help
|
|
8
9
|
When I try to run "./objects/packetin_filter/packetin_filter --help"
|
|
9
10
|
Then the output should be:
|
|
10
11
|
"""
|
|
11
12
|
OpenFlow Packet in Filter.
|
|
12
13
|
Usage: packetin_filter [OPTION]... [PACKETIN-FILTER-RULE]...
|
|
13
|
-
|
|
14
|
-
-n, --name=SERVICE_NAME
|
|
15
|
-
-d, --daemonize
|
|
16
|
-
-l, --logging_level=LEVEL
|
|
17
|
-
-
|
|
18
|
-
|
|
14
|
+
|
|
15
|
+
-n, --name=SERVICE_NAME service name
|
|
16
|
+
-d, --daemonize run in the background
|
|
17
|
+
-l, --logging_level=LEVEL set logging level
|
|
18
|
+
-g, --syslog output log messages to syslog
|
|
19
|
+
-f, --logging_facility=FACILITY set syslog facility
|
|
20
|
+
-h, --help display this help and exit
|
|
21
|
+
|
|
19
22
|
PACKETIN-FILTER-RULE:
|
|
20
23
|
match-type::destination-service-name
|
|
21
|
-
|
|
24
|
+
|
|
22
25
|
match-type:
|
|
23
|
-
lldp
|
|
24
|
-
packet_in
|
|
25
|
-
|
|
26
|
-
destination-service-name
|
|
26
|
+
lldp LLDP ethernet frame type and priority is 0x8000
|
|
27
|
+
packet_in any packet and priority is zero
|
|
28
|
+
|
|
29
|
+
destination-service-name destination service name
|
|
27
30
|
"""
|
|
28
31
|
|
|
32
|
+
@wip
|
|
29
33
|
Scenario: packetin_filter -h
|
|
30
34
|
When I try to run "./objects/packetin_filter/packetin_filter -h"
|
|
31
35
|
Then the output should be:
|
|
32
36
|
"""
|
|
33
37
|
OpenFlow Packet in Filter.
|
|
34
38
|
Usage: packetin_filter [OPTION]... [PACKETIN-FILTER-RULE]...
|
|
35
|
-
|
|
36
|
-
-n, --name=SERVICE_NAME
|
|
37
|
-
-d, --daemonize
|
|
38
|
-
-l, --logging_level=LEVEL
|
|
39
|
-
-
|
|
40
|
-
|
|
39
|
+
|
|
40
|
+
-n, --name=SERVICE_NAME service name
|
|
41
|
+
-d, --daemonize run in the background
|
|
42
|
+
-l, --logging_level=LEVEL set logging level
|
|
43
|
+
-g, --syslog output log messages to syslog
|
|
44
|
+
-f, --logging_facility=FACILITY set syslog facility
|
|
45
|
+
-h, --help display this help and exit
|
|
46
|
+
|
|
41
47
|
PACKETIN-FILTER-RULE:
|
|
42
48
|
match-type::destination-service-name
|
|
43
|
-
|
|
49
|
+
|
|
44
50
|
match-type:
|
|
45
|
-
lldp
|
|
46
|
-
packet_in
|
|
47
|
-
|
|
48
|
-
destination-service-name
|
|
51
|
+
lldp LLDP ethernet frame type and priority is 0x8000
|
|
52
|
+
packet_in any packet and priority is zero
|
|
53
|
+
|
|
54
|
+
destination-service-name destination service name
|
|
49
55
|
"""
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Author: Yasuhito Takamiya <yasuhito@gmail.com>
|
|
3
|
-
#
|
|
4
2
|
# Copyright (C) 2008-2012 NEC Corporation
|
|
5
3
|
#
|
|
6
4
|
# This program is free software; you can redistribute it and/or modify
|
|
@@ -41,19 +39,32 @@ Then /^([^\s]*) is terminated$/ do | name |
|
|
|
41
39
|
end
|
|
42
40
|
|
|
43
41
|
|
|
44
|
-
Then /^vswitch (
|
|
45
|
-
pid_file = File.join( Trema.
|
|
42
|
+
Then /^the vswitch "(.*?)" is running$/ do | dpid |
|
|
43
|
+
pid_file = File.join( Trema.pid, "open_vswitch.#{ dpid }.pid" )
|
|
44
|
+
File.exists?( pid_file ).should be_true
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Then /^the vswitch "([^"]*)" is terminated$/ do | dpid |
|
|
49
|
+
pid_file = File.join( Trema.pid, "open_vswitch.#{ dpid }.pid" )
|
|
46
50
|
File.exists?( pid_file ).should be_false
|
|
47
51
|
end
|
|
48
52
|
|
|
49
53
|
|
|
50
|
-
Then /^(
|
|
51
|
-
|
|
54
|
+
Then /^the vhost "(.*?)" is terminated$/ do | host |
|
|
55
|
+
pid_file = File.join( Trema.pid, "phost.#{ host }.pid" )
|
|
56
|
+
File.exists?( pid_file ).should be_false
|
|
52
57
|
end
|
|
53
58
|
|
|
54
59
|
|
|
55
|
-
Then /^
|
|
56
|
-
|
|
60
|
+
Then /^the controller "(.*?)" is terminated$/ do | controller |
|
|
61
|
+
pid_file = File.join( Trema.pid, "#{ controller }.pid" )
|
|
62
|
+
File.exists?( pid_file ).should be_false
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
Then /^([^\s]*) is started$/ do | name |
|
|
67
|
+
ps_entry_of( name ).should_not be_empty
|
|
57
68
|
end
|
|
58
69
|
|
|
59
70
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Author: Yasuhito Takamiya <yasuhito@gmail.com>
|
|
3
|
-
#
|
|
4
2
|
# Copyright (C) 2008-2012 NEC Corporation
|
|
5
3
|
#
|
|
6
4
|
# This program is free software; you can redistribute it and/or modify
|
|
@@ -19,8 +17,7 @@
|
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
When /^I send (\d+) packets from (.+) to (.+)$/ do | n_packets, host_a, host_b |
|
|
22
|
-
run
|
|
23
|
-
sleep 1 # ensure that all packets are sent
|
|
20
|
+
step "I run `trema send_packets --source #{ host_a } --dest #{ host_b } --n_pkts #{ n_packets }`"
|
|
24
21
|
end
|
|
25
22
|
|
|
26
23
|
|
|
@@ -29,12 +26,6 @@ When /^I send 1 packet from (.+) to (.+)$/ do | host_a, host_b |
|
|
|
29
26
|
end
|
|
30
27
|
|
|
31
28
|
|
|
32
|
-
When /^I send packets from (.+) to (.+) \(duration = (\d+)\)$/ do | host_a, host_b, duration |
|
|
33
|
-
run "./trema send_packets --source #{ host_a } --dest #{ host_b } --duration #{ duration }"
|
|
34
|
-
sleep 1 # ensure that all packets are sent
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
|
|
38
29
|
### Local variables:
|
|
39
30
|
### mode: Ruby
|
|
40
31
|
### coding: utf-8-unix
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Author: Yasuhito Takamiya <yasuhito@gmail.com>
|
|
3
|
-
#
|
|
4
2
|
# Copyright (C) 2008-2012 NEC Corporation
|
|
5
3
|
#
|
|
6
4
|
# This program is free software; you can redistribute it and/or modify
|
|
@@ -19,15 +17,17 @@
|
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
Then /^the total number of tx packets should be:$/ do | table |
|
|
20
|
+
sleep 1
|
|
22
21
|
table.hashes[ 0 ].each_pair do | host, n |
|
|
23
|
-
count_packets(
|
|
22
|
+
count_packets( `trema show_stats #{ host } --tx` ).should == n.to_i
|
|
24
23
|
end
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
|
|
28
27
|
Then /^the total number of rx packets should be:$/ do | table |
|
|
28
|
+
sleep 1
|
|
29
29
|
table.hashes[ 0 ].each_pair do | host, n |
|
|
30
|
-
count_packets(
|
|
30
|
+
count_packets( `trema show_stats #{ host } --rx` ).should == n.to_i
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
data/features/support/env.rb
CHANGED
|
@@ -31,6 +31,7 @@ end
|
|
|
31
31
|
$LOAD_PATH.unshift( File.expand_path( File.dirname( __FILE__ ) + "/../../ruby" ) )
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
require "aruba/cucumber"
|
|
34
35
|
require "rspec"
|
|
35
36
|
require "tempfile"
|
|
36
37
|
require "trema/executables"
|
|
@@ -54,7 +55,7 @@ end
|
|
|
54
55
|
|
|
55
56
|
def new_tmp_log
|
|
56
57
|
system "rm #{ Trema.log }/tmp.*" # cleanup
|
|
57
|
-
`mktemp --tmpdir=#{ Trema.log }`.chomp
|
|
58
|
+
`mktemp --tmpdir=#{ Trema.log }`.chomp
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
|
data/features/support/hooks.rb
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
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
|
+
|
|
1
19
|
Before do
|
|
2
|
-
|
|
20
|
+
@aruba_timeout_seconds = 5
|
|
21
|
+
run "trema killall"
|
|
22
|
+
sleep 5
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Before( "@slow_process" ) do
|
|
27
|
+
@aruba_io_wait_seconds = 1
|
|
3
28
|
end
|
|
4
29
|
|
|
5
30
|
|
|
6
31
|
After do
|
|
7
|
-
run "
|
|
32
|
+
run "trema killall"
|
|
33
|
+
sleep 1
|
|
8
34
|
end
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Local variables:
|
|
38
|
+
### mode: Ruby
|
|
39
|
+
### coding: utf-8-unix
|
|
40
|
+
### indent-tabs-mode: nil
|
|
41
|
+
### End:
|
|
@@ -4,6 +4,7 @@ Feature: switch_manager help
|
|
|
4
4
|
I want to see the help message of switch_manager command
|
|
5
5
|
So that I can learn how to use switch_manager
|
|
6
6
|
|
|
7
|
+
@wip
|
|
7
8
|
Scenario: switch_manager --help
|
|
8
9
|
When I try to run "./objects/switch_manager/switch_manager --help"
|
|
9
10
|
Then the output should be:
|
|
@@ -11,14 +12,17 @@ Feature: switch_manager help
|
|
|
11
12
|
OpenFlow Switch Manager.
|
|
12
13
|
Usage: switch_manager [OPTION]... [-- SWITCH_MANAGER_OPTION]...
|
|
13
14
|
|
|
14
|
-
-s, --switch=PATH
|
|
15
|
-
-n, --name=SERVICE_NAME
|
|
16
|
-
-p, --port=PORT
|
|
17
|
-
-d, --daemonize
|
|
18
|
-
-l, --logging_level=LEVEL
|
|
19
|
-
-
|
|
15
|
+
-s, --switch=PATH the command path of switch
|
|
16
|
+
-n, --name=SERVICE_NAME service name
|
|
17
|
+
-p, --port=PORT server listen port (default 6633)
|
|
18
|
+
-d, --daemonize run in the background
|
|
19
|
+
-l, --logging_level=LEVEL set logging level
|
|
20
|
+
-g, --syslog output log messages to syslog
|
|
21
|
+
-f, --logging_facility=FACILITY set syslog facility
|
|
22
|
+
-h, --help display this help and exit
|
|
20
23
|
"""
|
|
21
24
|
|
|
25
|
+
@wip
|
|
22
26
|
Scenario: switch_manager -h
|
|
23
27
|
When I try to run "./objects/switch_manager/switch_manager -h"
|
|
24
28
|
Then the output should be:
|
|
@@ -26,10 +30,12 @@ Feature: switch_manager help
|
|
|
26
30
|
OpenFlow Switch Manager.
|
|
27
31
|
Usage: switch_manager [OPTION]... [-- SWITCH_MANAGER_OPTION]...
|
|
28
32
|
|
|
29
|
-
-s, --switch=PATH
|
|
30
|
-
-n, --name=SERVICE_NAME
|
|
31
|
-
-p, --port=PORT
|
|
32
|
-
-d, --daemonize
|
|
33
|
-
-l, --logging_level=LEVEL
|
|
34
|
-
-
|
|
33
|
+
-s, --switch=PATH the command path of switch
|
|
34
|
+
-n, --name=SERVICE_NAME service name
|
|
35
|
+
-p, --port=PORT server listen port (default 6633)
|
|
36
|
+
-d, --daemonize run in the background
|
|
37
|
+
-l, --logging_level=LEVEL set logging level
|
|
38
|
+
-g, --syslog output log messages to syslog
|
|
39
|
+
-f, --logging_facility=FACILITY set syslog facility
|
|
40
|
+
-h, --help display this help and exit
|
|
35
41
|
"""
|
|
@@ -1,68 +1,55 @@
|
|
|
1
|
-
Feature: trema-config
|
|
2
|
-
|
|
3
|
-
As a Trema user
|
|
4
|
-
I want to compile trema apps like: gcc -o hello_trema hello_trema.c `trema-config --cflags --libs`
|
|
5
|
-
So that I can compile trema apps without specifying Trema-specific flags and options.
|
|
1
|
+
Feature: trema-config command
|
|
6
2
|
|
|
3
|
+
In order to specify C compiler options easily
|
|
4
|
+
As a developer using Trema
|
|
5
|
+
I want to use trema-config command
|
|
7
6
|
|
|
8
7
|
Scenario: trema-config --cflags
|
|
9
|
-
When I
|
|
10
|
-
Then
|
|
11
|
-
|
|
8
|
+
When I run `trema-config --cflags`
|
|
9
|
+
Then the output should match /^-I\S+lib -I\S+openflow$/
|
|
12
10
|
|
|
13
11
|
Scenario: trema-config -c
|
|
14
|
-
When I
|
|
15
|
-
Then
|
|
16
|
-
|
|
12
|
+
When I run `trema-config -c`
|
|
13
|
+
Then the output should match /^-I\S+lib -I\S+openflow$/
|
|
17
14
|
|
|
18
15
|
Scenario: trema-config --libs
|
|
19
|
-
When I
|
|
20
|
-
|
|
21
|
-
Then I should not get errors
|
|
22
|
-
|
|
16
|
+
When I run `trema-config --libs`
|
|
17
|
+
Then the output should match /^-L\S+lib -l.*/
|
|
23
18
|
|
|
24
19
|
Scenario: trema-config -l
|
|
25
|
-
When I
|
|
26
|
-
|
|
27
|
-
Then I should not get errors
|
|
28
|
-
|
|
20
|
+
When I run `trema-config -l`
|
|
21
|
+
Then the output should match /^-L\S+lib -l.*/
|
|
29
22
|
|
|
30
23
|
Scenario: trema-config --cflags --libs
|
|
31
|
-
When I
|
|
32
|
-
|
|
33
|
-
Then I should not get errors
|
|
34
|
-
|
|
24
|
+
When I run `trema-config --cflags --libs`
|
|
25
|
+
Then the output should match /^-I\S+lib -I\S+openflow -L\S+lib -l.*/
|
|
35
26
|
|
|
36
27
|
Scenario: trema-config -c --libs
|
|
37
|
-
When I
|
|
38
|
-
Then
|
|
39
|
-
|
|
28
|
+
When I run `trema-config -c --libs`
|
|
29
|
+
Then the output should match /^-I\S+lib -I\S+openflow -L\S+lib -l.*/
|
|
40
30
|
|
|
41
31
|
Scenario: trema-config --cflags -l
|
|
42
|
-
When I
|
|
43
|
-
Then
|
|
44
|
-
|
|
32
|
+
When I run `trema-config --cflags -l`
|
|
33
|
+
Then the output should match /^-I\S+lib -I\S+openflow -L\S+lib -l.*/
|
|
45
34
|
|
|
46
35
|
Scenario: trema-config -c -l
|
|
47
|
-
When I
|
|
48
|
-
Then
|
|
49
|
-
|
|
36
|
+
When I run `trema-config -c -l`
|
|
37
|
+
Then the output should match /^-I\S+lib -I\S+openflow -L\S+lib -l.*/
|
|
50
38
|
|
|
51
39
|
Scenario: trema-config --help
|
|
52
|
-
When I
|
|
53
|
-
Then the output should
|
|
40
|
+
When I run `trema-config --help`
|
|
41
|
+
Then the output should contain:
|
|
54
42
|
"""
|
|
55
|
-
Usage:
|
|
43
|
+
Usage: trema-config [OPTIONS ...]
|
|
56
44
|
-c, --cflags
|
|
57
45
|
-l, --libs
|
|
58
46
|
"""
|
|
59
47
|
|
|
60
|
-
|
|
61
48
|
Scenario: trema-config -h
|
|
62
|
-
When I
|
|
63
|
-
Then the output should
|
|
49
|
+
When I run `trema-config -h`
|
|
50
|
+
Then the output should contain:
|
|
64
51
|
"""
|
|
65
|
-
Usage:
|
|
52
|
+
Usage: trema-config [OPTIONS ...]
|
|
66
53
|
-c, --cflags
|
|
67
54
|
-l, --libs
|
|
68
55
|
"""
|