Commit e62448d3 authored by winckel's avatar winckel

Added a HSS connection test in MME before accepting eNB association request.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4919 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 326f508e
......@@ -218,8 +218,13 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
{
S1ap_S1SetupFailureIEs_t *s1_setup_failure_p;
s1ap_eNB_mme_data_t *mme_desc_p;
DevAssert(message_p != NULL);
s1_setup_failure_p = &message_p->msg.s1ap_S1SetupFailureIEs;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */
if (stream != 0) {
S1AP_WARN("[SCTP %d] Received s1 setup failure on stream != 0 (%d)\n",
......@@ -232,7 +237,12 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
return -1;
}
if ((s1_setup_failure_p->cause.present == S1ap_Cause_PR_misc) &&
(s1_setup_failure_p->cause.choice.misc == S1ap_CauseMisc_unspecified)) {
S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n");
} else {
S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n");
}
mme_desc_p->state = S1AP_ENB_STATE_WAITING;
s1ap_handle_s1_setup_message(mme_desc_p, 0);
......
......@@ -62,8 +62,11 @@
#if !defined(MME_CLIENT_TEST)
// static pthread_t s1ap_task_thread;
int hss_associated = 0;
uint32_t nb_eNB_associated = 0;
STAILQ_HEAD(eNB_list_s, eNB_description_s) eNB_list_head;
STAILQ_HEAD(eNB_list_s, eNB_description_s)
eNB_list_head;
static int indent = 0;
void *s1ap_mme_thread(void *args);
......@@ -103,6 +106,10 @@ void *s1ap_mme_thread(void *args)
switch (ITTI_MSG_ID(received_message_p))
{
case ACTIVATE_MESSAGE: {
hss_associated = 1;
} break;
case SCTP_DATA_IND: {
/* New message received from SCTP layer.
* Decode and handle it.
......
......@@ -111,6 +111,7 @@ typedef struct eNB_description_s {
/*@}*/
} eNB_description_t;
extern int hss_associated;
extern uint32_t nb_eNB_associated;
extern mme_config_t *global_mme_config_p;
......
......@@ -217,6 +217,8 @@ int s1ap_mme_generate_s1_setup_failure(
int s1ap_mme_handle_s1_setup_request(uint32_t assoc_id, uint32_t stream,
struct s1ap_message_s *message)
{
if (hss_associated)
{
S1ap_S1SetupRequestIEs_t *s1SetupRequest_p;
eNB_description_t *eNB_association;
uint32_t eNB_id = 0;
......@@ -327,14 +329,19 @@ int s1ap_mme_handle_s1_setup_request(uint32_t assoc_id, uint32_t stream,
S1AP_DEBUG("Rejeting s1 setup request as eNB id %d is already associated to an active sctp association"
"Previous known: %d, new one: %d\n",
eNB_id, eNB_association->sctp_assoc_id, assoc_id);
// s1ap_mme_encode_s1setupfailure(&s1SetupFailure,
// receivedMessage->msg.s1ap_sctp_new_msg_ind.assocId);
// s1ap_mme_encode_s1setupfailure(&s1SetupFailure,
// receivedMessage->msg.s1ap_sctp_new_msg_ind.assocId);
return -1;
}
/* TODO: call the reset procedure */
}
s1ap_dump_eNB(eNB_association);
return s1ap_generate_s1_setup_response(eNB_association);
} else {
/* Can not process the request, MME is not connected to HSS */
return s1ap_mme_generate_s1_setup_failure(assoc_id, S1ap_Cause_PR_misc,
S1ap_CauseMisc_unspecified, -1);
}
}
static
......
......@@ -50,8 +50,15 @@ void s6a_peer_connected_cb(struct peer_info *info, void *arg)
if (info == NULL) {
S6A_ERROR("Failed to connect to HSS entity\n");
} else {
MessageDef *message_p;
S6A_DEBUG("Peer %*s is now connected...\n",
(int)info->pi_diamidlen, info->pi_diamid);
/* Inform S1AP that connection to HSS is established */
message_p = itti_alloc_new_message(TASK_S6A, ACTIVATE_MESSAGE);
itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
/* For test */
......
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