static void test_set_config( void **state ) { UNUSED( state ); const uint32_t transaction_id = TRANSACTION_ID; uint16_t flags = OFPC_FRAG_NORMAL; const uint16_t miss_send_len = OFP_DEFAULT_MISS_SEND_LEN; _handle_set_config( transaction_id, flags, miss_send_len, NULL ); expect_value( mock_switch_send_openflow_message, buffer->length, sizeof( struct ofp_switch_config ) ); expect_value( mock_switch_send_openflow_message, ( ( struct ofp_switch_config * ) buffer->data )->flags, ntohs( flags ) ); _handle_get_config_request( transaction_id, NULL ); struct ofp_switch_config config; get_switch_config( &config ); assert_int_equal( config.flags, flags ); assert_int_equal( config.miss_send_len, miss_send_len ); }
static void _handle_get_config_request( const uint32_t transaction_id, void * user_data ) { UNUSED( user_data ); switch_config config; memset( &config, 0, sizeof( switch_config ) ); OFDPE ret = get_switch_config( &config ); if ( ret != OFDPE_SUCCESS ) { uint16_t type = OFPET_BAD_REQUEST; uint16_t code = OFPBRC_EPERM; get_ofp_error( ret, &type, &code ); send_error_message( transaction_id, type, code ); } buffer *get_config_reply = create_get_config_reply( transaction_id, config.flags, config.miss_send_len ); switch_send_openflow_message( get_config_reply ); free_buffer( get_config_reply ); }