[Epic-Id: ODUHIGH-576][Task-Id: ODUHIGH-600][SubTask-Id: ODUHIGH-601]|[NFAPI_Branch... 16/12916/3
authorpborla <pborla@radisys.com>
Tue, 21 May 2024 10:00:40 +0000 (15:30 +0530)
committerpborla <pborla@radisys.com>
Wed, 22 May 2024 06:05:06 +0000 (11:35 +0530)
Change-Id: I99bf857cec59c3bbcadbf5b59db23be51d641c9f
Signed-off-by: pborla <pborla@radisys.com>
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/nfapi_vnf_fsm.c
src/pnf_stub/pnf_stub.c
src/pnf_stub/pnf_stub.h
src/pnf_stub/pnf_stub_p5_msg_hdl.c [new file with mode: 0644]
src/pnf_stub/pnf_stub_p5_msg_hdl.h [new file with mode: 0644]
src/pnf_stub/pnf_stub_sctp.c

index bca67c5..d78540e 100644 (file)
 #include "lwr_mac_phy.h"
 #include "lwr_mac_utils.h"
 #include "mac_utils.h"
+#ifdef NFAPI_ENABLED
 #include "nfapi_interface.h"
+#include "lwr_mac_sctp_inf.h"
+#include "nfapi_common.h"
+#endif
 
 #define MIB_SFN_BITMASK 0xFC
 #define PDCCH_PDU_TYPE 0
@@ -1329,6 +1333,25 @@ void setMibPdu(uint8_t *mibPdu, uint32_t *val, uint16_t sfn)
 
 uint8_t lwr_mac_procParamReqEvt(void *msg)
 {
+
+#ifdef NFAPI_ENABLED
+
+   Buffer *mBuf = NULLP;
+   Pst pst;
+
+   DU_LOG("\nCall Flow: ENTMAC -> ENTLWRMAC : NFAPI P5 PARAM_REQ\n");
+   if (ODU_GET_MSG_BUF(MAC_MEM_REGION, MAC_POOL, &mBuf) != ROK)
+   {
+      DU_LOG("\nERROR  --> NFAPI_VNF : Memory allocation failed in packPnfParamReq");
+      return RFAILED;
+   }
+   nfapiFillP5Hdr(mBuf);
+   nfapiFillMsgHdr(mBuf, NFAPI_P5_PHY_ID, FAPI_PARAM_REQUEST, 0);
+
+   FILL_PST_LWR_MAC_TO_DUAPP(pst, EVENT_PNF_DATA);
+   return ODU_POST_TASK(&pst, mBuf);
+
+#else
 #ifdef INTEL_FAPI
 #ifdef CALL_FLOW_DEBUG_LOG 
    DU_LOG("\nCall Flow: ENTMAC -> ENTLWRMAC : PARAM_REQ\n");
@@ -1371,6 +1394,7 @@ uint8_t lwr_mac_procParamReqEvt(void *msg)
       DU_LOG("\nERROR  -->  LWR_MAC: Failed to allocate memory for Param Request");
       return RFAILED;
    }
+#endif
 #endif
    return ROK;
 }
index d63ed4b..84b9ea6 100644 (file)
@@ -27,6 +27,7 @@
 #include "lwr_mac_utils.h"
 #include "lwr_mac_sctp_inf.h"
 #include "mac_utils.h"
+#include "lwr_mac_fsm.h"
 
 /*******************************************************************
  *
@@ -332,6 +333,7 @@ uint8_t nfapi_vnf_procPnfStartRespEvt(nFapi_p5_hdr *p5Hdr, nFapi_msg_header *msg
       {
          vnfDb.pnfToReconfigure = false;
       }
+      sendEventToLowerMacFsm(PARAM_REQUEST, 0, NULL);
    }
    else
    {
index f56a490..40acea5 100644 (file)
 /* This functions contains main() for pnf simulator */
 #include "common_def.h"
 #include <unistd.h>
+#include "nfapi_interface.h"
 #include "pnf_stub_sctp.h"
 #include "pnf_stub.h"
-#include "nfapi_interface.h"
+#include "pnf_stub_p5_msg_hdl.h"
+
 
 PnfGlobalCb pnfCb;
 
@@ -259,243 +261,7 @@ void nFapiExtractMsgHdr(nFapi_msg_header *msgHdr, Buffer *mBuf)
     return;
 }
 
-/*********************************************************************************
- *
- * @Function Name: buildAndSendPnfReadyInd 
- *
- *
- * @Functionality: 
- *   Builds and Sends PNF_READY_IND(Ref: SCF 225, Sec 3.1.0)
- *
- *
- * *******************************************************************************/
-uint8_t buildAndSendPnfReadyInd()
-{
-   uint8_t ret = ROK;
-   Buffer *mBuf = NULLP;
-
-   if (ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
-   {
-      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf_readyInd");
-      return RFAILED;
-   }
-   nfapiFillP5Hdr(mBuf);
-   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_READY_IND, 0);
-   CMCHKPK(oduPackPostUInt32, 123, mBuf); //version
-   ret = pnfP5SctpSend(mBuf);
-   if(ret == RFAILED)
-   {
-      ODU_PUT_MSG_BUF(mBuf);
-   }
-   return ret;
-}
-
-/*********************************************************************************
- *
- * @Function Name: buildAndSendPnfParamResp 
- *
- * @Functionality: 
- *    Build Pnf Param rsp as per  5G nFAPI Specification 3.1.2 PNF_PARAM.response 
- *    And Send to VNF
- *
- * *******************************************************************************/
-
-uint8_t buildAndSendPnfParamResp()
-{
-   uint8_t ret = ROK,idx=0, array_size=0;
-   Buffer *mBuf = NULLP;
-   nFapi_pnf_param_general paramGeneral;
-
-   memset(&paramGeneral, 0, sizeof(nFapi_pnf_param_general));
-   array_size = sizeof(paramGeneral.loc_coordinates) / sizeof(paramGeneral.loc_coordinates[0]);
-   paramGeneral.max_num_phy=1;
-
-   if (ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
-   {
-      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf_readyInd");
-      return RFAILED;
-   }
-   nfapiFillP5Hdr(mBuf);
-   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_PARAM_RESP, 0);
-   CMCHKPK(oduPackPostUInt8, 0, mBuf); 
-   CMCHKPK(oduPackPostUInt8, 1, mBuf); 
-   CMCHKPK(oduPackPostUInt16, TAG_NFAPI_PNF_PARAM_GENERAL, mBuf);
-   CMCHKPK(oduPackPostUInt16, sizeof(nFapi_pnf_param_general), mBuf);
-   CMCHKPK(oduPackPostUInt8, paramGeneral.nFapi_sync_mode, mBuf); 
-   CMCHKPK(oduPackPostUInt8, paramGeneral.loc_mode, mBuf);
-   CMCHKPK(oduPackPostUInt16, paramGeneral.max_num_phy, mBuf); 
-   for(idx =0; idx < 3; idx++)
-   {
-      CMCHKPK(oduPackPostUInt8, paramGeneral.oui[idx], mBuf); 
-   }
-   CMCHKPK(oduPackPostUInt16, paramGeneral.numRfInstances, mBuf); 
-   CMCHKPK(oduPackPostUInt16, paramGeneral.numDfeInstances, mBuf); 
-
-   ret = pnfP5SctpSend(mBuf);
-   if(ret == RFAILED)
-   {
-      ODU_PUT_MSG_BUF(mBuf);
-   }
-   return ret;
-}
-
-/*********************************************************************************
- *
- * @Function Name: buildAndSendPnfConfigResp
- *
- *
- * @Functionality:
- *   Builds and Sends PNF_CONFIG_RSP(Ref: SCF 225, Sec 3.1.4)
- *
- *
- * *******************************************************************************/
-uint8_t buildAndSendPnfConfigResp()
-{
-   uint8_t ret = ROK;
-   Buffer *mBuf = NULLP;
-
-   DU_LOG("\nINFO   --> NFAPI_PNF: Building PNF_CONFIG_RSP");
-   pnfCb.pnfCfgParams.pnfState=PNF_CONFIGURED;
-   
-   if(ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
-   {
-      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf config rsp");
-      return RFAILED;
-   }
-   nfapiFillP5Hdr(mBuf);
-   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_CONFIG_RESP, 0);
-   CMCHKPK(oduPackPostUInt32, 0, mBuf); //Error Code
-   ret = pnfP5SctpSend(mBuf);
-   if(ret == RFAILED)
-   {
-      ODU_PUT_MSG_BUF(mBuf);
-   }
-   return ret;
-}
-
-/*********************************************************************************
- *
- * @Function Name: buildAndSendPnfStartResp
- *
- *
- * @Functionality:
- *   Builds and Sends PNF_START_RSP(Ref: SCF 225, Sec 3.1.6)
- *
- *
- * *******************************************************************************/
-uint8_t buildAndSendPnfStartResp()
-{
-   uint8_t ret = ROK;
-   Buffer *mBuf = NULLP;
-
-   DU_LOG("\nINFO   --> NFAPI_PNF: Building PNF_START_RSP");
-   pnfCb.pnfCfgParams.pnfState=PNF_RUNNING;
-   
-   if(ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
-   {
-      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf start rsp");
-      return RFAILED;
-   }
-   nfapiFillP5Hdr(mBuf);
-   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_START_RESP, 0);
-   CMCHKPK(oduPackPostUInt32, 0, mBuf); //Error Code
-   ret = pnfP5SctpSend(mBuf);
-   if(ret == RFAILED)
-   {
-      ODU_PUT_MSG_BUF(mBuf);
-   }
-   return ret;
-}
+/**********************************************************************
+End of file
+**********************************************************************/
 
-/*********************************************************************************
- *
- * @Function Name: buildAndSendPnfStopResp
- *
- *
- * @Functionality:
- *   Builds and Sends PNF_STOP_RSP(Ref: SCF 225, Sec 3.1.8)
- *
- *
- * *******************************************************************************/
-uint8_t buildAndSendPnfStopResp()
-{
-   uint8_t ret = ROK;
-   Buffer *mBuf = NULLP;
-
-   DU_LOG("\nINFO   --> NFAPI_PNF: Building PNF_STOP_RSP");
-   pnfCb.pnfCfgParams.pnfState=PNF_CONFIGURED;
-
-   if(ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
-   {
-      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf stop rsp");
-      return RFAILED;
-   }
-   nfapiFillP5Hdr(mBuf);
-   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_STOP_RESP, 0);
-   CMCHKPK(oduPackPostUInt32, 0, mBuf); //Error Code
-   ret = pnfP5SctpSend(mBuf);
-   if(ret == RFAILED)
-   {
-      ODU_PUT_MSG_BUF(mBuf);
-   }
-   return ret;
-}
-
-/*********************************************************************************
- *
- * @Function Name: p5MsgHandlerAtPnf
- *
- *
- * @Functionality: 
- *    Handles the P5 MEssages at PNF SIM
- *
- * @Params [IN]: Message Buffer received at SCTP NFAPI P5 Interface
- *
- * *******************************************************************************/
-uint8_t  p5MsgHandlerAtPnf(Buffer *mBuf)
-{
-   nFapi_p5_hdr p5Hdr;
-   nFapi_msg_header msgHdr;
-   uint8_t ret = ROK;
-
-   nFapiExtractP5Hdr(&p5Hdr, mBuf);
-   nFapiExtractMsgHdr(&msgHdr, mBuf);
-
-   switch(msgHdr.msg_id)
-   {
-      case TAG_NFAPI_PNF_PARAM_REQ:
-         {
-            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_PARAM_REQ recevied.");
-            ret = buildAndSendPnfParamResp();
-            break;
-         }
-      case TAG_NFAPI_PNF_CONFIG_REQ:
-         {
-            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_CONFIG_REQ recevied.");
-            ret = buildAndSendPnfConfigResp();
-            break;
-         }
-      case TAG_NFAPI_PNF_START_REQ:
-         {
-            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_START_REQ recevied.");
-            ret = buildAndSendPnfStartResp();
-            break;
-         }
-      case TAG_NFAPI_PNF_STOP_REQ:
-         {
-            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_STOP_REQ recevied.");
-            ret = buildAndSendPnfStopResp();
-            break;
-         }
-      default:
-      {
-         DU_LOG("\nERROR  --> NFAPI_PNF: Wrong MSGID of NFAPI P5 Message:%d",msgHdr.msg_id);
-      }
-   }
-
-   if(ret == RFAILED)
-   {
-      return RFAILED;
-   }
-   return ret;
-}
index e49d7d4..2c6baba 100644 (file)
@@ -55,7 +55,9 @@ typedef struct pnfGlobalCb
 }PnfGlobalCb;
 
 extern PnfGlobalCb pnfCb;
-uint8_t buildAndSendPnfReadyInd();
-uint8_t buildAndSendPnfConfigRsp();
 uint8_t p5MsgHandlerAtPnf(Buffer *mBuf);
+void nfapiFillP5Hdr(Buffer *mBuf);
+void nfapiFillMsgHdr(Buffer *mBuf, uint8_t phyId, uint16_t msgId, uint32_t msgLen);
+void nFapiExtractP5Hdr(nFapi_p5_hdr *p5Hdr, Buffer *mBuf);
+void nFapiExtractMsgHdr(nFapi_msg_header *msgHdr, Buffer *mBuf);
 #endif
diff --git a/src/pnf_stub/pnf_stub_p5_msg_hdl.c b/src/pnf_stub/pnf_stub_p5_msg_hdl.c
new file mode 100644 (file)
index 0000000..a2108d9
--- /dev/null
@@ -0,0 +1,321 @@
+
+/*******************************************************************************
+ * ################################################################################
+ * #   Copyright (c) [2017-2019] [Radisys]
+ * #
+ * #
+ * #
+ * #   Licensed under the Apache License, Version 2.0 (the "License");
+ * #
+ * #   you may not use this file except in compliance with the License.
+ * #
+ * #   You may obtain a copy of the License at
+ * #
+ * #
+ * #
+ * #       http://www.apache.org/licenses/LICENSE-2.0
+ * #
+ * #
+ * #
+ * #   Unless required by applicable law or agreed to in writing, software
+ * #
+ * #   distributed under the License is distributed on an "AS IS" BASIS,
+ * #
+ * #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * #
+ * #   See the License for the specific language governing permissions and
+ * #
+ * #   limitations under the License.
+ * #
+ * ################################################################################
+ * *******************************************************************************/
+
+/* This functions contains main() for pnf simulator */
+#include "common_def.h"
+#include <unistd.h>
+#include "pnf_stub_p5_msg_hdl.h"
+#include "nfapi_interface.h"
+#include "pnf_stub_sctp.h"
+#include "pnf_stub.h"
+
+PnfGlobalCb pnfCb;
+/*********************************************************************************
+ *
+ * @Function Name: buildAndSendPnfReadyInd 
+ *
+ *
+ * @Functionality: 
+ *   Builds and Sends PNF_READY_IND(Ref: SCF 225, Sec 3.1.0)
+ *
+ *
+ * *******************************************************************************/
+uint8_t buildAndSendPnfReadyInd()
+{
+   uint8_t ret = ROK;
+   Buffer *mBuf = NULLP;
+
+   if (ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
+   {
+      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf_readyInd");
+      return RFAILED;
+   }
+   nfapiFillP5Hdr(mBuf);
+   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_READY_IND, 0);
+   CMCHKPK(oduPackPostUInt32, 123, mBuf); //version
+   ret = pnfP5SctpSend(mBuf);
+   if(ret == RFAILED)
+   {
+      ODU_PUT_MSG_BUF(mBuf);
+   }
+   return ret;
+}
+
+/*********************************************************************************
+ *
+ * @Function Name: buildAndSendPnfParamResp 
+ *
+ * @Functionality: 
+ *    Build Pnf Param rsp as per  5G nFAPI Specification 3.1.2 PNF_PARAM.response 
+ *    And Send to VNF
+ *
+ * *******************************************************************************/
+
+uint8_t buildAndSendPnfParamResp()
+{
+   uint8_t ret = ROK,idx=0;
+   Buffer *mBuf = NULLP;
+   nFapi_pnf_param_general paramGeneral;
+
+   memset(&paramGeneral, 0, sizeof(nFapi_pnf_param_general));
+   paramGeneral.max_num_phy=1;
+
+   if (ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
+   {
+      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf_readyInd");
+      return RFAILED;
+   }
+   nfapiFillP5Hdr(mBuf);
+   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_PARAM_RESP, 0);
+   CMCHKPK(oduPackPostUInt8, 0, mBuf); 
+   CMCHKPK(oduPackPostUInt8, 1, mBuf); 
+   CMCHKPK(oduPackPostUInt16, TAG_NFAPI_PNF_PARAM_GENERAL, mBuf);
+   CMCHKPK(oduPackPostUInt16, sizeof(nFapi_pnf_param_general), mBuf);
+   CMCHKPK(oduPackPostUInt8, paramGeneral.nFapi_sync_mode, mBuf); 
+   CMCHKPK(oduPackPostUInt8, paramGeneral.loc_mode, mBuf);
+   CMCHKPK(oduPackPostUInt16, paramGeneral.max_num_phy, mBuf); 
+   for(idx =0; idx < 3; idx++)
+   {
+      CMCHKPK(oduPackPostUInt8, paramGeneral.oui[idx], mBuf); 
+   }
+   CMCHKPK(oduPackPostUInt16, paramGeneral.numRfInstances, mBuf); 
+   CMCHKPK(oduPackPostUInt16, paramGeneral.numDfeInstances, mBuf); 
+
+   ret = pnfP5SctpSend(mBuf);
+   if(ret == RFAILED)
+   {
+      ODU_PUT_MSG_BUF(mBuf);
+   }
+   return ret;
+}
+
+/*********************************************************************************
+ *
+ * @Function Name: buildAndSendPnfConfigResp
+ *
+ *
+ * @Functionality:
+ *   Builds and Sends PNF_CONFIG_RSP(Ref: SCF 225, Sec 3.1.4)
+ *
+ *
+ * *******************************************************************************/
+uint8_t buildAndSendPnfConfigResp()
+{
+   uint8_t ret = ROK;
+   Buffer *mBuf = NULLP;
+
+   DU_LOG("\nINFO   --> NFAPI_PNF: Building PNF_CONFIG_RSP");
+   pnfCb.pnfCfgParams.pnfState=PNF_CONFIGURED;
+   
+   if(ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
+   {
+      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf config rsp");
+      return RFAILED;
+   }
+   nfapiFillP5Hdr(mBuf);
+   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_CONFIG_RESP, 0);
+   CMCHKPK(oduPackPostUInt32, 0, mBuf); //Error Code
+   ret = pnfP5SctpSend(mBuf);
+   if(ret == RFAILED)
+   {
+      ODU_PUT_MSG_BUF(mBuf);
+   }
+   return ret;
+}
+
+/*********************************************************************************
+ *
+ * @Function Name: buildAndSendPnfStartResp
+ *
+ *
+ * @Functionality:
+ *   Builds and Sends PNF_START_RSP(Ref: SCF 225, Sec 3.1.6)
+ *
+ *
+ * *******************************************************************************/
+uint8_t buildAndSendPnfStartResp()
+{
+   uint8_t ret = ROK;
+   Buffer *mBuf = NULLP;
+
+   DU_LOG("\nINFO   --> NFAPI_PNF: Building PNF_START_RSP");
+   pnfCb.pnfCfgParams.pnfState=PNF_RUNNING;
+   
+   if(ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
+   {
+      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf start rsp");
+      return RFAILED;
+   }
+   nfapiFillP5Hdr(mBuf);
+   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_START_RESP, 0);
+   CMCHKPK(oduPackPostUInt32, 0, mBuf); //Error Code
+   ret = pnfP5SctpSend(mBuf);
+   if(ret == RFAILED)
+   {
+      ODU_PUT_MSG_BUF(mBuf);
+   }
+   return ret;
+}
+
+/*********************************************************************************
+ *
+ * @Function Name: buildAndSendPnfStopResp
+ *
+ *
+ * @Functionality:
+ *   Builds and Sends PNF_STOP_RSP(Ref: SCF 225, Sec 3.1.8)
+ *
+ *
+ * *******************************************************************************/
+uint8_t buildAndSendPnfStopResp()
+{
+   uint8_t ret = ROK;
+   Buffer *mBuf = NULLP;
+
+   DU_LOG("\nINFO   --> NFAPI_PNF: Building PNF_STOP_RSP");
+   pnfCb.pnfCfgParams.pnfState=PNF_CONFIGURED;
+
+   if(ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
+   {
+      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf stop rsp");
+      return RFAILED;
+   }
+   nfapiFillP5Hdr(mBuf);
+   nfapiFillMsgHdr(mBuf, 0, TAG_NFAPI_PNF_STOP_RESP, 0);
+   CMCHKPK(oduPackPostUInt32, 0, mBuf); //Error Code
+   ret = pnfP5SctpSend(mBuf);
+   if(ret == RFAILED)
+   {
+      ODU_PUT_MSG_BUF(mBuf);
+   }
+   return ret;
+}
+
+/*********************************************************************************
+ *
+ * @Function Name: buildAndSendParamResp 
+ *
+ * @Functionality: 
+ *    Build  Param rsp as per  5G nFAPI Specification 3.1.2 PARAM.response 
+ *    And Send to VNF
+ *
+ * *******************************************************************************/
+
+uint8_t buildAndSendParamResp()
+{
+   uint8_t ret = ROK,idx=0;
+   Buffer *mBuf = NULLP;
+   fapi_param_resp_t *fapiParamRsp;
+
+   if (ODU_GET_MSG_BUF(PNF_APP_MEM_REG, PNF_POOL, &mBuf) != ROK)
+   {
+      DU_LOG("\nERROR  --> NFAPI_PNF : Memory allocation failed in pnf_readyInd");
+      return RFAILED;
+   }
+   nfapiFillP5Hdr(mBuf);
+   nfapiFillMsgHdr(mBuf, 0, FAPI_PARAM_RESPONSE, 0);
+   CMCHKPK(oduPackPostUInt8, 0, mBuf); 
+   CMCHKPK(oduPackPostUInt8, 1, mBuf);
+   //TODO->
+   //Fill TLVs
+
+   return ROK;
+}
+
+/*********************************************************************************
+ *
+ * @Function Name: p5MsgHandlerAtPnf
+ *
+ *
+ * @Functionality: 
+ *    Handles the P5 MEssages at PNF SIM
+ *
+ * @Params [IN]: Message Buffer received at SCTP NFAPI P5 Interface
+ *
+ * *******************************************************************************/
+uint8_t  p5MsgHandlerAtPnf(Buffer *mBuf)
+{
+   nFapi_p5_hdr p5Hdr;
+   nFapi_msg_header msgHdr;
+   uint8_t ret = ROK;
+
+   nFapiExtractP5Hdr(&p5Hdr, mBuf);
+   nFapiExtractMsgHdr(&msgHdr, mBuf);
+
+   switch(msgHdr.msg_id)
+   {
+      case TAG_NFAPI_PNF_PARAM_REQ:
+         {
+            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_PARAM_REQ recevied.");
+            ret = buildAndSendPnfParamResp();
+            break;
+         }
+      case TAG_NFAPI_PNF_CONFIG_REQ:
+         {
+            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_CONFIG_REQ recevied.");
+            ret = buildAndSendPnfConfigResp();
+            break;
+         }
+      case TAG_NFAPI_PNF_START_REQ:
+         {
+            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_START_REQ recevied.");
+            ret = buildAndSendPnfStartResp();
+            break;
+         }
+      case TAG_NFAPI_PNF_STOP_REQ:
+         {
+            DU_LOG("\nINFO   --> NFAPI_PNF: PNF_STOP_REQ recevied.");
+            ret = buildAndSendPnfStopResp();
+            break;
+         }
+      case FAPI_PARAM_REQUEST:
+         {
+            DU_LOG("\nINFO   --> NFAPI_PNF: PHY_PARAM_REQ recevied.");
+            ret = buildAndSendParamResp();
+            break;
+         }
+      default:
+      {
+         DU_LOG("\nERROR  --> NFAPI_PNF: Wrong MSGID of NFAPI P5 Message:%d",msgHdr.msg_id);
+      }
+   }
+
+   if(ret == RFAILED)
+   {
+      return RFAILED;
+   }
+   return ret;
+}
+
+/**********************************************************************
+End of file
+**********************************************************************/
diff --git a/src/pnf_stub/pnf_stub_p5_msg_hdl.h b/src/pnf_stub/pnf_stub_p5_msg_hdl.h
new file mode 100644 (file)
index 0000000..906a7b7
--- /dev/null
@@ -0,0 +1,25 @@
+
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+uint8_t buildAndSendPnfReadyInd();
+uint8_t buildAndSendPnfConfigRsp();
+
+/**********************************************************************
+End of file
+**********************************************************************/
index 27950e7..a6ea67b 100644 (file)
@@ -19,7 +19,9 @@
 /* This file contains all SCTP related functionality */
 
 #include "common_def.h" 
+#include "nfapi_interface.h"
 #include "pnf_stub_sctp.h"
+#include "pnf_stub_p5_msg_hdl.h"
 #include "pnf_stub.h"
 
 uint8_t   socket_type;      /* Socket type */