anchor.diff:          _Error ->
               lager:error("...!!! Error in encode of: ~p", [Message])
       end.
  -
  +%%---------------------------------------------------------------------------------
   handle_msg(#ofp_message{ version = Version,
                            body = #ofp_error_msg{type = hello_failed,
                                                  code = incompatible}} = Message,_Socket) ->
       io:format("___hello_failed...\n"),
  -    %% io:format("___new hello version: ~p...\n",[Version]),
  -    %% io:format("___Received message ~p\n", [Message]),
  -    
  -    %% io:format(" resending hello with compatible version ... \n", []),
  -    
  -    
       ok;
   handle_msg(#ofp_message{ body = #ofp_packet_in{buffer_id = _BufferId,
                                                  match     = _Match,
                                                  data      = _Data}} = Message,_Socket) ->
       io:format("___switch entry...\n"),
  -    %% io:format("___Received message ~p\n", [Message]),
       ok;
   handle_msg(Message,_Socket) ->
       io:format("___Received message ~p\n", [Message]),
       ok.
   %%---------------------------------------------------------------------------------
  -
   version_negotiation(Version,StateVersion) when Version == StateVersion ->
       {ok,Version};
   version_negotiation(Version,StateVersion) when Version < StateVersion ->
       {version_down,Version}; %% Controller needs to use lower version, and maybe resend hello ? ...
   version_negotiation(Version,StateVersion) when Version > StateVersion ->
       {version_up,Version}. %% Controller needs to use higer version, and maybe resend hello ? ...
  +
  +
  +%%--- Scenarios ------------------------------------------------------------------------------
  +
  +features_request(Version) ->
  +    message(#ofp_features_request{},Version).
  +
  +echo_request(Version) ->
  +    echo_request(<<>>,Version).
  +echo_request(Data,Version) ->
  +    message(#ofp_echo_request{data = Data},Version).
  +
  +get_config_request(Version) ->
  +    message(#ofp_get_config_request{},Version).
  +
  +barrier_request(Version) ->
  +    message(#ofp_barrier_request{},Version).
  +
  +queue_get_config_request(Version) ->
  +    message(#ofp_queue_get_config_request{port = any},Version).
  +
  +desc_request(Version) ->
  +    message(#ofp_desc_request{},Version).
  +
  +flow_stats_request(Version) ->
  +    message(#ofp_flow_stats_request{table_id = all},Version).
  +
  +flow_stats_request_with_cookie(Cookie,Version) ->
  +    message(#ofp_flow_stats_request{table_id = all,
  +                                    cookie = Cookie,
  +                                    cookie_mask = <<-1:64>>},Version).
  +
  +aggregate_stats_request(Version) ->
  +    message(#ofp_aggregate_stats_request{table_id = all},Version).
  +
  +table_stats_request(Version) ->
  +    message(#ofp_table_stats_request{},Version).
  +
  +port_stats_request(Version) ->
  +    message(#ofp_port_stats_request{port_no = any},Version).
  +
  +queue_stats_request(Version) ->
  +    message(#ofp_queue_stats_request{port_no = any, queue_id = all},Version).
  +
  +group_stats_request(Version) ->
  +    message(#ofp_group_stats_request{group_id = all},Version).
  +
  +group_desc_request(Version) ->
  +    message(#ofp_group_desc_request{},Version).
  +
  +group_features_request(Version) ->
  +    message(#ofp_group_features_request{},Version).
  +
  +remove_all_flows(Version) ->
  +    message(#ofp_flow_mod{command = delete},Version).
  +
  +set_config(Version) ->
  +    message(#ofp_set_config{miss_send_len = no_buffer},Version).
  +
  +group_mod(Version) ->
  +    message(#ofp_group_mod{
  +               command  = add,
  +               type = all,
  +               group_id = 1,
  +               buckets = [#ofp_bucket{
  +                             weight = 1,
  +                             watch_port = 1,
  +                             watch_group = 1,
  +                             actions = [#ofp_action_output{port = 2}]}]},Version).
  +
  +port_mod(Version) ->
  +    message(#ofp_port_mod{port_no = 1,
  +                          hw_addr = <<0,17,0,0,17,17>>,
  +                          config = [],
  +                          mask = [],
  +                          advertise = [fiber]},Version).
  +
  +group_mod_add_bucket_with_output_to_controller(GroupId,Version) ->
  +    message(#ofp_group_mod{
  +               command  = add,
  +               type = all,
  +               group_id = GroupId,
  +               buckets = [#ofp_bucket{
  +                             actions = [#ofp_action_output{port = controller}]}]
  +              },Version).
  +
  +group_mod_modify_bucket(GroupId,Version) ->
  +    message(#ofp_group_mod{
  +               command  = modify,
  +               type = all,
  +               group_id = GroupId,
  +               buckets = [#ofp_bucket{
  +                             actions = [#ofp_action_output{port = 2}]}]
  +              },Version).
  +
  +delete_all_groups(Version) ->
  +    message(#ofp_group_mod{
  +               command = delete,
  +               type = all,
  +               group_id = 16#fffffffc
  +              },Version).
  +
  +port_desc_request(Version) ->
  +    message(#ofp_port_desc_request{},Version).
  +
  +role_request(Version) ->
  +    message(#ofp_role_request{role = nochange, generation_id = 1},Version).
  +
  +flow_mod_table_miss(Version) ->
  +    Action = #ofp_action_output{port = controller},
  +    Instruction = #ofp_instruction_apply_actions{actions = [Action]},
  +    message(#ofp_flow_mod{table_id = 0,
  +                          command = add,
  +                          priority = 0,
  +                          instructions = [Instruction]},Version).
  +
  +flow_mod_delete_all_flows(Version) ->
  +    message(#ofp_flow_mod{table_id = all,
  +                          command = delete},Version).
  +
  +set_async(Version) ->
  +    message(#ofp_set_async{
  +               packet_in_mask = {
  +                 [no_match],
  +                 [action]},
  +               port_status_mask = {
  +                 [add, delete, modify],
  +                 [add, delete, modify]},
  +               flow_removed_mask = {
  +                 [idle_timeout, hard_timeout, delete, group_delete],
  +                 [idle_timeout, hard_timeout, delete, group_delete]
  +                }},Version).
  +
  +get_async_request(Version) ->
  +    message(#ofp_get_async_request{},Version).
  +
  +role_request(Role, GenerationId,Version) ->
  +    message(#ofp_role_request{role = Role, generation_id = GenerationId},Version).
  +
  +flow_add(Opts, Matches, Instructions, Version) ->
  +    message(ofp_v4_utils:flow_add(Opts, Matches, Instructions), Version).
  +
  +table_features_keep_table_0(Version) ->
  +    message(#ofp_table_features_request{
  +               body = [#ofp_table_features{
  +                          table_id = 0,
  +                          name = <<"flow table 0">>,
  +                          metadata_match = <<0:64>>,
  +                          metadata_write = <<0:64>>,
  +                          max_entries = 10,
  +                          properties = [#ofp_table_feature_prop_instructions{}
  +                                        , #ofp_table_feature_prop_next_tables{}
  +                                        , #ofp_table_feature_prop_write_actions{}
  +                                        , #ofp_table_feature_prop_apply_actions{}
  +                                        , #ofp_table_feature_prop_match{}
  +                                        , #ofp_table_feature_prop_wildcards{}
  +                                        , #ofp_table_feature_prop_write_setfield{}
  +                                        , #ofp_table_feature_prop_apply_setfield{}
  +                                       ]}]},Version).
  
positive.code: hello(Version) ->
      message(#ofp_hello{},Version).
  
  echo_request(Version) ->
      echo_request(<<>>,Version).
  echo_request(Data,Version) ->
      message(#ofp_echo_request{data = Data},Version).
  
  role_request(Version) ->
      message(#ofp_role_request{role = nochange, generation_id = 1},Version).
  
  message(Body,Version) ->
      #ofp_message{version = Version,
                   xid     = get_xid(),
  
negative.code: -behaviour(gen_server).
  
  -export([start_link/2, init/1, handle_call/3, handle_cast/2, handle_info/2,terminate/2, code_change/3]).
  -export([do_send/2]).
  
  %% Scenario's
  -export([hello/1,
           echo_request/1,
           echo_request/2,
           features_request/1,
           get_config_request/1,
           barrier_request/1,
           queue_get_config_request/1,
           desc_request/1,
           flow_stats_request/1,
           flow_stats_request_with_cookie/2,
           aggregate_stats_request/1,
           table_stats_request/1,
           port_stats_request/1,
           queue_stats_request/1,
           group_stats_request/1,
           group_desc_request/1,
           group_features_request/1,
           remove_all_flows/1,
           set_config/1,
           group_mod/1,
           port_mod/1,
           group_mod_add_bucket_with_output_to_controller/2,
           group_mod_modify_bucket/2,
           delete_all_groups/1,
           port_desc_request/1,
           role_request/1,
           flow_mod_table_miss/1,
           flow_mod_delete_all_flows/1,
           set_async/1,
           get_async_request/1,
           role_request/3,
           flow_add/4,
           table_features_keep_table_0/1
          ]).
  
  -define(SERVER,?MODULE). 
  -define(STATE,of_driver_connection_state).
  