From 7b8c5cea524d5b9d113f17e1aa8893c08a1f596a Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Mon, 23 Apr 2018 17:03:23 +0200
Subject: [PATCH] FlexRAN: handle incoming UE-slice association message

---
 openair2/ENB_APP/flexran_agent_common.c  | 13 +++++++++++++
 openair2/ENB_APP/flexran_agent_common.h  |  8 ++++++++
 openair2/ENB_APP/flexran_agent_handler.c |  2 +-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c
index 1cbf411c65..d08517edea 100644
--- a/openair2/ENB_APP/flexran_agent_common.c
+++ b/openair2/ENB_APP/flexran_agent_common.c
@@ -1123,3 +1123,16 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot
   *msg = NULL;
   return 0;
 }
+
+int flexran_agent_handle_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg)
+{
+  int i;
+  Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
+  Protocol__FlexUeConfigReply *ue_config_reply = input->ue_config_reply_msg;
+
+  for (i = 0; i < ue_config_reply->n_ue_config; i++)
+    prepare_ue_slice_assoc_update(mod_id, ue_config_reply->ue_config[i]);
+
+  *msg = NULL;
+  return 0;
+}
diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h
index 2738a2f3d3..5d78e382d4 100644
--- a/openair2/ENB_APP/flexran_agent_common.h
+++ b/openair2/ENB_APP/flexran_agent_common.h
@@ -174,4 +174,12 @@ err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id);
  * issue another eNB config request message. */
 int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg);
 
+/* Handle a received UE config reply message as an "order" to reconfigure the
+ * association of a UE to a slice.  It does not come as a reconfiguration
+ * message as this is a "structured" ProtoBuf message (as opposed to
+ * "unstructured" YAML). There is no destructor since we do not reply to this
+ * message (yet). Instead, the controller has to issue another eNB config
+ * request message. */
+int flexran_agent_handle_ue_config_reply(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg);
+
 #endif
diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c
index b3025bf769..fa3270696a 100644
--- a/openair2/ENB_APP/flexran_agent_handler.c
+++ b/openair2/ENB_APP/flexran_agent_handler.c
@@ -48,7 +48,7 @@ flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
   {flexran_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/
   {flexran_agent_handle_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/
   {flexran_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/
-  {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/
+  {flexran_agent_handle_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/
   {flexran_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/
   {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/
   {flexran_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/
-- 
GitLab