From ee5e434a348bb9107e0960c531fff65b00c22d76 Mon Sep 17 00:00:00 2001 From: Ron Shacham Date: Thu, 11 Jun 2020 12:34:46 -0400 Subject: [PATCH] Removed unnecessary logging messages Signed-off-by: Ron Shacham Change-Id: Iadf1289d3229e82902557c72e05220e05a1aa9a0 --- container-tag.yaml | 2 +- docs/rel-notes.rst | 4 ++ src/ts_xapp/ts_xapp.cpp | 133 ++++++++++++++++---------------------------- xapp-descriptor/config.json | 4 +- 4 files changed, 54 insertions(+), 89 deletions(-) diff --git a/container-tag.yaml b/container-tag.yaml index f8e7a7f..fe2132e 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,3 +1,3 @@ # this is used by CI jobs to apply a tag when it builds the image --- -tag: '1.0.10' +tag: '1.0.11' diff --git a/docs/rel-notes.rst b/docs/rel-notes.rst index 340b21c..26bd814 100644 --- a/docs/rel-notes.rst +++ b/docs/rel-notes.rst @@ -9,6 +9,10 @@ Traffic Steering xAPP ===================== +2020 June 11 Version 1.0.11 +---------------------------- + Removed extraneous logging messages + 2020 June 8 Version 1.0.10 ---------------------------- Set env. variable RMR_SRC_ID to bet K8s RMR Service Host and Port diff --git a/src/ts_xapp/ts_xapp.cpp b/src/ts_xapp/ts_xapp.cpp index 8c1b79a..1ef8a56 100644 --- a/src/ts_xapp/ts_xapp.cpp +++ b/src/ts_xapp/ts_xapp.cpp @@ -98,10 +98,10 @@ struct PolicyHandler : public BaseReaderHandler, PolicyHandler> { bool found_threshold = false; - bool Null() { cout << "Null()" << endl; return true; } - bool Bool(bool b) { cout << "Bool(" << boolalpha << b << ")" << endl; return true; } + bool Null() { return true; } + bool Bool(bool b) { return true; } bool Int(int i) { - cout << "Int(" << i << ")" << endl; + if (curr_key.compare("policy_type_id") == 0) { policy_type_id = i; } else if (curr_key.compare("policy_instance_id") == 0) { @@ -114,7 +114,7 @@ struct PolicyHandler : public BaseReaderHandler, PolicyHandler> { return true; } bool Uint(unsigned u) { - cout << "Int(" << u << ")" << endl; + if (curr_key.compare("policy_type_id") == 0) { policy_type_id = u; } else if (curr_key.compare("policy_instance_id") == 0) { @@ -126,11 +126,11 @@ struct PolicyHandler : public BaseReaderHandler, PolicyHandler> { return true; } - bool Int64(int64_t i) { cout << "Int64(" << i << ")" << endl; return true; } - bool Uint64(uint64_t u) { cout << "Uint64(" << u << ")" << endl; return true; } - bool Double(double d) { cout << "Double(" << d << ")" << endl; return true; } + bool Int64(int64_t i) { return true; } + bool Uint64(uint64_t u) { return true; } + bool Double(double d) { return true; } bool String(const char* str, SizeType length, bool copy) { - cout << "String(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl; + if (curr_key.compare("operation") != 0) { operation = str; } @@ -138,18 +138,18 @@ struct PolicyHandler : public BaseReaderHandler, PolicyHandler> { return true; } bool StartObject() { - cout << "StartObject()" << endl; + return true; } bool Key(const char* str, SizeType length, bool copy) { - cout << "Key(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl; + curr_key = str; return true; } - bool EndObject(SizeType memberCount) { cout << "EndObject(" << memberCount << ")" << endl; return true; } - bool StartArray() { cout << "StartArray()" << endl; return true; } - bool EndArray(SizeType elementCount) { cout << "EndArray(" << elementCount << ")" << endl; return true; } + bool EndObject(SizeType memberCount) { return true; } + bool StartArray() { return true; } + bool EndArray(SizeType elementCount) { return true; } }; @@ -161,37 +161,33 @@ struct PredictionHandler : public BaseReaderHandler, PredictionHandler> { string curr_key = ""; string curr_value = ""; bool down_val = true; - bool Null() { cout << "Null()" << endl; return true; } - bool Bool(bool b) { cout << "Bool(" << boolalpha << b << ")" << endl; return true; } - bool Int(int i) { cout << "Int(" << i << ")" << endl; return true; } + bool Null() { return true; } + bool Bool(bool b) { return true; } + bool Int(int i) { return true; } bool Uint(unsigned u) { - cout << "Uint(" << u << ")" << endl; + if (down_val) { cell_pred_down[curr_key] = u; - cout << "Setting xput down val for " << curr_key << " to " << u << endl; down_val = false; } else { cell_pred_up[curr_key] = u; - cout << "Setting xput up val for " << curr_key << " to " << u << endl; down_val = true; } return true; } - bool Int64(int64_t i) { cout << "Int64(" << i << ")" << endl; return true; } - bool Uint64(uint64_t u) { cout << "Uint64(" << u << ")" << endl; return true; } - bool Double(double d) { cout << "Double(" << d << ")" << endl; return true; } + bool Int64(int64_t i) { return true; } + bool Uint64(uint64_t u) { return true; } + bool Double(double d) { return true; } bool String(const char* str, SizeType length, bool copy) { - cout << "String(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl; return true; } - bool StartObject() { cout << "StartObject()" << endl; return true; } + bool StartObject() { return true; } bool Key(const char* str, SizeType length, bool copy) { - cout << "Key(" << str << ", " << length << ", " << boolalpha << copy << ")" << endl; if (!ue_id_found) { - cout << "Found UE ID\n"; + ue_id = str; ue_id_found = true; } else { @@ -199,9 +195,9 @@ struct PredictionHandler : public BaseReaderHandler, PredictionHandler> { } return true; } - bool EndObject(SizeType memberCount) { cout << "EndObject(" << memberCount << ")" << endl; return true; } - bool StartArray() { cout << "StartArray()" << endl; return true; } - bool EndArray(SizeType elementCount) { cout << "EndArray(" << elementCount << ")" << endl; return true; } + bool EndObject(SizeType memberCount) { return true; } + bool StartArray() { return true; } + bool EndArray(SizeType elementCount) { return true; } }; @@ -216,12 +212,12 @@ struct UEDataHandler : public BaseReaderHandler, UEDataHandler> { string curr_key = ""; string curr_value = ""; - bool Null() { cout << "Null()" << endl; return true; } - bool Bool(bool b) { cout << "Bool(" << boolalpha << b << ")" << endl; return true; } + bool Null() { return true; } + bool Bool(bool b) { return true; } bool Int(int i) { - fprintf(stderr, "Int(%d)\n", i); + if (in_serving_array) { - fprintf(stderr, "we are in serving array\n"); + switch(rf_meas_index) { case 0: serving_cell_rsrp = i; @@ -238,27 +234,27 @@ struct UEDataHandler : public BaseReaderHandler, UEDataHandler> { return true; } bool Uint(unsigned u) { - fprintf(stderr, "Int(%d)\n", u); return true; } - bool Int64(int64_t i) { cout << "Int64(" << i << ")" << endl; return true; } - bool Uint64(uint64_t u) { cout << "Uint64(" << u << ")" << endl; return true; } - bool Double(double d) { cout << "Double(" << d << ")" << endl; return true; } + return true; } + bool Int64(int64_t i) { return true; } + bool Uint64(uint64_t u) { return true; } + bool Double(double d) { return true; } bool String(const char* str, SizeType length, bool copy) { - fprintf(stderr,"String(%s)\n", str); + if (curr_key.compare("ServingCellID") == 0) { serving_cell_id = str; } return true; } - bool StartObject() { cout << "StartObject()" << endl; return true; } + bool StartObject() { return true; } bool Key(const char* str, SizeType length, bool copy) { - fprintf(stderr,"Key(%s)\n", str); + curr_key = str; return true; } - bool EndObject(SizeType memberCount) { cout << "EndObject(" << memberCount << ")" << endl; return true; } + bool EndObject(SizeType memberCount) { return true; } bool StartArray() { - fprintf(stderr,"StartArray()"); + if (curr_key.compare("ServingCellRF") == 0) { in_serving_array = true; } @@ -266,7 +262,7 @@ struct UEDataHandler : public BaseReaderHandler, UEDataHandler> { return true; } bool EndArray(SizeType elementCount) { - fprintf(stderr, "EndArray()\n"); + if (curr_key.compare("servingCellRF") == 0) { in_serving_array = false; rf_meas_index = 0; @@ -295,7 +291,7 @@ unordered_map get_sdl_ue_data() { std::vector val_v = Dk2[(*si)]; // 4 lines to unpack a string char val[val_v.size()+1]; // from Data int i; - fprintf(stderr, "val size %d\n", val_v.size()); + for(i=0;i get_sdl_ue_data() { ue_data[ue_id] = ue_json; } - fprintf(stderr, "after sdl get of ue data\n"); - - fprintf(stderr, "From UE data map\n"); - for (auto map_iter = ue_data.begin(); map_iter != ue_data.end(); map_iter++) { UEDataHandler handler; Reader reader; @@ -318,15 +310,10 @@ unordered_map get_sdl_ue_data() { string serving_cell_id = handler.serving_cell_id; int serv_rsrp = handler.serving_cell_rsrp; - fprintf(stderr,"UE data for %s\n", ueID.c_str()); - fprintf(stderr,"Serving cell %s\n", serving_cell_id.c_str()); - fprintf(stderr,"RSRP for UE %d\n", serv_rsrp); - return_ue_data_map[ueID] = {serving_cell_id, serv_rsrp}; - } - - fprintf(stderr, "\n"); + } + return return_ue_data_map; } @@ -372,8 +359,6 @@ void send_prediction_request(vector ues_to_predict) { int i; Msg_component send_payload; - fprintf(stderr, "cb 1\n"); - msg = xfw->Alloc_msg( 2048 ); sz = msg->Get_available_size(); // we'll reuse a message if we received one back; ensure it's big enough @@ -382,8 +367,6 @@ void send_prediction_request(vector ues_to_predict) { exit( 1 ); } - fprintf(stderr, "cb 2"); - string ues_list = "["; for (int i = 0; i < ues_to_predict.size(); i++) { @@ -405,9 +388,7 @@ void send_prediction_request(vector ues_to_predict) { // snprintf( (char *) send_payload.get(), 2048, body); snprintf( (char *) send_payload.get(), 2048, "{\"UEPredictionSet\": [\"12345\"]}"); - fprintf(stderr, "message body %s\n", send_payload.get()); - - fprintf(stderr, "cb 3"); + fprintf(stderr, "message body %s\n", send_payload.get()); fprintf(stderr, "payload length %d\n", strlen( (char *) send_payload.get() )); // payload updated in place, nothing to copy from, so payload parm is nil @@ -415,8 +396,6 @@ void send_prediction_request(vector ues_to_predict) { fprintf( stderr, " send failed: %d\n", msg->Get_state() ); } - fprintf(stderr, "cb 4"); - /* msg = xfw->Receive( response_to ); if( msg != NULL ) { @@ -447,12 +426,7 @@ void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_comp mtype = 0; - cout << "prediction callback 1" << endl; - const char* arg = (const char*)payload.get(); - - cout << "ready to parse " << arg << endl; - PredictionHandler handler; try { @@ -470,7 +444,6 @@ void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_comp unordered_map throughput_map = handler.cell_pred_down; - cout << endl; unordered_map sdl_data = get_sdl_ue_data(); @@ -490,14 +463,10 @@ void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_comp std::string highest_throughput_cell_id; std::string::size_type str_size; - cout << "Going through throughtput map:" << endl; - for (auto map_iter = throughput_map.begin(); map_iter != throughput_map.end(); map_iter++) { - cout << map_iter->first << " : " << map_iter->second << endl; + std::string curr_cellid = map_iter->first; - cout << "Cell ID is " << curr_cellid; int curr_throughput = map_iter->second; - cout << "Throughput is " << curr_throughput << endl; if (curr_cellid.compare(serving_cell_id) == 0) { serving_cell_throughput = curr_throughput; @@ -509,11 +478,9 @@ void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_comp //Iterating again to identify the highest throughput prediction for (auto map_iter = throughput_map.begin(); map_iter != throughput_map.end(); map_iter++) { - cout << map_iter->first << " : " << map_iter->second << endl; + std::string curr_cellid = map_iter->first; - cout << "Cell ID is " << curr_cellid; int curr_throughput = map_iter->second; - cout << "Throughput is " << curr_throughput << endl; if (curr_throughput > serving_cell_throughput) { highest_throughput = curr_throughput; @@ -539,7 +506,7 @@ void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_comp void run_loop() { - cout << "in run_loop()\n"; + cout << "in Traffic Steering run_loop()\n"; unordered_map uemap; @@ -547,8 +514,6 @@ void run_loop() { while (1) { - cout << "in while loop\n"; - uemap = get_sdl_ue_data(); for (auto map_iter = uemap.begin(); map_iter != uemap.end(); map_iter++) { @@ -582,14 +547,10 @@ extern int main( int argc, char** argv ) { fprintf( stderr, " listening on port: %s\n", port ); - xfw = std::unique_ptr( new Xapp( port, true ) ); // new xAPP thing; wait for a route table - fprintf(stderr, "code1\n"); - + xfw = std::unique_ptr( new Xapp( port, true ) ); xfw->Add_msg_cb( 20010, policy_callback, NULL ); xfw->Add_msg_cb( 30002, prediction_callback, NULL ); - - fprintf(stderr, "code2\n"); std::thread loop_thread; diff --git a/xapp-descriptor/config.json b/xapp-descriptor/config.json index 30b1591..c703bf9 100644 --- a/xapp-descriptor/config.json +++ b/xapp-descriptor/config.json @@ -5,9 +5,9 @@ { "name": "trafficxapp", "image": { - "registry": "nexus3.o-ran-sc.org:10004", + "registry": "nexus3.o-ran-sc.org:10002", "name": "o-ran-sc/ric-app-ts", - "tag": "1.0.10" + "tag": "1.0.11" } } ], -- 2.16.6