From 572205b203bec9a787b051c19195ea1db17eb94b Mon Sep 17 00:00:00 2001 From: sjana Date: Wed, 3 Jun 2020 21:20:10 -0400 Subject: [PATCH] Changes A1 JSON Parser Issue-ID: RICAPP-115 Signed-off-by: sjana Change-Id: If92ee4f421bf7840e746afc09f361604c30e8a6a --- container-tag.yaml | 2 +- docs/release-notes.rst | 2 +- init/config-file.json | 5 +++-- src/xapp-mgmt/msgs_proc.cc | 5 +++-- src/xapp-utils/xapp_rmr.hpp | 10 ++++------ src/xapp.cc | 2 +- test/test_hc.h | 3 ++- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/container-tag.yaml b/container-tag.yaml index 5f150a0..4466856 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,4 +1,4 @@ # this is used by CI jobs to apply a tag when it builds the image --- -tag: '1.0.2' +tag: '1.0.3' diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 2b4a530..1b42721 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -21,7 +21,7 @@ Version history | **Date** | **Ver.** | **Author** | **Comment** | | | | | | +--------------------+--------------------+--------------------+--------------------+ -| 2020-21-05 | 1.0.2 | Shraboni Jana | Second draft | +| 2020-21-05 | 1.0.3 | Shraboni Jana | Third draft | | | | | | +--------------------+--------------------+--------------------+--------------------+ diff --git a/init/config-file.json b/init/config-file.json index 463c238..5300d90 100644 --- a/init/config-file.json +++ b/init/config-file.json @@ -7,7 +7,7 @@ "image": { "registry": "nexus3.o-ran-sc.org:10002", "name": "o-ran-sc/ric-app-hw", - "tag": "1.0.2" + "tag": "1.0.3" } } ], @@ -43,6 +43,7 @@ "rxMessages": [ "RIC_SUB_RESP", "A1_POLICY_REQ", "RIC_HEALTH_CHECK_REQ" - ] + ], + "policies": [1] } } diff --git a/src/xapp-mgmt/msgs_proc.cc b/src/xapp-mgmt/msgs_proc.cc index 3d45672..19d21a8 100644 --- a/src/xapp-mgmt/msgs_proc.cc +++ b/src/xapp-mgmt/msgs_proc.cc @@ -105,9 +105,10 @@ bool XappMsgHandler::a1_policy_handler(char * message, int *message_len, a1_pol mdclog_write(MDCLOG_ERR, "Error : %s, %d:: Could not extract policy type id from %s\n", __FILE__, __LINE__, message); return false; } - helper.policy_type_id = ref2->GetString(); + //helper.policy_type_id = ref2->GetString(); + helper.policy_type_id = to_string(ref2->GetInt()); - // Extract policy instance id + // Extract policy instance id rapidjson::Pointer temp("/policy_instance_id"); rapidjson::Value * ref = temp.Get(doc); if (ref == NULL){ diff --git a/src/xapp-utils/xapp_rmr.hpp b/src/xapp-utils/xapp_rmr.hpp index d2fabd2..4139036 100755 --- a/src/xapp-utils/xapp_rmr.hpp +++ b/src/xapp-utils/xapp_rmr.hpp @@ -51,8 +51,8 @@ typedef struct{ int32_t message_type; int32_t state; int32_t payload_length; - unsigned char sid[RMR_MAX_SID]; //sender ID for return to sender needs.(ACKS required)[RMR_MAX_SID] - unsigned char src[RMR_MAX_SRC]; //name of the sender (source)[RMR_MAX_SRC] + unsigned char sid[RMR_MAX_SID]; //Subscription ID. + unsigned char src[RMR_MAX_SRC]; //Xapp Name unsigned char meid[RMR_MAX_MEID]={}; } xapp_rmr_header; @@ -78,8 +78,6 @@ public: template void xapp_rmr_receive(MessageProcessor&&, XappRmr *parent); - template - void xapp_test_receiver(MessageProcessor&&, XappRmr *parent); bool xapp_rmr_send(xapp_rmr_header*, void*); bool rmr_header(xapp_rmr_header*); @@ -138,8 +136,8 @@ void XappRmr::xapp_rmr_receive(MsgHandler&& msgproc, XappRmr *parent){ msgproc(this->_xapp_received_buff, resend); if(*resend){ - //mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message of Type: %d",this->_xapp_received_buff->mtype); - //mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message: %s",(char*)this->_xapp_received_buff->payload); + mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message of Type: %d",this->_xapp_received_buff->mtype); + mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message: %s",(char*)this->_xapp_received_buff->payload); rmr_rts_msg(rmr_context, this->_xapp_received_buff ); sleep(1); *resend = false; diff --git a/src/xapp.cc b/src/xapp.cc index 1fb2b5b..d8e0476 100644 --- a/src/xapp.cc +++ b/src/xapp.cc @@ -189,7 +189,7 @@ void Xapp::startup_get_policies(void){ int policy_id = HELLOWORLD_POLICY_ID; - std::string policy_query = "{\"policy_id\":" + std::to_string(policy_id) + "}"; + std::string policy_query = "{\"policy_type_id\":" + std::to_string(policy_id) + "}"; unsigned char * message = (unsigned char *)calloc(policy_query.length(), sizeof(unsigned char)); memcpy(message, policy_query.c_str(), policy_query.length()); xapp_rmr_header header; diff --git a/test/test_hc.h b/test/test_hc.h index d07fbfe..7e98043 100644 --- a/test/test_hc.h +++ b/test/test_hc.h @@ -70,7 +70,8 @@ TEST(Xapp, RMRHealthCheck){ TEST(Xapp, A1HealthCheck){ //Read the json file and send it using rmr. - string json = "{\"policy_type_id\": \"1\",\"policy_instance_id\":\"3d2157af-6a8f-4a7c-810f-38c2f824bf12\",\"operation\": \"CREATE\"}"; + //string json = "{\"policy_type_id\": \"1\",\"policy_instance_id\":\"3d2157af-6a8f-4a7c-810f-38c2f824bf12\",\"operation\": \"CREATE\"}"; + string json = "{\"operation\": \"CREATE\", \"policy_type_id\": 1, \"policy_instance_id\": \"hwpolicy321\", \"payload\": {\"threshold\": 5}}"; int n = json.length(); char strMsg[n + 1]; strcpy(strMsg, json.c_str()); -- 2.16.6