trema 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/Rantfile +14 -13
- data/features/example.openflow_message.echo.feature +59 -0
- data/features/{example.message.hello.feature → example.openflow_message.hello.feature} +0 -0
- data/ruby/trema/mac.rb +2 -0
- data/ruby/trema/set-eth-dst-addr.rb +3 -2
- data/ruby/trema/set-eth-src-addr.rb +3 -2
- data/ruby/trema/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/trema/set-eth-dst-addr_spec.rb +6 -0
- data/spec/trema/set-eth-src-addr_spec.rb +6 -0
- data/src/examples/openflow_message/{echo_request.c → echo.c} +12 -2
- data/src/examples/openflow_message/{echo-request.rb → echo.rb} +2 -2
- data/src/examples/openflow_switch/echo_switch.c +89 -0
- data/src/examples/openflow_switch/hello_switch.c +24 -20
- data/src/examples/simple_router/arp-table.rb +92 -0
- data/src/examples/simple_router/interface.rb +99 -0
- data/src/examples/simple_router/router-utils.rb +211 -0
- data/src/examples/simple_router/routing-table.rb +67 -0
- data/src/examples/simple_router/simple-router.rb +180 -0
- data/src/examples/simple_router/simple_router.conf +18 -0
- data/src/examples/simple_router/simple_router_netns.conf +15 -0
- data/src/examples/simple_router/simple_router_network.conf +6 -0
- data/src/tremashark/plugin/packet-trema/packet-trema.c +8 -8
- metadata +17 -11
- data/features/example.message.echo_reply.feature +0 -26
- data/features/example.message.echo_request.feature +0 -25
- data/src/examples/openflow_message/echo-reply.rb +0 -59
- data/src/examples/openflow_message/echo_reply.c +0 -70
@@ -0,0 +1,211 @@
|
|
1
|
+
#
|
2
|
+
# A router implementation in Trema
|
3
|
+
#
|
4
|
+
# Copyright (C) 2012 NEC Corporation
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License, version 2, as
|
8
|
+
# published by the Free Software Foundation.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License along
|
16
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
17
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
18
|
+
#
|
19
|
+
|
20
|
+
|
21
|
+
require 'ipaddr'
|
22
|
+
|
23
|
+
|
24
|
+
def get_checksum csum, val
|
25
|
+
sum = ( ~csum & 0xffff ) + val
|
26
|
+
while sum > 0xffff
|
27
|
+
sum = ( sum & 0xffff ) + ( sum >> 16 )
|
28
|
+
end
|
29
|
+
~sum & 0xffff
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
class IPAddr
|
34
|
+
def to_a
|
35
|
+
self.to_s.split( "." ).collect do | each |
|
36
|
+
each.to_i
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
class EthernetHeader
|
43
|
+
attr_accessor :macda, :macsa, :eth_type
|
44
|
+
|
45
|
+
|
46
|
+
def initialize macda, macsa, eth_type
|
47
|
+
@macda = macda
|
48
|
+
@macsa = macsa
|
49
|
+
@eth_type = eth_type
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def pack
|
54
|
+
( @macda.to_a + @macsa.to_a + [ eth_type ] ).pack( "C12n" )
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
class ARPPacket
|
60
|
+
attr_accessor :type, :tha, :sha, :tpa, :spa
|
61
|
+
|
62
|
+
|
63
|
+
def initialize type, tha, sha, tpa, spa
|
64
|
+
@type = type
|
65
|
+
@tha = tha
|
66
|
+
@sha = sha
|
67
|
+
@tpa = tpa
|
68
|
+
@spa = spa
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
def pack
|
73
|
+
eth_header = EthernetHeader.new( @tha, @sha, 0x0806 )
|
74
|
+
|
75
|
+
# arp
|
76
|
+
arp = [ 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, @type ]
|
77
|
+
arp += @sha.to_a + @spa.to_a + @tha.to_a + @tpa.to_a
|
78
|
+
|
79
|
+
while arp.length < 46 do
|
80
|
+
arp += [ 0x00 ]
|
81
|
+
end
|
82
|
+
|
83
|
+
eth_header.pack + arp.pack( "C*" )
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
class ARPRequest < ARPPacket
|
89
|
+
def initialize sha, tpa, spa
|
90
|
+
tha = [ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]
|
91
|
+
super( 1, tha, sha, tpa, spa )
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
class ARPReply < ARPPacket
|
97
|
+
def initialize tha, sha, tpa, spa
|
98
|
+
super( 2, tha, sha, tpa, spa )
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
class IPPacket
|
104
|
+
attr_accessor :id, :protocol, :daddr, :saddr, :payload
|
105
|
+
|
106
|
+
|
107
|
+
def initialize options
|
108
|
+
@id = options[ :id ]
|
109
|
+
@protocol = options[ :protocol ]
|
110
|
+
@daddr = options[ :daddr ]
|
111
|
+
@saddr = options[ :saddr ]
|
112
|
+
@payload = options[ :payload ]
|
113
|
+
@tot_len = 20 + payload.length
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
def pack
|
118
|
+
csum = get_checksum( 0, 0x4500 )
|
119
|
+
header = [ 0x45, 0x00 ] # Version, IHL, ToS
|
120
|
+
|
121
|
+
csum = get_checksum( csum, @tot_len )
|
122
|
+
header += [ @tot_len >> 8, @tot_len & 0xff ] # len
|
123
|
+
|
124
|
+
csum = get_checksum( csum, @id )
|
125
|
+
header += [ @id >> 8, @id & 0xff ] # ID
|
126
|
+
|
127
|
+
csum = get_checksum( csum, 0x4000 )
|
128
|
+
header += [ 0x40, 0x00 ] # Flags, Frag offset
|
129
|
+
|
130
|
+
csum = get_checksum( csum, 0x40 * 0x100 + @protocol )
|
131
|
+
header += [ 0x40, @protocol ] # ttl, protocol
|
132
|
+
|
133
|
+
csum = get_checksum( csum, @saddr.to_i >> 16 )
|
134
|
+
csum = get_checksum( csum, @saddr.to_i & 0xffff )
|
135
|
+
csum = get_checksum( csum, @daddr.to_i >> 16 )
|
136
|
+
csum = get_checksum( csum, @daddr.to_i & 0xffff )
|
137
|
+
header += [ csum >> 8, csum & 0xff ] # checksum
|
138
|
+
header += @saddr.to_a + @daddr.to_a
|
139
|
+
|
140
|
+
header.pack( "C*" ) + @payload.pack
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
class ICMPPacket
|
146
|
+
attr_reader :payload, :length
|
147
|
+
|
148
|
+
|
149
|
+
def initialize type, code, payload
|
150
|
+
@type = type
|
151
|
+
@code = code
|
152
|
+
@payload = payload
|
153
|
+
@length = 4 + payload.length
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
def pack
|
158
|
+
@checksum = get_checksum( 0, @type * 0x100 + @code )
|
159
|
+
|
160
|
+
words = @payload.pack( "C*" ).unpack( "n*" )
|
161
|
+
words.each do | each |
|
162
|
+
@checksum = get_checksum( @checksum, each )
|
163
|
+
end
|
164
|
+
|
165
|
+
[ @type, @code, @checksum ].pack( "C2n" ) + @payload.pack( "C*" )
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
class ICMPEchoReply < ICMPPacket
|
171
|
+
def initialize payload
|
172
|
+
super( 0x00, 0x00, payload )
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
module RouterUtils
|
178
|
+
def create_arp_request_from interface, addr
|
179
|
+
arp = ARPRequest.new( interface.hwaddr, addr, interface.ipaddr )
|
180
|
+
arp.pack
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
def create_arp_reply_from message, replyaddr
|
185
|
+
arp = ARPReply.new( message.macsa, replyaddr, message.arp_spa, message.arp_tpa )
|
186
|
+
arp.pack
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
def create_icmpv4_reply entry, interface, message
|
191
|
+
offset = 14 + 20 + 4
|
192
|
+
payload = message.data.unpack( "C*" )[ offset .. message.data.length - 1 ]
|
193
|
+
icmp = ICMPEchoReply.new( payload )
|
194
|
+
ip_packet = IPPacket.new( :id => message.ipv4_id,
|
195
|
+
:protocol => message.ipv4_protocol,
|
196
|
+
:ttl => message.ipv4_ttl,
|
197
|
+
:daddr => message.ipv4_saddr,
|
198
|
+
:saddr => message.ipv4_daddr,
|
199
|
+
:payload => icmp )
|
200
|
+
eth_header = EthernetHeader.new( entry.hwaddr, interface.hwaddr, 0x0800 )
|
201
|
+
|
202
|
+
eth_header.pack + ip_packet.pack
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
### Local variables:
|
208
|
+
### mode: Ruby
|
209
|
+
### coding: utf-8
|
210
|
+
### indent-tabs-mode: nil
|
211
|
+
### End:
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#
|
2
|
+
# Routing Table
|
3
|
+
#
|
4
|
+
# Copyright (C) 2012 NEC Corporation
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License, version 2, as
|
8
|
+
# published by the Free Software Foundation.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License along
|
16
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
17
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
18
|
+
#
|
19
|
+
|
20
|
+
|
21
|
+
require "ipaddr"
|
22
|
+
|
23
|
+
|
24
|
+
class RoutingTable
|
25
|
+
ADDR_LEN = 32
|
26
|
+
|
27
|
+
|
28
|
+
def initialize route = []
|
29
|
+
@db = Array.new( ADDR_LEN + 1 ) { Hash.new }
|
30
|
+
route.each do | each |
|
31
|
+
add( each )
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def add options
|
37
|
+
dest = IPAddr.new( options[ :destination ] )
|
38
|
+
masklen = options[ :masklen ]
|
39
|
+
prefix = dest.mask( masklen )
|
40
|
+
@db[ masklen ][ prefix.to_i ] = IPAddr.new( options[ :gateway ] )
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def delete options
|
45
|
+
dest = IPAddr.new( options[ :destination ] )
|
46
|
+
masklen = options[ :masklen ]
|
47
|
+
prefix = dest.mask( masklen )
|
48
|
+
@db[ masklen ].delete( prefix.to_i )
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def lookup dest
|
53
|
+
( 0..ADDR_LEN ).reverse_each do | masklen |
|
54
|
+
prefix = dest.mask( masklen )
|
55
|
+
entry = @db[ masklen ][ prefix.to_i ]
|
56
|
+
return entry if entry
|
57
|
+
end
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
### Local variables:
|
64
|
+
### mode: Ruby
|
65
|
+
### coding: utf-8-unix
|
66
|
+
### indent-tabs-mode: nil
|
67
|
+
### End:
|
@@ -0,0 +1,180 @@
|
|
1
|
+
#
|
2
|
+
# A router implementation in Trema
|
3
|
+
#
|
4
|
+
# Copyright (C) 2012 NEC Corporation
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License, version 2, as
|
8
|
+
# published by the Free Software Foundation.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License along
|
16
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
17
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
18
|
+
#
|
19
|
+
|
20
|
+
require "arp-table"
|
21
|
+
require "interface"
|
22
|
+
require "router-utils"
|
23
|
+
require "routing-table"
|
24
|
+
|
25
|
+
|
26
|
+
class SimpleRouter < Controller
|
27
|
+
include RouterUtils
|
28
|
+
|
29
|
+
|
30
|
+
def start
|
31
|
+
load "simple_router.conf"
|
32
|
+
@interfaces = Interfaces.new( $interface )
|
33
|
+
@arp_table = ARPTable.new
|
34
|
+
@routing_table = RoutingTable.new( $route )
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def packet_in( dpid, message )
|
39
|
+
return if not to_me?( message )
|
40
|
+
|
41
|
+
if message.arp_request?
|
42
|
+
handle_arp_request dpid, message
|
43
|
+
elsif message.arp_reply?
|
44
|
+
handle_arp_reply message
|
45
|
+
elsif message.ipv4?
|
46
|
+
handle_ipv4 dpid, message
|
47
|
+
else
|
48
|
+
# noop.
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
|
56
|
+
def to_me?( message )
|
57
|
+
return true if message.macda.broadcast?
|
58
|
+
|
59
|
+
interface = @interfaces.find_by_port( message.in_port )
|
60
|
+
if interface and interface.has?( message.macda )
|
61
|
+
return true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def handle_arp_request( dpid, message )
|
67
|
+
port = message.in_port
|
68
|
+
daddr = message.arp_tpa
|
69
|
+
interface = @interfaces.find_by_port_and_ipaddr( port, daddr )
|
70
|
+
if interface
|
71
|
+
arp_reply = create_arp_reply_from( message, interface.hwaddr )
|
72
|
+
packet_out dpid, arp_reply, SendOutPort.new( interface.port )
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
def handle_arp_reply( message )
|
78
|
+
@arp_table.update message.in_port, message.arp_spa, message.arp_sha
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
def handle_ipv4( dpid, message )
|
83
|
+
if should_forward?( message )
|
84
|
+
forward dpid, message
|
85
|
+
elsif message.icmpv4_echo_request?
|
86
|
+
handle_icmpv4_echo_request dpid, message
|
87
|
+
else
|
88
|
+
# noop.
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
def should_forward?( message )
|
94
|
+
not @interfaces.find_by_ipaddr( message.ipv4_daddr )
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
def handle_icmpv4_echo_request( dpid, message )
|
99
|
+
interface = @interfaces.find_by_port( message.in_port )
|
100
|
+
saddr = message.ipv4_saddr.value
|
101
|
+
arp_entry = @arp_table.lookup( saddr )
|
102
|
+
if arp_entry
|
103
|
+
icmpv4_reply = create_icmpv4_reply( arp_entry, interface, message )
|
104
|
+
packet_out dpid, icmpv4_reply, SendOutPort.new( interface.port )
|
105
|
+
else
|
106
|
+
handle_unresolved_packet dpid, message, interface, saddr
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
def forward( dpid, message )
|
112
|
+
next_hop = resolve_next_hop( message.ipv4_daddr )
|
113
|
+
|
114
|
+
interface = @interfaces.find_by_prefix( next_hop )
|
115
|
+
if not interface or interface.port == message.in_port
|
116
|
+
return
|
117
|
+
end
|
118
|
+
|
119
|
+
arp_entry = @arp_table.lookup( next_hop )
|
120
|
+
if arp_entry
|
121
|
+
macsa = interface.hwaddr
|
122
|
+
macda = arp_entry.hwaddr
|
123
|
+
action = create_action_from( macsa, macda, interface.port )
|
124
|
+
flow_mod dpid, message, action
|
125
|
+
packet_out dpid, message.data, action
|
126
|
+
else
|
127
|
+
handle_unresolved_packet dpid, message, interface, next_hop
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
def resolve_next_hop( daddr )
|
133
|
+
next_hop = @routing_table.lookup( daddr.value )
|
134
|
+
if next_hop
|
135
|
+
next_hop
|
136
|
+
else
|
137
|
+
daddr.value
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
def flow_mod( dpid, message, action )
|
143
|
+
send_flow_mod_add(
|
144
|
+
dpid,
|
145
|
+
:match => ExactMatch.from( message ),
|
146
|
+
:actions => action
|
147
|
+
)
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
def packet_out( dpid, packet, action )
|
152
|
+
send_packet_out(
|
153
|
+
dpid,
|
154
|
+
:data => packet,
|
155
|
+
:actions => action
|
156
|
+
)
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
def handle_unresolved_packet( dpid, message, interface, ipaddr )
|
161
|
+
arp_request = create_arp_request_from( interface, ipaddr )
|
162
|
+
packet_out dpid, arp_request, SendOutPort.new( interface.port )
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
def create_action_from( macsa, macda, port )
|
167
|
+
[
|
168
|
+
SetEthSrcAddr.new( macsa.to_s ),
|
169
|
+
SetEthDstAddr.new( macda.to_s ),
|
170
|
+
SendOutPort.new( port )
|
171
|
+
]
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
|
176
|
+
### Local variables:
|
177
|
+
### mode: Ruby
|
178
|
+
### coding: utf-8
|
179
|
+
### indent-tabs-mode: nil
|
180
|
+
### End:
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
$interface = [
|
4
|
+
{
|
5
|
+
:port => 2,
|
6
|
+
:hwaddr => "00:00:00:01:00:01",
|
7
|
+
:ipaddr => "192.168.1.1",
|
8
|
+
:masklen => 24
|
9
|
+
},
|
10
|
+
{
|
11
|
+
:port => 1,
|
12
|
+
:hwaddr => "00:00:00:01:00:02",
|
13
|
+
:ipaddr => "192.168.2.1",
|
14
|
+
:masklen => 24
|
15
|
+
}
|
16
|
+
]
|
17
|
+
|
18
|
+
$route = []
|
@@ -0,0 +1,15 @@
|
|
1
|
+
vswitch { dpid "0x1" }
|
2
|
+
|
3
|
+
netns ( "host1" ) {
|
4
|
+
ip "192.168.1.2"
|
5
|
+
netmask "255.255.255.0"
|
6
|
+
route :net=>"0.0.0.0/0", :gw=>"192.168.1.1"
|
7
|
+
}
|
8
|
+
netns ( "host2" ) {
|
9
|
+
ip "192.168.2.2"
|
10
|
+
netmask "255.255.255.0"
|
11
|
+
route :net=>"0.0.0.0/0", :gw=>"192.168.2.1"
|
12
|
+
}
|
13
|
+
|
14
|
+
link "host1", "0x1"
|
15
|
+
link "host2", "0x1"
|
@@ -22,20 +22,20 @@
|
|
22
22
|
#include "config.h"
|
23
23
|
#endif
|
24
24
|
|
25
|
-
#include <
|
26
|
-
#include <
|
27
|
-
#include <
|
25
|
+
#include <stdio.h>
|
26
|
+
#include <stdlib.h>
|
27
|
+
#include <glib.h>
|
28
28
|
#include <epan/emem.h>
|
29
|
-
#include <epan/etypes.h>
|
30
|
-
#include <epan/ipproto.h>
|
31
29
|
#include <epan/packet.h>
|
30
|
+
#include <epan/dissectors/packet-tcp.h>
|
32
31
|
#include <epan/prefs.h>
|
32
|
+
#include <epan/ipproto.h>
|
33
|
+
#include <epan/etypes.h>
|
34
|
+
#include <epan/addr_resolv.h>
|
33
35
|
#include <epan/reassemble.h>
|
34
|
-
#include <glib.h>
|
35
36
|
#include <pcap/pcap.h>
|
36
|
-
#include <stdio.h>
|
37
|
-
#include <stdlib.h>
|
38
37
|
#include <string.h>
|
38
|
+
#include <arpa/inet.h>
|
39
39
|
#include "messenger.h"
|
40
40
|
#include "openflow_service_interface.h"
|
41
41
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 8
|
10
|
+
version: 0.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yasuhito Takamiya
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: .
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-01-01 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|
@@ -118,13 +118,12 @@ files:
|
|
118
118
|
- features/example.hello_trema.feature
|
119
119
|
- features/example.learning_switch.feature
|
120
120
|
- features/example.list_switches.feature
|
121
|
-
- features/example.message.echo_reply.feature
|
122
|
-
- features/example.message.echo_request.feature
|
123
121
|
- features/example.message.features_request.feature
|
124
|
-
- features/example.message.hello.feature
|
125
122
|
- features/example.message.set_config.feature
|
126
123
|
- features/example.message.vendor-action.feature
|
127
124
|
- features/example.multi_learning_switch.feature
|
125
|
+
- features/example.openflow_message.echo.feature
|
126
|
+
- features/example.openflow_message.hello.feature
|
128
127
|
- features/example.packet_in.feature
|
129
128
|
- features/example.packetin_filter_config.feature
|
130
129
|
- features/example.patch_panel.feature
|
@@ -432,10 +431,8 @@ files:
|
|
432
431
|
- src/examples/multi_learning_switch/multi_learning_switch.c
|
433
432
|
- src/examples/multi_learning_switch/multi_learning_switch.conf
|
434
433
|
- src/examples/openflow_message/README
|
435
|
-
- src/examples/openflow_message/echo
|
436
|
-
- src/examples/openflow_message/echo
|
437
|
-
- src/examples/openflow_message/echo_reply.c
|
438
|
-
- src/examples/openflow_message/echo_request.c
|
434
|
+
- src/examples/openflow_message/echo.c
|
435
|
+
- src/examples/openflow_message/echo.rb
|
439
436
|
- src/examples/openflow_message/example.rb
|
440
437
|
- src/examples/openflow_message/features-request.rb
|
441
438
|
- src/examples/openflow_message/features_request.c
|
@@ -445,6 +442,7 @@ files:
|
|
445
442
|
- src/examples/openflow_message/set_config.c
|
446
443
|
- src/examples/openflow_message/vendor-action.rb
|
447
444
|
- src/examples/openflow_message/vendor_action.c
|
445
|
+
- src/examples/openflow_switch/echo_switch.c
|
448
446
|
- src/examples/openflow_switch/hello_switch.c
|
449
447
|
- src/examples/packet_in/README
|
450
448
|
- src/examples/packet_in/packet-in.rb
|
@@ -468,6 +466,14 @@ files:
|
|
468
466
|
- src/examples/repeater_hub/repeater-hub_spec.rb
|
469
467
|
- src/examples/repeater_hub/repeater_hub.c
|
470
468
|
- src/examples/repeater_hub/repeater_hub.conf
|
469
|
+
- src/examples/simple_router/arp-table.rb
|
470
|
+
- src/examples/simple_router/interface.rb
|
471
|
+
- src/examples/simple_router/router-utils.rb
|
472
|
+
- src/examples/simple_router/routing-table.rb
|
473
|
+
- src/examples/simple_router/simple-router.rb
|
474
|
+
- src/examples/simple_router/simple_router.conf
|
475
|
+
- src/examples/simple_router/simple_router_netns.conf
|
476
|
+
- src/examples/simple_router/simple_router_network.conf
|
471
477
|
- src/examples/switch_info/README
|
472
478
|
- src/examples/switch_info/switch-info.rb
|
473
479
|
- src/examples/switch_info/switch_info.c
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Feature: Send echo reply messages
|
2
|
-
|
3
|
-
As a Trema user
|
4
|
-
I want to send echo reply messages to openflow switches
|
5
|
-
Because I want to reply to echo requests from openflow switches
|
6
|
-
|
7
|
-
@wip
|
8
|
-
Scenario: Send echo reply x 10
|
9
|
-
When I try trema run "./objects/examples/openflow_message/echo_reply 10" with following configuration (backgrounded):
|
10
|
-
"""
|
11
|
-
vswitch("echo_reply") { datapath_id "0xabc" }
|
12
|
-
"""
|
13
|
-
And wait until "echo_reply" is up
|
14
|
-
And *** sleep 2 ***
|
15
|
-
Then the log file "openflowd.echo_reply.log" should include "received: OFPT_ECHO_REPLY" x 10
|
16
|
-
|
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
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: Send echo request messages
|
2
|
-
|
3
|
-
As a Trema user
|
4
|
-
I want to send echo request messages to openflow switches
|
5
|
-
So that I can receive echo reply messages from openflow switches
|
6
|
-
|
7
|
-
@wip
|
8
|
-
Scenario: Send echo request x 10
|
9
|
-
When I try trema run "./objects/examples/openflow_message/echo_request 10" with following configuration (backgrounded):
|
10
|
-
"""
|
11
|
-
vswitch("echo_request") { datapath_id "0xabc" }
|
12
|
-
"""
|
13
|
-
And wait until "echo_request" is up
|
14
|
-
And *** sleep 2 ***
|
15
|
-
Then the log file "openflowd.echo_request.log" should include "received: OFPT_ECHO_REQUEST" x 10
|
16
|
-
|
17
|
-
@wip
|
18
|
-
Scenario: Send echo request x 10 in Ruby
|
19
|
-
When I try trema run "./src/examples/openflow_message/echo-request.rb 0xabc, 10" with following configuration (backgrounded):
|
20
|
-
"""
|
21
|
-
vswitch("echo-request") { datapath_id "0xabc" }
|
22
|
-
"""
|
23
|
-
And wait until "EchoRequestController" is up
|
24
|
-
And *** sleep 2 ***
|
25
|
-
Then the log file "openflowd.echo-request.log" should include "received: OFPT_ECHO_REQUEST" x 10
|