--- /dev/null
+/*\r
+==================================================================================\r
+\r
+ Copyright (c) 2018-2019 AT&T Intellectual Property.\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+==================================================================================\r
+*/\r
+\r
+\r
+#include "KPIMessageHandler.h"\r
+\r
+kpi_msg_handler::kpi_msg_handler()\r
+{ \r
+ m_access = std::make_unique<std::mutex>();\r
+}\r
+\r
+// Decodes the CuCpResourceStatusReport present in the RIC Indication Message and Calls the method to Update the content in the DB.\r
+bool kpi_msg_handler::operator()(redisContext *redis_context, unsigned char *msg_ref, size_t msg_size)\r
+{\r
+ \r
+ bool res = true;\r
+ \r
+ std::lock_guard<std::mutex> lck(*(m_access.get()));\r
+\r
+ CuCpResourceStatusReport_t *cucp_resource_status_rcv = 0;\r
+\r
+ /* Decode */\r
+ asn_dec_rval_t dec_res = asn_decode(0,ATS_ALIGNED_BASIC_PER, &asn_DEF_CuCpResourceStatusReport, (void **)&cucp_resource_status_rcv, msg_ref, msg_size);\r
+\r
+ if (dec_res.code == RC_OK){\r
+ mdclog_write(MDCLOG_INFO, "Processing CuCpResourceStatusReport message\n");\r
+ res = true;\r
+ }\r
+ else{\r
+ mdclog_write(MDCLOG_ERR, "Error :: %s, %d :: Could not decode CuCpResourceStatusReport of size %lu bytes \n", __FILE__, __LINE__, msg_size);\r
+ res = false;\r
+ }\r
+\r
+ if (res){\r
+ \r
+ //std::cout <<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;\r
+ //xer_fprint(stdout, &asn_DEF_CuCpResourceStatusReport, cucp_resource_status_rcv);\r
+ //std::cout <<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;\r
+\r
+ // Add our get field function for Custom message\r
+ res = kpi_report.get_fields(cucp_resource_status_rcv, kpi_data);\r
+ if (!res){\r
+ mdclog_write(MDCLOG_ERR, "Error :: %s, %d :: could not get fields from CuCpResourceStatusReport. Reason = %s\n", __FILE__, __LINE__, kpi_report.get_error().c_str());\r
+ }\r
+ }\r
+\r
+ kpi_db_res.UpdateDB(redis_context,&kpi_data);\r
+\r
+ ASN_STRUCT_FREE(asn_DEF_CuCpResourceStatusReport, cucp_resource_status_rcv);\r
+ return res;\r
+ \r
+}\r
+\r
+void kpi_msg_handler::clear()\r
+{\r
+ std::lock_guard<std::mutex> lck(*(m_access.get()));\r
+}
\ No newline at end of file