Exemplo n.º 1
0
:: import of_g
:: from loxi_utils import loxi_utils
:: from loxi_front_end import type_maps

/**
 * Test message validator
 *
 * Run the message validator on corrupt messages to ensure it catches them.
 */

#include "loci_log.h"

#include <locitest/test_common.h>
#include <loci/loci_validator.h>

static int
test_validate_fixed_length(void)
{
    of_table_stats_request_t *obj = of_table_stats_request_new(OF_VERSION_1_0);
    of_message_t msg = OF_OBJECT_TO_MESSAGE(obj);

    TEST_ASSERT(of_validate_message(msg, of_message_length_get(msg)) == 0);

    of_message_length_set(msg, of_message_length_get(msg) - 1);
    TEST_ASSERT(of_validate_message(msg, of_message_length_get(msg)) == -1);

    of_table_stats_request_delete(obj);
    return TEST_PASS;
}
Exemplo n.º 2
0
void
indigo_fwd_table_stats_get(of_table_stats_request_t *request,
                           indigo_cookie_t cookie)
{
    of_table_stats_reply_t *reply;

    AIM_LOG_VERBOSE("table stats get called\n");
    reply = of_table_stats_reply_new(request->version);
    indigo_core_table_stats_get_callback(INDIGO_ERROR_NONE, reply, cookie);
    of_table_stats_request_delete(request);
}
Exemplo n.º 3
0
static int
test_validate_fixed_length(void)
{
    of_table_stats_request_t *obj = of_table_stats_request_new(OF_VERSION_1_0);
    of_message_t msg = OF_OBJECT_TO_MESSAGE(obj);

    TEST_ASSERT(of_validate_message(msg, of_message_length_get(msg)) == 0);

    of_message_length_set(msg, of_message_length_get(msg) - 1);
    TEST_ASSERT(of_validate_message(msg, of_message_length_get(msg)) == -1);

    of_table_stats_request_delete(obj);
    return TEST_PASS;
}