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
@@ -20,39 +20,38 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
|
|
20
20
|
require "trema"
|
21
21
|
|
22
22
|
|
23
|
-
describe SetIpTos, ".new(
|
23
|
+
describe SetIpTos, ".new( type_of_service )", :type => "actions" do
|
24
24
|
subject { SetIpTos.new( type_of_service ) }
|
25
25
|
|
26
|
-
context "
|
26
|
+
context "with type_of_service (32)" do
|
27
27
|
let( :type_of_service ) { 32 }
|
28
28
|
its( :type_of_service ) { should == 32 }
|
29
29
|
end
|
30
30
|
|
31
|
-
it_validates "option range", :type_of_service, 0..( 2 ** 8 - 1 )
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
describe SetIpTos, %{.new( "32" )} do
|
36
|
-
it { expect { SetIpTos.new( "32" ) }.to raise_error( TypeError ) }
|
37
|
-
end
|
31
|
+
it_validates "option is within range", :type_of_service, 0..( 2 ** 8 - 1 )
|
38
32
|
|
33
|
+
context %{with type_of_service ("32")} do
|
34
|
+
let( :type_of_service ) { "32" }
|
35
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
36
|
+
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
context %{with type_of_service ([32])} do
|
39
|
+
let( :type_of_service ) { [ 32 ] }
|
40
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
41
|
+
end
|
43
42
|
|
43
|
+
context "when sending a Flow Mod with SetIpTos" do
|
44
|
+
let( :type_of_service ) { 4 }
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
it "should have a flow with action set to mod_nw_tos" do
|
48
|
-
class FlowModAddController < Controller; end
|
46
|
+
it "should insert a new flow entry with action (mod_nw_tos:4)" do
|
47
|
+
class TestController < Controller; end
|
49
48
|
network {
|
50
49
|
vswitch { datapath_id 0xabc }
|
51
|
-
}.run(
|
52
|
-
controller( "
|
53
|
-
sleep 2
|
54
|
-
vswitch( "0xabc" ).
|
55
|
-
vswitch( "0xabc" ).flows[0].actions.
|
50
|
+
}.run( TestController ) {
|
51
|
+
controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
|
52
|
+
sleep 2
|
53
|
+
expect( vswitch( "0xabc" ) ).to have( 1 ).flows
|
54
|
+
expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_nw_tos:4" )
|
56
55
|
}
|
57
56
|
end
|
58
57
|
end
|
@@ -20,39 +20,38 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
|
|
20
20
|
require "trema"
|
21
21
|
|
22
22
|
|
23
|
-
describe SetTransportDstPort, "new(
|
24
|
-
subject { SetTransportDstPort.new
|
23
|
+
describe SetTransportDstPort, "new( port_number )", :type => "actions" do
|
24
|
+
subject { SetTransportDstPort.new port_number }
|
25
25
|
|
26
|
-
context "
|
27
|
-
let( :
|
26
|
+
context "with port_number (5555)" do
|
27
|
+
let( :port_number ) { 5555 }
|
28
28
|
its( :port_number ) { should == 5555 }
|
29
29
|
end
|
30
30
|
|
31
|
-
it_validates "option range", :
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
describe SetTransportDstPort, ".new( string )" do
|
36
|
-
it { expect { SetTransportDstPort.new( "5555" ) }.to raise_error( TypeError ) }
|
37
|
-
end
|
31
|
+
it_validates "option is within range", :port_number, 0..( 2 ** 16 - 1 )
|
38
32
|
|
33
|
+
context %{with invalid port_number ("5555")} do
|
34
|
+
let( :port_number ) { "5555" }
|
35
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
36
|
+
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
context %{with invalid port_number ([1, 2, 3])} do
|
39
|
+
let( :port_number ) { [ 1, 2, 3 ] }
|
40
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
41
|
+
end
|
43
42
|
|
43
|
+
context "when sending a Flow Mod with SetTransportDstPort" do
|
44
|
+
let( :port_number ) { 5555 }
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
it "should have a flow with action set to mod_tp_dst" do
|
48
|
-
class FlowModAddController < Controller; end
|
46
|
+
it "should insert a new flow entry with action (mod_tp_dst:5555)" do
|
47
|
+
class TestController < Controller; end
|
49
48
|
network {
|
50
49
|
vswitch { datapath_id 0xabc }
|
51
|
-
}.run(
|
52
|
-
controller( "
|
53
|
-
sleep 2
|
54
|
-
vswitch( "0xabc" ).
|
55
|
-
vswitch( "0xabc" ).flows[0].actions.
|
50
|
+
}.run( TestController ) {
|
51
|
+
controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
|
52
|
+
sleep 2
|
53
|
+
expect( vswitch( "0xabc" ) ).to have( 1 ).flows
|
54
|
+
expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_tp_dst:5555" )
|
56
55
|
}
|
57
56
|
end
|
58
57
|
end
|
@@ -20,39 +20,38 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
|
|
20
20
|
require "trema"
|
21
21
|
|
22
22
|
|
23
|
-
describe SetTransportSrcPort, "new(
|
24
|
-
subject { SetTransportSrcPort.new
|
23
|
+
describe SetTransportSrcPort, "new( port_number )", :type => "actions" do
|
24
|
+
subject { SetTransportSrcPort.new port_number }
|
25
25
|
|
26
|
-
context "
|
27
|
-
let( :
|
26
|
+
context "with port_number (5555)" do
|
27
|
+
let( :port_number ) { 5555 }
|
28
28
|
its( :port_number ) { should == 5555 }
|
29
29
|
end
|
30
30
|
|
31
|
-
it_validates "option range", :
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
describe SetTransportSrcPort, ".new( string )" do
|
36
|
-
it { expect { SetTransportSrcPort.new( "5555" ) }.to raise_error( TypeError ) }
|
37
|
-
end
|
31
|
+
it_validates "option is within range", :port_number, 0..( 2 ** 16 - 1 )
|
38
32
|
|
33
|
+
context %{with invalid port_number ("5555")} do
|
34
|
+
let( :port_number ) { "5555" }
|
35
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
36
|
+
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
context %{with invalid port_number ([1, 2, 3])} do
|
39
|
+
let( :port_number ) { [ 1, 2, 3 ] }
|
40
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
41
|
+
end
|
43
42
|
|
43
|
+
context "when sending a Flow Mod with SetTransportSrcPort" do
|
44
|
+
let( :port_number ) { 5555 }
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
it "should have a flow with action set to mod_tp_src" do
|
48
|
-
class FlowModAddController < Controller; end
|
46
|
+
it "should insert a new flow entry with action (mod_tp_src:5555)" do
|
47
|
+
class TestController < Controller; end
|
49
48
|
network {
|
50
49
|
vswitch { datapath_id 0xabc }
|
51
|
-
}.run(
|
52
|
-
controller( "
|
53
|
-
sleep 2
|
54
|
-
vswitch( "0xabc" ).
|
55
|
-
vswitch( "0xabc" ).flows[0].actions.
|
50
|
+
}.run( TestController ) {
|
51
|
+
controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
|
52
|
+
sleep 2
|
53
|
+
expect( vswitch( "0xabc" ) ).to have( 1 ).flows
|
54
|
+
expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_tp_src:5555" )
|
56
55
|
}
|
57
56
|
end
|
58
57
|
end
|
@@ -20,39 +20,38 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
|
|
20
20
|
require "trema"
|
21
21
|
|
22
22
|
|
23
|
-
describe SetVlanPriority, ".new(
|
23
|
+
describe SetVlanPriority, ".new(vlan_priority)", :type => "actions" do
|
24
24
|
subject { SetVlanPriority.new( vlan_priority ) }
|
25
25
|
|
26
|
-
context "
|
26
|
+
context "with vlan_priority (4)" do
|
27
27
|
let( :vlan_priority ) { 4 }
|
28
28
|
its( :vlan_priority ) { should == 4 }
|
29
29
|
end
|
30
30
|
|
31
|
-
it_validates "option range", :vlan_priority, 0..7
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
describe SetVlanPriority, %{.new( "4" )} do
|
36
|
-
it { expect { SetVlanPriority.new( "4" ) }.to raise_error( TypeError ) }
|
37
|
-
end
|
31
|
+
it_validates "option is within range", :vlan_priority, 0..7
|
38
32
|
|
33
|
+
context %{with vlan_priority ("4")} do
|
34
|
+
let( :vlan_priority ) { "4" }
|
35
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
36
|
+
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
context "with vlan_priority ([4])" do
|
39
|
+
let( :vlan_priority ) { [ 4 ] }
|
40
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
41
|
+
end
|
43
42
|
|
43
|
+
context "when sending a Flow Mod with SetVlanVid" do
|
44
|
+
let( :vlan_priority ) { 7 }
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
it "should have a flow with action set to mod_vlan_pcp" do
|
48
|
-
class FlowModAddController < Controller; end
|
46
|
+
it "should insert a new flow with action (mod_vlan_pcp:7)" do
|
47
|
+
class TestController < Controller; end
|
49
48
|
network {
|
50
49
|
vswitch { datapath_id 0xabc }
|
51
|
-
}.run(
|
52
|
-
controller( "
|
53
|
-
sleep 2
|
54
|
-
vswitch( "0xabc" ).
|
55
|
-
vswitch( "0xabc" ).flows[0].actions.
|
50
|
+
}.run( TestController ) {
|
51
|
+
controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
|
52
|
+
sleep 2
|
53
|
+
expect( vswitch( "0xabc" ) ).to have( 1 ).flows
|
54
|
+
expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_vlan_pcp:7" )
|
56
55
|
}
|
57
56
|
end
|
58
57
|
end
|
@@ -20,39 +20,38 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
|
|
20
20
|
require "trema"
|
21
21
|
|
22
22
|
|
23
|
-
describe SetVlanVid, ".new(
|
23
|
+
describe SetVlanVid, ".new(vlan_id)", :type => "actions" do
|
24
24
|
subject { SetVlanVid.new( vlan_id ) }
|
25
25
|
|
26
|
-
context "
|
26
|
+
context "with vlan_id (1024)" do
|
27
27
|
let( :vlan_id ) { 1024 }
|
28
28
|
its( :vlan_id ) { should == 1024 }
|
29
29
|
end
|
30
30
|
|
31
|
-
it_validates "option range", :vlan_id, 1..4095
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
describe SetVlanVid, %{.new( "1024" )} do
|
36
|
-
it { expect { SetVlanVid.new( "1024" ) }.to raise_error( TypeError ) }
|
37
|
-
end
|
31
|
+
it_validates "option is within range", :vlan_id, 1..4095
|
38
32
|
|
33
|
+
context %{with vlan_id ("1024")} do
|
34
|
+
let( :vlan_id ) { "1024" }
|
35
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
36
|
+
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
context "with vlan_id ([1024])" do
|
39
|
+
let( :vlan_id ) { [ 1024 ] }
|
40
|
+
it { expect { subject }.to raise_error( TypeError ) }
|
41
|
+
end
|
43
42
|
|
43
|
+
context "when sending a Flow Mod with SetVlanVid" do
|
44
|
+
let( :vlan_id ) { 1024 }
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
it "should have a flow with action set to mod_vlan_vid" do
|
48
|
-
class FlowModAddController < Controller; end
|
46
|
+
it "should insert a new flow entry with action (mod_vlan_vid:1024)" do
|
47
|
+
class TestController < Controller; end
|
49
48
|
network {
|
50
49
|
vswitch { datapath_id 0xabc }
|
51
|
-
}.run(
|
52
|
-
controller( "
|
53
|
-
sleep 2
|
54
|
-
vswitch( "0xabc" ).
|
55
|
-
vswitch( "0xabc" ).flows[0].actions.
|
50
|
+
}.run( TestController ) {
|
51
|
+
controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
|
52
|
+
sleep 2
|
53
|
+
expect( vswitch( "0xabc" ) ).to have( 1 ).flows
|
54
|
+
expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_vlan_vid:1024" )
|
56
55
|
}
|
57
56
|
end
|
58
57
|
end
|
@@ -31,8 +31,8 @@ describe Trema::Shell, ".vhost" do
|
|
31
31
|
it "should create a new vhost if name given" do
|
32
32
|
Trema::Shell.vhost( "host1" )
|
33
33
|
|
34
|
-
Trema::Host.
|
35
|
-
Trema::Host[ "host1" ].name.
|
34
|
+
expect( Trema::Host ).to have( 1 ).host
|
35
|
+
expect( Trema::Host[ "host1" ].name ).to eq( "host1" )
|
36
36
|
end
|
37
37
|
|
38
38
|
|
@@ -44,11 +44,11 @@ describe Trema::Shell, ".vhost" do
|
|
44
44
|
mac "00:00:00:1:1:1"
|
45
45
|
}
|
46
46
|
|
47
|
-
Trema::Host.
|
48
|
-
Trema::Host[ "host1" ].name.
|
49
|
-
Trema::Host[ "host1" ].ip.
|
50
|
-
Trema::Host[ "host1" ].promisc.
|
51
|
-
Trema::Host[ "host1" ].mac.
|
47
|
+
expect( Trema::Host ).to have( 1 ).host
|
48
|
+
expect( Trema::Host[ "host1" ].name ).to eq( "host1" )
|
49
|
+
expect( Trema::Host[ "host1" ].ip ).to eq( "192.168.100.1" )
|
50
|
+
expect( Trema::Host[ "host1" ].promisc ).to be_true
|
51
|
+
expect( Trema::Host[ "host1" ].mac ).to eq( "00:00:00:1:1:1" )
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -51,20 +51,20 @@ describe Trema::Shell, ".vswitch" do
|
|
51
51
|
|
52
52
|
it "should create a new vswitch if name given" do
|
53
53
|
Trema::Shell.vswitch { dpid "0xabc" }
|
54
|
-
Trema::OpenflowSwitch.
|
55
|
-
Trema::OpenflowSwitch[ "0xabc" ].name.
|
56
|
-
Trema::OpenflowSwitch[ "0xabc" ].dpid_short.
|
57
|
-
Trema::OpenflowSwitch[ "0xabc" ].dpid_long.
|
54
|
+
expect( Trema::OpenflowSwitch ).to have( 1 ).switch
|
55
|
+
expect( Trema::OpenflowSwitch[ "0xabc" ].name ).to eq( "0xabc" )
|
56
|
+
expect( Trema::OpenflowSwitch[ "0xabc" ].dpid_short ).to eq( "0xabc" )
|
57
|
+
expect( Trema::OpenflowSwitch[ "0xabc" ].dpid_long ).to eq( "0000000000000abc" )
|
58
58
|
end
|
59
59
|
|
60
60
|
|
61
61
|
it "should create a new vswitch if dpid given" do
|
62
62
|
Trema::Shell.vswitch "0xabc"
|
63
63
|
|
64
|
-
Trema::OpenflowSwitch.
|
65
|
-
Trema::OpenflowSwitch[ "0xabc" ].name.
|
66
|
-
Trema::OpenflowSwitch[ "0xabc" ].dpid_short.
|
67
|
-
Trema::OpenflowSwitch[ "0xabc" ].dpid_long.
|
64
|
+
expect( Trema::OpenflowSwitch ).to have( 1 ).switch
|
65
|
+
expect( Trema::OpenflowSwitch[ "0xabc" ].name ).to eq( "0xabc" )
|
66
|
+
expect( Trema::OpenflowSwitch[ "0xabc" ].dpid_short ).to eq( "0xabc" )
|
67
|
+
expect( Trema::OpenflowSwitch[ "0xabc" ].dpid_long ).to eq( "0000000000000abc" )
|
68
68
|
end
|
69
69
|
|
70
70
|
|
@@ -190,11 +190,11 @@ describe StatsReply, ".new( VALID OPTIONS )" do
|
|
190
190
|
vswitch( "desc-stats" ) { datapath_id 0xabc }
|
191
191
|
}.run( DescStatsController ) {
|
192
192
|
controller( "DescStatsController" ).should_receive( :stats_reply ) do | datapath_id, message |
|
193
|
-
datapath_id.
|
194
|
-
message.type.
|
195
|
-
message.stats[ 0 ].mfr_desc.
|
196
|
-
message.stats[ 0 ].hw_desc.
|
197
|
-
message.stats[ 0 ].
|
193
|
+
expect( datapath_id ).to eq( 0xabc )
|
194
|
+
expect( message.type ).to eq( 0 )
|
195
|
+
expect( message.stats[ 0 ].mfr_desc ).to eq( "Nicira Networks, Inc." )
|
196
|
+
expect( message.stats[ 0 ].hw_desc ).to eq( "Open vSwitch" )
|
197
|
+
expect( message.stats[ 0 ] ).to respond_to :to_s
|
198
198
|
end
|
199
199
|
|
200
200
|
controller( "DescStatsController" ).send_message( 0xabc,
|
@@ -228,10 +228,10 @@ describe StatsReply, ".new( VALID OPTIONS )" do
|
|
228
228
|
sleep 2 # FIXME: wait to send_packets
|
229
229
|
|
230
230
|
controller( "FlowStatsController" ).should_receive( :stats_reply ) do | datapath_id, message |
|
231
|
-
datapath_id.
|
232
|
-
message.type.
|
233
|
-
message.stats[ 0 ].packet_count.
|
234
|
-
message.stats[ 0 ].
|
231
|
+
expect( datapath_id ).to eq( 0xabc )
|
232
|
+
expect( message.type ).to eq( 1 )
|
233
|
+
expect( message.stats[ 0 ].packet_count ).to eq( 2 )
|
234
|
+
expect( message.stats[ 0 ] ).to respond_to :to_s
|
235
235
|
end
|
236
236
|
match = Match.new( :dl_type =>0x800, :nw_proto => 17 )
|
237
237
|
controller( "FlowStatsController" ).send_message( 0xabc,
|
@@ -265,11 +265,11 @@ describe StatsReply, ".new( VALID OPTIONS )" do
|
|
265
265
|
sleep 2 # FIXME: wait to send_packets
|
266
266
|
|
267
267
|
controller( "AggregateStatsController" ).should_receive( :stats_reply ) do | datapath_id, message |
|
268
|
-
datapath_id.
|
269
|
-
message.type.
|
270
|
-
message.stats[ 0 ].packet_count.
|
271
|
-
message.stats[ 0 ].flow_count.
|
272
|
-
message.stats[ 0 ].
|
268
|
+
expect( datapath_id ).to eq( 0xabc )
|
269
|
+
expect( message.type ).to eq( 2 )
|
270
|
+
expect( message.stats[ 0 ].packet_count ).to eq( 10 )
|
271
|
+
expect( message.stats[ 0 ].flow_count ).to eq( 1 )
|
272
|
+
expect( message.stats[ 0 ] ).to respond_to :to_s
|
273
273
|
end
|
274
274
|
match = Match.new( :dl_type =>0x800, :nw_proto => 17 )
|
275
275
|
controller( "AggregateStatsController" ).send_message( 0xabc,
|
@@ -300,10 +300,10 @@ describe StatsReply, ".new( VALID OPTIONS )" do
|
|
300
300
|
sleep 2 # FIXME: wait to send_packets
|
301
301
|
|
302
302
|
controller( "PortStatsController" ).should_receive( :stats_reply ) do | datapath_id, message |
|
303
|
-
datapath_id.
|
304
|
-
message.type.
|
305
|
-
message.stats[ 0 ].
|
306
|
-
message.stats[ 0 ].
|
303
|
+
expect( datapath_id ).to eq( 0xabc )
|
304
|
+
expect( message.type ).to eq( 4 )
|
305
|
+
expect( message.stats[ 0 ] ).to be_an_instance_of( Trema::PortStatsReply )
|
306
|
+
expect( message.stats[ 0 ] ).to respond_to :to_s
|
307
307
|
end
|
308
308
|
controller( "PortStatsController" ).send_message( 0xabc,
|
309
309
|
PortStatsRequest.new( :port_no => 1 ) )
|
@@ -332,11 +332,11 @@ describe StatsReply, ".new( VALID OPTIONS )" do
|
|
332
332
|
sleep 2 # FIXME: wait to send_packets
|
333
333
|
|
334
334
|
controller( "TableStatsController" ).should_receive( :stats_reply ) do | datapath_id, message |
|
335
|
-
datapath_id.
|
336
|
-
message.type.
|
337
|
-
message.transaction_id.
|
338
|
-
message.stats[ 0 ].
|
339
|
-
message.stats[ 0 ].
|
335
|
+
expect( datapath_id ).to eq( 0xabc )
|
336
|
+
expect( message.type ).to eq( 3 )
|
337
|
+
expect( message.transaction_id ).to eq( 123 )
|
338
|
+
expect( message.stats[ 0 ] ).to be_an_instance_of(Trema::TableStatsReply)
|
339
|
+
expect( message.stats[ 0 ] ).to respond_to :to_s
|
340
340
|
end
|
341
341
|
controller( "TableStatsController" ).send_message( 0xabc,
|
342
342
|
TableStatsRequest.new( :transaction_id => 123 ) )
|
@@ -20,17 +20,17 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
|
|
20
20
|
require "trema"
|
21
21
|
|
22
22
|
|
23
|
-
describe StripVlanHeader, "
|
24
|
-
context "when sending
|
25
|
-
it "should
|
26
|
-
class
|
23
|
+
describe StripVlanHeader, :type => "actions" do
|
24
|
+
context "when sending a Flow Mod with StripVlanHeader" do
|
25
|
+
it "should insert a new flow entry with action (strip_vlan)" do
|
26
|
+
class TestController < Controller; end
|
27
27
|
network {
|
28
28
|
vswitch { datapath_id 0xabc }
|
29
|
-
}.run(
|
30
|
-
controller( "
|
31
|
-
sleep 2
|
32
|
-
vswitch( "0xabc" ).
|
33
|
-
vswitch( "0xabc" ).flows[ 0 ].actions.
|
29
|
+
}.run( TestController ) {
|
30
|
+
controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
|
31
|
+
sleep 2
|
32
|
+
expect( vswitch( "0xabc" ) ).to have( 1 ).flows
|
33
|
+
expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "strip_vlan" )
|
34
34
|
}
|
35
35
|
end
|
36
36
|
end
|