From: Eduardo Ramos Testillano Date: Fri, 30 Jun 2017 01:06:24 +0000 (+0200) Subject: Fixes and improvements X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=commitdiff_plain;h=5406b19bdbfe101b264f8c4d878392e2916b8f9d Fixes and improvements * Allow zeroed cntRecordPeriod as special case (no counters dump) instead of throwing exception for invalid time measure. * Remove symlink to services_example in st client deployment and improve help to guide to correct configuration of services. * Alert about restarting ADML processes when dynamic library has been updated/selected. * Fixed ApplicationMessageOamModule key (eventId now includes %s_%s instead of %s%s to avoid possible ambiguity in a key definition from to values. * Hide exception for non Result-Code in diameter answer, because this AVP is optional even in some answers. * Initialize resultCode to -1 instead of 0 to avoid having a ResultCode0 as counter prefixes. * Remove warning from OriginHostManager::getOriginHost when item is not found, because this is used also to discard redefinitions when something already exists in the map. * CodecEngine getter has been fixed to cover the monostack case where the stack id does not correspond to the app id in the requests but the value of 0 (normally). * Clarify MessageDeque warnings when answer is analyzed during configured from original request: this seems to be missing warnings from request message findings but that are coming from answer ! --- diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index eabf635..94d8f66 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -596,7 +596,14 @@ throw(anna::RuntimeException) { // Counters record procedure: const char *varname = "cntRecordPeriod"; - anna::Millisecond cntRecordPeriod = (cl.exists(varname)) ? checkTimeMeasure(varname, cl.getValue(varname)) : (anna::Millisecond)300000; + anna::Millisecond cntRecordPeriod; + try { + cntRecordPeriod = (cl.exists(varname)) ? checkTimeMeasure(varname, cl.getValue(varname)) : (anna::Millisecond)300000; + } + catch(anna::RuntimeException &ex) { + if (cntRecordPeriod != 0) throw ex; + } + if(cntRecordPeriod != 0) { a_counterRecorderClock = new MyCounterRecorderClock("Counters record procedure clock", cntRecordPeriod); // clock std::string cntDir = "."; diff --git a/example/diameter/launcher/deploy.sh b/example/diameter/launcher/deploy.sh index 6edd05a..fdd17e7 100755 --- a/example/diameter/launcher/deploy.sh +++ b/example/diameter/launcher/deploy.sh @@ -224,7 +224,7 @@ cd - >/dev/null if [ "$option" = "s" ] then cd $DPATH - ln -s services_example services + #ln -s services_example services mv run.sh .run-one.sh mv run_all.sh run.sh mv operation.sh .operation-one.sh diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh index 56adfcc..4b231ee 100755 --- a/example/diameter/launcher/deployments/st-client/configure.sh +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -17,9 +17,7 @@ N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE=.st_conf_n_testcases_program_layout # FUNCTIONS # ############# _exit () { - echo - echo $1 - echo + echo -e "\n$1\n" exit 1 } @@ -132,7 +130,7 @@ then _exit fi -[ ! -d services ] && _exit "Missing services configuration (expecting '$PWD/services' directory) !" +[ ! -d services ] && _exit "Missing services configuration (expecting '$PWD/services' directory).\nTake a look to 'services_example' and './dynlibs' scenaries stuff to complete your services.\n\nFor example:\n ln -s services_example services\n cp dynlibs/gx/00001/services/* services\n Edit CER files and 'services.msk' there, to fit your needs." calculate_deployment_layout diff --git a/example/diameter/launcher/deployments/st-client/program.sh b/example/diameter/launcher/deployments/st-client/program.sh index e5f3b35..5714785 100755 --- a/example/diameter/launcher/deployments/st-client/program.sh +++ b/example/diameter/launcher/deployments/st-client/program.sh @@ -184,7 +184,7 @@ else TESTCASE_DIR=$(readlink -f dynlibs/libanna_launcher_procedure_default_shared.so | xargs dirname) DYNAMIC_SUFFIX_FILE=$TESTCASE_DIR/dynamic.suffix - [ ! -f $DYNAMIC_SUFFIX_FILE ] && _exit "Missing '$DYNAMIC_SUFFIX_FILE' file.\nUse 'dynlibs/select.sh' to change the dynamic procedure and restart the ADML instances." + [ ! -f $DYNAMIC_SUFFIX_FILE ] && _exit "Missing '$DYNAMIC_SUFFIX_FILE' file.\nUse 'dynlibs/select.sh' to change the dynamic procedure and very important: RESTART the ADML instances." dynamic_suffix=( $(grep -v ^# $DYNAMIC_SUFFIX_FILE) ) # Multiple scenarios: diff --git a/example/diameter/launcher/resources/scripts/select_dynlib.sh b/example/diameter/launcher/resources/scripts/select_dynlib.sh index c1cf52b..0308ca9 100755 --- a/example/diameter/launcher/resources/scripts/select_dynlib.sh +++ b/example/diameter/launcher/resources/scripts/select_dynlib.sh @@ -29,6 +29,11 @@ option_bn=$(basename $option) ln -sf $option $dynamicProcedureLibName [ $? -ne 0 ] && { rm -f $dynamicProcedureLibName ; echo -e "\nInvalid file (must be a dynamic procedure library) !\n" ; exit 1 ; } echo -echo "Library enabled" +echo "Library enabled." +echo +echo +echo "IMPORTANT: remember to Re-Start the affected ADML instances:" +echo +echo " pkill -9 ADML ; ./run.sh" echo diff --git a/source/diameter.comm/ApplicationMessageOamModule.cpp b/source/diameter.comm/ApplicationMessageOamModule.cpp index d167d71..91fff6c 100644 --- a/source/diameter.comm/ApplicationMessageOamModule.cpp +++ b/source/diameter.comm/ApplicationMessageOamModule.cpp @@ -80,10 +80,10 @@ void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, setActiveCounterScope(scopeId); // Build event id: _ - std::string eventId = anna::functions::asString("%d%d", messageCode, resultCode); + std::string eventId = anna::functions::asString("%d_%d", messageCode, resultCode); std::map::const_iterator eventMap_it = a_eventMap.find(eventId); - int baseOffset = eventMap_it->second; + int baseOffset; if (eventMap_it == a_eventMap.end()) { int capacity = anna::oam::CounterScope::MaxCounter / getCounterTypes(); @@ -124,6 +124,9 @@ void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, registerCounter(baseOffset + offset, counterName, baseOffset + offset); //} } + else { + baseOffset = eventMap_it->second; + } // Count Module::count(baseOffset + type, amount); diff --git a/source/diameter.comm/ClientSession.cpp b/source/diameter.comm/ClientSession.cpp index aea2851..c624155 100644 --- a/source/diameter.comm/ClientSession.cpp +++ b/source/diameter.comm/ClientSession.cpp @@ -569,12 +569,13 @@ throw(anna::RuntimeException) { ///////////////////////////// bool doUnbind = false; bool immediateUnbind = false; - int resultCode = 0; + int resultCode = -1; try { resultCode = helpers::base::functions::getResultCode(db); } catch(anna::RuntimeException& ex) { - ex.trace(); + // Not always mandatory ... + //ex.trace(); } // Received CEA diff --git a/source/diameter.comm/OriginHostManager.cpp b/source/diameter.comm/OriginHostManager.cpp index 067444d..d821a7a 100644 --- a/source/diameter.comm/OriginHostManager.cpp +++ b/source/diameter.comm/OriginHostManager.cpp @@ -20,11 +20,6 @@ OriginHost *OriginHostManager::getOriginHost(const std::string &name) const thro if (it != a_origin_hosts.end()) return it->second; - LOGWARNING( - std::string msg = "Unknown origin host node with name '"; msg += name; msg += "'"; - anna::Logger::warning(msg, ANNA_FILE_LOCATION); - ); - return NULL; } diff --git a/source/diameter/codec/EngineManager.cpp b/source/diameter/codec/EngineManager.cpp index 2eb6f78..f3f505e 100644 --- a/source/diameter/codec/EngineManager.cpp +++ b/source/diameter/codec/EngineManager.cpp @@ -22,7 +22,8 @@ Engine *EngineManager::getCodecEngine(const ApplicationId &appid) const throw() if (it != a_appid_codec_engines.end()) return it->second; - return NULL; + // Just in case: + return getMonoStackCodecEngine(); } void EngineManager::registerCodecEngine(const ApplicationId &appid, Engine* engine) throw() { diff --git a/source/diameter/codec/Message.cpp b/source/diameter/codec/Message.cpp index 0b4d802..0ea876b 100644 --- a/source/diameter/codec/Message.cpp +++ b/source/diameter/codec/Message.cpp @@ -557,6 +557,8 @@ void Message::setStandardToAnswer(const Message &request, const std::string &ori // Session-Id if exists: const Avp *reqSessionId = request.getAvp(helpers::base::AVPID__Session_Id, 1, anna::Exception::Mode::Ignore); + LOGDEBUG(anna::Logger::debug("Check answer message AVPs Session-Id, Origin-Host and Origin-Realm => replace them if missing, with request session-id & node configuration:", ANNA_FILE_LOCATION)); + if(reqSessionId) if(!getAvp(helpers::base::AVPID__Session_Id, 1, anna::Exception::Mode::Ignore)) addAvp(helpers::base::AVPID__Session_Id)->getUTF8String()->setValue(reqSessionId->getUTF8String()->getValue()); diff --git a/source/diameter/codec/MessagesDeque.cpp b/source/diameter/codec/MessagesDeque.cpp index 2461e19..96f526a 100644 --- a/source/diameter/codec/MessagesDeque.cpp +++ b/source/diameter/codec/MessagesDeque.cpp @@ -106,7 +106,7 @@ void MessagesDeque::nextMessage(int code) throw () { //pops the deque and releas engine->releaseMessage(message); } else { - LOGWARNING(anna::Logger::warning("Cannot release a message for which i don't know the codec engine (check the registered stack id regarding the message application id) !", ANNA_FILE_LOCATION)); + LOGWARNING(anna::Logger::warning("Cannot release a message for which I don't know the codec engine (check the registered stack id regarding the message application id) !", ANNA_FILE_LOCATION)); return; } }