Commit 1b863637 authored by gauthier's avatar gauthier

Remaining TODO: handle diff MME_UE_S1AP_ID, asn1c compare not tested

parent afa23c82
......@@ -1677,6 +1677,7 @@ add_executable(test_epc_play_scenario
${OPENAIR2_DIR}/COMMON/messages_types.h
${OPENAIR_BIN_DIR}/messages_xml.h
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
......
This diff is collapsed.
This diff is collapsed.
......@@ -286,14 +286,26 @@ const char * const et_chunk_type_cid2str(const sctp_cid_t chunk_type)
const char * const et_error_match2str(const int err)
{
switch (err) {
case -ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE: return "SCTP_CHUNK_TYPE"; break;
case -ET_ERROR_MATCH_PACKET_SCTP_PPID: return "SCTP_PPID"; break;
case -ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID: return "SCTP_ASSOC_ID"; break;
case -ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID: return "SCTP_STREAM_ID"; break;
case -ET_ERROR_MATCH_PACKET_SCTP_SSN: return "SCTP_SSN"; break;
case -ET_ERROR_MATCH_PACKET_S1AP_PRESENT: return "S1AP_PRESENT"; break;
case -ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE: return "S1AP_PROCEDURE_CODE"; break;
case -ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY: return "S1AP_CRITICALITY"; break;
// from asn_compare.h
case COMPARE_ERR_CODE_NO_MATCH: return "CODE_NO_MATCH"; break;
case COMPARE_ERR_CODE_TYPE_MISMATCH: return "TYPE_MISMATCH"; break;
case COMPARE_ERR_CODE_TYPE_ARG_NULL: return "TYPE_ARG_NULL"; break;
case COMPARE_ERR_CODE_VALUE_NULL: return "VALUE_NULL"; break;
case COMPARE_ERR_CODE_VALUE_ARG_NULL: return "VALUE_ARG_NULL"; break;
case COMPARE_ERR_CODE_CHOICE_NUM: return "CHOICE_NUM"; break;
case COMPARE_ERR_CODE_CHOICE_PRESENT: return "CHOICE_PRESENT"; break;
case COMPARE_ERR_CODE_CHOICE_MALFORMED: return "CHOICE_MALFORMED"; break;
case COMPARE_ERR_CODE_SET_MALFORMED: return "SET_MALFORMED"; break;
case COMPARE_ERR_CODE_COLLECTION_NUM_ELEMENTS: return "COLLECTION_NUM_ELEMENTS"; break;
// from play_scenario.h
case ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE: return "SCTP_CHUNK_TYPE"; break;
case ET_ERROR_MATCH_PACKET_SCTP_PPID: return "SCTP_PPID"; break;
case ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID: return "SCTP_ASSOC_ID"; break;
case ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID: return "SCTP_STREAM_ID"; break;
case ET_ERROR_MATCH_PACKET_SCTP_SSN: return "SCTP_SSN"; break;
case ET_ERROR_MATCH_PACKET_S1AP_PRESENT: return "S1AP_PRESENT"; break;
case ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE: return "S1AP_PROCEDURE_CODE"; break;
case ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY: return "S1AP_CRITICALITY"; break;
default:
AssertFatal (0, "ERROR: Unknown match error %d!(TODO handle an1c error codes)\n", err);
}
......@@ -792,9 +804,9 @@ static void et_usage (
fprintf (stdout, "Please report any bug to: %s\n",PACKAGE_BUGREPORT);
fprintf (stdout, "Usage: %s [options]\n\n", argv[0]);
fprintf (stdout, "\n");
fprintf (stdout, "Client options:\n");
fprintf (stdout, "\t-S | --server <server network @> File name (with no path) of a test scenario that has to be replayed (TODO in future?)\n");
fprintf (stdout, "Server options:\n");
//fprintf (stdout, "Client options:\n");
//fprintf (stdout, "\t-S | --server <server network @> File name (with no path) of a test scenario that has to be replayed (TODO in future?)\n");
//fprintf (stdout, "Server options:\n");
fprintf (stdout, "\t-d | --test-dir <dir> Directory where a set of files related to a particular test are located\n");
fprintf (stdout, "\t-c | --enb-conf-file <file> Provide an eNB config file, valid for the testbed\n");
fprintf (stdout, "\t-s | --scenario <file> File name (with no path) of a test scenario that has to be replayed ()\n");
......
......@@ -46,6 +46,7 @@
#include "s1ap_ies_defs.h"
#include "play_scenario_s1ap_eNB_defs.h"
#include "hashtable.h"
#include "asn_compare.h"
// powers of 2
#define ET_BIT_MASK_MATCH_SCTP_STREAM 1
......@@ -179,8 +180,10 @@ typedef enum {
ET_FSM_STATE_END
} et_fsm_state_t;
enum COMPARE_ERR_CODE_e;
typedef enum {
ET_ERROR_MATCH_START = 1,
ET_ERROR_MATCH_START = COMPARE_ERR_CODE_END,
ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE = ET_ERROR_MATCH_START,
ET_ERROR_MATCH_PACKET_SCTP_PPID,
ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID,
......@@ -415,7 +418,8 @@ void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id);
s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance);
void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream);
long et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints);
int et_handle_s1ap_mismatch(et_packet_t * const spacket, et_packet_t * const rx_packet);
asn_comp_rval_t* et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints);
et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind);
int et_scenario_set_packet_received(et_packet_t * const packet);
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const sctp_data_ind);
......@@ -451,10 +455,10 @@ void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t
et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
et_scenario_t* et_generate_scenario(const char * const et_scenario_filename );
//-------------------------
long et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints);
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints);
//-------------------------
long et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints);
long et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints);
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints);
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints);
//------------------------------------------------------------------------------
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num);
int et_is_file_exists ( const char const * file_nameP, const char const *file_roleP);
......
This diff is collapsed.
......@@ -58,9 +58,9 @@ extern et_scenario_t *g_scenario;
extern uint32_t g_constraints;
//------------------------------------------------------------------------------
long et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints)
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints)
{
long ret = 0;
asn_comp_rval_t *ret = NULL;
AssertFatal(m1 != NULL, "bad parameter m1");
AssertFatal(m2 != NULL, "bad parameter m2");
AssertFatal((present == S1AP_PDU_PR_initiatingMessage) ||
......@@ -401,6 +401,8 @@ long et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1,
case S1ap_ProcedureCode_id_PrivateMessage:
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
case S1ap_ProcedureCode_id_MMEConfigurationTransfer:
AssertFatal(0, "TODO");
break;
case S1ap_ProcedureCode_id_CellTrafficTrace:
ret = s1ap_compare_s1ap_celltraffictraceies(
......
......@@ -44,27 +44,36 @@
#include "play_scenario.h"
//------------------------------------------------------------------------------
long et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints)
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints)
{
asn_comp_rval_t *rv = NULL;
// no comparison for ports
if (sctp1->ppid != sctp2->ppid) {
S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid);
return -ET_ERROR_MATCH_PACKET_SCTP_PPID;
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID;
return rv;
}
if (sctp1->assoc_id != sctp2->assoc_id) {
S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id);
return -ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID;
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID;
return rv;
}
if (sctp1->stream != sctp2->stream) {
if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) {
return -ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID;
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID;
return rv;
} else {
S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream);
}
}
if (sctp1->ssn != sctp2->ssn) {
if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
return -ET_ERROR_MATCH_PACKET_SCTP_SSN;
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
return rv;
} else {
S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
}
......@@ -73,10 +82,16 @@ long et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * con
}
//------------------------------------------------------------------------------
long et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints)
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints)
{
// no comparison for ports
if (sctp1->chunk_type != sctp2->chunk_type) return -ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE;
asn_comp_rval_t *rv = NULL;
if (sctp1->chunk_type != sctp2->chunk_type){
S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type);
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE;
return rv;
}
switch (sctp1->chunk_type) {
case SCTP_CID_DATA:
return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints);
......@@ -92,5 +107,5 @@ long et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp
AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type);
}
return 0;
return NULL;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment