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.
Files changed (56) hide show
  1. data/ruby/trema/flow-removed.c +3 -0
  2. data/ruby/trema/match.c +19 -0
  3. data/ruby/trema/packet-in.c +3 -0
  4. data/ruby/trema/port.c +12 -0
  5. data/ruby/trema/send-out-port.rb +1 -1
  6. data/ruby/trema/version.rb +1 -1
  7. data/spec/spec_helper.rb +8 -0
  8. data/spec/support/action.rb +4 -4
  9. data/spec/trema/barrier-request_spec.rb +1 -1
  10. data/spec/trema/cli_spec.rb +1 -3
  11. data/spec/trema/controller_spec.rb +1 -1
  12. data/spec/trema/dsl/configuration_spec.rb +24 -24
  13. data/spec/trema/dsl/link_spec.rb +4 -6
  14. data/spec/trema/dsl/run_spec.rb +7 -11
  15. data/spec/trema/dsl/runner_spec.rb +9 -9
  16. data/spec/trema/dsl/switch_spec.rb +5 -11
  17. data/spec/trema/dsl/vhost_spec.rb +1 -3
  18. data/spec/trema/dsl/vswitch_spec.rb +7 -15
  19. data/spec/trema/echo-request_spec.rb +1 -1
  20. data/spec/trema/enqueue_spec.rb +4 -4
  21. data/spec/trema/features-reply_spec.rb +1 -1
  22. data/spec/trema/features-request_spec.rb +1 -1
  23. data/spec/trema/flow-removed_spec.rb +19 -19
  24. data/spec/trema/get-config-request_spec.rb +1 -1
  25. data/spec/trema/hardware-switch_spec.rb +3 -3
  26. data/spec/trema/host_spec.rb +2 -2
  27. data/spec/trema/list-switches-reply_spec.rb +1 -1
  28. data/spec/trema/mac_spec.rb +1 -1
  29. data/spec/trema/match_spec.rb +8 -8
  30. data/spec/trema/open-vswitch_spec.rb +6 -6
  31. data/spec/trema/openflow-error_spec.rb +15 -15
  32. data/spec/trema/packet-in_spec.rb +210 -208
  33. data/spec/trema/packet-out_spec.rb +4 -6
  34. data/spec/trema/port-mod_spec.rb +28 -29
  35. data/spec/trema/port-status-modify_spec.rb +2 -2
  36. data/spec/trema/port_spec.rb +9 -9
  37. data/spec/trema/queue-get-config-reply_spec.rb +2 -2
  38. data/spec/trema/send-out-port_spec.rb +53 -43
  39. data/spec/trema/set-config_spec.rb +2 -2
  40. data/spec/trema/set-eth-dst-addr_spec.rb +3 -3
  41. data/spec/trema/set-eth-src-addr_spec.rb +3 -3
  42. data/spec/trema/set-ip-dst-addr_spec.rb +20 -16
  43. data/spec/trema/set-ip-src-addr_spec.rb +20 -16
  44. data/spec/trema/set-ip-tos_spec.rb +20 -21
  45. data/spec/trema/set-transport-dst-port_spec.rb +22 -23
  46. data/spec/trema/set-transport-src-port_spec.rb +22 -23
  47. data/spec/trema/set-vlan-priority_spec.rb +20 -21
  48. data/spec/trema/set-vlan-vid_spec.rb +20 -21
  49. data/spec/trema/shell/vhost_spec.rb +7 -7
  50. data/spec/trema/shell/vswitch_spec.rb +8 -8
  51. data/spec/trema/stats-reply_spec.rb +23 -23
  52. data/spec/trema/strip-vlan-header_spec.rb +9 -9
  53. data/spec/trema/switch-daemon_spec.rb +15 -15
  54. data/spec/trema/util_spec.rb +2 -6
  55. data/spec/trema/vendor-action_spec.rb +24 -36
  56. metadata +4 -4
@@ -41,16 +41,14 @@ end
41
41
  describe "packet-out" do
42
42
  context "a controller instance" do
43
43
  it "should respond to #send_packet_out" do
44
- PacketOutController.new.should respond_to(:send_packet_out)
44
+ expect( PacketOutController.new ).to respond_to(:send_packet_out)
45
45
  end
46
46
  end
47
47
 
48
48
 
49
49
  context "when invoked with no datapath_id" do
50
50
  it "should raise an error" do
51
- lambda do
52
- PacketOutController.new.send_packet_out
53
- end.should raise_error("wrong number of arguments (0 for 1)")
51
+ expect { PacketOutController.new.send_packet_out }.to raise_error("wrong number of arguments (0 for 1)")
54
52
  end
55
53
  end
56
54
 
@@ -66,7 +64,7 @@ describe "packet-out" do
66
64
  }.run( PacketOutController ) {
67
65
  send_packets "host2", "host1"
68
66
  sleep 2
69
- vhost( "host1" ).rx_stats.n_pkts.should == 1
67
+ expect( vhost( "host1" ).rx_stats.n_pkts ).to eq( 1 )
70
68
  }
71
69
  end
72
70
  end
@@ -114,7 +112,7 @@ describe "packet-out" do
114
112
  :actions => Trema::ActionOutput.new( :port => 1 )
115
113
  )
116
114
  sleep 2
117
- vhost( "host2" ).rx_stats.n_pkts.should == 1
115
+ expect( vhost( "host2" ).rx_stats.n_pkts ).to eq( 1 )
118
116
  }
119
117
  end
120
118
  end
@@ -33,7 +33,7 @@ describe PortMod, ".new( VALID OPTIONS )" do
33
33
  )
34
34
  }
35
35
  its( :port_no ) { should == 2 }
36
- its( :hw_addr ) { subject.to_s.should eq "11:22:33:44:55:66" }
36
+ its( "hw_addr.to_s" ) { should eq "11:22:33:44:55:66" }
37
37
  its( :config ) { should == 1 }
38
38
  its( :mask ) { should == 1 }
39
39
  its( :advertise ) { should == 0 }
@@ -42,46 +42,45 @@ describe PortMod, ".new( VALID OPTIONS )" do
42
42
 
43
43
  describe "hw_addr" do
44
44
  it "should be a Trema::Mac object" do
45
- PortMod.new(
46
- :port_no => 2,
47
- :hw_addr => Mac::new( "11:22:33:44:55:66" ),
48
- :config => 1,
49
- :mask => 1,
50
- :advertise => 0
51
- ).hw_addr.to_s.should eq( "11:22:33:44:55:66" )
45
+ expect( PortMod.new(
46
+ :port_no => 2,
47
+ :hw_addr => Mac::new( "11:22:33:44:55:66" ),
48
+ :config => 1,
49
+ :mask => 1,
50
+ :advertise => 0
51
+ ).hw_addr.to_s ).to eq( "11:22:33:44:55:66" )
52
52
  end
53
53
 
54
54
 
55
55
  it "should be a string('11:22:33:44:55')" do
56
- PortMod.new(
57
- :port_no => 2,
58
- :hw_addr => "11:22:33:44:55:66",
59
- :config => 1,
60
- :mask => 1,
61
- :advertise => 0 ).hw_addr.to_s.should eq( "11:22:33:44:55:66" )
56
+ expect( PortMod.new(
57
+ :port_no => 2,
58
+ :hw_addr => "11:22:33:44:55:66",
59
+ :config => 1,
60
+ :mask => 1,
61
+ :advertise => 0 ).hw_addr.to_s ).to eq( "11:22:33:44:55:66" )
62
62
  end
63
63
 
64
64
 
65
65
  it "should be a number(281474976710655)" do
66
- PortMod.new(
67
- :port_no => 2,
68
- :hw_addr => 281474976710655,
69
- :config => 1,
70
- :mask => 1,
71
- :advertise => 0 ).hw_addr.to_s.should eq( "ff:ff:ff:ff:ff:ff" )
66
+ expect( PortMod.new(
67
+ :port_no => 2,
68
+ :hw_addr => 281474976710655,
69
+ :config => 1,
70
+ :mask => 1,
71
+ :advertise => 0 ).hw_addr.to_s ).to eq( "ff:ff:ff:ff:ff:ff" )
72
72
  end
73
73
 
74
74
 
75
75
  it "should otherwise raise ArgumentError" do
76
- lambda do
77
- PortMod.new(
78
- :port_no => 2,
79
- :hw_addr => Array.new( 1234 ),
80
- :config => 1,
81
- :mask => 1,
82
- :advertise => 0
83
- )
84
- end.should raise_error ArgumentError
76
+ expect { PortMod.new(
77
+ :port_no => 2,
78
+ :hw_addr => Array.new( 1234 ),
79
+ :config => 1,
80
+ :mask => 1,
81
+ :advertise => 0
82
+ )
83
+ }.to raise_error( ArgumentError )
85
84
  end
86
85
  end
87
86
  end
@@ -51,8 +51,8 @@ module Trema
51
51
  link "host", "0xabc"
52
52
  }.run( PortStatusController ) {
53
53
  controller( "PortStatusController" ).should_receive( :port_status ).with do | dpid, message |
54
- dpid.should == 0xabc
55
- message.should be_an_instance_of( PortStatusModify )
54
+ expect( dpid ).to eq( 0xabc )
55
+ expect( message ).to be_an_instance_of( PortStatusModify )
56
56
  end
57
57
 
58
58
  controller( "PortStatusController" ).send_message 0xabc, FeaturesRequest.new
@@ -25,31 +25,31 @@ require "trema"
25
25
  describe Trema::Port do
26
26
  it "should have its port number" do
27
27
  port = Trema::Port.new( :number => 123 )
28
- port.number.should == 123
28
+ expect( port.number ).to be( 123 )
29
29
  end
30
30
 
31
31
  it "should check the port up" do
32
32
  port = Trema::Port.new( :config => 0, :state => 0 )
33
- port.up?.should == true
34
- port.down?.should == false
33
+ expect( port.up? ).to be_true
34
+ expect( port.down? ).to be_false
35
35
  end
36
36
 
37
37
  it "should check the port down(config=0,state=1)" do
38
38
  port = Trema::Port.new( :config => 0, :state => 1 )
39
- port.up?.should == false
40
- port.down?.should == true
39
+ expect( port.up? ).to be_false
40
+ expect( port.down? ).to be_true
41
41
  end
42
42
 
43
43
  it "should check the port down(config=1,state=0)" do
44
44
  port = Trema::Port.new( :config => 1, :state => 0 )
45
- port.up?.should == false
46
- port.down?.should == true
45
+ expect( port.up? ).to be_false
46
+ expect( port.down? ).to be_true
47
47
  end
48
48
 
49
49
  it "should check the port down(config=1,state=1)" do
50
50
  port = Trema::Port.new( :config => 1, :state => 1 )
51
- port.up?.should == false
52
- port.down?.should == true
51
+ expect( port.up? ).to be_false
52
+ expect( port.down? ).to be_true
53
53
  end
54
54
  end
55
55
 
@@ -34,8 +34,8 @@ describe QueueGetConfigReply, ".new( VALID OPTIONS )" do
34
34
  :queues => Queue.queues
35
35
  )
36
36
  end
37
- its( :queues ) { subject.length.should == 2 }
38
- its( :queues ) { subject[0].should be_an_instance_of PacketQueue }
37
+ its( "queues.length" ) { should == 2 }
38
+ its( "queues.first" ) { should be_an_instance_of PacketQueue }
39
39
  its( :datapath_id ) { should == 0xabc }
40
40
  its( :transaction_id ) { should == 123 }
41
41
  end
@@ -21,63 +21,73 @@ require "trema"
21
21
 
22
22
 
23
23
  describe SendOutPort, :type => "actions" do
24
- context "#new( 1 )" do
25
- subject { SendOutPort.new( 1 ) }
24
+ describe "#new(port_number)" do
25
+ subject( :send_out_port ) { SendOutPort.new( port_number ) }
26
26
 
27
- its( :port_number ) { should == 1 }
28
- its( :max_len ) { should == 2 ** 16 - 1 }
29
- its( :to_s ) { should == "SendOutPort: port=1, max_len=65535" }
30
- end
31
27
 
32
- context "#new( :port_number => number )" do
33
- subject { SendOutPort.new( :port_number => number ) }
28
+ context "with port_number (1)" do
29
+ let( :port_number ) { 1 }
34
30
 
35
- context "with port number (1)" do
36
- let( :number ) { 1 }
37
- its( :port_number ) { should == 1 }
38
- its( :to_s ) { should == "SendOutPort: port=1, max_len=65535" }
31
+ its( :port_number ) { should eq( 1 ) }
32
+ its( :max_len ) { should eq( 2 ** 16 - 1 ) }
33
+ its( :to_s ) { should eq( "SendOutPort: port_number=1, max_len=65535" ) }
39
34
  end
40
35
 
41
- it_validates "option range", :number, 0..( 2 ** 16 - 1 )
42
- end
43
36
 
44
- context "#new( :port_number => 1, :max_len => number )" do
45
- subject { SendOutPort.new( :port_number => 1, :max_len => max_len ) }
37
+ context "with port_number (10)" do
38
+ let( :port_number ) { 10 }
46
39
 
47
- context "with :max_len == 256" do
48
- let( :max_len ) { 256 }
49
- its( :max_len ) { should == 256 }
50
- its( :to_s ) { should == "SendOutPort: port=1, max_len=256" }
40
+ context "when set as FlowMod's action", :sudo => true do
41
+ it "should insert a new flow entry with action (output:10)" do
42
+ class TestController < Controller; end
43
+ network {
44
+ vswitch { datapath_id 0xabc }
45
+ }.run( TestController ) {
46
+ controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => send_out_port )
47
+ sleep 2
48
+ expect( vswitch( "0xabc" ) ).to have( 1 ).flows
49
+ expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "output:10" )
50
+ }
51
+ end
52
+ end
51
53
  end
52
54
 
53
- it_validates "option range", :max_len, 0..( 2 ** 16 - 1 )
55
+
56
+ it_validates "option is within range", :port_number, 0..( 2 ** 16 - 1 )
54
57
  end
55
58
 
56
- context "when sending a Flow Mod with SendOutPort action" do
57
- it "should insert a new flow entry with action (output:1)" do
58
- class TestController < Controller; end
59
- network {
60
- vswitch { datapath_id 0xabc }
61
- }.run( TestController ) {
62
- controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => SendOutPort.new( 1 ) )
63
- sleep 2
64
- vswitch( "0xabc" ).should have( 1 ).flows
65
- vswitch( "0xabc" ).flows[ 0 ].actions.should == "output:1"
66
- }
59
+
60
+ describe "#new(:port_number => value)" do
61
+ subject { SendOutPort.new( :port_number => port_number ) }
62
+
63
+
64
+ context "with option (:port_number => 1)" do
65
+ let( :port_number ) { 1 }
66
+
67
+ its( :port_number ) { should eq( 1 ) }
68
+ its( :max_len ) { should eq( 2 ** 16 - 1 ) }
69
+ its( :to_s ) { should eq( "SendOutPort: port_number=1, max_len=65535" ) }
67
70
  end
68
71
  end
69
72
 
70
- context "when sending a Flow Mod with multiple SendOutPort actions" do
71
- it "should insert a new flow entry with actions (output:1\/output:2)" do
72
- class TestController < Controller; end
73
- network {
74
- vswitch { datapath_id 0xabc }
75
- }.run( TestController ) {
76
- controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => [ SendOutPort.new( 1 ), SendOutPort.new( 2 ) ] )
77
- sleep 2
78
- vswitch( "0xabc" ).should have( 1 ).flows
79
- vswitch( "0xabc" ).flows[ 0 ].actions.should match( /output:1\/output:2/ )
80
- }
73
+
74
+ describe "#new(:port_number => value1, :max_len => value2)" do
75
+ subject { SendOutPort.new( options ) }
76
+
77
+
78
+ context "with options (:port_number => 1, :max_len => 256)" do
79
+ let( :options ) { { :port_number => 1, :max_len => 256 } }
80
+
81
+ its( :port_number ) { should eq( 1 ) }
82
+ its( :max_len ) { should eq( 256 ) }
83
+ its( :to_s ) { should eq( "SendOutPort: port_number=1, max_len=256" ) }
84
+ end
85
+
86
+
87
+ context "with options (:port_number => 1, :max_len => max_len)" do
88
+ let( :options ) { { :port_number => 1, :max_len => max_len } }
89
+
90
+ it_validates "option is within range", :max_len, 0..( 2 ** 16 - 1 )
81
91
  end
82
92
  end
83
93
  end
@@ -59,8 +59,8 @@ describe SetConfig, ".new( VALID OPTIONS )" do
59
59
  vswitch { datapath_id 0xabc }
60
60
  }.run( SetConfigController ) {
61
61
  controller( "SetConfigController" ).should_receive( :get_config_reply ) do | dpid, arg |
62
- arg.flags.should == 0
63
- arg.miss_send_len.should == 0
62
+ expect( arg.flags ).to eq( 0 )
63
+ expect( arg.miss_send_len ).to eq( 0 )
64
64
  end
65
65
  set_config = SetConfig.new( :flags => 0, :miss_send_len => 0, :transaction_id => 123 )
66
66
  controller( "SetConfigController" ).send_message( 0xabc, set_config )
@@ -51,7 +51,7 @@ describe SetEthDstAddr, ".new( mac_address )", :type => "actions" do
51
51
  it { expect { subject }.to raise_error( TypeError ) }
52
52
  end
53
53
 
54
- it_validates "option range", :mac_address, 0..0xffffffffffff
54
+ it_validates "option is within range", :mac_address, 0..0xffffffffffff
55
55
 
56
56
  context "when sending a Flow Mod with action set to SetEthDstAddr" do
57
57
  let( :mac_address ) { "52:54:00:a8:ad:8c" }
@@ -63,8 +63,8 @@ describe SetEthDstAddr, ".new( mac_address )", :type => "actions" do
63
63
  }.run( TestController ) {
64
64
  controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
65
65
  sleep 2
66
- vswitch( "0xabc" ).should have( 1 ).flows
67
- vswitch( "0xabc" ).flows[ 0 ].actions.should == "mod_dl_dst:52:54:00:a8:ad:8c"
66
+ expect( vswitch( "0xabc" ) ).to have( 1 ).flows
67
+ expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_dl_dst:52:54:00:a8:ad:8c" )
68
68
  }
69
69
  end
70
70
  end
@@ -51,7 +51,7 @@ describe SetEthSrcAddr, ".new( mac_address )", :type => "actions" do
51
51
  it { expect { subject }.to raise_error( TypeError ) }
52
52
  end
53
53
 
54
- it_validates "option range", :mac_address, 0..0xffffffffffff
54
+ it_validates "option is within range", :mac_address, 0..0xffffffffffff
55
55
 
56
56
  context "when sending a Flow Mod with action set to SetEthSrcAddr" do
57
57
  let( :mac_address ) { "52:54:00:a8:ad:8c" }
@@ -63,8 +63,8 @@ describe SetEthSrcAddr, ".new( mac_address )", :type => "actions" do
63
63
  }.run( TestController ) {
64
64
  controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
65
65
  sleep 2
66
- vswitch( "0xabc" ).should have( 1 ).flows
67
- vswitch( "0xabc" ).flows[ 0 ].actions.should == "mod_dl_src:52:54:00:a8:ad:8c"
66
+ expect( vswitch( "0xabc" ) ).to have( 1 ).flows
67
+ expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_dl_src:52:54:00:a8:ad:8c" )
68
68
  }
69
69
  end
70
70
  end
@@ -20,32 +20,36 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
20
20
  require "trema"
21
21
 
22
22
 
23
- describe SetIpDstAddr, ".new(ip_address)" do
23
+ describe SetIpDstAddr, ".new(ip_address)", :type => "actions" do
24
24
  subject { SetIpDstAddr.new( ip_address ) }
25
25
 
26
- context %{when "192.168.1.1"} do
26
+ context %{with ip_address ("192.168.1.1")} do
27
27
  let( :ip_address ) { "192.168.1.1" }
28
- its( :ip_address ) { should == IPAddr.new( "192.168.1.1" ) }
28
+ its( "ip_address.to_s" ) { should == "192.168.1.1" }
29
29
  end
30
- end
31
30
 
31
+ context %{with invalid ip_address ("192.168.1")} do
32
+ let( :ip_address ) { "192.168.1" }
33
+ it { expect { subject }.to raise_error( ArgumentError ) }
34
+ end
32
35
 
33
- describe ActionSetTpDst, ".new( array )" do
34
- it { expect { ActionSetTpDst.new( [ 1, 2, 3 ] ) }.to raise_error( TypeError ) }
35
- end
36
+ context "with invalid ip_address ([1, 2, 3])" do
37
+ let( :ip_address ) { [ 1, 2, 3 ] }
38
+ it { expect { subject }.to raise_error( TypeError ) }
39
+ end
36
40
 
41
+ context "when sending a Flow Mod with SetIpDstAddr" do
42
+ let( :ip_address ) { "192.168.1.1" }
37
43
 
38
- describe SetIpDstAddr, ".new( VALID OPTION )" do
39
- context "when sending #flow_mod(add) with action set to mod_nw_dst" do
40
- it "should have a flow with action set to mod_nw_dst" do
41
- class FlowModAddController < Controller; end
44
+ it "should insert a flow entry with action (mod_nw_dst:192.168.1.1)" do
45
+ class TestController < Controller; end
42
46
  network {
43
47
  vswitch { datapath_id 0xabc }
44
- }.run( FlowModAddController ) {
45
- controller( "FlowModAddController" ).send_flow_mod_add( 0xabc, :actions => SetIpDstAddr.new( "192.168.1.1" ) )
46
- sleep 2 # FIXME: wait to send_flow_mod_add
47
- vswitch( "0xabc" ).should have( 1 ).flows
48
- vswitch( "0xabc" ).flows[0].actions.should match( /mod_nw_dst:192.168.1.1/ )
48
+ }.run( TestController ) {
49
+ controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
50
+ sleep 2
51
+ expect( vswitch( "0xabc" ) ).to have( 1 ).flows
52
+ expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_nw_dst:192.168.1.1" )
49
53
  }
50
54
  end
51
55
  end
@@ -20,32 +20,36 @@ require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
20
20
  require "trema"
21
21
 
22
22
 
23
- describe SetIpSrcAddr, ".new(ip_address)" do
23
+ describe SetIpSrcAddr, ".new(ip_address)", :type => "actions" do
24
24
  subject { SetIpSrcAddr.new( ip_address ) }
25
25
 
26
- context %{when "192.168.1.1"} do
26
+ context %{with ip_address ("192.168.1.1")} do
27
27
  let( :ip_address ) { "192.168.1.1" }
28
- its( :ip_address ) { should == IPAddr.new( "192.168.1.1" ) }
28
+ its( "ip_address.to_s" ) { should == "192.168.1.1" }
29
29
  end
30
- end
31
30
 
31
+ context %{with invalid ip_address ("192.168.1")} do
32
+ let( :ip_address ) { "192.168.1" }
33
+ it { expect { subject }.to raise_error( ArgumentError ) }
34
+ end
32
35
 
33
- describe ActionSetTpSrc, ".new( array )" do
34
- it { expect { ActionSetTpSrc.new( [ 1, 2, 3 ] ) }.to raise_error( TypeError ) }
35
- end
36
+ context "with invalid ip_address ([1, 2, 3])" do
37
+ let( :ip_address ) { [ 1, 2, 3 ] }
38
+ it { expect { subject }.to raise_error( TypeError ) }
39
+ end
36
40
 
41
+ context "when sending a Flow Mod with SetIpSrcAddr" do
42
+ let( :ip_address ) { "192.168.1.1" }
37
43
 
38
- describe SetIpSrcAddr, ".new( VALID OPTION )" do
39
- context "when sending #flow_mod(add) with action set to mod_nw_src" do
40
- it "should have a flow with action set to mod_nw_src" do
41
- class FlowModAddController < Controller; end
44
+ it "should insert a flow entry with action (mod_nw_src:192.168.1.1)" do
45
+ class TestController < Controller; end
42
46
  network {
43
47
  vswitch { datapath_id 0xabc }
44
- }.run( FlowModAddController ) {
45
- controller( "FlowModAddController" ).send_flow_mod_add( 0xabc, :actions => SetIpSrcAddr.new( "192.168.1.1" ) )
46
- sleep 2 # FIXME: wait to send_flow_mod_add
47
- vswitch( "0xabc" ).should have( 1 ).flows
48
- vswitch( "0xabc" ).flows[0].actions.should match( /mod_nw_src:192.168.1.1/ )
48
+ }.run( TestController ) {
49
+ controller( "TestController" ).send_flow_mod_add( 0xabc, :actions => subject )
50
+ sleep 2
51
+ expect( vswitch( "0xabc" ) ).to have( 1 ).flows
52
+ expect( vswitch( "0xabc" ).flows[ 0 ].actions ).to eq( "mod_nw_src:192.168.1.1" )
49
53
  }
50
54
  end
51
55
  end