コード例 #1
0
void
test_group_mod_handle_delete_error(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  /* only header, no data */
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 08 00 00 00 10");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "no body error.");
  /* no type, pad, group_id, buckets */
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 0a 00 00 00 10 00 02");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "invalid body error.");
  /* no pad, group_id, buckets */
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 0b 00 00 00 10 00 02 00");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "invalid body error.");
  /* no group_id, buckets */
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 0c 00 00 00 10 00 02 00 00");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "invalid body error.");
}
コード例 #2
0
void
test_group_mod_handle_invalid_buckets(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  /* no weight, watch_port, watch_group, pad, actions */
  ret = check_packet_parse(ofp_group_mod_handle_wrap,
                           "04 0f 00 1c 00 00 00 10 00 01 00 00 ff ff ff 00 "
                           "00 02");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "parse buckets error.");
  /* no watch_port, watch_group, pad, actions */
  ret = check_packet_parse(ofp_group_mod_handle_wrap,
                           "04 0f 00 1c 00 00 00 10 00 01 00 00 ff ff ff 00 "
                           "00 04 00 02");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "parse buckets error.");
  /* no watch_group, pad, actions */
  ret = check_packet_parse(ofp_group_mod_handle_wrap,
                           "04 0f 00 18 00 00 00 10 00 01 00 00 ff ff ff 00 "
                           "00 08 00 02 00 00 00 03");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "parse buckets error.");
  /* no pad, actions */
  ret = check_packet_parse(ofp_group_mod_handle_wrap,
                           "04 0f 00 1c 00 00 00 10 00 01 00 00 ff ff ff 00 "
                           "00 0c 00 02 00 00 00 03 00 00 00 04");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "parse buckets error.");
}
コード例 #3
0
void
test_ofp_get_async_request_handle(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          s_ofp_get_async_request_handle_wrap,
          "04 1C 00 20 00 00 00 10 "
          /* <--------------------... ofp_async_config
           * <--------------------->  ofp_header
           * <> version
           *    <> type
           *       <---> length
           *             <---------> xid
           */
          "00 00 00 00 00 00 00 00 "
          /*...--------------------.. ofp_async_config
           * <---------------------> packet_in_mask[2]
           */
          "00 00 00 00 00 00 00 00 "
          /*...--------------------.. ofp_async_config
           * <---------------------> port_status_mask[2]
           */
          "00 00 00 00 00 00 00 00 "
          /*...-------------------->  ofp_async_config
           * <---------------------> flow_removed_mask[2]
           */
        );

  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_get_async_request_handle(normal) error.");
}
コード例 #4
0
void
test_ofp_role_request_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          s_ofp_role_request_handle_wrap,
          "04 19 00 18 00 00 00 10 "
          /* <--------------------... ofp_role_request
           * <---------------------> ofp_header
           * <> version
           *    <> type
           *       <---> length
           *             <---------> xid
           */
          "00 00 00 03 00 00 00 00 "
          /*...-------------------... ofp_role_request
           * <---------> role = 3 -> OFPCR_ROLE_SLAVE
           *             <---------> padding
           */
          "00 00 00 00 00 00 00 00 ");
  /*...-------------------->  ofp_role_request
   * <---------------------> generation_id = 0
   */

  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_role_request_handle(normal) error.");
}
コード例 #5
0
void
test_ofp_port_mod_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          ofp_port_mod_handle_wrap,
          "04 10 00 28 00 00 00 10 00 00 00 00 00 00 00 00 "
          /* <---------------------------------------------... ofp_port_mod
           * <---------------------> ofp_header
           * <> version
           *    <> type
           *       <---> lenght = 5 * 8 bytes
           *             <--------> xid
           *                         <---------> port_no
           *                                     <---------> padding
           */
          "ff ff ff ff ff ff 00 00 00 00 00 24 00 00 00 24 "
          /* ...-------------------------------------------... ofp_port_mod
           * <---------------> hw_addr
           *                   <---> padding
           *                         <---------> config
           *                                     <---------> mask
           */
          "00 00 00 05 00 00 00 00");
  /* ...-------------------> ofp_port_mod
   * <---------> advertise ( OFPPF_10MB_HD | OFPPF_100MB_HD)
   *             <--------> padding
   */

  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_port_mod_handle(normal) error.");
}
コード例 #6
0
void
test_ofp_get_config_handle(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(s_ofp_get_config_request_handle_wrap,
                           "04 07 00 08 00 00 00 10");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_get_config_request_handle(normal) error.");
}
コード例 #7
0
void
test_ofp_header_mp_copy(void) {
  /* Not check result.*/
  (void) check_packet_parse(ofp_header_mp_copy_wrap,
                            "04 13 00 12 00 00 00 10"
                            "00 05 00 00 00 00 00 00"
                            "12 34");
}
コード例 #8
0
void
test_ofp_header_handle(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(s_ofp_header_handle_wrap,
                           "04 00 00 08 00 00 00 64");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_header_handle error.");
}
コード例 #9
0
void
test_ofp_echo_reply_handle_normal_pattern(void) {
    lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
    ret = check_packet_parse(s_ofp_echo_reply_handle_wrap,
                             "04 03 00 08 00 00 00 10");
    TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                              "ofp_echo_reply_handle(normal) error.");
}
コード例 #10
0
void
test_ofp_features_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(ofp_features_request_handle,
                           "04 05 00 08 00 00 00 10");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_features_request_handle(normal) error.");
}
コード例 #11
0
/*
 * common
 */
void
test_group_mod_handle_invlaid_command(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 10 00 00 00 10 ff ff 00 00 00 00 00 00");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "invalid command error.");
}
コード例 #12
0
void
test_ofp_error_msg_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(s_ofp_error_msg_handle_wrap,
                           "04 01 00 0c 00 00 00 10"
                           "00 01 00 01");
  TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_OK,
                            "ofp_error_msg_handle(normal) error.");
}
コード例 #13
0
/*
 * add
 */
void
test_group_mod_handle_add_normal_pattern_no_buckets(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 10 00 00 00 10 00 00 00 00 ff ff ff 00");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "add no_buckets error.");
}
コード例 #14
0
void
test_ofp_role_request_handle_no_body(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;

  /* Case of decode error.*/
  ret = check_packet_parse(s_ofp_role_request_handle_wrap, "");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "ofp_role_request_handle(error) error.");
}
コード例 #15
0
void
test_ofp_experimenter_request_handle(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(ofp_experimenter_request_handle_wrap,
                           "04 04 00 10 00 00 00 10"
                           "00 00 00 01 00 00 00 02");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_experimenter_request_handle(normal) error.");
}
コード例 #16
0
void
test_group_mod_handle_delete_with_buckets(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 30 00 00 00 10 00 02 00 00 ff ff ff 00 "
          "00 10 00 02 00 00 00 03 00 00 00 04 00 00 00 00 "
          "00 10 00 06 00 00 00 07 00 00 00 08 00 00 00 00");
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OFP_ERROR, ret,
                            "delete no_actions error.");
}
コード例 #17
0
void
test_ofp_group_features_request_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;

  ret = check_packet_parse(ofp_multipart_request_handle_wrap,
                           "04 12 00 10 00 00 00 10"
                           "00 08 00 00 00 00 00 00");
  /* The request body is empty. */
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_group_features_request_handle(normal) error.");
}
コード例 #18
0
void
test_ofp_port_stats_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(ofp_multipart_request_handle_wrap,
                           "04 12 00 40 00 00 00 10 "
                           "00 04 00 00 00 00 00 00 "
                           // body
                           "00 00 00 00 "             /* uint32_t port_no;     */
                           "00 00 00 00 "             /* uint8_t  pad[4];      */
                          );
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_port_request_handle(normal) error.");
}
コード例 #19
0
void
test_ofp_set_config_handle_invalid_miss_send_len_no_buf(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          s_ofp_set_config_request_handle_wrap,
          "04 09 00 0c 00 00 00 10"
          "00 01 ff ff");
  /*
   *         <---> miss_send_len > OFPCML_NO_BUFFER
   */
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "miss send len - no buf error.");
}
コード例 #20
0
void
test_ofp_group_stats_request_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(ofp_multipart_request_handle_wrap,
                           "04 12 00 18 00 00 00 10"
                           "00 06 00 00 00 00 00 00"
                           "00 00 00 01 00 00 00 00");
  /* <---------> group_id
   *             <---------> pad
   */
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_group_stats_request_handle(normal) error.");
}
コード例 #21
0
void
test_ofp_set_config_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          s_ofp_set_config_request_handle_wrap,
          "04 09 00 0c 00 00 00 10"
          "00 01 ff e4");
  /*
   *   <---> flags
   *         <---> miss_send_len
   */
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_get_config_request_handle(normal) error.");
}
コード例 #22
0
void
test_ofp_queue_get_config_handle_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          s_ofp_queue_get_config_request_handle_wrap,
          "04 16 00 10 00 00 00 10 ff ff ff ff 00 00 00 00");
  /* <---------------------> ofp_header
   * <> version
   *    <> type
   *       <---> length
   *             <---------> xid
   *                         <---------> port 0xffffffff -> OFPP_ANY
   *                                     <----------> padding
   */
  TEST_ASSERT_EQUAL_MESSAGE(
    LAGOPUS_RESULT_OK, ret,
    "ofp_queue_get_config_request_handle(normal) error.");
}
コード例 #23
0
void
test_ofp_flow_handle(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(ofp_multipart_request_handle_wrap,
                           "04 12 00 40 00 00 00 10 00 01 00 00 00 00 00 00 "
                           /* <--------------------------------------------->  ofp_multipart_request
                            * <---------------------> ofp_header
                            * <> version
                            *    <> type
                            *       <---> length
                            *             <---------> xid
                            *                         <---> type = 2
                            *                               <---> flags
                            *                                     <---------> padding
                            */
                           "01 00 00 00 00 00 00 02 00 00 00 03 00 00 00 00 "
                           /* <--------------------------------------------... ofp_flow_stats_request
                            * <> table_id
                            *    <------> pad
                            *             <---------> out_port
                            *                         <---------> out_group
                            *                                     <---------> pad2
                            */
                           "00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 05 "
                           /* <---------------------> cookie
                            *                         <---------------------> cookie_mask
                            */
                           "00 01 00 0c 80 00 00 04 00 00 00 10 00 00 00 00");
  /* <---------------------------------------------> ofp_match
   * <---> type = 1 OXM match
   *       <---> length = 12
   *             <---------> OXM TLV header (oxm_class = 0x8000
   *                                          -> OFPXMC_OPENFLOW_BASIC
   *                                         oxm_field = 0
   *                                          -> OFPXMT_OFB_IN_PORT,
   *                                         oxm_hashmask = 0,
   *                                         oxm_length = 8)
   *                         <---------> OXML TLV payload ( value = 1)
   *                                     <---------> padding
   */
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_flow_request_handle(normal) error.");
}
コード例 #24
0
void
test_ofp_table_mod_handle_wrap(void) {
    lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
    ret = check_packet_parse(
              ofp_table_mod_handle_wrap,
              "04 11 00 10 00 00 00 10 01 00 00 00 00 00 00 03");
    /*
     * <---------------------> ofp_header
     * <> version
     *    <> type
     *       <---> length = 16 bytes
     *             <---------> xid
     *                         <> table_id
     *                            <------> padding
     *                                     <----------> config
     */
    TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                              "ofp_table_mod_handle(normal) error.");
}
コード例 #25
0
void
test_ofp_table_stats_handle(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(ofp_multipart_request_handle_wrap,
                           "04 12 00 10 00 00 00 10 "
                           /* <-----------------... ofp_multipart_request
                            * <---------------------> ofp_header
                            * <> version
                            *    <> type
                            *       <---> length
                            *             <---------> xid
                            */
                           "00 03 00 00 00 00 00 00 ");
  /* <---------------------> ofp_header
   * <---> type = 2
   *       <---> flags
   *             <---------> padding
   */
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "ofp_table_stats_request_handle(normal) error.");
}
コード例 #26
0
void
test_group_mod_handle_add_normal_pattern(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  ret = check_packet_parse(
          ofp_group_mod_handle_wrap,
          "04 0f 00 80 00 00 00 10 00 00 00 00 ff ff ff 00 "
          /* <----------------------------------------------... ofp_group_mod
           * <---------------------> ofp_header
           * <> version
           *    <> type
           *       <---> length = 8 * 16 bytes
           *             <---------> xid
           *                         <---> command ( 0 -> OFPGC_ADD
           *                               <> type ( 0 -> OFPGT_ALL
           *                                  <> padding
           *                                     <---------> group id = 0xffffff00
           */
          "00 30 00 02 00 00 00 03 00 00 00 04 00 00 00 00 "
          /* <----------------------------------------------.. ofp_bucket[0]
           * <---> len = 3 * 16 bytes
           *       <---> weight = 2
           *             <---------> watch_port = 3
           *                         <---------> watch_group = 4
           *                                     <---------> padding
           */
          "00 00 00 10 00 00 00 0a 03 e8 00 00 00 00 00 00 "
          /* ...--------------------------------------------.. ofp_bucket[0]
           * <---------------------> ofp_action_output
           * <---> type = 0 ( 0 -> AFPAT_OUTPUT
           *       <---> length = 1 * 16 bytes
           *             <---------> port = 10
           *                         <---> max_len = 0x3e8
           *                               <---------------> padding
           */
          "00 00 00 10 00 00 00 14 07 d0 00 00 00 00 00 00 "
          /* ...------------------------------------------->   ofp_bucket[0]
           * <---------------------> ofp_action_output
           * <---> type = 0 ( 0 -> AFPAT_OUTPUT
           *       <---> length = 1 * 16 bytes
           *             <---------> port = 20
           *                         <---> max_len = 0x07d0
           *                               <---------------> padding
           */
          "00 30 00 06 00 00 00 07 00 00 00 08 00 00 00 00 "
          /* <----------------------------------------------.. ofp_bucket[1]
           * <---> len = 3 * 16 bytes
           *       <---> weight = 6
           *             <---------> watch_port = 7
           *                         <---------> watch_group = 8
           *                                     <---------> padding
           */
          "00 00 00 10 00 00 00 0a 03 e8 00 00 00 00 00 00 "
          /* ...-------------------------------------------... ofp_bucket[1]
           * <---------------------> ofp_action_output
           * <---> type = 0 ( 0 -> AFPAT_OUTPUT
           *       <---> length = 1 * 16 bytes
           *             <---------> port = 10
           *                         <---> max_len = 0x03e8
           *                               <---------------> padding
           */
          "00 00 00 10 00 00 00 14 07 d0 00 00 00 00 00 00 "
          /* ...------------------------------------------->   ofp_bucket[1]
           * <---------------------> ofp_action_output
           * <---> type = 0 ( 0 -> AFPAT_OUTPUT
           *       <---> length = 1 * 16 bytes
           *             <---------> port = 20
           *                         <---> max_len = 0x07d0
           *                               <---------------> padding
           */
          "00 10 00 02 00 00 00 03 00 00 00 04 00 00 00 00"
          /* <--------------------------------------------->   ofp_bucket[2]
           * <---> len = 1 * 16 bytes
           *       <---> weight = 2
           *             <---------> watch_port = 3
           *                         <---------> watch_group = 4
           *                                     <---------> padding
           */
        );
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_OK, ret,
                            "add error.");
}