trema 0.3.19 → 0.3.20
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.
- checksums.yaml +4 -4
- data/Gemfile +7 -7
- data/README.md +3 -3
- data/Rakefile +13 -4
- data/cruise.rb +1 -1
- data/features/examples/switch_monitor.feature +2 -0
- data/features/switch_event/C-add_forward_entry.feature +4 -24
- data/features/switch_event/C-delete_forward_entry.feature +3 -18
- data/features/switch_event/C-dump_forward_entries.feature +2 -12
- data/features/switch_event/C-set_forward_entries.feature +2 -12
- data/features/switch_event/add_forward_entry.feature +44 -29
- data/features/switch_event/delete_forward_entry.feature +31 -16
- data/features/switch_event/dump_forward_entries.feature +23 -13
- data/features/switch_event/set_forward_entries.feature +17 -7
- data/features/trema_commands/dump_flows.feature +1 -0
- data/features/trema_commands/reset_stats.feature +1 -0
- data/features/trema_commands/show_stats.feature +1 -0
- data/ruby/trema/features-reply.c +9 -6
- data/ruby/trema/monkey-patch/integer/validators.rb +36 -0
- data/ruby/trema/monkey-patch/integer.rb +2 -0
- data/ruby/trema/packet-in.c +140 -0
- data/ruby/trema/packet-queue.rb +130 -126
- data/ruby/trema/port.c +11 -0
- data/ruby/trema/queue-get-config-reply.c +8 -5
- data/ruby/trema/set-ip-tos.rb +3 -3
- data/ruby/trema/vendor-action.rb +5 -1
- data/ruby/trema/version.rb +1 -1
- data/spec/trema/echo-reply_spec.rb +8 -8
- data/spec/trema/echo-request_spec.rb +1 -1
- data/spec/trema/hello_spec.rb +6 -6
- data/spec/trema/packet-in_spec.rb +131 -0
- data/spec/trema/queue-get-config-reply_spec.rb +1 -1
- data/spec/trema/set-ip-tos_spec.rb +5 -0
- data/spec/trema/vendor-action_spec.rb +5 -0
- data/src/examples/switch_event_config/.gitignore +0 -1
- data/src/examples/switch_event_config/network.conf +2 -0
- data/src/lib/arp.h +3 -1
- data/src/lib/ether.h +1 -0
- data/src/lib/event_forward_interface.c +9 -4
- data/src/lib/openflow_message.c +6 -0
- data/src/lib/openflow_message.h +1 -0
- data/src/lib/packet_info.c +23 -0
- data/src/lib/packet_info.h +5 -0
- data/src/lib/packet_parser.c +8 -3
- data/src/lib/utility.c +13 -13
- data/src/lib/utility.h +15 -0
- data/src/switch_manager/event_forward_entry_manipulation.c +1 -1
- data/src/switch_manager/secure_channel_listener.c +3 -6
- data/src/switch_manager/switch.c +68 -9
- data/trema.gemspec +4 -4
- data/unittests/lib/event_forward_interface_test.c +30 -0
- data/unittests/lib/openflow_message_test.c +19 -0
- data/unittests/lib/packet_info_test.c +16 -0
- data/unittests/lib/packet_parser_test.c +37 -0
- data/unittests/lib/test_packets/rarp_req.cap +0 -0
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
|
4
|
-
|
3
|
+
metadata.gz: 16d03309cfb3b65ed463dff0c59990db3f87dc26
|
4
|
+
data.tar.gz: 7e9dbad2ecea2ab026bf0ba0ee3cb79cf2885009
|
5
5
|
SHA512:
|
6
|
-
|
7
|
-
|
6
|
+
metadata.gz: be99f19cbba01fd9c25eaaee21389ffc4c334adefc5a5f6b681f8bd89938cef58780cb46bde60997c6d414f124465ef08035a22ed830498d7915c68f55256af5
|
7
|
+
data.tar.gz: 4de20550f57a268e26f419d53510222a5294caee7dc5ce31a472aded241ea7e40b000fbb8a0e235164d64dda1e7664f204e670aa71fa75c0cb38bc4e87c7246a
|
data/Gemfile
CHANGED
@@ -13,16 +13,16 @@ gemspec
|
|
13
13
|
# Add dependencies to develop your gem here.
|
14
14
|
# Include everything needed to run rake, tests, features, etc.
|
15
15
|
group :development do
|
16
|
-
gem "aruba", "~> 0.5.
|
17
|
-
gem "cucumber", "~> 1.2
|
18
|
-
gem "flay", "~> 2.
|
19
|
-
gem "flog", "~>
|
16
|
+
gem "aruba", "~> 0.5.3"
|
17
|
+
gem "cucumber", "~> 1.3.2"
|
18
|
+
gem "flay", "~> 2.3.0"
|
19
|
+
gem "flog", "~> 4.1.0"
|
20
20
|
gem "rcov", "~> 1.0.0"
|
21
|
-
gem "redcarpet", "~> 2.
|
21
|
+
gem "redcarpet", "~> 2.3.0"
|
22
22
|
gem "reek", "~> 1.3.1"
|
23
|
-
gem "relish", "~> 0.
|
23
|
+
gem "relish", "~> 0.7"
|
24
24
|
gem "rspec", "~> 2.13.0"
|
25
|
-
gem "yard", "~> 0.8.
|
25
|
+
gem "yard", "~> 0.8.6.1"
|
26
26
|
end
|
27
27
|
|
28
28
|
|
data/README.md
CHANGED
@@ -29,8 +29,8 @@ Trema supports GNU/Linux only. And it has been tested on the following environme
|
|
29
29
|
|
30
30
|
* Ruby 1.8.7 (1.9.x is NOT supported yet)
|
31
31
|
* RubyGems 1.3.6 or higher
|
32
|
-
* Ubuntu 12.10, 12.04, 11.10, and 10.04 (i386/amd64, Desktop Edition)
|
33
|
-
* Debian GNU/Linux 6.0 (i386/amd64)
|
32
|
+
* Ubuntu 13.04, 12.10, 12.04, 11.10, and 10.04 (i386/amd64, Desktop Edition)
|
33
|
+
* Debian GNU/Linux 7.0 and 6.0 (i386/amd64)
|
34
34
|
* Fedora 16 (i386/x86_64)
|
35
35
|
|
36
36
|
It may also run on other GNU/Linux distributions but is not tested and
|
@@ -48,7 +48,7 @@ Getting Started
|
|
48
48
|
|
49
49
|
1.Install the prerequisites at the command prompt:
|
50
50
|
|
51
|
-
(In Ubuntu 12.10)
|
51
|
+
(In Ubuntu 13.04, 12.10, or Debian GNU/Linux 7.0)
|
52
52
|
$ sudo apt-get install gcc make ruby1.8 rubygems1.8 ruby1.8-dev libpcap-dev libsqlite3-dev
|
53
53
|
|
54
54
|
(In Ubuntu 12.04, 11.10 or Debian GNU/Linux 6.0)
|
data/Rakefile
CHANGED
@@ -409,7 +409,7 @@ end
|
|
409
409
|
# Tests
|
410
410
|
################################################################################
|
411
411
|
|
412
|
-
task :travis => [ :setup, :build_trema ]
|
412
|
+
task :travis => [ :setup, :build_trema, "spec:travis" ]
|
413
413
|
|
414
414
|
|
415
415
|
begin
|
@@ -430,6 +430,15 @@ begin
|
|
430
430
|
task.rspec_opts = "--tag type:actions --format documentation --color"
|
431
431
|
end
|
432
432
|
|
433
|
+
|
434
|
+
task "spec:travis" => :build_trema
|
435
|
+
RSpec::Core::RakeTask.new( "spec:travis" ) do | task |
|
436
|
+
task.verbose = $trace
|
437
|
+
task.pattern = FileList[ "spec/trema/hello_spec.rb", "spec/trema/echo-*_spec.rb" ]
|
438
|
+
task.rspec_opts = "--tag ~sudo --format documentation --color"
|
439
|
+
end
|
440
|
+
|
441
|
+
|
433
442
|
task :rcov => :build_trema
|
434
443
|
RSpec::Core::RakeTask.new( :rcov ) do | spec |
|
435
444
|
spec.pattern = "spec/**/*_spec.rb"
|
@@ -488,15 +497,15 @@ begin
|
|
488
497
|
desc "Analyze for code complexity"
|
489
498
|
task :flog do
|
490
499
|
flog = Flog.new( :continue => true )
|
491
|
-
flog.flog
|
500
|
+
flog.flog *$quality_targets
|
492
501
|
threshold = 10
|
493
502
|
|
494
503
|
bad_methods = flog.totals.select do | name, score |
|
495
|
-
name
|
504
|
+
( not ( /##{flog.no_method}$/=~ name ) ) and score > threshold
|
496
505
|
end
|
497
506
|
bad_methods.sort do | a, b |
|
498
507
|
a[ 1 ] <=> b[ 1 ]
|
499
|
-
end.each do | name, score |
|
508
|
+
end.reverse.each do | name, score |
|
500
509
|
puts "%8.1f: %s" % [ score, name ]
|
501
510
|
end
|
502
511
|
unless bad_methods.empty?
|
data/cruise.rb
CHANGED
@@ -186,7 +186,7 @@ def gcov gcda, dir
|
|
186
186
|
shell.on_stdout do | l |
|
187
187
|
file = File.expand_path( $1 ) if /^File '(.*)'/=~ l
|
188
188
|
testee = $c_files[ file ]
|
189
|
-
if /^Lines executed:(.*)% of (.*)$/=~ l
|
189
|
+
if /^Lines executed:(.*)% of (.*)$/=~ l and not testee.nil?
|
190
190
|
testee.coverage = $1.to_f
|
191
191
|
testee.lines = $2.to_i
|
192
192
|
end
|
@@ -17,6 +17,7 @@ Feature: "Switch Monitor" sample application
|
|
17
17
|
Given I run `trema run ../../objects/examples/switch_monitor/switch_monitor -c switch_monitor.conf -d`
|
18
18
|
And wait until "switch_monitor" is up
|
19
19
|
When I run `trema kill 0x3`
|
20
|
+
And *** sleep 1 ***
|
20
21
|
Then the file "../../tmp/log/switch_monitor.log" should contain "Switch 0x3 is DOWN"
|
21
22
|
When I run `trema up 0x3`
|
22
23
|
And *** sleep 10 ***
|
@@ -27,6 +28,7 @@ Feature: "Switch Monitor" sample application
|
|
27
28
|
Given I run `trema run ../../src/examples/switch_monitor/switch-monitor.rb -c switch_monitor.conf -d`
|
28
29
|
And wait until "SwitchMonitor" is up
|
29
30
|
When I run `trema kill 0x3`
|
31
|
+
And *** sleep 1 ***
|
30
32
|
Then the file "../../tmp/log/SwitchMonitor.log" should contain "Switch 0x3 is DOWN"
|
31
33
|
When I run `trema up 0x3`
|
32
34
|
And *** sleep 10 ***
|
@@ -41,12 +41,7 @@ Feature: C function example command "add_forward_entry"
|
|
41
41
|
|
42
42
|
@slow_process
|
43
43
|
Scenario Outline: Add 'mirror' to All Switch Manager/Daemon's event forwarding entries of packet_in
|
44
|
-
Given
|
45
|
-
"""
|
46
|
-
vswitch { datapath_id 0x1 }
|
47
|
-
vswitch { datapath_id 0x2 }
|
48
|
-
"""
|
49
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
44
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
50
45
|
And wait until "RepeaterHub" is up
|
51
46
|
When I successfully run `trema run './add_forward_entry -t packet_in mirror'`
|
52
47
|
Then the output should contain "Operation Succeeded."
|
@@ -63,12 +58,7 @@ Feature: C function example command "add_forward_entry"
|
|
63
58
|
|
64
59
|
@slow_process
|
65
60
|
Scenario Outline: Switch added after event forwarding entry manipulation should also reflect new configuration of Switch Manager.
|
66
|
-
Given
|
67
|
-
"""
|
68
|
-
vswitch { datapath_id 0x1 }
|
69
|
-
vswitch { datapath_id 0x2 }
|
70
|
-
"""
|
71
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
61
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
72
62
|
And wait until "RepeaterHub" is up
|
73
63
|
And I successfully run `trema run './add_forward_entry -t packet_in mirror'`
|
74
64
|
And the output should contain "Operation Succeeded."
|
@@ -91,12 +81,7 @@ Feature: C function example command "add_forward_entry"
|
|
91
81
|
|
92
82
|
@slow_process
|
93
83
|
Scenario Outline: Add 'mirror' only to Switch Manager's event forwarding entry of packet_in
|
94
|
-
Given
|
95
|
-
"""
|
96
|
-
vswitch { datapath_id 0x1 }
|
97
|
-
vswitch { datapath_id 0x2 }
|
98
|
-
"""
|
99
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
84
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
100
85
|
And wait until "RepeaterHub" is up
|
101
86
|
When I successfully run `trema run './add_forward_entry -m -t packet_in mirror'`
|
102
87
|
Then the output should contain "Updated service name list:"
|
@@ -113,12 +98,7 @@ Feature: C function example command "add_forward_entry"
|
|
113
98
|
|
114
99
|
@slow_process
|
115
100
|
Scenario Outline: Add 'mirror' only to Switch Daemon 0x1's event forwarding entries of packet_in
|
116
|
-
Given
|
117
|
-
"""
|
118
|
-
vswitch { datapath_id 0x1 }
|
119
|
-
vswitch { datapath_id 0x2 }
|
120
|
-
"""
|
121
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
101
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
122
102
|
And wait until "RepeaterHub" is up
|
123
103
|
When I successfully run `trema run './add_forward_entry -s 0x1 -t packet_in mirror'`
|
124
104
|
Then the output should contain "Updated service name list:"
|
@@ -41,12 +41,7 @@ Feature: C function example command "delete_forward_entry"
|
|
41
41
|
|
42
42
|
@slow_process
|
43
43
|
Scenario Outline: Delete 'RepeaterHub' from All Switch Manager/Daemon's event forwarding entries of packet_in
|
44
|
-
Given
|
45
|
-
"""
|
46
|
-
vswitch { datapath_id 0x1 }
|
47
|
-
vswitch { datapath_id 0x2 }
|
48
|
-
"""
|
49
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
44
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
50
45
|
And wait until "RepeaterHub" is up
|
51
46
|
When I successfully run `trema run './delete_forward_entry -t packet_in RepeaterHub '`
|
52
47
|
Then the output should contain "Operation Succeeded."
|
@@ -61,12 +56,7 @@ Feature: C function example command "delete_forward_entry"
|
|
61
56
|
|
62
57
|
@slow_process
|
63
58
|
Scenario Outline: Delete 'RepeaterHub' only from Switch Manager's event forwarding entries of packet_in
|
64
|
-
Given
|
65
|
-
"""
|
66
|
-
vswitch { datapath_id 0x1 }
|
67
|
-
vswitch { datapath_id 0x2 }
|
68
|
-
"""
|
69
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
59
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
70
60
|
And wait until "RepeaterHub" is up
|
71
61
|
When I successfully run `trema run './delete_forward_entry -m -t packet_in RepeaterHub'`
|
72
62
|
Then the output should contain "Updated service name list is empty."
|
@@ -81,12 +71,7 @@ Feature: C function example command "delete_forward_entry"
|
|
81
71
|
|
82
72
|
@slow_process
|
83
73
|
Scenario Outline: Delete 'RepeaterHub' only from Switch Daemon 0x1's event forwarding entries of packet_in
|
84
|
-
Given
|
85
|
-
"""
|
86
|
-
vswitch { datapath_id 0x1 }
|
87
|
-
vswitch { datapath_id 0x2 }
|
88
|
-
"""
|
89
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
74
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
90
75
|
And wait until "RepeaterHub" is up
|
91
76
|
When I successfully run `trema run './delete_forward_entry -s 0x1 -t packet_in RepeaterHub'`
|
92
77
|
Then the output should contain "Updated service name list is empty."
|
@@ -39,12 +39,7 @@ Feature: C function example command "dump_forward_entries"
|
|
39
39
|
|
40
40
|
@slow_process
|
41
41
|
Scenario Outline: Dump Switch Manager's event forwarding entries for each event type
|
42
|
-
Given
|
43
|
-
"""
|
44
|
-
vswitch { datapath_id 0x1 }
|
45
|
-
vswitch { datapath_id 0x2 }
|
46
|
-
"""
|
47
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
42
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
48
43
|
And wait until "RepeaterHub" is up
|
49
44
|
When I successfully run `trema run './dump_forward_entries -m -t <type>'`
|
50
45
|
Then the output should contain "Current service name list:"
|
@@ -59,12 +54,7 @@ Feature: C function example command "dump_forward_entries"
|
|
59
54
|
|
60
55
|
@slow_process
|
61
56
|
Scenario Outline: Dump Switch Daemon's event forwarding entries for each event type on each switch
|
62
|
-
Given
|
63
|
-
"""
|
64
|
-
vswitch { datapath_id 0x1 }
|
65
|
-
vswitch { datapath_id 0x2 }
|
66
|
-
"""
|
67
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
57
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
68
58
|
And wait until "RepeaterHub" is up
|
69
59
|
When I successfully run `trema run './dump_forward_entries -s <switch> -t <type>'`
|
70
60
|
Then the output should contain "Current service name list:"
|
@@ -40,12 +40,7 @@ Feature: C function example command "set_forward_entries"
|
|
40
40
|
|
41
41
|
@slow_process
|
42
42
|
Scenario Outline: Replace Switch Manager's event forwarding entries of packet_in to 'mirror' and 'filter'
|
43
|
-
Given
|
44
|
-
"""
|
45
|
-
vswitch { datapath_id 0x1 }
|
46
|
-
vswitch { datapath_id 0x2 }
|
47
|
-
"""
|
48
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
43
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
49
44
|
And wait until "RepeaterHub" is up
|
50
45
|
When I successfully run `trema run './set_forward_entries -m -t packet_in mirror,filter'`
|
51
46
|
Then the output should contain "Updated service name list:"
|
@@ -64,12 +59,7 @@ Feature: C function example command "set_forward_entries"
|
|
64
59
|
|
65
60
|
@slow_process
|
66
61
|
Scenario Outline: Replace Switch Daemon 0x1's event forwarding entries of packet_in to 'mirror' and 'filter'
|
67
|
-
Given
|
68
|
-
"""
|
69
|
-
vswitch { datapath_id 0x1 }
|
70
|
-
vswitch { datapath_id 0x2 }
|
71
|
-
"""
|
72
|
-
And I successfully run `trema run ../repeater_hub/repeater-hub.rb -c nw_dsl.conf -d`
|
62
|
+
Given I successfully run `trema run ../repeater_hub/repeater-hub.rb -c network.conf -d`
|
73
63
|
And wait until "RepeaterHub" is up
|
74
64
|
When I successfully run `trema run './set_forward_entries -s 0x1 -t packet_in mirror,filter'`
|
75
65
|
Then the output should contain "Updated service name list:"
|
@@ -31,7 +31,7 @@ Feature: Ruby methods for adding switch event forwarding entry
|
|
31
31
|
|
32
32
|
@slow_process
|
33
33
|
Scenario Outline: add_forward_entry_to_all_switches event_type, trema_name
|
34
|
-
Given a file named "
|
34
|
+
Given a file named "network.conf" with:
|
35
35
|
"""
|
36
36
|
vswitch { datapath_id 0x1 }
|
37
37
|
"""
|
@@ -39,24 +39,29 @@ Feature: Ruby methods for adding switch event forwarding entry
|
|
39
39
|
"""ruby
|
40
40
|
class AddEntryToAllTest < Controller
|
41
41
|
include SwitchEvent
|
42
|
+
|
43
|
+
def start
|
44
|
+
@event_type = ARGV[0].delete(":").to_sym
|
45
|
+
@event_type_string = ":#{@event_type.to_s}"
|
46
|
+
end
|
42
47
|
|
43
48
|
def switch_ready datapath_id
|
44
|
-
add_forward_entry_to_all_switches
|
49
|
+
add_forward_entry_to_all_switches @event_type, "new_controller" do | success |
|
45
50
|
raise "Failed to add forwarding entry to all switches" if not success
|
46
|
-
info "Successfully added a forwarding entry of
|
47
|
-
dump_forward_entries_from_switch datapath_id,
|
51
|
+
info "Successfully added a forwarding entry of #{@event_type_string}."
|
52
|
+
dump_forward_entries_from_switch datapath_id, @event_type do | success, services |
|
48
53
|
raise "Failed to dump forwarding entry from a switch" if not success
|
49
|
-
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of
|
54
|
+
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of #{@event_type_string} : #{services.inspect}"
|
50
55
|
end
|
51
|
-
dump_forward_entries_from_switch_manager
|
56
|
+
dump_forward_entries_from_switch_manager @event_type do | success, services |
|
52
57
|
raise "Failed to dump forwarding entry from the switch manager" if not success
|
53
|
-
info "Dumping switch manager's forwarding entries of
|
58
|
+
info "Dumping switch manager's forwarding entries of #{@event_type_string} : #{services.inspect}"
|
54
59
|
end
|
55
60
|
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
"""
|
59
|
-
When I successfully run `trema run ./AddEntryToAllTest.rb -c
|
64
|
+
When I successfully run `trema run "./AddEntryToAllTest.rb <event_type>" -c network.conf -d`
|
60
65
|
And wait until "AddEntryToAllTest" is up
|
61
66
|
And *** sleep 2 ***
|
62
67
|
Then the file "../../tmp/log/AddEntryToAllTest.log" should contain:
|
@@ -73,15 +78,15 @@ Feature: Ruby methods for adding switch event forwarding entry
|
|
73
78
|
"""
|
74
79
|
|
75
80
|
Examples:
|
76
|
-
| event_type | switch_manager_event_list | switch_event_list
|
77
|
-
| :vendor | "
|
78
|
-
| :packet_in | "
|
79
|
-
| :port_status | "
|
80
|
-
| :state_notify | "
|
81
|
+
| event_type | switch_manager_event_list | switch_event_list |
|
82
|
+
| :vendor | "AddEntryToAllTest", "new_controller" | "AddEntryToAllTest", "new_controller" |
|
83
|
+
| :packet_in | "AddEntryToAllTest", "new_controller" | "AddEntryToAllTest", "new_controller" |
|
84
|
+
| :port_status | "AddEntryToAllTest", "new_controller" | "AddEntryToAllTest", "new_controller" |
|
85
|
+
| :state_notify | "AddEntryToAllTest", "new_controller" | "AddEntryToAllTest", "new_controller" |
|
81
86
|
|
82
87
|
@slow_process
|
83
88
|
Scenario Outline: add_forward_entry_to_switch dpid, event_type, trema_name
|
84
|
-
Given a file named "
|
89
|
+
Given a file named "network.conf" with:
|
85
90
|
"""
|
86
91
|
vswitch { datapath_id 0x1 }
|
87
92
|
"""
|
@@ -90,15 +95,20 @@ Feature: Ruby methods for adding switch event forwarding entry
|
|
90
95
|
class AddEntryToSwitchDaemonTest < Controller
|
91
96
|
include SwitchEvent
|
92
97
|
|
98
|
+
def start
|
99
|
+
@event_type = ARGV[0].delete(":").to_sym
|
100
|
+
@event_type_string = ":#{@event_type.to_s}"
|
101
|
+
end
|
102
|
+
|
93
103
|
def switch_ready datapath_id
|
94
|
-
add_forward_entry_to_switch datapath_id,
|
104
|
+
add_forward_entry_to_switch datapath_id, @event_type, "new_controller" do | success, services |
|
95
105
|
raise "Failed to add forwarding entry to switch" if not success
|
96
|
-
info "Successfully added a forwarding entry of
|
106
|
+
info "Successfully added a forwarding entry of #{@event_type_string} to switch #{datapath_id.to_hex} : #{services.inspect}"
|
97
107
|
end
|
98
108
|
end
|
99
109
|
end
|
100
110
|
"""
|
101
|
-
When I successfully run `trema run ./AddEntryToSwitchDaemonTest.rb -c
|
111
|
+
When I successfully run `trema run "./AddEntryToSwitchDaemonTest.rb <event_type>" -c network.conf -d`
|
102
112
|
And wait until "AddEntryToSwitchDaemonTest" is up
|
103
113
|
And *** sleep 1 ***
|
104
114
|
Then the file "../../tmp/log/AddEntryToSwitchDaemonTest.log" should contain:
|
@@ -107,11 +117,11 @@ Feature: Ruby methods for adding switch event forwarding entry
|
|
107
117
|
"""
|
108
118
|
|
109
119
|
Examples:
|
110
|
-
| event_type | switch_event_list
|
111
|
-
| :vendor | "
|
112
|
-
| :packet_in | "
|
113
|
-
| :port_status | "
|
114
|
-
| :state_notify | "
|
120
|
+
| event_type | switch_event_list |
|
121
|
+
| :vendor | "AddEntryToSwitchDaemonTest", "new_controller" |
|
122
|
+
| :packet_in | "AddEntryToSwitchDaemonTest", "new_controller" |
|
123
|
+
| :port_status | "AddEntryToSwitchDaemonTest", "new_controller" |
|
124
|
+
| :state_notify | "AddEntryToSwitchDaemonTest", "new_controller" |
|
115
125
|
|
116
126
|
@slow_process
|
117
127
|
Scenario Outline: add_forward_entry_to_switch_manager event_type, trema_name
|
@@ -120,16 +130,21 @@ Feature: Ruby methods for adding switch event forwarding entry
|
|
120
130
|
class AddEntryToSwitchManagerTest < Controller
|
121
131
|
include SwitchEvent
|
122
132
|
|
133
|
+
def start
|
134
|
+
@event_type = ARGV[0].delete(":").to_sym
|
135
|
+
@event_type_string = ":#{@event_type.to_s}"
|
136
|
+
end
|
137
|
+
|
123
138
|
oneshot_timer_event :test_start, 0
|
124
139
|
def test_start
|
125
|
-
add_forward_entry_to_switch_manager
|
140
|
+
add_forward_entry_to_switch_manager @event_type, "new_controller" do | success, services |
|
126
141
|
raise "Failed to add forwarding entry to switch manager" if not success
|
127
|
-
info "Successfully added a forwarding entry of
|
142
|
+
info "Successfully added a forwarding entry of #{@event_type_string} to switch manager : #{services.inspect}"
|
128
143
|
end
|
129
144
|
end
|
130
145
|
end
|
131
146
|
"""
|
132
|
-
When I successfully run `trema run ./AddEntryToSwitchManagerTest.rb -d`
|
147
|
+
When I successfully run `trema run "./AddEntryToSwitchManagerTest.rb <event_type>" -d`
|
133
148
|
And wait until "AddEntryToSwitchManagerTest" is up
|
134
149
|
And *** sleep 1 ***
|
135
150
|
Then the file "../../tmp/log/AddEntryToSwitchManagerTest.log" should contain:
|
@@ -139,7 +154,7 @@ Feature: Ruby methods for adding switch event forwarding entry
|
|
139
154
|
|
140
155
|
Examples:
|
141
156
|
| event_type | switch_manager_event_list |
|
142
|
-
| :vendor | "
|
143
|
-
| :packet_in | "
|
144
|
-
| :port_status | "
|
145
|
-
| :state_notify | "
|
157
|
+
| :vendor | "AddEntryToSwitchManagerTest", "new_controller" |
|
158
|
+
| :packet_in | "AddEntryToSwitchManagerTest", "new_controller" |
|
159
|
+
| :port_status | "AddEntryToSwitchManagerTest", "new_controller" |
|
160
|
+
| :state_notify | "AddEntryToSwitchManagerTest", "new_controller" |
|
@@ -31,7 +31,7 @@ Feature: Ruby methods for deleting switch event forwarding entry
|
|
31
31
|
|
32
32
|
@slow_process
|
33
33
|
Scenario Outline: delete_forward_entry_from_all_switches event_type, trema_name
|
34
|
-
Given a file named "
|
34
|
+
Given a file named "network.conf" with:
|
35
35
|
"""
|
36
36
|
vswitch { datapath_id 0x1 }
|
37
37
|
"""
|
@@ -40,23 +40,28 @@ Feature: Ruby methods for deleting switch event forwarding entry
|
|
40
40
|
class DeleteEntryFromAllTest < Controller
|
41
41
|
include SwitchEvent
|
42
42
|
|
43
|
+
def start
|
44
|
+
@event_type = ARGV[0].delete(":").to_sym
|
45
|
+
@event_type_string = ":#{@event_type.to_s}"
|
46
|
+
end
|
47
|
+
|
43
48
|
def switch_ready datapath_id
|
44
|
-
delete_forward_entry_from_all_switches
|
49
|
+
delete_forward_entry_from_all_switches @event_type, "DeleteEntryFromAllTest" do | success |
|
45
50
|
raise "Failed to delete forwarding entry from all switches" if not success
|
46
|
-
info "Successfully deleted a forwarding entry of
|
47
|
-
dump_forward_entries_from_switch datapath_id,
|
51
|
+
info "Successfully deleted a forwarding entry of #{@event_type_string}."
|
52
|
+
dump_forward_entries_from_switch datapath_id, @event_type do | success, services |
|
48
53
|
raise "Failed to dump forwarding entry from a switch" if not success
|
49
54
|
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of <event_type> : #{services.inspect}"
|
50
55
|
end
|
51
|
-
dump_forward_entries_from_switch_manager
|
56
|
+
dump_forward_entries_from_switch_manager @event_type do | success, services |
|
52
57
|
raise "Failed to dump forwarding entry from the switch manager" if not success
|
53
|
-
info "Dumping switch manager's forwarding entries of
|
58
|
+
info "Dumping switch manager's forwarding entries of #{@event_type_string} : #{services.inspect}"
|
54
59
|
end
|
55
60
|
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
"""
|
59
|
-
When I successfully run `trema run ./DeleteEntryFromAllTest.rb -c
|
64
|
+
When I successfully run `trema run "./DeleteEntryFromAllTest.rb <event_type>" -c network.conf -d`
|
60
65
|
And wait until "DeleteEntryFromAllTest" is up
|
61
66
|
And *** sleep 2 ***
|
62
67
|
Then the file "../../tmp/log/DeleteEntryFromAllTest.log" should contain:
|
@@ -77,11 +82,11 @@ Feature: Ruby methods for deleting switch event forwarding entry
|
|
77
82
|
| :vendor | | |
|
78
83
|
| :packet_in | | |
|
79
84
|
| :port_status | | |
|
80
|
-
| :state_notify | |
|
85
|
+
| :state_notify | | |
|
81
86
|
|
82
87
|
@slow_process
|
83
88
|
Scenario Outline: delete_forward_entry_from_switch dpid, event_type, trema_name
|
84
|
-
Given a file named "
|
89
|
+
Given a file named "network.conf" with:
|
85
90
|
"""
|
86
91
|
vswitch { datapath_id 0x1 }
|
87
92
|
"""
|
@@ -90,15 +95,20 @@ Feature: Ruby methods for deleting switch event forwarding entry
|
|
90
95
|
class DeleteFromSwitchDaemonTest < Controller
|
91
96
|
include SwitchEvent
|
92
97
|
|
98
|
+
def start
|
99
|
+
@event_type = ARGV[0].delete(":").to_sym
|
100
|
+
@event_type_string = ":#{@event_type.to_s}"
|
101
|
+
end
|
102
|
+
|
93
103
|
def switch_ready datapath_id
|
94
|
-
delete_forward_entry_from_switch datapath_id,
|
104
|
+
delete_forward_entry_from_switch datapath_id, @event_type, "DeleteFromSwitchDaemonTest" do | success, services |
|
95
105
|
raise "Failed to delete forwarding entry from switch" if not success
|
96
|
-
info "Successfully deleted a forwarding entry of
|
106
|
+
info "Successfully deleted a forwarding entry of #{@event_type_string} from switch #{datapath_id.to_hex} : #{services.inspect}"
|
97
107
|
end
|
98
108
|
end
|
99
109
|
end
|
100
110
|
"""
|
101
|
-
When I successfully run `trema run ./DeleteFromSwitchDaemonTest.rb -c
|
111
|
+
When I successfully run `trema run "./DeleteFromSwitchDaemonTest.rb <event_type>" -c network.conf -d`
|
102
112
|
And wait until "DeleteFromSwitchDaemonTest" is up
|
103
113
|
And *** sleep 1 ***
|
104
114
|
Then the file "../../tmp/log/DeleteFromSwitchDaemonTest.log" should contain:
|
@@ -111,7 +121,7 @@ Feature: Ruby methods for deleting switch event forwarding entry
|
|
111
121
|
| :vendor | |
|
112
122
|
| :packet_in | |
|
113
123
|
| :port_status | |
|
114
|
-
| :state_notify |
|
124
|
+
| :state_notify | |
|
115
125
|
|
116
126
|
@slow_process
|
117
127
|
Scenario Outline: delete_forward_entry_from_switch_manager event_type, trema_name
|
@@ -120,16 +130,21 @@ Feature: Ruby methods for deleting switch event forwarding entry
|
|
120
130
|
class DeleteFromSwitchManagerTest < Controller
|
121
131
|
include SwitchEvent
|
122
132
|
|
133
|
+
def start
|
134
|
+
@event_type = ARGV[0].delete(":").to_sym
|
135
|
+
@event_type_string = ":#{@event_type.to_s}"
|
136
|
+
end
|
137
|
+
|
123
138
|
oneshot_timer_event :test_start, 0
|
124
139
|
def test_start
|
125
|
-
delete_forward_entry_from_switch_manager
|
140
|
+
delete_forward_entry_from_switch_manager @event_type, "DeleteFromSwitchManagerTest" do | success, services |
|
126
141
|
raise "Failed to delete forwarding entry from switch manager" if not success
|
127
|
-
info "Successfully deleted a forwarding entry of
|
142
|
+
info "Successfully deleted a forwarding entry of #{@event_type_string} from switch manager : #{services.inspect}"
|
128
143
|
end
|
129
144
|
end
|
130
145
|
end
|
131
146
|
"""
|
132
|
-
When I successfully run `trema run ./DeleteFromSwitchManagerTest.rb -d`
|
147
|
+
When I successfully run `trema run "./DeleteFromSwitchManagerTest.rb <event_type>" -d`
|
133
148
|
And wait until "DeleteFromSwitchManagerTest" is up
|
134
149
|
And *** sleep 1 ***
|
135
150
|
Then the file "../../tmp/log/DeleteFromSwitchManagerTest.log" should contain:
|
@@ -24,7 +24,7 @@ Feature: Ruby methods for dumping switch event forwarding entry
|
|
24
24
|
|
25
25
|
@slow_process
|
26
26
|
Scenario Outline: dump_forward_entries_from_switch dpid, event_type
|
27
|
-
Given a file named "
|
27
|
+
Given a file named "network.conf" with:
|
28
28
|
"""
|
29
29
|
vswitch { datapath_id 0x1 }
|
30
30
|
event :vendor => "vendor", :packet_in => "packet_in", :port_status => "port_status"
|
@@ -34,15 +34,20 @@ Feature: Ruby methods for dumping switch event forwarding entry
|
|
34
34
|
class DumpSwitchDaemonTest < Controller
|
35
35
|
include SwitchEvent
|
36
36
|
|
37
|
+
def start
|
38
|
+
@event_type = ARGV[0].delete(":").to_sym
|
39
|
+
@event_type_string = ":#{@event_type.to_s}"
|
40
|
+
end
|
41
|
+
|
37
42
|
def switch_ready datapath_id
|
38
|
-
dump_forward_entries_from_switch datapath_id,
|
43
|
+
dump_forward_entries_from_switch datapath_id, @event_type do | success, services |
|
39
44
|
raise "Failed to dump forwarding entry from a switch" if not success
|
40
|
-
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of
|
45
|
+
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of #{@event_type_string} : #{services.inspect}"
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
44
49
|
"""
|
45
|
-
When I successfully run `trema run ./DumpSwitchDaemonTest.rb -c
|
50
|
+
When I successfully run `trema run "./DumpSwitchDaemonTest.rb <event_type>" -c network.conf -d`
|
46
51
|
And wait until "DumpSwitchDaemonTest" is up
|
47
52
|
And *** sleep 1 ***
|
48
53
|
Then the file "../../tmp/log/DumpSwitchDaemonTest.log" should contain:
|
@@ -51,15 +56,15 @@ Feature: Ruby methods for dumping switch event forwarding entry
|
|
51
56
|
"""
|
52
57
|
|
53
58
|
Examples:
|
54
|
-
| event_type | switch_event_list
|
55
|
-
| :vendor | "vendor"
|
56
|
-
| :packet_in | "packet_in"
|
57
|
-
| :port_status | "port_status"
|
58
|
-
| :state_notify | "DumpSwitchDaemonTest"
|
59
|
+
| event_type | switch_event_list |
|
60
|
+
| :vendor | "vendor" |
|
61
|
+
| :packet_in | "packet_in" |
|
62
|
+
| :port_status | "port_status" |
|
63
|
+
| :state_notify | "DumpSwitchDaemonTest" |
|
59
64
|
|
60
65
|
@slow_process
|
61
66
|
Scenario Outline: dump_forward_entries_from_switch_manager event_type
|
62
|
-
Given a file named "
|
67
|
+
Given a file named "network.conf" with:
|
63
68
|
"""
|
64
69
|
event :vendor => "vendor", :packet_in => "packet_in", :port_status => "port_status", :state_notify => "state_notify"
|
65
70
|
"""
|
@@ -68,16 +73,21 @@ Feature: Ruby methods for dumping switch event forwarding entry
|
|
68
73
|
class DumpSwitchManagerTest < Controller
|
69
74
|
include SwitchEvent
|
70
75
|
|
76
|
+
def start
|
77
|
+
@event_type = ARGV[0].delete(":").to_sym
|
78
|
+
@event_type_string = ":#{@event_type.to_s}"
|
79
|
+
end
|
80
|
+
|
71
81
|
oneshot_timer_event :test_start, 0
|
72
82
|
def test_start
|
73
|
-
dump_forward_entries_from_switch_manager
|
83
|
+
dump_forward_entries_from_switch_manager @event_type do | success, services |
|
74
84
|
raise "Failed to dump forwarding entry from the switch manager" if not success
|
75
|
-
info "Dumping switch manager's forwarding entries of
|
85
|
+
info "Dumping switch manager's forwarding entries of #{@event_type_string} : #{services.inspect}"
|
76
86
|
end
|
77
87
|
end
|
78
88
|
end
|
79
89
|
"""
|
80
|
-
When I successfully run `trema run ./DumpSwitchManagerTest.rb -c
|
90
|
+
When I successfully run `trema run "./DumpSwitchManagerTest.rb <event_type>" -c network.conf -d`
|
81
91
|
And wait until "DumpSwitchManagerTest" is up
|
82
92
|
And *** sleep 1 ***
|
83
93
|
Then the file "../../tmp/log/DumpSwitchManagerTest.log" should contain:
|