trema 0.3.16 → 0.3.17
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 +5 -5
- data/.gitignore +1 -0
- data/.rvmrc +52 -0
- data/.travis.yml +3 -0
- data/Gemfile +1 -1
- data/Rakefile +259 -1
- data/Rantfile +79 -216
- data/features/.nav +12 -0
- data/features/dsl/switch_port_specifier.feature +15 -0
- data/features/examples/switch-event/C-add_forward_entry.feature +130 -0
- data/features/examples/switch-event/C-delete_forward_entry.feature +97 -0
- data/features/examples/switch-event/C-dump_forward_entries.feature +80 -0
- data/features/examples/switch-event/C-set_forward_entries.feature +85 -0
- data/features/examples/switch-event/README.md +40 -0
- data/features/examples/switch-event/add_forward_entry.feature +142 -0
- data/features/examples/switch-event/delete_forward_entry.feature +142 -0
- data/features/examples/switch-event/dump_forward_entries.feature +91 -0
- data/features/examples/switch-event/set_forward_entries.feature +90 -0
- data/features/support/hooks.rb +1 -0
- data/ruby/rake/c/dependency.rb +42 -0
- data/ruby/rake/c/library-task.rb +142 -0
- data/ruby/rake/c/shared-library-task.rb +38 -0
- data/ruby/rake/c/static-library-task.rb +32 -0
- data/ruby/trema/path.rb +1 -0
- data/ruby/trema/switch-event.c +647 -0
- data/{src/switch_manager/management_interface.h → ruby/trema/switch-event.h} +7 -21
- data/ruby/trema/trema.c +2 -0
- data/ruby/trema/version.rb +1 -1
- data/spec/spec_helper.rb +26 -2
- data/src/examples/switch_event_config/.gitignore +7 -0
- data/src/examples/switch_event_config/add_forward_entry.c +227 -0
- data/src/examples/switch_event_config/delete_forward_entry.c +226 -0
- data/src/examples/switch_event_config/dump_forward_entries.c +190 -0
- data/src/examples/switch_event_config/set_forward_entries.c +210 -0
- data/src/lib/event_forward_interface.c +783 -0
- data/src/lib/event_forward_interface.h +138 -0
- data/src/lib/trema.h +1 -0
- data/src/lib/utility.c +13 -1
- data/src/lib/utility.h +3 -0
- data/src/switch_manager/event_forward_entry_manipulation.c +120 -0
- data/src/switch_manager/event_forward_entry_manipulation.h +31 -0
- data/src/switch_manager/secure_channel_listener.c +23 -3
- data/src/switch_manager/switch.c +99 -29
- data/src/switch_manager/switch_manager.c +176 -3
- data/src/switch_manager/switch_manager.h +4 -0
- data/src/switch_manager/switch_option.c +30 -0
- data/src/switch_manager/switch_option.h +41 -0
- data/trema.gemspec +2 -1
- data/unittests/lib/event_forward_interface_test.c +1646 -0
- data/unittests/lib/utility_test.c +23 -1
- metadata +48 -10
@@ -0,0 +1,142 @@
|
|
1
|
+
Feature: Ruby methods for adding switch event forwarding entry
|
2
|
+
|
3
|
+
There are three Ruby methods provided for adding switch event forwarding entries:
|
4
|
+
|
5
|
+
* add_forward_entry_to_all_switches
|
6
|
+
* add_forward_entry_to_switch
|
7
|
+
* add_forward_entry_to_switch_manager
|
8
|
+
|
9
|
+
These methods can be used by including the Trema::SwitchEvent module
|
10
|
+
in user controller code.
|
11
|
+
|
12
|
+
* ** add_forward_entry_to_all_switches event_type, trema_name **
|
13
|
+
|
14
|
+
This method will add `trema_name` to all existing switches and switch manager's
|
15
|
+
event forwarding entry list of the specified `event_type`.
|
16
|
+
|
17
|
+
* ** add_forward_entry_to_switch dpid, event_type, trema_name **
|
18
|
+
|
19
|
+
This method will add an entry to a switch specified by `dpid`.
|
20
|
+
It will add `trema_name` to the switch's
|
21
|
+
event forwarding entry list of the specified `event_type`.
|
22
|
+
|
23
|
+
* ** add_forward_entry_to_switch_manager event_type, trema_name **
|
24
|
+
|
25
|
+
This method will add `trema_name` to the switch manager's
|
26
|
+
event forwarding entry list of the specified `event_type`.
|
27
|
+
|
28
|
+
----
|
29
|
+
All the above methods take a result handler as Ruby block, but
|
30
|
+
can be omitted if checking is not necessary.
|
31
|
+
|
32
|
+
Scenario Outline: add_forward_entry_to_all_switches event_type, trema_name
|
33
|
+
Given a file named "nw_dsl.conf" with:
|
34
|
+
"""
|
35
|
+
vswitch { datapath_id 0x1 }
|
36
|
+
"""
|
37
|
+
And a file named "AddEntryToAllTest.rb" with:
|
38
|
+
"""
|
39
|
+
class AddEntryToAllTest < Controller
|
40
|
+
include SwitchEvent
|
41
|
+
|
42
|
+
def switch_ready datapath_id
|
43
|
+
add_forward_entry_to_all_switches <event_type>, "new_controller" do | success |
|
44
|
+
raise "Failed to add forwarding entry to all switches" if not success
|
45
|
+
info "Successfully added a forwarding entry of <event_type>."
|
46
|
+
dump_forward_entries_from_switch datapath_id, <event_type> do | success, services |
|
47
|
+
raise "Failed to dump forwarding entry from a switch" if not success
|
48
|
+
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of <event_type> : #{services.inspect}"
|
49
|
+
end
|
50
|
+
dump_forward_entries_from_switch_manager <event_type> do | success, services |
|
51
|
+
raise "Failed to dump forwarding entry from the switch manager" if not success
|
52
|
+
info "Dumping switch manager's forwarding entries of <event_type> : #{services.inspect}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
"""
|
58
|
+
When I successfully run `trema run ./AddEntryToAllTest.rb -c nw_dsl.conf -d`
|
59
|
+
And wait until "AddEntryToAllTest" is up
|
60
|
+
And *** sleep 1 ***
|
61
|
+
Then the file "../../tmp/log/AddEntryToAllTest.log" should contain:
|
62
|
+
"""
|
63
|
+
Successfully added a forwarding entry of <event_type>.
|
64
|
+
"""
|
65
|
+
And the file "../../tmp/log/AddEntryToAllTest.log" should contain:
|
66
|
+
"""
|
67
|
+
Dumping switch manager's forwarding entries of <event_type> : [<switch_manager_event_list>]
|
68
|
+
"""
|
69
|
+
And the file "../../tmp/log/AddEntryToAllTest.log" should contain:
|
70
|
+
"""
|
71
|
+
Dumping switch 0x1's forwarding entries of <event_type> : [<switch_event_list>]
|
72
|
+
"""
|
73
|
+
|
74
|
+
Examples:
|
75
|
+
| event_type | switch_manager_event_list | switch_event_list |
|
76
|
+
| :vendor | "new_controller", "AddEntryToAllTest" | "new_controller", "AddEntryToAllTest" |
|
77
|
+
| :packet_in | "new_controller", "AddEntryToAllTest" | "new_controller", "AddEntryToAllTest" |
|
78
|
+
| :port_status | "new_controller", "AddEntryToAllTest" | "new_controller", "AddEntryToAllTest" |
|
79
|
+
| :state_notify | "new_controller", "AddEntryToAllTest" | "new_controller", "AddEntryToAllTest", "switch_manager" |
|
80
|
+
|
81
|
+
Scenario Outline: add_forward_entry_to_switch dpid, event_type, trema_name
|
82
|
+
Given a file named "nw_dsl.conf" with:
|
83
|
+
"""
|
84
|
+
vswitch { datapath_id 0x1 }
|
85
|
+
"""
|
86
|
+
And a file named "AddEntryToSwitchDaemonTest.rb" with:
|
87
|
+
"""
|
88
|
+
class AddEntryToSwitchDaemonTest < Controller
|
89
|
+
include SwitchEvent
|
90
|
+
|
91
|
+
def switch_ready datapath_id
|
92
|
+
add_forward_entry_to_switch datapath_id, <event_type>, "new_controller" do | success, services |
|
93
|
+
raise "Failed to add forwarding entry to switch" if not success
|
94
|
+
info "Successfully added a forwarding entry of <event_type> to switch #{datapath_id.to_hex} : #{services.inspect}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
"""
|
99
|
+
When I successfully run `trema run ./AddEntryToSwitchDaemonTest.rb -c nw_dsl.conf -d`
|
100
|
+
And wait until "AddEntryToSwitchDaemonTest" is up
|
101
|
+
And *** sleep 1 ***
|
102
|
+
Then the file "../../tmp/log/AddEntryToSwitchDaemonTest.log" should contain:
|
103
|
+
"""
|
104
|
+
Successfully added a forwarding entry of <event_type> to switch 0x1 : [<switch_event_list>]
|
105
|
+
"""
|
106
|
+
|
107
|
+
Examples:
|
108
|
+
| event_type | switch_event_list |
|
109
|
+
| :vendor | "new_controller", "AddEntryToSwitchDaemonTest" |
|
110
|
+
| :packet_in | "new_controller", "AddEntryToSwitchDaemonTest" |
|
111
|
+
| :port_status | "new_controller", "AddEntryToSwitchDaemonTest" |
|
112
|
+
| :state_notify | "new_controller", "AddEntryToSwitchDaemonTest", "switch_manager" |
|
113
|
+
|
114
|
+
Scenario Outline: add_forward_entry_to_switch_manager event_type, trema_name
|
115
|
+
Given a file named "AddEntryToSwitchManagerTest.rb" with:
|
116
|
+
"""
|
117
|
+
class AddEntryToSwitchManagerTest < Controller
|
118
|
+
include SwitchEvent
|
119
|
+
|
120
|
+
oneshot_timer_event :test_start, 0
|
121
|
+
def test_start
|
122
|
+
add_forward_entry_to_switch_manager <event_type>, "new_controller" do | success, services |
|
123
|
+
raise "Failed to add forwarding entry to switch manager" if not success
|
124
|
+
info "Successfully added a forwarding entry of <event_type> to switch manager : #{services.inspect}"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
"""
|
129
|
+
When I successfully run `trema run ./AddEntryToSwitchManagerTest.rb -d`
|
130
|
+
And wait until "AddEntryToSwitchManagerTest" is up
|
131
|
+
And *** sleep 1 ***
|
132
|
+
Then the file "../../tmp/log/AddEntryToSwitchManagerTest.log" should contain:
|
133
|
+
"""
|
134
|
+
Successfully added a forwarding entry of <event_type> to switch manager : [<switch_manager_event_list>]
|
135
|
+
"""
|
136
|
+
|
137
|
+
Examples:
|
138
|
+
| event_type | switch_manager_event_list |
|
139
|
+
| :vendor | "new_controller", "AddEntryToSwitchManagerTest" |
|
140
|
+
| :packet_in | "new_controller", "AddEntryToSwitchManagerTest" |
|
141
|
+
| :port_status | "new_controller", "AddEntryToSwitchManagerTest" |
|
142
|
+
| :state_notify | "new_controller", "AddEntryToSwitchManagerTest" |
|
@@ -0,0 +1,142 @@
|
|
1
|
+
Feature: Ruby methods for deleting switch event forwarding entry
|
2
|
+
|
3
|
+
There are three Ruby methods provided for deleting switch event forwarding entries.
|
4
|
+
|
5
|
+
* delete_forward_entry_from_all_switches
|
6
|
+
* delete_forward_entry_from_switch
|
7
|
+
* delete_forward_entry_from_switch_manager
|
8
|
+
|
9
|
+
These methods can be used by including the Trema::SwitchEvent module
|
10
|
+
in user controller code.
|
11
|
+
|
12
|
+
* ** delete_forward_entry_from_all_switches event_type, trema_name **
|
13
|
+
|
14
|
+
This method will delete `trema_name` from all existing switches and switch manager's
|
15
|
+
event forwarding entry list of the specified `event_type`.
|
16
|
+
|
17
|
+
* ** delete_forward_entry_from_switch dpid, event_type, trema_name **
|
18
|
+
|
19
|
+
This method will delete an entry from switch specified by `dpid`.
|
20
|
+
It will delete `trema_name` from the switch's
|
21
|
+
event forwarding entry list of the specified `event_type`.
|
22
|
+
|
23
|
+
* ** delete_forward_entry_from_switch_manager event_type, trema_name **
|
24
|
+
|
25
|
+
This method will delete `trema_name` from the switch manager's
|
26
|
+
event forwarding entry list of the specified `event_type`.
|
27
|
+
|
28
|
+
----
|
29
|
+
All the above methods take a result handler as Ruby block, but
|
30
|
+
they can be omitted if checking is not necessary.
|
31
|
+
|
32
|
+
Scenario Outline: delete_forward_entry_from_all_switches event_type, trema_name
|
33
|
+
Given a file named "nw_dsl.conf" with:
|
34
|
+
"""
|
35
|
+
vswitch { datapath_id 0x1 }
|
36
|
+
"""
|
37
|
+
And a file named "DeleteEntryFromAllTest.rb" with:
|
38
|
+
"""
|
39
|
+
class DeleteEntryFromAllTest < Controller
|
40
|
+
include SwitchEvent
|
41
|
+
|
42
|
+
def switch_ready datapath_id
|
43
|
+
delete_forward_entry_from_all_switches <event_type>, "DeleteEntryFromAllTest" do | success |
|
44
|
+
raise "Failed to delete forwarding entry from all switches" if not success
|
45
|
+
info "Successfully deleted a forwarding entry of <event_type>."
|
46
|
+
dump_forward_entries_from_switch datapath_id, <event_type> do | success, services |
|
47
|
+
raise "Failed to dump forwarding entry from a switch" if not success
|
48
|
+
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of <event_type> : #{services.inspect}"
|
49
|
+
end
|
50
|
+
dump_forward_entries_from_switch_manager <event_type> do | success, services |
|
51
|
+
raise "Failed to dump forwarding entry from the switch manager" if not success
|
52
|
+
info "Dumping switch manager's forwarding entries of <event_type> : #{services.inspect}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
"""
|
58
|
+
When I successfully run `trema run ./DeleteEntryFromAllTest.rb -c nw_dsl.conf -d`
|
59
|
+
And wait until "DeleteEntryFromAllTest" is up
|
60
|
+
And *** sleep 1 ***
|
61
|
+
Then the file "../../tmp/log/DeleteEntryFromAllTest.log" should contain:
|
62
|
+
"""
|
63
|
+
Successfully deleted a forwarding entry of <event_type>.
|
64
|
+
"""
|
65
|
+
And the file "../../tmp/log/DeleteEntryFromAllTest.log" should contain:
|
66
|
+
"""
|
67
|
+
Dumping switch 0x1's forwarding entries of <event_type> : [<switch_event_list>]
|
68
|
+
"""
|
69
|
+
And the file "../../tmp/log/DeleteEntryFromAllTest.log" should contain:
|
70
|
+
"""
|
71
|
+
Dumping switch manager's forwarding entries of <event_type> : [<switch_manager_event_list>]
|
72
|
+
"""
|
73
|
+
|
74
|
+
Examples:
|
75
|
+
| event_type | switch_manager_event_list | switch_event_list |
|
76
|
+
| :vendor | | |
|
77
|
+
| :packet_in | | |
|
78
|
+
| :port_status | | |
|
79
|
+
| :state_notify | | "switch_manager" |
|
80
|
+
|
81
|
+
Scenario Outline: delete_forward_entry_from_switch dpid, event_type, trema_name
|
82
|
+
Given a file named "nw_dsl.conf" with:
|
83
|
+
"""
|
84
|
+
vswitch { datapath_id 0x1 }
|
85
|
+
"""
|
86
|
+
And a file named "DeleteFromSwitchDaemonTest.rb" with:
|
87
|
+
"""
|
88
|
+
class DeleteFromSwitchDaemonTest < Controller
|
89
|
+
include SwitchEvent
|
90
|
+
|
91
|
+
def switch_ready datapath_id
|
92
|
+
delete_forward_entry_from_switch datapath_id, <event_type>, "DeleteFromSwitchDaemonTest" do | success, services |
|
93
|
+
raise "Failed to delete forwarding entry from switch" if not success
|
94
|
+
info "Successfully deleted a forwarding entry of <event_type> from switch #{datapath_id.to_hex} : #{services.inspect}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
"""
|
99
|
+
When I successfully run `trema run ./DeleteFromSwitchDaemonTest.rb -c nw_dsl.conf -d`
|
100
|
+
And wait until "DeleteFromSwitchDaemonTest" is up
|
101
|
+
And *** sleep 1 ***
|
102
|
+
Then the file "../../tmp/log/DeleteFromSwitchDaemonTest.log" should contain:
|
103
|
+
"""
|
104
|
+
Successfully deleted a forwarding entry of <event_type> from switch 0x1 : [<switch_event_list>]
|
105
|
+
"""
|
106
|
+
|
107
|
+
Examples:
|
108
|
+
| event_type | switch_event_list |
|
109
|
+
| :vendor | |
|
110
|
+
| :packet_in | |
|
111
|
+
| :port_status | |
|
112
|
+
| :state_notify | "switch_manager" |
|
113
|
+
|
114
|
+
Scenario Outline: delete_forward_entry_from_switch_manager event_type, trema_name
|
115
|
+
Given a file named "DeleteFromSwitchManagerTest.rb" with:
|
116
|
+
"""
|
117
|
+
class DeleteFromSwitchManagerTest < Controller
|
118
|
+
include SwitchEvent
|
119
|
+
|
120
|
+
oneshot_timer_event :test_start, 0
|
121
|
+
def test_start
|
122
|
+
delete_forward_entry_from_switch_manager <event_type>, "DeleteFromSwitchManagerTest" do | success, services |
|
123
|
+
raise "Failed to delete forwarding entry from switch manager" if not success
|
124
|
+
info "Successfully deleted a forwarding entry of <event_type> from switch manager : #{services.inspect}"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
"""
|
129
|
+
When I successfully run `trema run ./DeleteFromSwitchManagerTest.rb -d`
|
130
|
+
And wait until "DeleteFromSwitchManagerTest" is up
|
131
|
+
And *** sleep 1 ***
|
132
|
+
Then the file "../../tmp/log/DeleteFromSwitchManagerTest.log" should contain:
|
133
|
+
"""
|
134
|
+
Successfully deleted a forwarding entry of <event_type> from switch manager : [<switch_manager_event_list>]
|
135
|
+
"""
|
136
|
+
|
137
|
+
Examples:
|
138
|
+
| event_type | switch_manager_event_list |
|
139
|
+
| :vendor | |
|
140
|
+
| :packet_in | |
|
141
|
+
| :port_status | |
|
142
|
+
| :state_notify | |
|
@@ -0,0 +1,91 @@
|
|
1
|
+
Feature: Ruby methods for dumping switch event forwarding entry
|
2
|
+
|
3
|
+
There are two Ruby methods provided for dumping switch event forwarding entry.
|
4
|
+
|
5
|
+
* dump_forward_entries_from_switch
|
6
|
+
* dump_forward_entries_from_switch_manager
|
7
|
+
|
8
|
+
These methods can be used by including the Trema::SwitchEvent module
|
9
|
+
in user controller code.
|
10
|
+
|
11
|
+
* ** dump_forward_entries_from_switch dpid, event_type **
|
12
|
+
|
13
|
+
This method will dump the forwarding entries of the switch specified by `dpid`.
|
14
|
+
It will dump the content of the the switch's
|
15
|
+
event forwarding entry list of the specified `event_type`.
|
16
|
+
|
17
|
+
* ** dump_forward_entries_from_switch_manager event_type **
|
18
|
+
|
19
|
+
This method will dump the content of the the switch manager's
|
20
|
+
event forwarding entry list of the specified `event_type`.
|
21
|
+
|
22
|
+
----
|
23
|
+
All the above methods take a result handler as Ruby block.
|
24
|
+
|
25
|
+
Scenario Outline: dump_forward_entries_from_switch dpid, event_type
|
26
|
+
Given a file named "nw_dsl.conf" with:
|
27
|
+
"""
|
28
|
+
vswitch { datapath_id 0x1 }
|
29
|
+
event :vendor => "vendor", :packet_in => "packet_in", :port_status => "port_status"
|
30
|
+
"""
|
31
|
+
And a file named "DumpSwitchDaemonTest.rb" with:
|
32
|
+
"""
|
33
|
+
class DumpSwitchDaemonTest < Controller
|
34
|
+
include SwitchEvent
|
35
|
+
|
36
|
+
def switch_ready datapath_id
|
37
|
+
dump_forward_entries_from_switch datapath_id, <event_type> do | success, services |
|
38
|
+
raise "Failed to dump forwarding entry from a switch" if not success
|
39
|
+
info "Dumping switch #{datapath_id.to_hex}'s forwarding entries of <event_type> : #{services.inspect}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
"""
|
44
|
+
When I successfully run `trema run ./DumpSwitchDaemonTest.rb -c nw_dsl.conf -d`
|
45
|
+
And wait until "DumpSwitchDaemonTest" is up
|
46
|
+
And *** sleep 1 ***
|
47
|
+
Then the file "../../tmp/log/DumpSwitchDaemonTest.log" should contain:
|
48
|
+
"""
|
49
|
+
Dumping switch 0x1's forwarding entries of <event_type> : [<switch_event_list>]
|
50
|
+
"""
|
51
|
+
|
52
|
+
Examples:
|
53
|
+
| event_type | switch_event_list |
|
54
|
+
| :vendor | "vendor" |
|
55
|
+
| :packet_in | "packet_in" |
|
56
|
+
| :port_status | "port_status" |
|
57
|
+
| :state_notify | "DumpSwitchDaemonTest", "switch_manager" |
|
58
|
+
|
59
|
+
Scenario Outline: dump_forward_entries_from_switch_manager event_type
|
60
|
+
Given a file named "nw_dsl.conf" with:
|
61
|
+
"""
|
62
|
+
event :vendor => "vendor", :packet_in => "packet_in", :port_status => "port_status", :state_notify => "state_notify"
|
63
|
+
"""
|
64
|
+
And a file named "DumpSwitchManagerTest.rb" with:
|
65
|
+
"""
|
66
|
+
class DumpSwitchManagerTest < Controller
|
67
|
+
include SwitchEvent
|
68
|
+
|
69
|
+
oneshot_timer_event :test_start, 0
|
70
|
+
def test_start
|
71
|
+
dump_forward_entries_from_switch_manager <event_type> do | success, services |
|
72
|
+
raise "Failed to dump forwarding entry from the switch manager" if not success
|
73
|
+
info "Dumping switch manager's forwarding entries of <event_type> : #{services.inspect}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
"""
|
78
|
+
When I successfully run `trema run ./DumpSwitchManagerTest.rb -c nw_dsl.conf -d`
|
79
|
+
And wait until "DumpSwitchManagerTest" is up
|
80
|
+
And *** sleep 1 ***
|
81
|
+
Then the file "../../tmp/log/DumpSwitchManagerTest.log" should contain:
|
82
|
+
"""
|
83
|
+
Dumping switch manager's forwarding entries of <event_type> : [<switch_manager_event_list>]
|
84
|
+
"""
|
85
|
+
|
86
|
+
Examples:
|
87
|
+
| event_type | switch_manager_event_list |
|
88
|
+
| :vendor | "vendor" |
|
89
|
+
| :packet_in | "packet_in" |
|
90
|
+
| :port_status | "port_status" |
|
91
|
+
| :state_notify | "state_notify" |
|
@@ -0,0 +1,90 @@
|
|
1
|
+
Feature: Ruby methods for setting switch event forwarding entry
|
2
|
+
|
3
|
+
There are two Ruby methods provided for setting switch event forwarding entry.
|
4
|
+
|
5
|
+
* set_forward_entries_to_switch
|
6
|
+
* set_forward_entries_to_switch_manager
|
7
|
+
|
8
|
+
These methods can be used by including the Trema::SwitchEvent module
|
9
|
+
in user controller code.
|
10
|
+
|
11
|
+
* ** set_forward_entries_to_switch dpid, event_type, trema_names **
|
12
|
+
|
13
|
+
This method will set the forwarding entries of the switch specified by `dpid`.
|
14
|
+
It will replace the switch's
|
15
|
+
event forwarding entry list of the specified `event_type`
|
16
|
+
to Array of trema-names specified by `trema_names`.
|
17
|
+
|
18
|
+
|
19
|
+
* ** set_forward_entries_to_switch_manager event_type, trema_names **
|
20
|
+
|
21
|
+
This method will replace the switch manager's
|
22
|
+
event forwarding entry list of the specified `event_type`
|
23
|
+
to Array of trema-names specified by `trema_names`.
|
24
|
+
|
25
|
+
----
|
26
|
+
All the above methods take a result handler as Ruby block, but
|
27
|
+
they can be omitted if checking is not necessary.
|
28
|
+
|
29
|
+
Scenario Outline: set_forward_entries_to_switch dpid, event_type, trema_names
|
30
|
+
Given a file named "nw_dsl.conf" with:
|
31
|
+
"""
|
32
|
+
vswitch { datapath_id 0x1 }
|
33
|
+
"""
|
34
|
+
And a file named "SetEntriesToSwitchDaemonTest.rb" with:
|
35
|
+
"""
|
36
|
+
class SetEntriesToSwitchDaemonTest < Controller
|
37
|
+
include SwitchEvent
|
38
|
+
|
39
|
+
def switch_ready datapath_id
|
40
|
+
set_forward_entries_to_switch datapath_id, <event_type>, ["SetEntriesToSwitchDaemonTest","Another"] do | success, services |
|
41
|
+
raise "Failed to set forwarding entry to switch" if not success
|
42
|
+
info "Successfully set a forwarding entries of <event_type> to switch #{datapath_id.to_hex} : #{services.inspect}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
"""
|
47
|
+
When I successfully run `trema run ./SetEntriesToSwitchDaemonTest.rb -c nw_dsl.conf -d`
|
48
|
+
And wait until "SetEntriesToSwitchDaemonTest" is up
|
49
|
+
And *** sleep 1 ***
|
50
|
+
Then the file "../../tmp/log/SetEntriesToSwitchDaemonTest.log" should contain:
|
51
|
+
"""
|
52
|
+
Successfully set a forwarding entries of <event_type> to switch 0x1 : [<switch_event_list>]
|
53
|
+
"""
|
54
|
+
|
55
|
+
Examples:
|
56
|
+
| event_type | switch_event_list |
|
57
|
+
| :vendor | "SetEntriesToSwitchDaemonTest", "Another" |
|
58
|
+
| :packet_in | "SetEntriesToSwitchDaemonTest", "Another" |
|
59
|
+
| :port_status | "SetEntriesToSwitchDaemonTest", "Another" |
|
60
|
+
| :state_notify | "SetEntriesToSwitchDaemonTest", "Another" |
|
61
|
+
|
62
|
+
Scenario Outline: set_forward_entries_to_switch_manager event_type, trema_names
|
63
|
+
Given a file named "SetEntriesToSwitchManagerTest.rb" with:
|
64
|
+
"""
|
65
|
+
class SetEntriesToSwitchManagerTest < Controller
|
66
|
+
include SwitchEvent
|
67
|
+
|
68
|
+
oneshot_timer_event :test_start, 0
|
69
|
+
def test_start
|
70
|
+
set_forward_entries_to_switch_manager <event_type>, ["SetEntriesToSwitchManagerTest","Another"] do | success, services |
|
71
|
+
raise "Failed to set forwarding entry to switch manager" if not success
|
72
|
+
info "Successfully set a forwarding entries of <event_type> to switch manager : #{services.inspect}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
"""
|
77
|
+
When I successfully run `trema run ./SetEntriesToSwitchManagerTest.rb -d`
|
78
|
+
And wait until "SetEntriesToSwitchManagerTest" is up
|
79
|
+
And *** sleep 1 ***
|
80
|
+
Then the file "../../tmp/log/SetEntriesToSwitchManagerTest.log" should contain:
|
81
|
+
"""
|
82
|
+
Successfully set a forwarding entries of <event_type> to switch manager : [<switch_manager_event_list>]
|
83
|
+
"""
|
84
|
+
|
85
|
+
Examples:
|
86
|
+
| event_type | switch_manager_event_list |
|
87
|
+
| :vendor | "SetEntriesToSwitchManagerTest", "Another" |
|
88
|
+
| :packet_in | "SetEntriesToSwitchManagerTest", "Another" |
|
89
|
+
| :port_status | "SetEntriesToSwitchManagerTest", "Another" |
|
90
|
+
| :state_notify | "SetEntriesToSwitchManagerTest", "Another" |
|