trema 0.3.3 → 0.3.4
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/ruby/trema/flow-removed.c +3 -0
- data/ruby/trema/match.c +19 -0
- data/ruby/trema/packet-in.c +3 -0
- data/ruby/trema/port.c +12 -0
- data/ruby/trema/send-out-port.rb +1 -1
- data/ruby/trema/version.rb +1 -1
- data/spec/spec_helper.rb +8 -0
- data/spec/support/action.rb +4 -4
- data/spec/trema/barrier-request_spec.rb +1 -1
- data/spec/trema/cli_spec.rb +1 -3
- data/spec/trema/controller_spec.rb +1 -1
- data/spec/trema/dsl/configuration_spec.rb +24 -24
- data/spec/trema/dsl/link_spec.rb +4 -6
- data/spec/trema/dsl/run_spec.rb +7 -11
- data/spec/trema/dsl/runner_spec.rb +9 -9
- data/spec/trema/dsl/switch_spec.rb +5 -11
- data/spec/trema/dsl/vhost_spec.rb +1 -3
- data/spec/trema/dsl/vswitch_spec.rb +7 -15
- data/spec/trema/echo-request_spec.rb +1 -1
- data/spec/trema/enqueue_spec.rb +4 -4
- data/spec/trema/features-reply_spec.rb +1 -1
- data/spec/trema/features-request_spec.rb +1 -1
- data/spec/trema/flow-removed_spec.rb +19 -19
- data/spec/trema/get-config-request_spec.rb +1 -1
- data/spec/trema/hardware-switch_spec.rb +3 -3
- data/spec/trema/host_spec.rb +2 -2
- data/spec/trema/list-switches-reply_spec.rb +1 -1
- data/spec/trema/mac_spec.rb +1 -1
- data/spec/trema/match_spec.rb +8 -8
- data/spec/trema/open-vswitch_spec.rb +6 -6
- data/spec/trema/openflow-error_spec.rb +15 -15
- data/spec/trema/packet-in_spec.rb +210 -208
- data/spec/trema/packet-out_spec.rb +4 -6
- data/spec/trema/port-mod_spec.rb +28 -29
- data/spec/trema/port-status-modify_spec.rb +2 -2
- data/spec/trema/port_spec.rb +9 -9
- data/spec/trema/queue-get-config-reply_spec.rb +2 -2
- data/spec/trema/send-out-port_spec.rb +53 -43
- data/spec/trema/set-config_spec.rb +2 -2
- data/spec/trema/set-eth-dst-addr_spec.rb +3 -3
- data/spec/trema/set-eth-src-addr_spec.rb +3 -3
- data/spec/trema/set-ip-dst-addr_spec.rb +20 -16
- data/spec/trema/set-ip-src-addr_spec.rb +20 -16
- data/spec/trema/set-ip-tos_spec.rb +20 -21
- data/spec/trema/set-transport-dst-port_spec.rb +22 -23
- data/spec/trema/set-transport-src-port_spec.rb +22 -23
- data/spec/trema/set-vlan-priority_spec.rb +20 -21
- data/spec/trema/set-vlan-vid_spec.rb +20 -21
- data/spec/trema/shell/vhost_spec.rb +7 -7
- data/spec/trema/shell/vswitch_spec.rb +8 -8
- data/spec/trema/stats-reply_spec.rb +23 -23
- data/spec/trema/strip-vlan-header_spec.rb +9 -9
- data/spec/trema/switch-daemon_spec.rb +15 -15
- data/spec/trema/util_spec.rb +2 -6
- data/spec/trema/vendor-action_spec.rb +24 -36
- metadata +4 -4
@@ -31,10 +31,10 @@ module Trema
|
|
31
31
|
}
|
32
32
|
switch_daemon = SwitchDaemon.new( rule )
|
33
33
|
|
34
|
-
switch_daemon.options.
|
35
|
-
switch_daemon.options.
|
36
|
-
switch_daemon.options.
|
37
|
-
switch_daemon.options.
|
34
|
+
expect( switch_daemon.options ).to include( "port_status::topology" )
|
35
|
+
expect( switch_daemon.options ).to include( "packet_in::controller" )
|
36
|
+
expect( switch_daemon.options ).to include( "state_notify::topology" )
|
37
|
+
expect( switch_daemon.options ).to include( "vendor::controller" )
|
38
38
|
end
|
39
39
|
|
40
40
|
|
@@ -47,14 +47,14 @@ module Trema
|
|
47
47
|
}
|
48
48
|
switch_daemon = SwitchDaemon.new( rule )
|
49
49
|
|
50
|
-
switch_daemon.options.
|
51
|
-
switch_daemon.options.
|
52
|
-
switch_daemon.options.
|
53
|
-
switch_daemon.options.
|
54
|
-
switch_daemon.options.
|
55
|
-
switch_daemon.options.
|
56
|
-
switch_daemon.options.
|
57
|
-
switch_daemon.options.
|
50
|
+
expect( switch_daemon.options ).to include( "port_status::topology0" )
|
51
|
+
expect( switch_daemon.options ).to include( "port_status::topology1" )
|
52
|
+
expect( switch_daemon.options ).to include( "packet_in::controller0" )
|
53
|
+
expect( switch_daemon.options ).to include( "packet_in::controller1" )
|
54
|
+
expect( switch_daemon.options ).to include( "state_notify::topology0" )
|
55
|
+
expect( switch_daemon.options ).to include( "state_notify::topology1" )
|
56
|
+
expect( switch_daemon.options ).to include( "vendor::controller0" )
|
57
|
+
expect( switch_daemon.options ).to include( "vendor::controller1" )
|
58
58
|
end
|
59
59
|
|
60
60
|
|
@@ -66,9 +66,9 @@ module Trema
|
|
66
66
|
}
|
67
67
|
switch_daemon = SwitchDaemon.new( rule )
|
68
68
|
|
69
|
-
switch_daemon.options.
|
70
|
-
switch_daemon.options.
|
71
|
-
switch_daemon.options.
|
69
|
+
expect( switch_daemon.options ).to include( "port_status::topology" )
|
70
|
+
expect( switch_daemon.options ).to include( "packet_in::controller" )
|
71
|
+
expect( switch_daemon.options ).to include( "state_notify::topology" )
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/spec/trema/util_spec.rb
CHANGED
@@ -31,16 +31,12 @@ describe Trema::Util do
|
|
31
31
|
it "should assert that trema is built" do
|
32
32
|
Trema::Executables.stub!( :compiled? ).and_return( false )
|
33
33
|
$stderr.should_receive( :puts ).with( /^ERROR/ )
|
34
|
-
|
35
|
-
assert_trema_is_built
|
36
|
-
end.should raise_error( SystemExit )
|
34
|
+
expect { assert_trema_is_built }.to raise_error( SystemExit )
|
37
35
|
end
|
38
36
|
|
39
37
|
|
40
38
|
it "should execute and check the results of a command" do
|
41
|
-
|
42
|
-
sh "NO SUCH COMMAND"
|
43
|
-
end.should raise_error( "Command 'NO SUCH COMMAND' failed!" )
|
39
|
+
expect { sh "NO SUCH COMMAND" }.to raise_error( "Command 'NO SUCH COMMAND' failed!" )
|
44
40
|
end
|
45
41
|
|
46
42
|
|
@@ -20,61 +20,49 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
|
|
20
20
|
require "trema"
|
21
21
|
|
22
22
|
|
23
|
-
describe VendorAction, "new(
|
23
|
+
describe VendorAction, "new(vendor_id)", :type => "actions" do
|
24
24
|
subject { VendorAction.new vendor_id }
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
context "when vendor_id == 0x00004cff" do
|
26
|
+
context "with vendor_id (0x00004cff)" do
|
29
27
|
let( :vendor_id ) { 0x00004cff }
|
30
28
|
its( :vendor_id ) { should == 0x00004cff }
|
31
29
|
end
|
32
|
-
end
|
33
30
|
|
31
|
+
it_validates "option is within range", :vendor_id, 0..( 2 ** 32 - 1 )
|
34
32
|
|
35
|
-
|
36
|
-
|
33
|
+
context %{with vendor_id ("0x00004cff")} do
|
34
|
+
let( :vendor_id ) { "0x00004cff" }
|
35
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
36
|
+
end
|
37
37
|
end
|
38
38
|
|
39
39
|
|
40
|
-
describe VendorAction, ".new(
|
41
|
-
|
42
|
-
end
|
43
|
-
|
40
|
+
describe VendorAction, ".new(0x00002320, body)", :type => "actions" do
|
41
|
+
subject { VendorAction.new 0x00002320, body }
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
context %{with body ("deadbeef")} do
|
44
|
+
let( :body ) { "deadbeef" }
|
45
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
46
|
+
end
|
48
47
|
|
49
|
-
context
|
48
|
+
context "when sending a Flow Mod with VendorAction" do
|
50
49
|
let( :body ) { [ 0x00, 0x08, 0x54, 0x72, 0x65, 0x6d, 0x61, 0x00 ] }
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
controller( "FlowModAddController" ).send_flow_mod_add( 0xabc, :actions => VendorAction.new( 0x00002320, body ) )
|
63
|
-
sleep 2 # FIXME: wait to send_flow_mod_add
|
64
|
-
vswitch( "0xabc" ).should have( 1 ).flows
|
65
|
-
vswitch( "0xabc" ).flows[ 0 ].actions.should match( /note:54.72.65.6d.61.00/ )
|
66
|
-
}
|
67
|
-
end
|
51
|
+
it "should insert a new flow entry with action (note:54.72.65.6d.61.00)" do
|
52
|
+
class TestController < Controller; end
|
53
|
+
network {
|
54
|
+
vswitch { datapath_id 0xabc }
|
55
|
+
}.run( TestController ) {
|
56
|
+
controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
|
57
|
+
sleep 2
|
58
|
+
expect( vswitch( "0xabc" ) ).to have( 1 ).flows
|
59
|
+
expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "note:54.72.65.6d.61.00" )
|
60
|
+
}
|
68
61
|
end
|
69
62
|
end
|
70
63
|
end
|
71
64
|
|
72
65
|
|
73
|
-
describe VendorAction, "new( vendor_id, string )" do
|
74
|
-
it { expect { VendorAction.new 0x00004cff, "deadbeef" }.to raise_error( TypeError ) }
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
66
|
### Local variables:
|
79
67
|
### mode: Ruby
|
80
68
|
### coding: utf-8-unix
|
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: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
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: 2013-01-
|
18
|
+
date: 2013-01-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|