[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-528] Optimization in RIC subscription procedure
[o-du/l2.git] / src / du_app / du_e2_conversions.c
index 3ee6ca0..d0bbb5b 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "common_def.h"
 #include "TimeToWaitE2.h"
+#include "du_app_mac_inf.h"
+#include "du_e2ap_mgr.h"
 
 /************************************************************************
  *
@@ -65,6 +67,49 @@ uint8_t covertE2WaitTimerEnumToValue(uint8_t timerToWait)
    return RFAILED;
 }
 
+/*******************************************************************
+ *
+ * @brief Converts DU specific failure cause to E2 interface
+ *        failure cause
+ *
+ * @details
+ *
+ *    Function : convertDuCauseToE2Cause
+ *
+ *    Functionality: Converts DU specific failure cause to E2 
+ *       interface failure cause
+ *
+ * @params[in] DU specific failure cause
+ *             E2 specific failure cause
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void convertDuCauseToE2Cause(CauseOfResult l2Cause, E2FailureCause *failureCause)
+{
+   switch(l2Cause)
+   {
+      case PARAM_INVALID:
+         {
+            failureCause->causeType = E2_RIC_REQUEST;
+            failureCause->cause = E2_ACTION_NOT_SUPPORTED;
+            break;
+         }
+      case RESOURCE_UNAVAILABLE:
+         {
+            failureCause->causeType = E2_RIC_REQUEST;
+            failureCause->cause = E2_FUNCTION_RESOURCE_LIMIT;
+            break;
+         }
+      default:
+         {
+            failureCause->causeType = E2_RIC_REQUEST;
+            failureCause->cause = E2_RIC_REQUEST_CAUSE_UNSPECIFIED;
+            break;
+         }
+   }
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/