Changes A1 JSON Parser 86/3986/1
authorsjana <sj492a@att.com>
Thu, 4 Jun 2020 01:20:10 +0000 (21:20 -0400)
committersjana <sj492a@att.com>
Thu, 4 Jun 2020 01:20:10 +0000 (21:20 -0400)
Issue-ID: RICAPP-115

Signed-off-by: sjana <sj492a@att.com>
Change-Id: If92ee4f421bf7840e746afc09f361604c30e8a6a

container-tag.yaml
docs/release-notes.rst
init/config-file.json
src/xapp-mgmt/msgs_proc.cc
src/xapp-utils/xapp_rmr.hpp
src/xapp.cc
test/test_hc.h

index 5f150a0..4466856 100644 (file)
@@ -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'
 
index 2b4a530..1b42721 100644 (file)
@@ -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        |
 |                    |                    |                    |                    |
 +--------------------+--------------------+--------------------+--------------------+
 
index 463c238..5300d90 100644 (file)
@@ -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]
         }
   }
index 3d45672..19d21a8 100644 (file)
@@ -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){
index d2fabd2..4139036 100755 (executable)
@@ -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 <class MessageProcessor>
        void xapp_rmr_receive(MessageProcessor&&, XappRmr *parent);
 
-       template <class MessageProcessor>
-       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;
index 1fb2b5b..d8e0476 100644 (file)
@@ -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;
index d07fbfe..7e98043 100644 (file)
@@ -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());