void test_ofp_queue_get_config_reply_create(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; /* OFPP_ANY */ s_port = 0xffffffff; ret = check_packet_create( s_ofp_queue_get_config_reply_create_wrap, "04 17 00 10 00 00 00 10 ff ff ff ff 00 00 00 00"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "create ofpp_any error."); /* OFPP_FLOOD */ s_port = 0xfffffffb; ret = check_packet_create( s_ofp_queue_get_config_reply_create_wrap, "04 17 00 10 00 00 00 10 ff ff ff fb 00 00 00 00"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "create ofpp_flood error."); /* port 0 */ s_port = 0x00000000; ret = check_packet_create( s_ofp_queue_get_config_reply_create_wrap, "04 17 00 10 00 00 00 10 00 00 00 00 00 00 00 00"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "create port 0 error."); }
void test_ofp_get_config_reply_create(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; s_switch_config.flags = 0x0000; s_switch_config.miss_send_len = 0x0000; ret = check_packet_create(s_ofp_get_config_reply_create_wrap, "04 08 00 0c 00 00 00 10 00 00 00 00"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "ofp_get_config_reply_create(normal) error."); s_switch_config.flags = 0xffff; s_switch_config.miss_send_len = 0xffff; ret = check_packet_create(s_ofp_get_config_reply_create_wrap, "04 08 00 0c 00 00 00 10 ff ff ff ff"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "ofp_get_config_reply_create(normal) error."); }
void test_ofp_echo_reply_create(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; ret = check_packet_create(ofp_echo_reply_create_wrap, "04 03 00 08 00 00 00 10"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "ofp_echo_reply_create(normal) error."); }
void test_ofp_barrier_reply_create(void) { lagopus_result_t ret; ret = check_packet_create(ofp_barrier_reply_create_wrap, "04 15 00 08 12 34 56 78"); TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_OK, "ofp_ofp_barrier_reply_create_create error."); }
void test_ofp_header_create_error(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; s_type = OFPT_ECHO_REQUEST; s_plen = 0x06; ret = check_packet_create(s_ofp_header_create_wrap, "04 00 00 08 00 00"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OUT_OF_RANGE, ret, "ofp_header_create error."); }
void test_ofp_features_reply_create(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; ret = check_packet_create(s_ofp_features_reply_create_wrap, "04 06 00 20 00 00 00 10" "00 00 00 00 00 00 0a bc" "00 00 ff ff ff 00 00 00" "00 00 00 4f 00 00 00 00"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "ofp_features_reply_create(normal) error."); }
void test_ofp_meter_band_stats_list_encode_band_stats_list_empty(void) { lagopus_result_t ret; band_stats_num = 0; ret = check_packet_create(ofp_meter_band_stats_list_encode_wrap, ""); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "ofp_meter_band_stats_list_encode(band_stats_list empty) error."); }
void test_ofp_get_async_reply_create(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; ret = check_packet_create(s_ofp_get_async_reply_create_wrap, "04 1B 00 20 00 00 00 10 " "ff ff ff ff ff ff ff ff " "ff ff ff ff ff ff ff ff " "ff ff ff ff ff ff ff ff "); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "ofp_get_async_reply_create(normal) error."); }
void test_ofp_error_msg_create(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; ofp_error.type = OFPET_HELLO_FAILED; ofp_error.code = OFPHFC_EPERM; ofp_error.str = "TEST"; ret = check_packet_create(s_ofp_error_msg_create_wrap, "04 01 00 11 00 00 00 10" "00 00 00 01 54 45 53 54" "00"); TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_OK, "ofp_error_msg_handle(normal) error."); }
void test_ofp_get_async_reply_create_error(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; s_is_invalid_argument = true; /* Case of invalid argument.*/ ret = check_packet_create(s_ofp_get_async_reply_create_wrap_error, "04 1B 00 20 00 00 00 10 " "00 00 00 00 00 00 00 00 " "00 00 00 00 00 00 00 00 " "00 00 00 00 00 00 00 00 "); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret, "ofp_get_async_reply_create(error) error."); }
void test_ofp_meter_band_stats_list_encode(void) { lagopus_result_t ret; band_stats_num = 2; ret = check_packet_create(ofp_meter_band_stats_list_encode_wrap, "00 00 00 00 00 00 00 01" "00 00 00 00 00 00 00 02" "00 00 00 00 00 00 00 02" "00 00 00 00 00 00 00 03"); TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret, "ofp_meter_band_stats_list_encode(normal) error."); }
void test_ofp_flow_removed_create(void) { lagopus_result_t ret; /* version, length, xid and buffer_id is 0. */ ret = check_packet_create(ofp_flow_removed_create_wrap, "00 0b 00 00 00 00 00 00" "00 00 00 00 00 00 00 12" "00 34 02 30" "00 00 00 56 00 00 00 78" "00 90 00 23" "00 00 00 00 00 00 00 45" "00 00 00 00 00 00 00 67" "00 01 00 16" "80 00 00 04 00 00 00 10" "80 00 08 06 00 0c 29 7a 90 b3 00 00"); TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_OK, "ofp_packet_in_create error."); }
void test_ofp_error_msg_create_failed_request(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; uint8_t req[] = {0x01, 0x02, 0x03}; size_t req_len = 3; struct pbuf *pbuf; /* create failed request data. */ pbuf = pbuf_alloc(req_len); memcpy(pbuf->data, req, req_len); pbuf->putp += req_len; pbuf->plen = req_len; ofp_error.type = OFPET_BAD_REQUEST; ofp_error.code = OFPBRC_BAD_TYPE; ofp_error.req = pbuf; ret = check_packet_create(s_ofp_error_msg_create_wrap, "04 01 00 0f 00 00 00 10" "00 01 00 01 01 02 03"); TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_OK, "ofp_error_msg_handle(failed_request) error."); pbuf_free(pbuf); }