Commit a6d105d2 authored by MaheshK1995's avatar MaheshK1995

P5 messages DONE [bypassed a bug]

parent 164397b0
......@@ -1038,7 +1038,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
openair0_config_t *cfg = &ru->openair0_cfg;
int mu = gNB_config->ssb_config.scs_common.value;
int N_RB = gNB_config->carrier_config.dl_grid_size[gNB_config->ssb_config.scs_common.value].value;
N_RB = 106; // TODO: hard coding (change later)
if (mu == NR_MU_0) { //or if LTE
if(N_RB == 100) {
if (fp->threequarter_fs) {
......
......@@ -10,3 +10,20 @@
* The values to config request are assigned in: `config_common()` in `config.c`
* need to add lines for `cfg->nfapi_config`
* the config request unpacked on pnf side still has some zero values, which causes assertional failure in from_nrarfcn()
### 16/06/20
* Config request is recived and unpacked correctly
* Regarding config response
* we are confused about its' struct definition
* it says list of TLVs in its entirety
* and we need to dyanmically insert the invalid TLVs after checking in a categorical fashion
* Need to think of a data structure to enable this feature.
```struct{
list of uint8_t tlvs
list of uint16_t tlvs
list of uint32_t tlvs
}list of tlvs
```
* Need the `N_RB` value to be non-zero and obtained from the config file. (carrier config grid size)
`int N_RB = gNB_config->carrier_config.dl_grid_size[gNB_config->ssb_config.scs_common.value].value;`
* how is this `gNB_config` assigned its values?
\ No newline at end of file
......@@ -669,7 +669,7 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
memcpy(nfapi_resp.nfapi_config.p7_pnf_address_ipv4.address, &pnf_p7_sockaddr.sin_addr.s_addr, 4);
nfapi_resp.num_tlv++;
// P7 PNF Port
printf("TAG value :%d",nfapi_resp.cell_param.phy_state.tl.tag);
printf("TAG value :%d",nfapi_resp.cell_param.phy_state.tl.tag);
nfapi_pnf_param_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PNF_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv);
......@@ -742,8 +742,11 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
}
if(req->nfapi_config.nrarfcn.tl.tag == NFAPI_NR_NFAPI_NRARFCN_TAG) {
fp->dl_CarrierFreq = from_nrarfcn(78, req->ssb_config.scs_common.value , req->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_nr_uldl_offset(fp->nr_band) * 1e5); // TODO: why 1e5 ?
// fp->dl_CarrierFreq = from_nrarfcn(78, req->ssb_config.scs_common.value , req->nfapi_config.nrarfcn.value);// TODO: get value nr_bandP
// fp->dl_CarrierFreq = req->carrier_config.dl_frequency.value;
// fp->ul_CarrierFreq = req->carrier_config.uplink_frequency.value;
//fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_nr_uldl_offset(fp->nr_band) * 1e5); // TODO: why 1e5 ?
num_tlv++;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() nrarfcn:%u dl_carrierFreq:%u ul_CarrierFreq:%u band:%u N_RB_DL:%u\n",
__FUNCTION__, req->nfapi_config.nrarfcn.value, fp->dl_CarrierFreq, fp->ul_CarrierFreq, pnf->rfs[0].band, fp->N_RB_DL);
......@@ -868,7 +871,7 @@ req->tdd_table.
phy_info->remote_addr = inet_ntoa(vnf_p7_sockaddr.sin_addr);
printf("[PNF] %d vnf p7 %s:%d timing %d %d %d\n", phy_info->id, phy_info->remote_addr, phy_info->remote_port,
phy_info->timing_window, phy_info->timing_info_mode, phy_info->timing_info_period);
nfapi_config_response_t nfapi_resp;
nfapi_nr_config_response_scf_t nfapi_resp;
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE;
nfapi_resp.header.phy_id = phy_info->id;
......@@ -1202,7 +1205,7 @@ nfapi_tx_request_t dummy_tx_req;
nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_start_request_t *req) {
int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_start_request_scf_t *req) {
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
nfapi_set_trace_level(NFAPI_TRACE_INFO);
pnf_info *pnf = (pnf_info *)(config->user_data);
......
......@@ -1080,11 +1080,11 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_respons
return 0;
}
int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response_t *resp) {
nfapi_start_request_t req;
int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_response_scf_t *resp) {
nfapi_nr_start_request_scf_t req;
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
printf("[VNF] Calling oai_enb_init()\n");
oai_enb_init();
oai_enb_init(); // TODO: change to gnb
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_START_REQUEST;
req.header.phy_id = resp->header.phy_id;
......
......@@ -501,7 +501,7 @@ typedef struct {
nfapi_p4_p5_message_header_t header;
nfapi_nr_param_errors_e error_code;
uint8_t num_invalid_tlvs;
// TODO: add list of invalid/unsupported TLVs (see Table 3.18)
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_config_response_scf_t;
......@@ -511,7 +511,7 @@ typedef struct {
typedef struct {
nfapi_p4_p5_message_header_t header;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_start_request_t;
} nfapi_nr_start_request_scf_t;
typedef enum {
NFAPI_NR_START_MSG_INVALID_STATE
......
......@@ -857,15 +857,15 @@ static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_
static uint8_t pack_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
{
nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t*)msg;
nfapi_nr_config_response_scf_t *pNfapiMsg = (nfapi_nr_config_response_scf_t*)msg;
return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
return ( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
}
static uint8_t pack_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
{
nfapi_start_request_t *pNfapiMsg = (nfapi_start_request_t*)msg;
nfapi_nr_start_request_scf_t *pNfapiMsg = (nfapi_nr_start_request_scf_t*)msg;
return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
}
......@@ -1591,7 +1591,7 @@ static uint8_t unpack_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, vo
// print ppReadPackedMsg
uint8_t *ptr = *ppReadPackedMsg;
printf("\n Read message: ");
printf("\n Read message unpack_param_response: ");
while(ptr < end){
printf(" %d ", *ptr);
ptr++;
......@@ -1786,19 +1786,19 @@ static uint8_t unpack_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, vo
static uint8_t unpack_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
{
nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t*)msg;
nfapi_nr_config_response_scf_t *pNfapiMsg = (nfapi_nr_config_response_scf_t*)msg;
unpack_tlv_t unpack_fns[] =
{
};
return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
}
static uint8_t unpack_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
{
nfapi_start_request_t *pNfapiMsg = (nfapi_start_request_t*)msg;
nfapi_nr_start_request_scf_t *pNfapiMsg = ( nfapi_nr_start_request_scf_t*)msg;
unpack_tlv_t unpack_fns[] =
{
......@@ -1952,8 +1952,8 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
break;
case NFAPI_START_REQUEST:
if (unpackedBufLen >= sizeof(nfapi_start_request_t))
retLen = sizeof(nfapi_start_request_t);
if (unpackedBufLen >= sizeof( nfapi_nr_start_request_scf_t))
retLen = sizeof( nfapi_nr_start_request_scf_t);
break;
case NFAPI_START_RESPONSE:
......@@ -2037,7 +2037,7 @@ int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
}
uint8_t *ptr = pReadPackedMessage;
printf("\n Read message: ");
printf("\n Read message unpack: ");
while(ptr < end){
printf(" %d ", *ptr);
ptr++;
......
......@@ -193,7 +193,7 @@ typedef struct nfapi_pnf_config
* The client is expected to send the START.response after the client has received the
* first subframe indication from FAPI.
*/
int (*start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req);
int (*start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_start_request_scf_t* req);
/*! A callback for the STOP.request
* \param config A pointer to the pnf configuration
......@@ -413,7 +413,7 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_scf
* \return 0 for success, -1 for failure
*
*/
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp);
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_scf_t* resp);
/*! Send the START.response
* \param config A pointer to a pnf configuraiton
......
......@@ -411,7 +411,7 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
}
else
{
nfapi_start_request_t req;
nfapi_nr_start_request_scf_t req;
nfapi_pnf_config_t* config = &(pnf->_public);
......
......@@ -182,7 +182,7 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_scf
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_param_response_scf_t));
}
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp)
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_scf_t* resp)
{
if (config == NULL || resp == NULL)
{
......@@ -207,7 +207,7 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* r
return -1;
}
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_config_response_t));
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_config_response_scf_t));
}
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp)
......
......@@ -19,7 +19,7 @@
#include "nfapi_interface.h"
#include "nfapi_nr_interface_scf.h"
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface.h"
#include "debug.h"
......@@ -549,7 +549,7 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config
* \param req A pointer to a START.request message structure
* \return 0 means success, -1 failure
*/
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req);
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_request_scf_t* req);
/*! Send the STOP.request
* \param config A pointer to a vnf config
......
......@@ -565,14 +565,14 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_config_request_scf_t));
}
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req)
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_request_scf_t * req)
{
if(config == 0 || req == 0)
return -1;
vnf_t* _this = (vnf_t*)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_start_request_t));
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_start_request_scf_t));
}
int nfapi_vnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_request_t* req)
{
......
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