spec/trema/openflow-error_spec.rb in trema-0.2.3 vs spec/trema/openflow-error_spec.rb in trema-0.2.4

- old
+ new

@@ -1,8 +1,6 @@ # -# Author: Nick Karanatsios <nickkaranatsios@gmail.com> -# # Copyright (C) 2008-2012 NEC Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. @@ -33,14 +31,14 @@ :hw_addr => Trema::Mac.new( "11:22:33:44:55:66" ), :config => 1, :mask => 1, :advertise => 0 ) - controller( "OpenflowErrorController" ).should_receive( :openflow_error ) do | arg | - arg.datapath_id.should == 0xabc - arg.type.should == Error::OFPET_PORT_MOD_FAILED - arg.code.should == Error::OFPPMFC_BAD_PORT + controller( "OpenflowErrorController" ).should_receive( :openflow_error ) do | datapath_id, message | + datapath_id.should == 0xabc + message.type.should == Error::OFPET_PORT_MOD_FAILED + message.code.should == Error::OFPPMFC_BAD_PORT end controller( "OpenflowErrorController" ).send_message( 0xabc, port_mod ) sleep 2 # FIXME: wait to send_message } end @@ -61,14 +59,14 @@ :hw_addr => Trema::Mac.new( "11:22:33:44:55:66" ), :config => 1, :mask => 1, :advertise => 0 ) - controller( "OpenflowErrorController" ).should_receive( :openflow_error ) do | arg | - arg.datapath_id.should == 0xabc - arg.type.should == Error::OFPET_PORT_MOD_FAILED - arg.code.should == Error::OFPPMFC_BAD_HW_ADDR + controller( "OpenflowErrorController" ).should_receive( :openflow_error ) do | datapath_id, message | + datapath_id.should == 0xabc + message.type.should == Error::OFPET_PORT_MOD_FAILED + message.code.should == Error::OFPPMFC_BAD_HW_ADDR end controller( "OpenflowErrorController" ).send_message( 0xabc, port_mod ) sleep 2 # FIXME: wait to send_message } end @@ -83,14 +81,14 @@ vhost "host1" vhost "host2" link "host1", "error-port" link "host2", "error-port" }.run( OpenflowErrorController ) { - controller( "OpenflowErrorController" ).should_receive( :openflow_error ) do | arg | - arg.datapath_id.should == 0xabc - arg.type.should == Error::OFPET_BAD_ACTION - arg.code.should == Error::OFPBAC_BAD_OUT_PORT + controller( "OpenflowErrorController" ).should_receive( :openflow_error ) do | datapath_id, message | + datapath_id.should == 0xabc + message.type.should == Error::OFPET_BAD_ACTION + message.code.should == Error::OFPBAC_BAD_OUT_PORT end controller( "OpenflowErrorController" ).send_flow_mod_add( 0xabc, :actions => ActionOutput.new( :port => 0x5555 ) ) sleep 2 # FIXME: wait to send_flow_mod_add } end @@ -102,10 +100,10 @@ class OpenflowController < Controller; end network { vswitch( "error-request") { datapath_id 0xabc } }.run( OpenflowController ) { queue_get_config_request = Trema::QueueGetConfigRequest.new( :port => 1 ) - controller( "OpenflowController" ).should_receive( :openflow_error ) do | message | + controller( "OpenflowController" ).should_receive( :openflow_error ) do | datapath_id, message | message.datapath_id.should == 0xabc message.type.should satisfy { | n | n >= 0 && n <= 5 } case message.type