From c8a0b8a8606f42cd2cc6cd14c7f180319f45bf85 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Wed, 7 Oct 2015 00:31:03 +0200 Subject: [PATCH 01/16] Allow set NULL codec engine --- source/diameter/codec/Message.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/diameter/codec/Message.cpp b/source/diameter/codec/Message.cpp index 6593dd4..5849196 100644 --- a/source/diameter/codec/Message.cpp +++ b/source/diameter/codec/Message.cpp @@ -84,7 +84,7 @@ Message::~Message() { //------------------------------------------------------------------------------ void Message::setEngine(Engine *engine) throw() { - if (a_engine && engine != a_engine) { + if (a_engine && engine && (engine != a_engine)) { LOGWARNING(anna::Logger::warning("Ignored: it is not a good practice to change the codec engine once assigned. Clear the message first to set the engine again.", ANNA_FILE_LOCATION)); return; } -- 2.20.1 From ceba20e0efab1bc4e564c18fe05a9a0047983653 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Wed, 7 Oct 2015 01:10:52 +0200 Subject: [PATCH 02/16] Not allowed to set engine NULL !! --- example/diameter/batchConverter/main.cpp | 2 +- include/anna/diameter/codec/Message.hpp | 9 +++------ source/diameter/codec/Message.cpp | 7 ++++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/example/diameter/batchConverter/main.cpp b/example/diameter/batchConverter/main.cpp index 0e7eff4..12265cf 100644 --- a/example/diameter/batchConverter/main.cpp +++ b/example/diameter/batchConverter/main.cpp @@ -70,7 +70,7 @@ void _exit(const std::string &message, int resultCode = 1) { // Decodes a diameter message coming from a datablock void decodeDataBlock(const anna::DataBlock &db/*, unsigned int & detectedApplicationId*/) throw() { try { - G_codecMsg.setEngine(NULL); // perhaps we will need another codec engine ... + G_codecMsg.clear(); G_codecMsg.decode(db); } catch(RuntimeException &ex) { _exit(ex.asString()); diff --git a/include/anna/diameter/codec/Message.hpp b/include/anna/diameter/codec/Message.hpp index 32aa932..a040aa1 100644 --- a/include/anna/diameter/codec/Message.hpp +++ b/include/anna/diameter/codec/Message.hpp @@ -189,12 +189,9 @@ public: * may occur. If you add elements (vendors, avps, messages) is not a problem. * * IMPORTANT NOTES: - * 1) if you want to reuse the message, as a recommendation, you should set engine to - * NULL or use #clear. In that way, next operation will adjust automatically the needed - * engine because it would not be configured in such stage. - * 2) if you want to pre-configure the engine you will need to set the engine to NULL - * previously and then you could change to the new one without warning/ignoring. - * 3) if you have dedicated message objects for each interface (application id), then + * 1) if you want to reuse the message, as a recommendation, you should #clear the + * message. In that way, next operation will adjust automatically the needed engine. + * 2) if you have dedicated message objects for each interface (application id), then * you could set the corresponding engine on constructor (or setEngine), and forget * about #clear. The needed cleanup will be done automatically from decoding and xml * loading procedures, and initialized engine will be kept along message operations. diff --git a/source/diameter/codec/Message.cpp b/source/diameter/codec/Message.cpp index 5849196..28a1d45 100644 --- a/source/diameter/codec/Message.cpp +++ b/source/diameter/codec/Message.cpp @@ -84,7 +84,12 @@ Message::~Message() { //------------------------------------------------------------------------------ void Message::setEngine(Engine *engine) throw() { - if (a_engine && engine && (engine != a_engine)) { + if (!engine) { + LOGWARNING(anna::Logger::warning("Ignored: you must assign a valid codec engine. If you want to set NULL engine, clear the message", ANNA_FILE_LOCATION)); + return; + } + + if (a_engine && (engine != a_engine)) { LOGWARNING(anna::Logger::warning("Ignored: it is not a good practice to change the codec engine once assigned. Clear the message first to set the engine again.", ANNA_FILE_LOCATION)); return; } -- 2.20.1 From 3dde4250ae27629bc4a633bc76472ac8519201ef Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Wed, 7 Oct 2015 17:37:04 +0200 Subject: [PATCH 03/16] Disable logs general override configuration, for system test easy startup --- example/diameter/launcher/Launcher.cpp | 27 +++++++++++++++++--------- example/diameter/launcher/main.cpp | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 5ee3466..c582cf4 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -132,7 +132,11 @@ Launcher::Launcher() : anna::comm::Application("launcher", "DiameterLauncher", " void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool eventOperation) throw(anna::RuntimeException) { - // + + CommandLine& cl(anna::CommandLine::instantiate()); + bool allLogsDisabled = cl.exists("disableLogs"); + + // const anna::xml::Attribute *id, *dictionary; // @@ -140,7 +144,6 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool eventOp *answersTimeout, *ceaTimeout, *watchdogPeriod, *entity, *entityServerSessions, *diameterServer, *diameterServerSessions, *balance, *sessionBasedModelsClientSocketSelection, *retries, *log, *splitLog, *detailedLog, *dumpLog, *burstLog; - // Never clear services content from here (append new data from xml). At the moment no node removing is implemented in this process // Stacks @@ -348,13 +351,15 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool eventOp } // Logs: - std::string realm = commEngine->getRealm(); - std::string s_log = realm + ".launcher.log"; if (log) s_log = log->getValue(); - bool b_splitLog = (splitLog ? (splitLog->getValue() == "yes") : false); - bool b_detailedLog = (detailedLog ? (detailedLog->getValue() == "yes") : false); - bool b_dumpLog = (dumpLog ? (dumpLog->getValue() == "yes") : false); - std::string s_burstLog = realm + ".launcher.burst"; if (burstLog) s_burstLog = burstLog->getValue(); - a_workingNode->setLogs(s_log, b_splitLog, b_detailedLog, b_dumpLog, s_burstLog); + if (!allLogsDisabled) { + std::string realm = commEngine->getRealm(); + std::string s_log = realm + ".launcher.log"; if (log) s_log = log->getValue(); + bool b_splitLog = (splitLog ? (splitLog->getValue() == "yes") : false); + bool b_detailedLog = (detailedLog ? (detailedLog->getValue() == "yes") : false); + bool b_dumpLog = (dumpLog ? (dumpLog->getValue() == "yes") : false); + std::string s_burstLog = realm + ".launcher.burst"; if (burstLog) s_burstLog = burstLog->getValue(); + a_workingNode->setLogs(s_log, b_splitLog, b_detailedLog, b_dumpLog, s_burstLog); + } // Lazy initialization for comm engine: @@ -967,6 +972,10 @@ std::string Launcher::help() const throw() { result += "\n to load new nodes once the ADML is started, regardless if command"; result += "\n line '--services' parameter was used or not. Those services which"; result += "\n are not correctly loaded will be ignored to keep the process alive."; + result += "\n If you need to load services as deltas, you must firstly load the"; + result += "\n diameter base dictionary with stack id 0, because all the realms"; + result += "\n will use this dictionary to encode/decode base protocol messages"; + result += "\n managed by the communication engine."; result += "\n"; result += "\ndiameterServerSessions| Updates the maximum number of accepted connections to diameter"; result += "\n server socket."; diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index a0f4fb6..9f45651 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -35,6 +35,7 @@ int main(int argc, const char** argv) { commandLine.add("tmDir", anna::CommandLine::Argument::Optional, "Test manager directory. By default is the current execution directory. Warning: report files could be dump during system testing (see help for management operation 'test|report'); take care about the possible accumulation of files"); commandLine.add("cntRecordPeriod", anna::CommandLine::Argument::Optional, "Counters record procedure period in milliseconds. If missing, default value of 300000 (5 minutes) will be assigned. Value of 0 disables the record procedure."); commandLine.add("logStatisticSamples", anna::CommandLine::Argument::Optional, "Log statistics samples for the provided concept id list, over './sample..csv' files. For example: \"1,2\" will log concepts 1 and 2. Reserved word \"all\" activates all registered statistics concept identifiers. That ids are shown at context dump (see help to get it)."); + commandLine.add("disableLogs", anna::CommandLine::Argument::Optional, "Overrides every realm configuration regarding traffic log in order to disable it and ease production or system test startup.", false); // Communications commandLine.add("reconnectionPeriod", anna::CommandLine::Argument::Optional, "Milliseconds to recover diameter client-session when server connection has been broken. If missing, default value of 10000 will be assigned"); -- 2.20.1 From 38f67dae313f5b4b988a11804cfee52f74e16e33 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Thu, 8 Oct 2015 01:15:54 +0200 Subject: [PATCH 04/16] Session-Id don't have to be mandatory to programm testcases --- example/diameter/launcher/testing/TestCase.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/example/diameter/launcher/testing/TestCase.cpp b/example/diameter/launcher/testing/TestCase.cpp index 3d91f32..0b26170 100644 --- a/example/diameter/launcher/testing/TestCase.cpp +++ b/example/diameter/launcher/testing/TestCase.cpp @@ -241,8 +241,16 @@ void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(ann a_hopByHops[hbh] = NULL; // may be assigned to a wait condition } - if (registerSessionId) - TestManager::instantiate().registerSessionId(anna::diameter::helpers::base::functions::getSessionId(db), this); + if (registerSessionId) { + try { + std::string sid = anna::diameter::helpers::base::functions::getSessionId(db); + TestManager::instantiate().registerSessionId(sid, this); + } + catch (anna::RuntimeException &ex) { + //ex.trace(); + // if we don't have session-id ... don't worry + } + } } void TestCase::addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException) { -- 2.20.1 From 56afb5fb4f4985e5529e7491b78a6214e455f95a Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Thu, 8 Oct 2015 02:23:41 +0200 Subject: [PATCH 05/16] Separate oam and statistics in event operations --- example/diameter/launcher/Launcher.cpp | 31 +++++++++++++++++++------- example/diameter/launcher/Launcher.hpp | 3 ++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index c582cf4..4ec6ea0 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -989,8 +989,10 @@ std::string Launcher::help() const throw() { result += "\n This operation applies over all the registered realm nodes"; result += "\n except if one specific working node has been set."; result += "\nforceCountersRecord Forces dump to file the current counters of the process."; - result += "\noam-and-stats Dumps current counters and statistics of the process. This is"; - result += "\n also done at process context dump."; + result += "\nshow-oam Dumps current counters of the process. This is also done at"; + result += "\n process context dump."; + result += "\nshow-stats Dumps statistics of the process. This is also done at process"; + result += "\n context dump."; result += "\n"; result += "\n[|
:][|socket id]"; result += "\n"; @@ -1442,9 +1444,14 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons } // OAM & statistics: - if(operation == "oam-and-stats") { + if(operation == "show-oam") { anna::xml::Node root("root"); - response_content = anna::xml::Compiler().apply(oamAndStatsAsXML(&root)); + response_content = anna::xml::Compiler().apply(oamAsXML(&root)); + return; + } + if(operation == "show-stats") { + anna::xml::Node root("root"); + response_content = anna::xml::Compiler().apply(statsAsXML(&root)); return; } @@ -2130,7 +2137,8 @@ throw() { } // OAM & statistics: - oamAndStatsAsXML(result); + oamAsXML(result); + statsAsXML(result); // Testing: could be heavy if test case reports are enabled TestManager::instantiate().asXML(result); @@ -2138,17 +2146,24 @@ throw() { return result; } -anna::xml::Node* Launcher::oamAndStatsAsXML(anna::xml::Node* parent) const +anna::xml::Node* Launcher::oamAsXML(anna::xml::Node* parent) const throw() { - anna::xml::Node* result = parent->createChild("OamAndStatistics"); + anna::xml::Node* result = parent->createChild("Oam"); // OAM: anna::diameter::comm::OamModule::instantiate().asXML(result); anna::diameter::comm::ApplicationMessageOamModule::instantiate().asXML(result); anna::diameter::codec::OamModule::instantiate().asXML(result); + + return result; +} + +anna::xml::Node* Launcher::statsAsXML(anna::xml::Node* parent) const +throw() { + anna::xml::Node* result = parent->createChild("Statistics"); + // Statistics: anna::statistics::Engine::instantiate().asXML(result); return result; } - diff --git a/example/diameter/launcher/Launcher.hpp b/example/diameter/launcher/Launcher.hpp index 8bd0093..2101948 100644 --- a/example/diameter/launcher/Launcher.hpp +++ b/example/diameter/launcher/Launcher.hpp @@ -112,7 +112,8 @@ public: void resetCounters() throw(); void signalUSR2() throw(anna::RuntimeException); std::string help() const throw(); - anna::xml::Node* oamAndStatsAsXML(anna::xml::Node* parent) const throw(); + anna::xml::Node* oamAsXML(anna::xml::Node* parent) const throw(); + anna::xml::Node* statsAsXML(anna::xml::Node* parent) const throw(); // helpers bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw(); -- 2.20.1 From 61535eaec506725cfd019750c6b8d1ed6cdf16fd Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Thu, 8 Oct 2015 02:48:00 +0200 Subject: [PATCH 06/16] System testing manage DPA --- example/diameter/launcher/MyDiameterEntity.cpp | 3 +++ example/diameter/launcher/MyLocalServer.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/example/diameter/launcher/MyDiameterEntity.cpp b/example/diameter/launcher/MyDiameterEntity.cpp index 6c1244b..6dcf797 100644 --- a/example/diameter/launcher/MyDiameterEntity.cpp +++ b/example/diameter/launcher/MyDiameterEntity.cpp @@ -318,4 +318,7 @@ throw(anna::RuntimeException) { // Write reception if(my_node->logEnabled()) my_node->writeLogFile(message, "recvfe", clientSession->asString()); + + // Testing: + TestManager::instantiate().receiveMessage(message, my_node, clientSession); } diff --git a/example/diameter/launcher/MyLocalServer.cpp b/example/diameter/launcher/MyLocalServer.cpp index 110efdc..513cdb4 100644 --- a/example/diameter/launcher/MyLocalServer.cpp +++ b/example/diameter/launcher/MyLocalServer.cpp @@ -273,5 +273,9 @@ throw(anna::RuntimeException) { anna::Logger::debug(msg, ANNA_FILE_LOCATION); ); + // Write reception if(my_node->logEnabled()) my_node->writeLogFile(message, "recvfc", serverSession->asString()); + + // Testing: + TestManager::instantiate().receiveMessage(message, my_node, serverSession); } -- 2.20.1 From b2eda5879555efb07a0b1d8461ae1dcb93f8d8c8 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 9 Oct 2015 15:20:37 +0200 Subject: [PATCH 07/16] Revert "Session-Id don't have to be mandatory to programm testcases" This reverts commit 38f67dae313f5b4b988a11804cfee52f74e16e33. --- example/diameter/launcher/testing/TestCase.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/example/diameter/launcher/testing/TestCase.cpp b/example/diameter/launcher/testing/TestCase.cpp index 0b26170..3d91f32 100644 --- a/example/diameter/launcher/testing/TestCase.cpp +++ b/example/diameter/launcher/testing/TestCase.cpp @@ -241,16 +241,8 @@ void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(ann a_hopByHops[hbh] = NULL; // may be assigned to a wait condition } - if (registerSessionId) { - try { - std::string sid = anna::diameter::helpers::base::functions::getSessionId(db); - TestManager::instantiate().registerSessionId(sid, this); - } - catch (anna::RuntimeException &ex) { - //ex.trace(); - // if we don't have session-id ... don't worry - } - } + if (registerSessionId) + TestManager::instantiate().registerSessionId(anna::diameter::helpers::base::functions::getSessionId(db), this); } void TestCase::addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException) { -- 2.20.1 From 66409396bebc1cfeb63d404f3aee8639159298d5 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 9 Oct 2015 17:52:30 +0200 Subject: [PATCH 08/16] Register accumulators on stat engine to centralize reports. TODO remove from engine (index them) when server/local server are destroyed. --- include/anna/diameter.comm/LocalServer.hpp | 3 +- include/anna/diameter.comm/Server.hpp | 3 +- include/anna/statistics/Engine.hpp | 17 ++++++++++ source/diameter.comm/LocalServer.cpp | 24 +++++++------- source/diameter.comm/Server.cpp | 24 +++++++------- source/diameter.comm/Session.cpp | 1 - source/statistics/Accumulator.cpp | 2 +- source/statistics/Engine.cpp | 37 ++++++++++++++++++++-- 8 files changed, 81 insertions(+), 30 deletions(-) diff --git a/include/anna/diameter.comm/LocalServer.hpp b/include/anna/diameter.comm/LocalServer.hpp index 734972d..e97fb20 100644 --- a/include/anna/diameter.comm/LocalServer.hpp +++ b/include/anna/diameter.comm/LocalServer.hpp @@ -67,7 +67,7 @@ class LocalServer { // Statistics int a_processing_time__StatisticConceptId; // request from local server (dpr's, etc.) int a_received_message_size__StatisticConceptId; - anna::statistics::Accumulator a_statisticsAccumulator; + anna::statistics::Accumulator *a_statisticsAccumulator; void initializeStatisticConcepts() throw(); void resetStatistics() throw(); @@ -412,4 +412,3 @@ protected: } #endif - diff --git a/include/anna/diameter.comm/Server.hpp b/include/anna/diameter.comm/Server.hpp index 15c29de..0484484 100644 --- a/include/anna/diameter.comm/Server.hpp +++ b/include/anna/diameter.comm/Server.hpp @@ -73,7 +73,7 @@ class Server { // Statistics int a_processing_time__StatisticConceptId; int a_received_message_size__StatisticConceptId; - anna::statistics::Accumulator a_statisticsAccumulator; + anna::statistics::Accumulator *a_statisticsAccumulator; void initializeStatisticConcepts() throw(); void resetStatistics() throw(); @@ -331,4 +331,3 @@ protected: } #endif - diff --git a/include/anna/statistics/Engine.hpp b/include/anna/statistics/Engine.hpp index bb376f8..8f59a2e 100644 --- a/include/anna/statistics/Engine.hpp +++ b/include/anna/statistics/Engine.hpp @@ -11,9 +11,11 @@ #include #include +#include // Standard #include +#include #include // Local @@ -45,6 +47,8 @@ typedef std::map _concept_identification_map_t; typedef std::map ::const_iterator _concept_identification_map_iter; typedef std::map ::iterator _concept_identification_map_nc_iter; +typedef std::vector _accumulator_vector_t; +typedef std::vector ::const_iterator _accumulator_vector_it; /** @@ -57,6 +61,9 @@ class Engine : public anna::Singleton { public: + /** Destructor */ + ~Engine(); + // Sets /** @@ -130,6 +137,14 @@ public: */ bool enabled(void) const throw() { return (a_enabled); } + /** + * There is an advantage creating Accumulators over the engine: the #asXML method will show all the controlled information + * easily. Anyway, you could allocate this class objects without using this. Then, this is a helper to create accumulators + * and centralize their reports. + * + * @return New allocated accumulator, to be used by the client + */ + Accumulator *createAccumulator() throw(); /** * Class string representation @@ -154,8 +169,10 @@ private: Engine(); // private constructor _concept_identification_map_t a_concept_identification_map; + _accumulator_vector_t a_accumulators; // you could create accumulators regardless the engine, but this is easier and asXML will show all the information easily bool a_enabled; int a_sequence_concept_id; + anna::Mutex a_mutex; // for logSample bool logSample(const int & conceptId, const anna::Millisecond & unixTimestamp, const double & value) const throw(); diff --git a/source/diameter.comm/LocalServer.cpp b/source/diameter.comm/LocalServer.cpp index a14b3c6..67c35fc 100644 --- a/source/diameter.comm/LocalServer.cpp +++ b/source/diameter.comm/LocalServer.cpp @@ -44,34 +44,37 @@ LocalServer::LocalServer() : a_lock(false), a_available(false), a_lastUsedResource(NULL) { - a_statisticsAccumulator.reset(); + a_statisticsAccumulator = anna::statistics::Engine::instantiate().createAccumulator(); } void LocalServer::initializeStatisticConcepts() throw() { + // Realm name + std::string realmName = a_engine ? a_engine->getRealm() : "unknown"; // it should be known (createServer) + // Statistics: anna::statistics::Engine& statsEngine = anna::statistics::Engine::instantiate(); // Concepts descriptions: std::string serverAsString = anna::functions::socketLiteralAsString(a_key.first, a_key.second); - std::string c1desc = "Diameter processing time (for requests) at clients connected to "; c1desc += serverAsString; - std::string c2desc = "Diameter message sizes received from clients connected to "; c2desc += serverAsString; + std::string c1desc = "Diameter processing time (for requests) at clients connected to "; c1desc += serverAsString; c1desc += " for realm '"; c1desc += realmName; c1desc += "'"; + std::string c2desc = "Diameter message sizes received from clients connected to "; c2desc += serverAsString; c2desc += " for realm '"; c2desc += realmName; c2desc += "'"; // Registering a_processing_time__StatisticConceptId = statsEngine.addConcept(c1desc.c_str(), "ms", true/* integer values */); a_received_message_size__StatisticConceptId = statsEngine.addConcept(c2desc.c_str(), "bytes", true/* integer values */); } void LocalServer::resetStatistics() throw() { - a_statisticsAccumulator.reset(); + a_statisticsAccumulator->reset(); } void LocalServer::updateProcessingTimeStatisticConcept(const double &value) throw() { - a_statisticsAccumulator.process(a_processing_time__StatisticConceptId, value); - LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator.asString(), ANNA_FILE_LOCATION)); + a_statisticsAccumulator->process(a_processing_time__StatisticConceptId, value); + LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator->asString(), ANNA_FILE_LOCATION)); } void LocalServer::updateReceivedMessageSizeStatisticConcept(const double &value) throw() { - a_statisticsAccumulator.process(a_received_message_size__StatisticConceptId, value); - //LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator.asString(), ANNA_FILE_LOCATION)); + a_statisticsAccumulator->process(a_received_message_size__StatisticConceptId, value); + //LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator->asString(), ANNA_FILE_LOCATION)); } @@ -565,7 +568,7 @@ std::string LocalServer::asString() const throw() { result += " | Last Outgoing Activity Time: "; result += a_lastOutgoingActivityTime.asString(); // result += "\n"; -// result += a_statisticsAccumulator.asString(); +// result += a_statisticsAccumulator->asString(); // ServerSessions only in xml return result += " }"; } @@ -590,7 +593,7 @@ anna::xml::Node* LocalServer::asXML(anna::xml::Node* parent) const throw() { result->createAttribute("LastOutgoingActivityTime", a_lastOutgoingActivityTime.asString()); // Statistics anna::xml::Node* stats = result->createChild("Statistics"); - a_statisticsAccumulator.asXML(stats); + a_statisticsAccumulator->asXML(stats); anna::xml::Node* serverSessions = result->createChild("ServerSessions"); // LocalServer.ServerSessions for(const_serverSession_iterator it = serverSession_begin(); it != serverSession_end(); it++) @@ -625,4 +628,3 @@ void LocalServer::updateOutgoingActivityTime(void) throw() { anna::Logger::debug(msg, ANNA_FILE_LOCATION); ); } - diff --git a/source/diameter.comm/Server.cpp b/source/diameter.comm/Server.cpp index a751d48..758ac2d 100644 --- a/source/diameter.comm/Server.cpp +++ b/source/diameter.comm/Server.cpp @@ -36,34 +36,37 @@ void Server::initialize() throw() { a_maxClientSessions = 1; // mono client connection a_lastIncomingActivityTime = (anna::Millisecond)0; a_lastOutgoingActivityTime = (anna::Millisecond)0; - a_statisticsAccumulator.reset(); + a_statisticsAccumulator = anna::statistics::Engine::instantiate().createAccumulator(); a_lastUsedResource = NULL; } void Server::initializeStatisticConcepts() throw() { + // Realm name + std::string realmName = a_engine ? a_engine->getRealm() : "unknown"; // it should be known (createServer) + // Statistics: anna::statistics::Engine& statsEngine = anna::statistics::Engine::instantiate(); // Concepts descriptions: std::string serverAsString = anna::functions::socketLiteralAsString(a_socket.first, a_socket.second); - std::string c1desc = "Diameter processing time (for requests) at servers on "; c1desc += serverAsString; - std::string c2desc = "Diameter message sizes received from servers on "; c2desc += serverAsString; + std::string c1desc = "Diameter processing time (for requests) at servers on "; c1desc += serverAsString; c1desc += " for realm '"; c1desc += realmName; c1desc += "'"; + std::string c2desc = "Diameter message sizes received from servers on "; c2desc += serverAsString; c2desc += " for realm '"; c2desc += realmName; c2desc += "'"; // Registering a_processing_time__StatisticConceptId = statsEngine.addConcept(c1desc.c_str(), "ms", true/* integer values */); a_received_message_size__StatisticConceptId = statsEngine.addConcept(c2desc.c_str(), "bytes", true/* integer values */); } void Server::resetStatistics() throw() { - a_statisticsAccumulator.reset(); + a_statisticsAccumulator->reset(); } void Server::updateProcessingTimeStatisticConcept(const double &value) throw() { - a_statisticsAccumulator.process(a_processing_time__StatisticConceptId, value); - LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator.asString(), ANNA_FILE_LOCATION)); + a_statisticsAccumulator->process(a_processing_time__StatisticConceptId, value); + LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator->asString(), ANNA_FILE_LOCATION)); } void Server::updateReceivedMessageSizeStatisticConcept(const double &value) throw() { - a_statisticsAccumulator.process(a_received_message_size__StatisticConceptId, value); - //LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator.asString(), ANNA_FILE_LOCATION)); + a_statisticsAccumulator->process(a_received_message_size__StatisticConceptId, value); + //LOGDEBUG(anna::Logger::debug(a_statisticsAccumulator->asString(), ANNA_FILE_LOCATION)); } @@ -280,7 +283,7 @@ std::string Server::asString() const throw() { result += " | Hidden: "; result += (hidden() ? "yes" : "no"); result += "\n"; - result += a_statisticsAccumulator.asString(); + result += a_statisticsAccumulator->asString(); for(std::vector::const_iterator it = begin(); it != end(); it++) { result += "\n"; @@ -304,7 +307,7 @@ anna::xml::Node* Server::asXML(anna::xml::Node* parent) const throw() { result->createAttribute("Hidden", hidden() ? "yes" : "no"); // Statistics anna::xml::Node* stats = result->createChild("Statistics"); - a_statisticsAccumulator.asXML(stats); + a_statisticsAccumulator->asXML(stats); anna::xml::Node* clientSessions = result->createChild("Server.ClientSessions"); for(std::vector::const_iterator it = begin(); it != end(); it++) @@ -438,4 +441,3 @@ void Server::updateOutgoingActivityTime(void) throw() { ); a_parent->updateOutgoingActivityTime(); } - diff --git a/source/diameter.comm/Session.cpp b/source/diameter.comm/Session.cpp index 06bec4b..11fe035 100644 --- a/source/diameter.comm/Session.cpp +++ b/source/diameter.comm/Session.cpp @@ -496,4 +496,3 @@ void Session::updateOutgoingActivityTime(void) throw() { anna::Logger::debug(msg, ANNA_FILE_LOCATION); ); } - diff --git a/source/statistics/Accumulator.cpp b/source/statistics/Accumulator.cpp index 3753ed7..1644700 100644 --- a/source/statistics/Accumulator.cpp +++ b/source/statistics/Accumulator.cpp @@ -145,7 +145,7 @@ void Accumulator::process(const int & conceptId, const double & value) throw(ann _concept_data_t *ptr_auxConceptData = getConcept(conceptId); anna::Millisecond current = anna::Millisecond::getTime(); // Optional sample file dump: - Engine::instantiate().logSample(conceptId, current, value); + Engine::instantiate().logSample(conceptId, current, value); // Accumulator is friend of Engine // Statistics calculations if(ptr_auxConceptData->Size == ULLONG_MAX) // Statistics is better during processing until reset diff --git a/source/statistics/Engine.cpp b/source/statistics/Engine.cpp index b6e1ee1..b90b609 100644 --- a/source/statistics/Engine.cpp +++ b/source/statistics/Engine.cpp @@ -9,7 +9,7 @@ // Local #include #include - +#include #include #include @@ -24,6 +24,10 @@ using namespace anna::statistics; //****************************************************************************** //----------------------------------------------------------------------- Engine //****************************************************************************** + +//------------------------------------------------------------------------------ +//------------------------------------------------------------- Engine::Engine() +//------------------------------------------------------------------------------ Engine::Engine() { statistics::sccs::activate(); a_enabled = false; @@ -31,6 +35,15 @@ Engine::Engine() { } +//------------------------------------------------------------------------------ +//------------------------------------------------------------ Engine::~Engine() +//------------------------------------------------------------------------------ +Engine::~Engine() { + for (_accumulator_vector_it it = a_accumulators.begin(); it != a_accumulators.end(); it++) + delete (*it); +} + + //------------------------------------------------------------------------------ //--------------------------------------------------------- Engine::addConcept() //------------------------------------------------------------------------------ @@ -119,6 +132,8 @@ bool Engine::disableSampleLog(const int & id) throw() { //--------------------------------------------------- Engine::disableSampleLog() //------------------------------------------------------------------------------ bool Engine::logSample(const int & conceptId, const anna::Millisecond & unixTimestamp, const double & value) const throw() { + anna::Guard guard(a_mutex); + _concept_identification_map_iter it = a_concept_identification_map.find(conceptId); if(it == a_concept_identification_map.end()) return false; @@ -139,6 +154,19 @@ bool Engine::logSample(const int & conceptId, const anna::Millisecond & unixTime return true; } + +//------------------------------------------------------------------------------ +//----------------------------------------------------------- Engine::asString() +//------------------------------------------------------------------------------ +Accumulator *Engine::createAccumulator() throw() { + Accumulator *result; + + result = new Accumulator(); + a_accumulators.push_back(result); + return result; +} + + //------------------------------------------------------------------------------ //----------------------------------------------------------- Engine::asString() //------------------------------------------------------------------------------ @@ -201,6 +229,11 @@ anna::xml::Node* Engine::asXML(anna::xml::Node* parent, const int & numberOfDeci concept->createAttribute("IntegerNatureSample", (*iter).second.IntegerNatureSample ? "yes" : "no"); } + // Accumulators: + for (_accumulator_vector_it it = a_accumulators.begin(); it != a_accumulators.end(); it++) { + anna::xml::Node* accumulators = result->createChild("anna.statistics.Accumulators"); + (*it)->asXML(accumulators); + } + return result; } - -- 2.20.1 From c6b62fd814b6e5b4e3ba65b6f092f6aa4e1d298d Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Sat, 10 Oct 2015 14:28:45 +0200 Subject: [PATCH 09/16] Include accumulators on statistics engine in order to centralize and ease asXML. Fix setEngine(NULL) on TestStep.cpp --- .../diameter/launcher/testing/TestStep.cpp | 2 +- include/anna/diameter.comm/LocalServer.hpp | 2 +- include/anna/diameter.comm/Server.hpp | 2 +- include/anna/statistics/Accumulator.hpp | 21 ++++++++++++- include/anna/statistics/Engine.hpp | 4 ++- source/diameter.comm/Engine.cpp | 4 +-- source/diameter.comm/LocalServer.cpp | 31 ++++++++----------- source/diameter.comm/Server.cpp | 24 ++++++-------- source/statistics/Accumulator.cpp | 26 ++++++++++------ source/statistics/Engine.cpp | 18 ++++++++--- source/statistics/Meter.cpp | 2 +- 11 files changed, 81 insertions(+), 55 deletions(-) diff --git a/example/diameter/launcher/testing/TestStep.cpp b/example/diameter/launcher/testing/TestStep.cpp index 018dfcd..cb1b0f9 100644 --- a/example/diameter/launcher/testing/TestStep.cpp +++ b/example/diameter/launcher/testing/TestStep.cpp @@ -152,7 +152,7 @@ namespace { bool result = true; try { - messageCodec.setEngine(NULL); // perhaps we will need another codec engine ... + messageCodec.clear(); messageCodec.decode(message); } catch (anna::RuntimeException &ex) { diff --git a/include/anna/diameter.comm/LocalServer.hpp b/include/anna/diameter.comm/LocalServer.hpp index e97fb20..d83dd31 100644 --- a/include/anna/diameter.comm/LocalServer.hpp +++ b/include/anna/diameter.comm/LocalServer.hpp @@ -68,7 +68,7 @@ class LocalServer { int a_processing_time__StatisticConceptId; // request from local server (dpr's, etc.) int a_received_message_size__StatisticConceptId; anna::statistics::Accumulator *a_statisticsAccumulator; - void initializeStatisticConcepts() throw(); + void initializeStatisticResources() throw(); void resetStatistics() throw(); // void eraseServerSession(const anna::comm::ClientSocket& clientSocket) throw(); diff --git a/include/anna/diameter.comm/Server.hpp b/include/anna/diameter.comm/Server.hpp index 0484484..69f5e80 100644 --- a/include/anna/diameter.comm/Server.hpp +++ b/include/anna/diameter.comm/Server.hpp @@ -74,7 +74,7 @@ class Server { int a_processing_time__StatisticConceptId; int a_received_message_size__StatisticConceptId; anna::statistics::Accumulator *a_statisticsAccumulator; - void initializeStatisticConcepts() throw(); + void initializeStatisticResources() throw(); void resetStatistics() throw(); // Availability diff --git a/include/anna/statistics/Accumulator.hpp b/include/anna/statistics/Accumulator.hpp index 98d4624..c13bbf1 100644 --- a/include/anna/statistics/Accumulator.hpp +++ b/include/anna/statistics/Accumulator.hpp @@ -89,14 +89,31 @@ public: /** * Constructor. + * + * @param name Accumulator name */ - Accumulator(); + Accumulator(const std::string &name) : a_name(name) {}; /** * Destructor. */ ~Accumulator(); + /** + * Adds a new statistic concept through the accumulator, to ease the concept name creation, + * which will be a string defined by: concept name + ': ' + accumulator name. + * + * @param description Concept description; e.g.: processing time, messages size, etc. + * @param unit Concept unit description + * @param integerNatureSample Most of cases we will measure 'time' with the unit which force integer values + * (is more intuitive 850 msecs than 0,850 secs). Then, it is @em true by default. + * This is useful to advice better representation for some indicators like minimum/maximum + * within integer samples. + * + * @return Assigned concept identification number (sequence) + */ + int addConcept(const std::string & description, const std::string & unit, const bool & integerNatureSample = true) throw(); + /** * Process new value for the sample. @@ -189,6 +206,8 @@ public: private: + std::string a_name; + void initialize(const int & conceptId) throw(); _concept_data_t * getConcept(const int & conceptId) const throw(anna::RuntimeException); // Return NULL if no data is found for the concept Id diff --git a/include/anna/statistics/Engine.hpp b/include/anna/statistics/Engine.hpp index 8f59a2e..61a9fe6 100644 --- a/include/anna/statistics/Engine.hpp +++ b/include/anna/statistics/Engine.hpp @@ -142,9 +142,11 @@ public: * easily. Anyway, you could allocate this class objects without using this. Then, this is a helper to create accumulators * and centralize their reports. * + * @param name Accumulator name + * * @return New allocated accumulator, to be used by the client */ - Accumulator *createAccumulator() throw(); + Accumulator *createAccumulator(const std::string &name) throw(); /** * Class string representation diff --git a/source/diameter.comm/Engine.cpp b/source/diameter.comm/Engine.cpp index 489a093..88f78e2 100644 --- a/source/diameter.comm/Engine.cpp +++ b/source/diameter.comm/Engine.cpp @@ -274,7 +274,7 @@ throw(anna::RuntimeException) { result->setCategory(category); result->setDescription(description); result->setAllowedInactivityTime(allowedInactivityTime); - result->initializeStatisticConcepts(); + result->initializeStatisticResources(); // Los saco con metodos virtuales readXXX del motor: // if ((a_cea.isEmpty()) || (a_dwa.isEmpty())) // throw anna::RuntimeException("Must define valid CEA and DWA messages by mean setCEAandDWA()", ANNA_FILE_LOCATION); @@ -315,7 +315,7 @@ throw(anna::RuntimeException) { result->a_socket = socket; result->setMaxClientSessions(a_numberOfClientSessionsPerServer /* engine */); result->a_engine = this; - result->initializeStatisticConcepts(); + result->initializeStatisticResources(); for(int k = 0; k < a_numberOfClientSessionsPerServer; k++) result->addClientSession(k); diff --git a/source/diameter.comm/LocalServer.cpp b/source/diameter.comm/LocalServer.cpp index 67c35fc..b43a754 100644 --- a/source/diameter.comm/LocalServer.cpp +++ b/source/diameter.comm/LocalServer.cpp @@ -43,24 +43,19 @@ LocalServer::LocalServer() : a_category(0), a_lock(false), a_available(false), - a_lastUsedResource(NULL) { - a_statisticsAccumulator = anna::statistics::Engine::instantiate().createAccumulator(); -} - - -void LocalServer::initializeStatisticConcepts() throw() { - // Realm name - std::string realmName = a_engine ? a_engine->getRealm() : "unknown"; // it should be known (createServer) - - // Statistics: - anna::statistics::Engine& statsEngine = anna::statistics::Engine::instantiate(); - // Concepts descriptions: - std::string serverAsString = anna::functions::socketLiteralAsString(a_key.first, a_key.second); - std::string c1desc = "Diameter processing time (for requests) at clients connected to "; c1desc += serverAsString; c1desc += " for realm '"; c1desc += realmName; c1desc += "'"; - std::string c2desc = "Diameter message sizes received from clients connected to "; c2desc += serverAsString; c2desc += " for realm '"; c2desc += realmName; c2desc += "'"; - // Registering - a_processing_time__StatisticConceptId = statsEngine.addConcept(c1desc.c_str(), "ms", true/* integer values */); - a_received_message_size__StatisticConceptId = statsEngine.addConcept(c2desc.c_str(), "bytes", true/* integer values */); + a_lastUsedResource(NULL), + a_statisticsAccumulator(NULL) {} + + +void LocalServer::initializeStatisticResources() throw() { + std::string accName = "local server '"; + accName += anna::functions::socketLiteralAsString(a_key.first, a_key.second); + accName += "' on realm '"; + accName += a_engine ? a_engine->getRealm() : "unknown"; // it should be known (createServer) + accName += "'"; + a_statisticsAccumulator = anna::statistics::Engine::instantiate().createAccumulator(accName); + a_processing_time__StatisticConceptId = a_statisticsAccumulator->addConcept("Diameter requests processing time at clients connected to", "ms", true/* integer values */); + a_received_message_size__StatisticConceptId = a_statisticsAccumulator->addConcept("Diameter message sizes received from clients connected to", "bytes", true/* integer values */); } void LocalServer::resetStatistics() throw() { diff --git a/source/diameter.comm/Server.cpp b/source/diameter.comm/Server.cpp index 758ac2d..0b9bcd7 100644 --- a/source/diameter.comm/Server.cpp +++ b/source/diameter.comm/Server.cpp @@ -36,23 +36,19 @@ void Server::initialize() throw() { a_maxClientSessions = 1; // mono client connection a_lastIncomingActivityTime = (anna::Millisecond)0; a_lastOutgoingActivityTime = (anna::Millisecond)0; - a_statisticsAccumulator = anna::statistics::Engine::instantiate().createAccumulator(); + a_statisticsAccumulator = NULL; a_lastUsedResource = NULL; } -void Server::initializeStatisticConcepts() throw() { - // Realm name - std::string realmName = a_engine ? a_engine->getRealm() : "unknown"; // it should be known (createServer) - - // Statistics: - anna::statistics::Engine& statsEngine = anna::statistics::Engine::instantiate(); - // Concepts descriptions: - std::string serverAsString = anna::functions::socketLiteralAsString(a_socket.first, a_socket.second); - std::string c1desc = "Diameter processing time (for requests) at servers on "; c1desc += serverAsString; c1desc += " for realm '"; c1desc += realmName; c1desc += "'"; - std::string c2desc = "Diameter message sizes received from servers on "; c2desc += serverAsString; c2desc += " for realm '"; c2desc += realmName; c2desc += "'"; - // Registering - a_processing_time__StatisticConceptId = statsEngine.addConcept(c1desc.c_str(), "ms", true/* integer values */); - a_received_message_size__StatisticConceptId = statsEngine.addConcept(c2desc.c_str(), "bytes", true/* integer values */); +void Server::initializeStatisticResources() throw() { + std::string accName = "remote server '"; + accName += anna::functions::socketLiteralAsString(a_socket.first, a_socket.second); + accName += "' from realm '"; + accName += a_engine ? a_engine->getRealm() : "unknown"; // it should be known (createServer) + accName += "'"; + a_statisticsAccumulator = anna::statistics::Engine::instantiate().createAccumulator(accName); + a_processing_time__StatisticConceptId = a_statisticsAccumulator->addConcept("Diameter requests processing time at", "ms", true/* integer values */); + a_received_message_size__StatisticConceptId = a_statisticsAccumulator->addConcept("Diameter message sizes received from", "bytes", true/* integer values */); } void Server::resetStatistics() throw() { diff --git a/source/statistics/Accumulator.cpp b/source/statistics/Accumulator.cpp index 1644700..358c87c 100644 --- a/source/statistics/Accumulator.cpp +++ b/source/statistics/Accumulator.cpp @@ -34,21 +34,13 @@ using namespace anna::time; //****************************************************************************** //------------------------------------------------------------------------------ -//--------------------------------------------------- Accumulator::Accumulator() +//-------------------------------------------------- Accumulator::~Accumulator() //------------------------------------------------------------------------------ - -// Default Constructor -Accumulator::Accumulator() { - //reset (); no sense -} - - Accumulator::~Accumulator() { // LOGMETHOD (TraceMethod tttm ("anna::statistics::Accumulator", "Destructor", ANNA_FILE_LOCATION)); + // TODO: anna::statistics::Engine::instantiate().releaseAccumulator(a_name); } - - // Private functions: @@ -62,6 +54,17 @@ void Accumulator::initialize(const int & conceptId) throw() { } +//------------------------------------------------------------------------------ +//---------------------------------------------------- Accumulator::addConcept() +//------------------------------------------------------------------------------ +int Accumulator::addConcept(const std::string & description, const std::string & unit, const bool & integerNatureSample) throw() { + std::string conceptName = description; + conceptName += ": "; + conceptName += a_name; + return anna::statistics::Engine::instantiate().addConcept(conceptName, unit, integerNatureSample); +} + + //------------------------------------------------------------------------------ //---------------------------------------------------- Accumulator::getConcept() //------------------------------------------------------------------------------ @@ -289,6 +292,8 @@ std::string Accumulator::asString(const int & numberOfDecimals) const throw() { trace = "\n====================="; trace += "\nStatistic Information"; trace += "\n====================="; + trace += "\nAccumulator name: "; + trace += a_name; trace += "\nCurrent Time: "; trace += time_now.asString(); @@ -370,6 +375,7 @@ std::string Accumulator::asString(const int & numberOfDecimals) const throw() { //------------------------------------------------------------------------------ anna::xml::Node* Accumulator::asXML(anna::xml::Node* parent, const int & numberOfDecimals) const throw() { anna::xml::Node* result = parent->createChild("anna.statistics.Accumulator"); + result->createAttribute("Name", a_name); _concept_data_map_iter iter; _concept_data_map_iter iter_min(a_concept_data_map.begin()); _concept_data_map_iter iter_max(a_concept_data_map.end()); diff --git a/source/statistics/Engine.cpp b/source/statistics/Engine.cpp index b90b609..ebde06c 100644 --- a/source/statistics/Engine.cpp +++ b/source/statistics/Engine.cpp @@ -158,10 +158,10 @@ bool Engine::logSample(const int & conceptId, const anna::Millisecond & unixTime //------------------------------------------------------------------------------ //----------------------------------------------------------- Engine::asString() //------------------------------------------------------------------------------ -Accumulator *Engine::createAccumulator() throw() { +Accumulator *Engine::createAccumulator(const std::string &name) throw() { Accumulator *result; - result = new Accumulator(); + result = new Accumulator(name); a_accumulators.push_back(result); return result; } @@ -201,6 +201,14 @@ std::string Engine::asString(void) const throw() { } trace += "\n"; + + // Accumulators: + trace += "\nNumber of accumulators= "; trace += anna::functions::asString(a_accumulators.size()); + for (_accumulator_vector_it it = a_accumulators.begin(); it != a_accumulators.end(); it++) { + trace += "\n"; + trace += (*it)->asString(); + } + return (trace); } @@ -230,10 +238,10 @@ anna::xml::Node* Engine::asXML(anna::xml::Node* parent, const int & numberOfDeci } // Accumulators: - for (_accumulator_vector_it it = a_accumulators.begin(); it != a_accumulators.end(); it++) { - anna::xml::Node* accumulators = result->createChild("anna.statistics.Accumulators"); + anna::xml::Node* accumulators = result->createChild("anna.statistics.Accumulators"); + accumulators->createAttribute("RegisteredAccumulators", a_accumulators.size()); + for (_accumulator_vector_it it = a_accumulators.begin(); it != a_accumulators.end(); it++) (*it)->asXML(accumulators); - } return result; } diff --git a/source/statistics/Meter.cpp b/source/statistics/Meter.cpp index feda763..9c9de5f 100644 --- a/source/statistics/Meter.cpp +++ b/source/statistics/Meter.cpp @@ -26,7 +26,7 @@ using namespace anna::statistics; //------------------------------------------------------------------------------ // Default Constructor -Meter::Meter(const std::string & description) { +Meter::Meter(const std::string & description) : a_accumulator(description) { Engine& statsEngine = Engine::instantiate(); a_single_accumulator_concept_id = statsEngine.addConcept(description, "ms", true); } -- 2.20.1 From daeeaacceeccefcac46838f460b19409cc5c4cb4 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Tue, 13 Oct 2015 02:36:49 +0200 Subject: [PATCH 10/16] New st-client deployment. Allow to load same stack id (accumulative services), ignoring all except first loaded. --- example/diameter/launcher/DEPLOY.sh | 12 +- example/diameter/launcher/DEPLOY_setups.sh | 13 ++ example/diameter/launcher/Launcher.cpp | 29 +++- .../launcher/deployments/st-client/README | 20 +++ .../deployments/st-client/configure.sh | 157 ++++++++++++++++++ .../deployments/st-client/hex_examples | 1 + .../deployments/st-client/operation.sh | 1 + .../launcher/deployments/st-client/run.sh | 11 ++ .../launcher/deployments/st-client/run_all.sh | 6 + .../deployments/st-client/xml_examples | 1 + .../diameter/launcher/testing/TestManager.cpp | 8 +- .../diameter/launcher/testing/TestManager.hpp | 2 + 12 files changed, 257 insertions(+), 4 deletions(-) create mode 100644 example/diameter/launcher/deployments/st-client/README create mode 100755 example/diameter/launcher/deployments/st-client/configure.sh create mode 120000 example/diameter/launcher/deployments/st-client/hex_examples create mode 120000 example/diameter/launcher/deployments/st-client/operation.sh create mode 100755 example/diameter/launcher/deployments/st-client/run.sh create mode 100755 example/diameter/launcher/deployments/st-client/run_all.sh create mode 120000 example/diameter/launcher/deployments/st-client/xml_examples diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh index 3e3cbd9..e44e928 100755 --- a/example/diameter/launcher/DEPLOY.sh +++ b/example/diameter/launcher/DEPLOY.sh @@ -29,12 +29,13 @@ _exit () { } usage () { - echo "Usage: $0 [deployment_type: a|b|f] [deployment_path]" + echo "Usage: $0 [deployment_type: a|b|f|s] [deployment_path]" echo echo " deployment_type:" echo " a=advanced" echo " b=basic" echo " f=function test client" + echo " s=system test client" echo " deployment_path:" echo " non-existent path directory." echo @@ -42,6 +43,7 @@ usage () { echo " $0 b $HOME/ADML/basicServer" echo " $0 b $HOME/ADML/MMSbalancer" echo " $0 f $HOME/ADML/tester" + echo " $0 s $HOME/ADML/stress-client" echo exit 0 } @@ -54,6 +56,7 @@ createRunScript () { local other= [ "$1" = "a" ] && { exe=ADML-launcher ; other="--httpServer \`grep -v ^# .httpServer\`"; } [ "$1" = "f" ] && { exe=ADML-ftclient ; ln -s ADML-launcher $exe ; } + [ "$1" = "s" ] && { exe=ADML-stclient ; other="--disableLogs"; ln -s ADML-launcher $exe ; } echo "Creating 'run.sh' script ..." @@ -151,6 +154,7 @@ then echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start." echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method." echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs. Requires a server to perform the tests." + echo " (s)ystem test client: special client for stress testing. Requires a server to perform the tests." echo echo "Input option [b]:" read option @@ -178,6 +182,12 @@ case $option in DPATH_dflt=$HOME/ADML/ft-client ;; + s) + echo "ST deployment" + DEPLOYMENTS_DIR=deployments/st-client + DPATH_dflt=$HOME/ADML/st-client + ;; + *) _exit "Invalid deployment type '$option' !!" ;; diff --git a/example/diameter/launcher/DEPLOY_setups.sh b/example/diameter/launcher/DEPLOY_setups.sh index 3457bbf..b050efd 100755 --- a/example/diameter/launcher/DEPLOY_setups.sh +++ b/example/diameter/launcher/DEPLOY_setups.sh @@ -23,6 +23,7 @@ echo "Which one you want to deploy [1]:" echo echo " 1. Client and server" echo " 2. Ft-client and server" +echo " 3. St-client and server" echo read type [ "$type" = "" ] && type=1 @@ -36,6 +37,10 @@ case $type in DEPLOY_DIR__dflt=$HOME/ADML-ftclientAndServer ;; + 3) + DEPLOY_DIR__dflt=$HOME/ADML-stclientAndServer + ;; + *) echo "Unknown option!" exit 1 @@ -67,6 +72,14 @@ case $type in echo s | ./configure.sh cd - >/dev/null ;; + + 3) + $DEPLOY_SCR s $DIR/st-client + $DEPLOY_SCR b $DIR/server + cd $DIR/server + echo s | ./configure.sh + cd - >/dev/null + ;; esac echo diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 4ec6ea0..8ea7511 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -174,6 +174,11 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool eventOp dictionary = (*it)->getAttribute("dictionary"); id_value = id->getIntegerValue(); + if (stackEngine.getDictionary(id_value)) { // Ignore (but don't fail) dictionary load with same stack id already registered + LOGWARNING(anna::Logger::warning(anna::functions::asString("Ignore dictionary load for stack id already registered: %llu", id_value), ANNA_FILE_LOCATION)); + continue; + } + try { d = stackEngine.createDictionary(id_value, dictionary->getValue()); LOGDEBUG(anna::Logger::debug(anna::functions::asString("Created dictionary (%p) for stack id %llu", d, id_value), ANNA_FILE_LOCATION)); @@ -1310,13 +1315,18 @@ std::string Launcher::help() const throw() { result += "\n"; result += "\n Provide 0 in order to stop the timer triggering."; result += "\n"; - result += "\n There timer manager resolution currently harcoded allows a maximum of "; + result += "\n The timer manager resolution currently harcoded allows a maximum of "; result += anna::functions::asString(1000/a_admlMinResolution); result += " events"; result += "\n per second. To reach greater rates ADML will join synchronously the needed number of"; result += "\n new time-triggered test cases per a single event, writting a warning-level trace to"; result += "\n advice about the risk of burst sendings and recommend launching multiple instances"; result += "\n to achieve such load with a lower rate per instance."; result += "\n"; + result += "\n test|next[|] Forces the execution of the next test case(s) without waiting for test manager tick."; + result += "\n Provide an integer value for 'sync-amount' to send a burst synchronous amount of the"; + result += "\n next programmed test cases (1 by default). This event works regardless the timer tick"; + result += "\n function, but it is normally used with the test manager tick stopped."; + result += "\n"; result += "\n test|ip-limit[|amount] In-progress limit of test cases. No new test cases will be launched over this value"; result += "\n (test Manager tick work will be ignored). Zero-value is equivalent to stop the clock."; result += "\n tick, -1 is used to specify 'no limit' which is the default. If missing amount, the"; @@ -1757,6 +1767,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons } else if((opType == "test")) { // test||[|parameters] Add a new step to the test case ... // test|ttps| Starts/resume the provided number of time ticks per second (ttps). The ADML starts ... + // test|next[|] Forces the execution of the next test case(s) without waiting for test manager tick ... // test|ip-limit[|amount] In-progress limit of test cases. No new test cases will be launched over this value ... // test|repeats| Restarts the whole programmed test list when finished the amount number of times ... // test|report[|[yes]|no] Every time a test case is finished a report file in xml format will be created under ... @@ -1783,6 +1794,22 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons opt_response_content += "unable to configure the test rate provided"; } } + else if (param1 == "next") { + if (numParams > 2) + throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); + + int sync_amount = ((param2 != "") ? atoi(param2.c_str()) : 1); + + if (sync_amount < 1) + throw anna::RuntimeException("The parameter 'sync-amount' must be a positive integer value", ANNA_FILE_LOCATION); + + bool success = testManager.execTestCases(sync_amount); + + opt_response_content = (success ? "" : "not completely " /* completed cycle and no repeats, rare case */); + opt_response_content += "processed "; + opt_response_content += anna::functions::asString(sync_amount); + opt_response_content += ((sync_amount > 1) ? " test cases synchronously" : " test case"); + } else if(param1 == "ip-limit") { if (numParams > 2) throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); diff --git a/example/diameter/launcher/deployments/st-client/README b/example/diameter/launcher/deployments/st-client/README new file mode 100644 index 0000000..6c8c711 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/README @@ -0,0 +1,20 @@ +ABOUT CONTENT +------------- +Template for xml messages (message.dtd), dictionaries (dictionary.dtd) and services (services.dtd) +are informative, not actually required by process. They are located at './DTDs'. Stacks are available +at './stacks'. There are also some stuff (hex/xml examples, etc.) which could be useful. + +Execute './configure.sh' and follow the intructions to clone the ADML instance into the needed amount +for system testing. + +STARTING THE PROCESS +-------------------- +After configuring the ADML execution context, a new script has been created: 'run.sh'. +This script will run all the cloned ADML instances within ADMLS directory. + +OPERATION +--------- +Management interface for lite version is based on SIGUSR2 signal caugh. Use './operation.sh' +script to send any operation to the processes. Ask for help with that script to see all the +operations supported. + diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh new file mode 100755 index 0000000..383c21a --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +############# +# VARIABLES # +############# +MAXIMUM_ADML_ASYNC_RATE=50 +MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE=10 +ADML_INSTANCES__ST_CONF_FILE=.st_conf_adml_instances +ADML_CONNECTIONS__ST_CONF_FILE=.st_conf_adml_connections +CYCLE_REPEATS__ST_CONF_FILE=.st_conf_cycle_repeats +N_TESTCASES__ST_CONF_FILE=.st_conf_n_testcases + +############# +# FUNCTIONS # +############# +_exit () { + echo + echo $1 + echo + exit 1 +} + +# ceil of division $1/$2 +ceil() { + echo "$1 $2" | awk '{print int( ($1/$2) + 1 )}' +} + +# Calculates the number of ADML instances and their client connections +calculate_deployment_layout() { + echo "Input the maximum client connections accepted by the server to be tested [5000]:" + read max_server_accepted_connections + [ "$max_server_accepted_connections" = "" ] && max_server_accepted_connections=5000 + + echo "Input the maximum test case rate per second:" + read desired_rate + while [ -z "$desired_rate" ]; do read desired_rate; done + + max_connections=$((desired_rate/MAXIMUM_ADML_ASYNC_RATE)) + if [ $max_connections -eq 0 ] + then + G_ADML_CONNECTIONS=1 + G_ADML_INSTANCES=1 + return + fi + max_adml_instances=$((max_server_accepted_connections/MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE)) + if [ $max_connections -gt $max_server_accepted_connections ] + then + echo + echo "Maximum rate reached for $max_server_accepted_connections server connections:" + G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE + G_ADML_INSTANCES=$max_adml_instances + return + fi + + echo + echo "===========================================================================================================" + echo "Orientative table" + echo "-----------------------------------------------------------------------------------------------------------" + echo -e "Connects per instance:\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10" + echo -n "Number of instances: " + for conn in `seq 1 $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE` + do + instances=$(ceil $max_connections $conn) + echo -n -e "\t$instances" + done + echo + echo "===========================================================================================================" + echo + echo "Input selection (connections per instance 1..$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) [1]:" + read G_ADML_CONNECTIONS + [ -z "$G_ADML_CONNECTIONS" ] && G_ADML_CONNECTIONS=1 + [ $G_ADML_CONNECTIONS -lt 1 ] && G_ADML_CONNECTIONS=1 + [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ] && G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE + + G_ADML_INSTANCES=$((max_connections/G_ADML_CONNECTIONS)) +} + +############# +# EXECUTION # +############# + +cd `dirname $0` + +echo +echo "=====================================" +echo "ADML SYSTEM TEST CONFIGURATION WIZARD" +echo "=====================================" +echo + +calculate_deployment_layout + +# Dump persintently: +echo $G_ADML_INSTANCES > $ADML_INSTANCES__ST_CONF_FILE +echo $G_ADML_CONNECTIONS > $ADML_CONNECTIONS__ST_CONF_FILE + +echo +echo "Suggested layout:" +echo " - $G_ADML_INSTANCES ADML instances" +echo " - $G_ADML_CONNECTIONS client connections per ADML instance" +maximum_rate=$((G_ADML_INSTANCES*G_ADML_CONNECTIONS*MAXIMUM_ADML_ASYNC_RATE)) +echo " - Maximum rate: $maximum_rate test cases per second" +echo +echo "Usually, you will program a test case per subscriber. Input the number of test cases to program:" +read N_TESTCASES +while [ -z "$N_TESTCASES" ]; do read N_TESTCASES; done +echo $N_TESTCASES > $N_TESTCASES__ST_CONF_FILE +echo +time_covered_1=$(ceil $N_TESTCASES $maximum_rate) +time_covered=$(ceil $N_TESTCASES $((maximum_rate*G_ADML_INSTANCES))) +echo "That amount covers $time_covered_1 seconds for one running ADML instance." +if [ $G_ADML_INSTANCES -gt 1 ] +then + echo "But you will have $G_ADML_INSTANCES instances running in parallel, then the total covered time is: $time_covered seconds" + testcase_per_adml_instance=$(ceil $N_TESTCASES $G_ADML_INSTANCES) + echo "(aproximately, $testcase_per_adml_instance test cases will be programmed on each ADML instance)" +fi + +echo +if [ $time_covered -lt 300 ] +then + echo "$time_covered seconds is under 5 minutes, you should add more test cases to the pool except if you are sure" + echo " they will take less time that cycle completion. You could ensure that with a first timeout step." + echo "Configuring such timeout slightly under $((1000*time_covered)) milliseconds, you could repeat the cycle safely to" + echo " obtain a greater total time of testing." +fi +echo +echo "How many total time do you want to cover (in minutes):" +read minutes +while [ -z "$minutes" ]; do read minutes; done +seconds=$((minutes*60)) +repeats=$(ceil $seconds $time_covered) +echo $repeats > $CYCLE_REPEATS__ST_CONF_FILE +[ $repeats -gt 0 ] && echo "Configured $repeats cycle repeats ($repeats x $time_covered seconds = $seconds seconds (desired $minutes minutes)" +echo +echo "System test configuration completed." +echo +echo "Ready to clone/start the ADML instances: press ENTER to continue, CTRL+C to abort ..." +read dummy +[ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory). Try with 'realms.example' and see README inside it !" + +# Update services.xml regarding the number of client connections: +cp realms/services.msk realms/services.xml +sed -i 's/__CLIENT_CONNECTIONS__/'$G_ADML_CONNECTIONS'/g' realms/services.xml + +rm -rf ADMLS +for instance in `seq 1 $G_ADML_INSTANCES` +do + mkdir -p ADMLS/$instance + cd ADMLS/$instance + # Create resources: + ln -s ../../ADML-launcher + ln -s ../../operation.sh + ln -s ../../realms/services.xml + for cer in `ls ../../realms/cer*xml`; do ln -s $cer; done + cd - >/dev/null +done + diff --git a/example/diameter/launcher/deployments/st-client/hex_examples b/example/diameter/launcher/deployments/st-client/hex_examples new file mode 120000 index 0000000..0a74a2d --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/hex_examples @@ -0,0 +1 @@ +../../resources/hex_examples/ \ No newline at end of file diff --git a/example/diameter/launcher/deployments/st-client/operation.sh b/example/diameter/launcher/deployments/st-client/operation.sh new file mode 120000 index 0000000..c9b45ae --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/operation.sh @@ -0,0 +1 @@ +../../resources/scripts/operation_signal.sh \ No newline at end of file diff --git a/example/diameter/launcher/deployments/st-client/run.sh b/example/diameter/launcher/deployments/st-client/run.sh new file mode 100755 index 0000000..27aa362 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/run.sh @@ -0,0 +1,11 @@ +#!/bin/bash +cd `dirname $0` +EXE_BN=`basename $PWD` +STARTED=`pgrep $EXE_BN 2>/dev/null` +[ $? -eq 0 ] && { echo "Already started!"; echo "$STARTED" ; exit 1 ; } +0> launcher.trace +rm -f counters/* test-reports/* +# Execution line: +nohup ./ADML-client --cntDir counters --tmDir test-reports --disableLogs --services $SERVICES > stdout & +echo $! > .pid + diff --git a/example/diameter/launcher/deployments/st-client/run_all.sh b/example/diameter/launcher/deployments/st-client/run_all.sh new file mode 100755 index 0000000..8f2cd56 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/run_all.sh @@ -0,0 +1,6 @@ +#!/bin/bash +cd `dirname $0` +for run in `ls ADMLS/*/run.sh` +do + $run +done diff --git a/example/diameter/launcher/deployments/st-client/xml_examples b/example/diameter/launcher/deployments/st-client/xml_examples new file mode 120000 index 0000000..c18402a --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/xml_examples @@ -0,0 +1 @@ +../../resources/xml_examples \ No newline at end of file diff --git a/example/diameter/launcher/testing/TestManager.cpp b/example/diameter/launcher/testing/TestManager.cpp index ee6be63..2c03b4d 100644 --- a/example/diameter/launcher/testing/TestManager.cpp +++ b/example/diameter/launcher/testing/TestManager.cpp @@ -279,14 +279,18 @@ bool TestManager::resetPool(bool hard) throw() { bool TestManager::tick() throw() { LOGDEBUG(anna::Logger::debug("New test clock tick !", ANNA_FILE_LOCATION)); + return execTestCases(a_synchronousAmount); +} + +bool TestManager::execTestCases(int sync_amount) throw() { if (!tests()) { - LOGWARNING(anna::Logger::warning("Testing pool is empty. You need programming. Stopping test clock", ANNA_FILE_LOCATION)); + LOGWARNING(anna::Logger::warning("Testing pool is empty. You need programming", ANNA_FILE_LOCATION)); return false; } // Synchronous sendings per tick: - int count = a_synchronousAmount; + int count = sync_amount; while (count > 0) { if (!nextTestCase()) return false; // stop the clock count--; diff --git a/example/diameter/launcher/testing/TestManager.hpp b/example/diameter/launcher/testing/TestManager.hpp index 2f61501..76abcbb 100644 --- a/example/diameter/launcher/testing/TestManager.hpp +++ b/example/diameter/launcher/testing/TestManager.hpp @@ -90,6 +90,7 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto int a_synchronousAmount; TestClock *a_clock; bool tick() throw(); + bool execTestCases(int sync_amount) throw(); bool nextTestCase() throw(); // Test timers @@ -162,6 +163,7 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto friend class TestStepTimeout; // createTimer friend class TestStepDelay; // createTimer friend class TestClock; // tick + friend class Launcher; // tick }; #endif -- 2.20.1 From 932990242f7b76f7c1404bdfdda6587bbe588c5f Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Tue, 20 Oct 2015 00:54:10 +0200 Subject: [PATCH 11/16] Dummy step (delay 0) --- example/diameter/launcher/Launcher.cpp | 3 ++- example/diameter/launcher/testing/TestStep.cpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 8ea7511..1b7a7ee 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -1163,6 +1163,7 @@ std::string Launcher::help() const throw() { result += "\n"; result += "\n delay| Blocking step until the time lapse expires. Useful to give "; result += "\n some cadence control and time schedule for a specific case."; + result += "\n A value of 0 could be used as a dummy step."; result += "\n wait| Blocking step until condition is fulfilled. The message could"; result += "\n received from entity (waitfe) or from client (waitfc)."; result += "\n"; @@ -2016,7 +2017,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons if (numParams > 3) throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); if(param3 == "") throw anna::RuntimeException("Missing milliseconds for 'delay' command in test id operation", ANNA_FILE_LOCATION); - anna::Millisecond delay = checkTimeMeasure("Test case delay step", param3); + anna::Millisecond delay = ((param3 == "0" /* special case */) ? (anna::Millisecond)0 : checkTimeMeasure("Test case delay step", param3)); testManager.getTestCase(id)->addDelay(delay); // creates / reuses } else if ((param2 == "waitfe")||(param2 == "waitfc")) { diff --git a/example/diameter/launcher/testing/TestStep.cpp b/example/diameter/launcher/testing/TestStep.cpp index cb1b0f9..524e0bd 100644 --- a/example/diameter/launcher/testing/TestStep.cpp +++ b/example/diameter/launcher/testing/TestStep.cpp @@ -483,12 +483,13 @@ throw() { anna::xml::Node* result = TestStep::asXML(parent); //parent->createChild("TestStepDelay"); - result->createAttribute("Delay", a_delay.asString()); + result->createAttribute("Delay", ((a_delay == 0) ? "dummy step, no delay" : a_delay.asString())); return result; } bool TestStepDelay::do_execute() throw() { + if (a_delay == 0) { complete(); return true; } // special case try { a_timer = TestManager::instantiate().createTimer((TestCaseStep*)this, a_delay, TestTimer::Type::Delay); } @@ -502,12 +503,14 @@ bool TestStepDelay::do_execute() throw() { } void TestStepDelay::do_complete() throw() { + if (a_delay == 0) return; // special case a_timer = NULL; next(); // next() invoked here because execute() is always false for delay and never advance the iterator // TODO, avoid this recursion } void TestStepDelay::do_reset() throw() { + if (a_delay == 0) return; // special case try { TestManager::instantiate().cancelTimer(a_timer); } -- 2.20.1 From 983eaadca6cfae987be3453853d75bb9bce04487 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Mon, 16 Nov 2015 21:59:49 +0100 Subject: [PATCH 12/16] Optimize clone procedure --- example/diameter/launcher/Launcher.cpp | 6 +- .../launcher/resources/scripts/clone.sh | 212 ++++++++++++++++++ .../resources/scripts/operation_signal.sh | 6 +- .../diameter/launcher/testing/TestCase.cpp | 8 +- .../diameter/launcher/testing/TestManager.cpp | 1 + 5 files changed, 224 insertions(+), 9 deletions(-) create mode 100755 example/diameter/launcher/resources/scripts/clone.sh diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 1b7a7ee..45f51a9 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -802,7 +802,7 @@ void Launcher::resetCounters() throw() { void Launcher::signalUSR2() throw(anna::RuntimeException) { LOGNOTICE( - std::string msg = "Captured signal SIGUSR2. Reading tasks at '"; + std::string msg = "Captured signal SIGUSR2. Reading tasks at '"; msg += SIGUSR2_TASKS_INPUT_FILENAME; msg += "' (results will be written at '"; msg += SIGUSR2_TASKS_OUTPUT_FILENAME; @@ -817,7 +817,6 @@ void Launcher::signalUSR2() throw(anna::RuntimeException) { std::ofstream out_file(SIGUSR2_TASKS_OUTPUT_FILENAME); if(!in_file.is_open()) throw RuntimeException("Unable to read tasks", ANNA_FILE_LOCATION); - if(!out_file.is_open()) throw RuntimeException("Unable to write tasks", ANNA_FILE_LOCATION); while(getline(in_file, line)) { @@ -837,6 +836,7 @@ void Launcher::signalUSR2() throw(anna::RuntimeException) { } in_file.close(); + out_file << "EOF\n"; out_file.close(); } @@ -1403,6 +1403,8 @@ std::string Launcher::help() const throw() { result += "\n and then see the results:"; result += "\n cat "; result += SIGUSR2_TASKS_OUTPUT_FILENAME; result += "\n"; + result += "\n (this file is ended with EOF final line, useful managing huge batch files to ensure the job completion)"; + result += "\n"; result += "\nYou could place more than one line (task) in the input file. Output reports will be appended in that"; result += "\n case over the output file. Take into account that all the content of the task file will be executed"; result += "\n sinchronously by the process. If you are planning traffic load, better use the asynchronous http"; diff --git a/example/diameter/launcher/resources/scripts/clone.sh b/example/diameter/launcher/resources/scripts/clone.sh new file mode 100755 index 0000000..c6560f3 --- /dev/null +++ b/example/diameter/launcher/resources/scripts/clone.sh @@ -0,0 +1,212 @@ +#!/bin/bash + +############# +# VARIABLES # +############# +CLONE_WKDIR=$(mktemp -d) +MAX_NUMBER_GROUPS=400 +# (depends on the machine) + +############# +# FUNCTIONS # +############# +_exit (){ + echo + echo $1 + echo + + # Cleanup: + rm -rf $CLONE_WKDIR + + rc=1 + [ -n "$2" ] && rc=$2 + exit $rc +} + +sig_handler() { + _exit "Script interrupted. Cleanup & exit ..." +} + +usage() { + echo "Usage: $0 [number of groups]" + echo + echo " ADML directory: path to the ADML directory where 'operation.sh' script is used to load the test cases." + echo " testcase variable file: path to the testcase file with parseable variables, for example '/testcase.txt.msk'." + echo " xml files within this test case, must exist with aditional .msk extension in the same directory." + echo " Currently, 9 variables are supported to be replaced:" + echo " __TESTID__ : sequence number. For example if you provide 1 to 20 for this script, it will be 1 .. 20" + echo " __SEQ8__ : 8-digit number corresponding to the sequence number (00000001 for 1, and so on)" + echo " __MSISDN9__: 9-digit msisdn" + echo " __IPV4HEX__: hexadecimal IPv4 address, for example: 00000001" + echo " __IPV4__ : IPv4 address, for example: 0.0.0.1" + echo " __SGX1_SUFFIX__: 1<8-digit sequence>" + echo " __SRX1_SUFFIX__: \"" + echo " __SGX2_SUFFIX__: 2<8-digit sequence>" + echo " __SRX2_SUFFIX__: \"" + echo + echo " initial sequence: initial sequence number to parse over variables." + echo " final sequence: final sequence number to parse over variables." + echo " number of groups: number of background group jobs to clone the provided sequence range." + echo " By default, it will be the number of items divided by 25, with a maximum of $MAX_NUMBER_GROUPS." + echo + echo + _exit +} + +children () { + bash_pid=$$ + children=`ps -eo ppid | grep -w $bash_pid` + echo $children | wc -w +} + +# $1: sequence number; $2: file to parse(will be updated); $3: result file +parse_file() { + local vars=$(egrep -o '__((_*[A-Z]*[0-9]*)*)__' $2 | cut -d: -f2 | sort -u) + local file=$2 + cp $2 $3 + file=$3 + for pvar in $vars + do + eval pvalue=\$$pvar + sed -i 's/'$pvar'/'$pvalue'/g' $file + done +} + +# $1: sequence number; $2: working directory +clone() { + local sequence=$1 + local wkdir=$2 + mkdir -p $wkdir + + # Values: + testid=$sequence + seq8=$(printf "%08d" $testid) + msisdn9=6${seq8} + ipv4hex=$seq8 + #ipv4=$(for i in $(echo $seq8 | sed 's/\(..\)/0x\1 /g'); do printf "%d." $i; done | sed 's/\.$/\n/') + # Numbers beginning with "0" are treated as octal (i.e. base-8): we would have 'invalid octal number with 08 and 09' + # Solution: convert to base-10 in this way: $((10#$i)) + ipv4=$(for i in $(echo $seq8 | sed 's/\(..\)/ \1 /g'); do printf "%d." $((10#$i)); done | sed 's/\.$/\n/') + # Sessions + sgx1_suffix=1$seq8 + srx1_suffix=1$seq8 + sgx2_suffix=2$seq8 + srx2_suffix=2$seq8 + + local target=$wkdir/values.${1} + echo "__TESTID__=$testid" > $target + echo "__SEQ8__=$seq8" >> $target + echo "__MSISDN9__=$msisdn9" >> $target + echo "__IPV4HEX__=$ipv4hex" >> $target + echo "__IPV4__=$ipv4" >> $target + echo "__SGX1_SUFFIX__=$sgx1_suffix" >> $target + echo "__SRX1_SUFFIX__=$srx1_suffix" >> $target + echo "__SGX2_SUFFIX__=$sgx2_suffix" >> $target + echo "__SRX2_SUFFIX__=$srx2_suffix" >> $target + source $target + #rm $target + + # Parse template files: + parse_file $sequence $TESTCASE_TEMPLATE $wkdir/testcase.txt.$sequence + for file in $(grep sendxml $TESTCASE_TEMPLATE | cut -d\| -f4 | sed 's/\.xml$/.xml.msk/') + do + xml=`basename $file .msk` + parse_file $sequence $TESTCASE_TEMPLATE_DIR/$file $wkdir/${xml}.${sequence} + new_file=`readlink -f $wkdir/${xml}.${sequence}` + sed -i 's|'$xml'|'$new_file'|g' $wkdir/testcase.txt.$sequence + done + cat $wkdir/testcase.txt.$sequence >> $wkdir/testcase.txt + rm $wkdir/testcase.txt.$sequence +} + +# $1: group number; $2: initial subrange value; $3: final subrange value +clone_group() { + for i in `seq $2 $3` + do + clone $i $CLONE_WKDIR/$1 + #sleep 0.01 + done +} + +############# +# EXECUTION # +############# +trap sig_handler SIGINT +trap sig_handler SIGTERM + +ADML_DIR=$1 +TESTCASE_TEMPLATE=`readlink -f $2` +CLONE_SEQ_BEGIN=$3 +CLONE_SEQ_END=$4 +N_GROUPS=$5 + +[ "$4" = "" ] && usage + +# Auxiliary: +OPERATION=$ADML_DIR/operation.sh +[ ! -f $OPERATION ] && _exit "Missing '$OPERATION' file !!" +[ ! -f $TESTCASE_TEMPLATE ] && _exit "Missing '$TESTCASE_TEMPLATE' testcase template file !!" + +TESTCASE_TEMPLATE_DIR=`dirname $TESTCASE_TEMPLATE` +N_ITEMS=$((CLONE_SEQ_END - CLONE_SEQ_BEGIN + 1)) +if [ -z "$N_GROUPS" ] +then + N_GROUPS=$((N_ITEMS/25)) + [ $N_GROUPS -gt $MAX_NUMBER_GROUPS ] && N_GROUPS=$MAX_NUMBER_GROUPS + [ $N_GROUPS -eq 0 ] && N_GROUPS=1 +fi +GROUPS_SIZE=$((N_ITEMS/N_GROUPS)) +if [ "$GROUPS_SIZE" -eq 0 ] +then + echo "Assuming minimum allowed number of groups: $N_ITEMS" + GROUPS_SIZE=1 + N_GROUPS=$N_ITEMS +fi + +# Start cloning: +timestamp_begin=$(echo "scale=3 ; $(date '+%s') + $(date '+%N') / 1000000000" | bc) +children_before=$(children) +offset=0 +echo "Please be patient, this may take a while ..." +$OPERATION "test|clear" +for group in `seq 1 $((N_GROUPS+1))` +do + n_begin=$((CLONE_SEQ_BEGIN + offset)) + n_end=$((n_begin + GROUPS_SIZE - 1)) + [ $n_end -gt $CLONE_SEQ_END ] && n_end=$CLONE_SEQ_END + [ $n_end -lt $n_begin ] && break + clone_group $group $n_begin $n_end & + offset=$((group * GROUPS_SIZE)) +done +children_now=$(children) + +# Wait background jobs to finish: +while true +do + sleep 1 + [ $(children) -eq $children_before ] && break +done + +# Programming: +echo -n "Programming .." +for file in $(ls $CLONE_WKDIR/*/testcase.txt) +do + echo -n . + r_file=`readlink -f $file` + dn_r_file=`dirname $r_file` + #bn_dn_r_file=`basename $dn_r_file` + #echo "Programming group $bn_dn_r_file ..." + $OPERATION -f $r_file >/dev/null + #$OPERATION -f $r_file > $dn_r_file/result.txt + rm -rf $dn_r_file & +done + +timestamp_end=$(echo "scale=3 ; $(date '+%s') + $(date '+%N') / 1000000000" | bc) +echo +lasted=$(echo "scale=3 ; $timestamp_end - $timestamp_begin" | bc) +echo "Total Lasted $lasted seconds" +echo "Programming speed: $(echo "$N_ITEMS/$lasted" | bc) tests per second" + +# Finish: +_exit "Done!" 0 + diff --git a/example/diameter/launcher/resources/scripts/operation_signal.sh b/example/diameter/launcher/resources/scripts/operation_signal.sh index 4db01a5..85b3111 100755 --- a/example/diameter/launcher/resources/scripts/operation_signal.sh +++ b/example/diameter/launcher/resources/scripts/operation_signal.sh @@ -30,7 +30,7 @@ else fi 0> sigusr2.out kill -s SIGUSR2 $PID -count=0 -while [ ! -s sigusr2.out -a $count -lt 500 ]; do sleep 0.01; count=$((count+1)); done -cat `pwd`/sigusr2.out +# Detect EOF and print all except that last line: +while [ -z "$(tail -1 sigusr2.out | grep ^EOF)" ]; do sleep 0.1; done +head --lines=-1 `pwd`/sigusr2.out diff --git a/example/diameter/launcher/testing/TestCase.cpp b/example/diameter/launcher/testing/TestCase.cpp index 3d91f32..2817248 100644 --- a/example/diameter/launcher/testing/TestCase.cpp +++ b/example/diameter/launcher/testing/TestCase.cpp @@ -341,9 +341,9 @@ void TestCase::addWait(bool fromEntity, if (!step) step = new TestStepWait(this); step->setCondition(fromEntity, code, bitR, usedHopByHop, applicationId, sessionId, resultCode, msisdn, imsi, serviceContextId); - LOGWARNING( + LOGINFORMATION( if (hasSameCondition(step->getCondition())) - anna::Logger::warning(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION); + anna::Logger::information(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION); ); addStep(step); @@ -355,9 +355,9 @@ void TestCase::addWaitRegexp(bool fromEntity, const std::string ®exp) throw(a TestStepWait *step = new TestStepWait(this); step->setCondition(fromEntity, regexp); - LOGWARNING( + LOGINFORMATION( if (hasSameCondition(step->getCondition())) - anna::Logger::warning(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION); + anna::Logger::information(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION); ); addStep(step); diff --git a/example/diameter/launcher/testing/TestManager.cpp b/example/diameter/launcher/testing/TestManager.cpp index 2c03b4d..bd9bbfc 100644 --- a/example/diameter/launcher/testing/TestManager.cpp +++ b/example/diameter/launcher/testing/TestManager.cpp @@ -262,6 +262,7 @@ bool TestManager::clearPool() throw() { a_currentTestIt = a_testPool.end(); a_poolCycle = 1; configureTTPS(0); // stop + a_statSummary.clear(); return true; } -- 2.20.1 From fca0f585780127dba2564de6741d2de9a5e59fb4 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Mon, 16 Nov 2015 22:02:59 +0100 Subject: [PATCH 13/16] Change order --- example/diameter/launcher/resources/scripts/clone.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/diameter/launcher/resources/scripts/clone.sh b/example/diameter/launcher/resources/scripts/clone.sh index c6560f3..815a5a7 100755 --- a/example/diameter/launcher/resources/scripts/clone.sh +++ b/example/diameter/launcher/resources/scripts/clone.sh @@ -167,8 +167,8 @@ fi timestamp_begin=$(echo "scale=3 ; $(date '+%s') + $(date '+%N') / 1000000000" | bc) children_before=$(children) offset=0 -echo "Please be patient, this may take a while ..." $OPERATION "test|clear" +echo "Please be patient, this may take a while ..." for group in `seq 1 $((N_GROUPS+1))` do n_begin=$((CLONE_SEQ_BEGIN + offset)) -- 2.20.1 From 18319deabbc8563fc112795968372e96263e6fe4 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 20 Nov 2015 15:46:50 +0100 Subject: [PATCH 14/16] System test refinement --- example/diameter/launcher/DEPLOY.sh | 17 +- example/diameter/launcher/DEPLOY_setups.sh | 33 +- .../launcher/deployments/basic/configure.sh | 4 +- .../launcher/deployments/st-client/README | 21 +- .../launcher/deployments/st-client/clone.sh | 1 + .../deployments/st-client/configure.sh | 71 +- .../deployments/st-client/operation_all.sh | 17 + .../deployments/st-client/pre-start.sh | 2 + .../launcher/deployments/st-client/program.sh | 112 ++ .../st-client/realms_example/README | 13 + .../realms_example/cerGx.xml} | 0 .../realms_example/cerRx.xml} | 0 .../realms_example/dictionaryBase.xml | 1 + .../st-client/realms_example/dictionaryGx.xml | 1 + .../st-client/realms_example/dictionaryRx.xml | 1 + .../st-client/realms_example/services.msk | 11 + .../launcher/deployments/st-client/run.sh | 11 - .../launcher/deployments/st-client/run_all.sh | 23 +- .../deployments/st-client/st_examples | 1 + .../test_examples/RxGx/02.CEA_Gx.xml | 21 - .../test_examples/RxGx/04.CEA_Rx.xml | 21 - .../test_examples/RxGx/06.CCA-I.xml | 16 - .../test_examples/RxGx/08.AAA-flows.xml | 13 - .../test_examples/RxGx/09.RAR-install.xml | 124 -- .../test_examples/RxGx/12.CCA-U.xml | 116 -- .../test_examples/RxGx/14.STA_Rx.xml | 7 - .../test_examples/RxGx/15.RAR-remove.xml | 16 - .../test_examples/RxGx/18.CCA-T.xml | 10 - .../test_examples/RxGx/19.DPR_Gx.xml | 5 - .../test_examples/RxGx/20.DPA_Gx.xml | 5 - .../test_examples/RxGx/21.DPR_Rx.xml | 5 - .../test_examples/RxGx/22.DPA_Rx.xml | 5 - .../deployments/test_examples/RxGx/simple.sh | 23 - .../deployments/test_examples/checkings.sh | 24 - .../deployments/test_examples/cycle.sh | 40 - .../deployments/test_examples/endsOk.sh | 22 - .../launcher/resources/scripts/clone.sh | 46 +- .../resources/scripts/operation_signal.sh | 3 + .../DynamicQualification/.testcase.txt.st | 17 + .../DynamicQualification/1.15.hex.as.xml.msk} | 12 +- .../DynamicQualification/1.20.hex.as.xml.msk} | 32 +- .../DynamicQualification/1.28.hex.as.xml.msk} | 4 +- .../DynamicQualification/1.30.hex.as.xml.msk} | 6 +- .../DynamicQualification/1.35.hex.as.xml.msk} | 6 +- .../DynamicQualification/1.39.hex.as.xml.msk} | 4 +- .../DynamicQualification/1.41.hex.as.xml.msk} | 6 +- .../DynamicQualification/15.hex.as.xml.msk | 27 + .../DynamicQualification/20.hex.as.xml.msk | 68 + .../DynamicQualification/28.hex.as.xml.msk | 7 + .../DynamicQualification/30.hex.as.xml.msk | 18 + .../DynamicQualification/35.hex.as.xml.msk | 10 + .../DynamicQualification/39.hex.as.xml.msk | 7 + .../DynamicQualification/41.hex.as.xml.msk | 18 + .../DynamicQualification/testcase.txt.msk | 17 + .../launcher/resources/st_examples/README | 3 + .../launcher/resources/stack_examples/0.xml | 438 ++++++ .../resources/stack_examples/16777236.xml | 696 +++++++++ .../resources/stack_examples/16777238.xml | 1270 +++++++++++++++++ .../resources/stack_examples/16777302.xml | 553 +++++++ 59 files changed, 3521 insertions(+), 560 deletions(-) create mode 120000 example/diameter/launcher/deployments/st-client/clone.sh create mode 100755 example/diameter/launcher/deployments/st-client/operation_all.sh create mode 100755 example/diameter/launcher/deployments/st-client/pre-start.sh create mode 100755 example/diameter/launcher/deployments/st-client/program.sh create mode 100644 example/diameter/launcher/deployments/st-client/realms_example/README rename example/diameter/launcher/deployments/{test_examples/RxGx/01.CER_Gx.xml => st-client/realms_example/cerGx.xml} (100%) rename example/diameter/launcher/deployments/{test_examples/RxGx/03.CER_Rx.xml => st-client/realms_example/cerRx.xml} (100%) create mode 120000 example/diameter/launcher/deployments/st-client/realms_example/dictionaryBase.xml create mode 120000 example/diameter/launcher/deployments/st-client/realms_example/dictionaryGx.xml create mode 120000 example/diameter/launcher/deployments/st-client/realms_example/dictionaryRx.xml create mode 100644 example/diameter/launcher/deployments/st-client/realms_example/services.msk delete mode 100755 example/diameter/launcher/deployments/st-client/run.sh create mode 120000 example/diameter/launcher/deployments/st-client/st_examples delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/02.CEA_Gx.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/04.CEA_Rx.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/06.CCA-I.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/08.AAA-flows.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/09.RAR-install.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/12.CCA-U.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/14.STA_Rx.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/15.RAR-remove.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/18.CCA-T.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/19.DPR_Gx.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/20.DPA_Gx.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/21.DPR_Rx.xml delete mode 100644 example/diameter/launcher/deployments/test_examples/RxGx/22.DPA_Rx.xml delete mode 100755 example/diameter/launcher/deployments/test_examples/RxGx/simple.sh delete mode 100755 example/diameter/launcher/deployments/test_examples/checkings.sh delete mode 100755 example/diameter/launcher/deployments/test_examples/cycle.sh delete mode 100755 example/diameter/launcher/deployments/test_examples/endsOk.sh create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/.testcase.txt.st rename example/diameter/launcher/{deployments/test_examples/RxGx/05.CCR-I.xml => resources/st_examples/DynamicQualification/1.15.hex.as.xml.msk} (72%) rename example/diameter/launcher/{deployments/test_examples/RxGx/07.AAR-flows.xml => resources/st_examples/DynamicQualification/1.20.hex.as.xml.msk} (73%) rename example/diameter/launcher/{deployments/test_examples/RxGx/10.RAA-install.xml => resources/st_examples/DynamicQualification/1.28.hex.as.xml.msk} (63%) rename example/diameter/launcher/{deployments/test_examples/RxGx/11.CCR-U.xml => resources/st_examples/DynamicQualification/1.30.hex.as.xml.msk} (77%) rename example/diameter/launcher/{deployments/test_examples/RxGx/13.STR_Rx.xml => resources/st_examples/DynamicQualification/1.35.hex.as.xml.msk} (64%) rename example/diameter/launcher/{deployments/test_examples/RxGx/16.RAA-remove.xml => resources/st_examples/DynamicQualification/1.39.hex.as.xml.msk} (63%) rename example/diameter/launcher/{deployments/test_examples/RxGx/17.CCR-T.xml => resources/st_examples/DynamicQualification/1.41.hex.as.xml.msk} (77%) create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/15.hex.as.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/20.hex.as.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/28.hex.as.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/30.hex.as.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/35.hex.as.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/39.hex.as.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/41.hex.as.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/DynamicQualification/testcase.txt.msk create mode 100644 example/diameter/launcher/resources/st_examples/README create mode 100644 example/diameter/launcher/resources/stack_examples/0.xml create mode 100644 example/diameter/launcher/resources/stack_examples/16777236.xml create mode 100644 example/diameter/launcher/resources/stack_examples/16777238.xml create mode 100644 example/diameter/launcher/resources/stack_examples/16777302.xml diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh index e44e928..1023729 100755 --- a/example/diameter/launcher/DEPLOY.sh +++ b/example/diameter/launcher/DEPLOY.sh @@ -8,6 +8,7 @@ MSGDTD=../../../include/anna/diameter/codec/message.dtd DCTDTD=../../../include/anna/diameter/stack/dictionary.dtd BASE_PROT=commands_baseProtocol.xml SERVICES=./resources/services_examples +STACK_EXAMPLES=./resources/stack_examples SRVDTD=$SERVICES/services.dtd # Executables in priority order: @@ -17,6 +18,7 @@ EXECS=( $EXEC_installed ./release/example_diameter_launcher ./debug/example_diam # Stack management STACKMGMT_EXEC_installed=/opt/bin/anna/example_diameter_stackManagement STACKMGMT_EXECS=( $STACKMGMT_EXEC_installed ../stackManagement/release/example_diameter_stackManagement ../stackManagement/debug/example_diameter_stackManagement ) +:1 ############# # FUNCTIONS # @@ -54,17 +56,17 @@ createRunScript () { [ "$1" = "b" ] && return local other= - [ "$1" = "a" ] && { exe=ADML-launcher ; other="--httpServer \`grep -v ^# .httpServer\`"; } - [ "$1" = "f" ] && { exe=ADML-ftclient ; ln -s ADML-launcher $exe ; } - [ "$1" = "s" ] && { exe=ADML-stclient ; other="--disableLogs"; ln -s ADML-launcher $exe ; } + [ "$1" = "a" ] && other="--httpServer \`grep -v ^# .httpServer\`" + [ "$1" = "f" ] && ln -s ADML-launcher $EXE + [ "$1" = "s" ] && { other="--disableLogs"; ln -s ADML-launcher $EXE ; } echo "Creating 'run.sh' script ..." cat << EOF > run.sh #!/bin/bash cd \`dirname \$0\` -EXE=$exe -STARTED=\`pgrep \$EXE 2>/dev/null\` +EXE=$EXE +STARTED=\`pgrep \$EXE$ 2>/dev/null\` [ \$? -eq 0 ] && { echo "Already started!"; echo "\$STARTED" ; exit 1 ; } ./pre-start.sh 0> launcher.trace @@ -154,7 +156,7 @@ then echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start." echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method." echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs. Requires a server to perform the tests." - echo " (s)ystem test client: special client for stress testing. Requires a server to perform the tests." + echo " (s)ystem test client: special client for stress testing. Requires a server/s to perform the tests." echo echo "Input option [b]:" read option @@ -204,6 +206,7 @@ else fi [ -d $DPATH ] && _exit "The installation path '$DPATH' must not exists." +EXE=ADML-`basename $DPATH` echo "Copying to '$DPATH' ..." mkdir -p $DPATH @@ -222,6 +225,8 @@ cp -rL $DEPLOYMENTS_DIR/* $DPATH cp $SETUPS_DIR/*xml $DPATH/stacks cp $SETUPS_DIR/*sh $DPATH/stacks cp $SETUPS_DIR/readme.txt $DPATH/stacks +mkdir $DPATH/stacks/other_examples +cp $STACK_EXAMPLES/* $DPATH/stacks/other_examples cp $MSGDTD $DPATH/DTDs cp $DCTDTD $DPATH/DTDs cp $SRVDTD $DPATH/DTDs diff --git a/example/diameter/launcher/DEPLOY_setups.sh b/example/diameter/launcher/DEPLOY_setups.sh index b050efd..5a3256d 100755 --- a/example/diameter/launcher/DEPLOY_setups.sh +++ b/example/diameter/launcher/DEPLOY_setups.sh @@ -23,7 +23,7 @@ echo "Which one you want to deploy [1]:" echo echo " 1. Client and server" echo " 2. Ft-client and server" -echo " 3. St-client and server" +echo " 3. St-client and servers" echo read type [ "$type" = "" ] && type=1 @@ -38,7 +38,7 @@ case $type in ;; 3) - DEPLOY_DIR__dflt=$HOME/ADML-stclientAndServer + DEPLOY_DIR__dflt=$HOME/ADML-stclientAndServers ;; *) @@ -57,27 +57,44 @@ case $type in 1) $DEPLOY_SCR b $DIR/client $DEPLOY_SCR b $DIR/server + echo "Configuring ..." cd $DIR/client - echo c | ./configure.sh + echo c | ./configure.sh >/dev/null cd - >/dev/null cd $DIR/server - echo s | ./configure.sh + echo s | ./configure.sh >/dev/null cd - >/dev/null ;; 2) $DEPLOY_SCR f $DIR/ft-client $DEPLOY_SCR b $DIR/server + echo "Configuring ..." cd $DIR/server - echo s | ./configure.sh + echo s | ./configure.sh >/dev/null cd - >/dev/null ;; 3) $DEPLOY_SCR s $DIR/st-client - $DEPLOY_SCR b $DIR/server - cd $DIR/server - echo s | ./configure.sh + $DEPLOY_SCR b $DIR/serverGx + $DEPLOY_SCR b $DIR/serverRx + echo "Configuring ..." + cd $DIR/st-client + mv run.sh .run-one.sh + mv run_all.sh run.sh + mv operation.sh .operation-one.sh + mv operation_all.sh operation.sh + rm dictionary.xml + cd - >/dev/null + cd $DIR/serverGx + echo s | ./configure.sh >/dev/null + sed -i 's/3868/3869/' services.xml + ln -sf stacks/other_examples/16777238.xml dictionary.xml + cd - >/dev/null + cd $DIR/serverRx + echo s | ./configure.sh >/dev/null + ln -sf stacks/other_examples/16777236.xml dictionary.xml cd - >/dev/null ;; esac diff --git a/example/diameter/launcher/deployments/basic/configure.sh b/example/diameter/launcher/deployments/basic/configure.sh index 7a3705b..3b326bc 100755 --- a/example/diameter/launcher/deployments/basic/configure.sh +++ b/example/diameter/launcher/deployments/basic/configure.sh @@ -24,7 +24,7 @@ createRunScript () { cat << EOF > run.sh #!/bin/bash cd \`dirname \$0\` -STARTED=\`pgrep $1 2>/dev/null\` +STARTED=\`pgrep $1$ 2>/dev/null\` [ \$? -eq 0 ] && { echo "Already started!"; echo "\$STARTED" ; exit 1 ; } 0> launcher.trace rm -f counters/* test-reports/* @@ -88,7 +88,7 @@ then fi # Run script: -EXE_LINK=ADML-$tol +EXE_LINK=ADML-`basename $PWD` ln -sf $EXE_BN $EXE_LINK case $tol in diff --git a/example/diameter/launcher/deployments/st-client/README b/example/diameter/launcher/deployments/st-client/README index 6c8c711..8950d84 100644 --- a/example/diameter/launcher/deployments/st-client/README +++ b/example/diameter/launcher/deployments/st-client/README @@ -10,11 +10,26 @@ for system testing. STARTING THE PROCESS -------------------- After configuring the ADML execution context, a new script has been created: 'run.sh'. -This script will run all the cloned ADML instances within ADMLS directory. +This script will run all the cloned ADML instances within ADMLS directory. Also, an +'./operation.sh' script will broadcast the operation provided through every cloned +instance. For example, if you provide 'test|ttps|5', the speed of 5 test cases per +second will be set on every ADML instance. Imagine you have N instances, and then +you actually are establishing a total 5*N speed rate over the servers. + +TESTING PROCEDURE +----------------- +Firstly you shall program the test cases. For example: + ./program.sh st_examples/DynamicQualification + +Using option '-s', the testing will start after programming, with the desired rate +selected on configuration stage. + +Don't forget to populate whatever data you need on the tested system, because this +work is not done here. OPERATION --------- Management interface for lite version is based on SIGUSR2 signal caugh. Use './operation.sh' -script to send any operation to the processes. Ask for help with that script to see all the -operations supported. +script within a specific instance directory to send any operation to the process. Ask for +help with that script to see all the operations supported. diff --git a/example/diameter/launcher/deployments/st-client/clone.sh b/example/diameter/launcher/deployments/st-client/clone.sh new file mode 120000 index 0000000..1a5e8eb --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/clone.sh @@ -0,0 +1 @@ +../../resources/scripts/clone.sh \ No newline at end of file diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh index 383c21a..3073050 100755 --- a/example/diameter/launcher/deployments/st-client/configure.sh +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -9,6 +9,9 @@ ADML_INSTANCES__ST_CONF_FILE=.st_conf_adml_instances ADML_CONNECTIONS__ST_CONF_FILE=.st_conf_adml_connections CYCLE_REPEATS__ST_CONF_FILE=.st_conf_cycle_repeats N_TESTCASES__ST_CONF_FILE=.st_conf_n_testcases +ADML_RATE_PER_INSTANCE__ST_CONF_FILE=.st_conf_rate_per_instance +ADML_DESIRED_RATE__ST_CONF_FILE=.st_conf_desired_rate +N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE=.st_conf_n_testcases_program_layout ############# # FUNCTIONS # @@ -22,7 +25,10 @@ _exit () { # ceil of division $1/$2 ceil() { - echo "$1 $2" | awk '{print int( ($1/$2) + 1 )}' + #echo "$1 $2" | awk '{print int( ($1/$2) + 1 )}' + awk -vnumber="$1" -vdiv="$2" ' + function ceiling(x){return x%1 ? int(x)+1 : x} + BEGIN{ print ceiling(number/div) }' } # Calculates the number of ADML instances and their client connections @@ -70,9 +76,20 @@ calculate_deployment_layout() { read G_ADML_CONNECTIONS [ -z "$G_ADML_CONNECTIONS" ] && G_ADML_CONNECTIONS=1 [ $G_ADML_CONNECTIONS -lt 1 ] && G_ADML_CONNECTIONS=1 - [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ] && G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE + if [ $G_ADML_CONNECTIONS -gt 1 ] + then + echo "Remember to add 'diameterServerSessions="$G_ADML_CONNECTIONS"' on servers services.xml file (node tag)" + echo " in case that you are testing against ADML servers." + echo + echo "Press ENTER to continue, CTRL-C to abort ..." + read dummy + fi + if [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ] + then + G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE + fi - G_ADML_INSTANCES=$((max_connections/G_ADML_CONNECTIONS)) + G_ADML_INSTANCES=$(ceil $max_connections $G_ADML_CONNECTIONS) } ############# @@ -86,6 +103,8 @@ echo "=====================================" echo "ADML SYSTEM TEST CONFIGURATION WIZARD" echo "=====================================" echo +[ -d ADMLS ] && _exit "ADMLS directory still exists. Please remove it to continue (perhaps you have to 'pkill ADML' before) !" +[ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory). Try with 'realms-example' and see README inside it !" calculate_deployment_layout @@ -93,6 +112,13 @@ calculate_deployment_layout echo $G_ADML_INSTANCES > $ADML_INSTANCES__ST_CONF_FILE echo $G_ADML_CONNECTIONS > $ADML_CONNECTIONS__ST_CONF_FILE +# Rate per instance: +#rate_per_instance=$(ceil $desired_rate $G_ADML_INSTANCES) +rate_per_instance=$((desired_rate/$G_ADML_INSTANCES)) +[ $rate_per_instance -lt 1 ] && rate_per_instance=1 +echo $rate_per_instance > $ADML_RATE_PER_INSTANCE__ST_CONF_FILE +echo $desired_rate > $ADML_DESIRED_RATE__ST_CONF_FILE + echo echo "Suggested layout:" echo " - $G_ADML_INSTANCES ADML instances" @@ -104,6 +130,7 @@ echo "Usually, you will program a test case per subscriber. Input the number of read N_TESTCASES while [ -z "$N_TESTCASES" ]; do read N_TESTCASES; done echo $N_TESTCASES > $N_TESTCASES__ST_CONF_FILE +testcase_per_adml_instance=$N_TESTCASES echo time_covered_1=$(ceil $N_TESTCASES $maximum_rate) time_covered=$(ceil $N_TESTCASES $((maximum_rate*G_ADML_INSTANCES))) @@ -111,10 +138,19 @@ echo "That amount covers $time_covered_1 seconds for one running ADML instance." if [ $G_ADML_INSTANCES -gt 1 ] then echo "But you will have $G_ADML_INSTANCES instances running in parallel, then the total covered time is: $time_covered seconds" - testcase_per_adml_instance=$(ceil $N_TESTCASES $G_ADML_INSTANCES) + testcase_per_adml_instance=$((N_TESTCASES/G_ADML_INSTANCES)) echo "(aproximately, $testcase_per_adml_instance test cases will be programmed on each ADML instance)" fi +0>$N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE +for instance in `seq 1 $G_ADML_INSTANCES` +do + offset=$((testcase_per_adml_instance * (instance-1))) + ini=$((offset + 1)) + fin=$((offset + testcase_per_adml_instance)) + echo "$instance $ini $fin" >> $N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE +done + echo if [ $time_covered -lt 300 ] then @@ -130,28 +166,37 @@ while [ -z "$minutes" ]; do read minutes; done seconds=$((minutes*60)) repeats=$(ceil $seconds $time_covered) echo $repeats > $CYCLE_REPEATS__ST_CONF_FILE -[ $repeats -gt 0 ] && echo "Configured $repeats cycle repeats ($repeats x $time_covered seconds = $seconds seconds (desired $minutes minutes)" +[ $repeats -gt 0 ] && echo "Configured $repeats cycle repeats ($repeats x $time_covered seconds ~ $seconds seconds (desired $minutes minutes)" echo echo "System test configuration completed." echo echo "Ready to clone/start the ADML instances: press ENTER to continue, CTRL+C to abort ..." read dummy -[ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory). Try with 'realms.example' and see README inside it !" # Update services.xml regarding the number of client connections: -cp realms/services.msk realms/services.xml -sed -i 's/__CLIENT_CONNECTIONS__/'$G_ADML_CONNECTIONS'/g' realms/services.xml +cd realms +cp services.msk services.xml +sed -i 's/__CLIENT_CONNECTIONS__/'$G_ADML_CONNECTIONS'/g' services.xml +cd - >/dev/null + -rm -rf ADMLS for instance in `seq 1 $G_ADML_INSTANCES` do + echo "Creating ADMLS/$instance ..." mkdir -p ADMLS/$instance cd ADMLS/$instance # Create resources: - ln -s ../../ADML-launcher - ln -s ../../operation.sh - ln -s ../../realms/services.xml - for cer in `ls ../../realms/cer*xml`; do ln -s $cer; done + ln -s ../../.operation-one.sh operation.sh + ln -s ../../pre-start.sh + cp ../../.run-one.sh run.sh + sed -i 's/^EXE=.*/EXE=ADML-'$instance'/' run.sh + ln -s ../../ADML-launcher ADML-$instance + for xml in `ls ../../realms/*xml`; do ln -s $xml; done cd - >/dev/null done +echo +echo "Now you can run all the instances deployed: ./run.sh" +echo +echo "Done!" + diff --git a/example/diameter/launcher/deployments/st-client/operation_all.sh b/example/diameter/launcher/deployments/st-client/operation_all.sh new file mode 100755 index 0000000..616814d --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/operation_all.sh @@ -0,0 +1,17 @@ +#!/bin/bash +cd `dirname $0` +if [ ! -d "ADMLS" ] +then + echo + echo "Run './configure.sh' first !" + echo + exit 1 +fi + +for op in `ls ADMLS/*/operation.sh` +do + cd `dirname $op` + ./operation.sh $@ + cd - >/dev/null +done + diff --git a/example/diameter/launcher/deployments/st-client/pre-start.sh b/example/diameter/launcher/deployments/st-client/pre-start.sh new file mode 100755 index 0000000..8b97a22 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/pre-start.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "Launching ADML instance `pwd` ..." diff --git a/example/diameter/launcher/deployments/st-client/program.sh b/example/diameter/launcher/deployments/st-client/program.sh new file mode 100755 index 0000000..fccfe07 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/program.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +############# +# VARIABLES # +############# +ADML_INSTANCES=`cat .st_conf_adml_instances 2>/dev/null` +RATE_PER_INSTANCE=`cat .st_conf_rate_per_instance 2>/dev/null` +DESIRED_RATE=`cat .st_conf_desired_rate 2>/dev/null` +REPEATS=`cat .st_conf_cycle_repeats 2>/dev/null` +PROGRAM_LAYOUT_FILE=.st_conf_n_testcases_program_layout + +############# +# FUNCTIONS # +############# +_exit() { + echo + echo $1 + echo + exit 1 +} + +usage() { + echo "Usage: $0 [-s]" + echo + echo " test stuff directory: contains msk files, specially a testcase description with xml files referenced." + echo " Those files, adding .msk extension, shall exists in the same directory. For example:" + echo " $0 st_examples/DynamicQualification" + echo + echo " -s: start testing just after programming, using desired rate: $DESIRED_RATE test cases per second." + [ $ADML_INSTANCES -gt 1 ] && echo " In your case, with $ADML_INSTANCES, a rate of $RATE_PER_INSTANCE ttps will be send per instance" + echo + _exit +} + +children () { + bash_pid=$$ + children=`ps -eo ppid | grep -w $bash_pid` + echo $children | wc -w +} + + +############# +# EXECUTION # +############# +miss_conf= +[ ! -f .st_conf_adml_instances ] && miss_conf=yes +[ ! -f .st_conf_n_testcases_program_layout ] && miss_conf=yes +[ ! -f .st_conf_cycle_repeats ] && miss_conf=yes +[ ! -f .st_conf_rate_per_instance ] && miss_conf=yes +[ ! -f .st_conf_desired_rate ] && miss_conf=yes +[ -n "$miss_conf" ] && _exit "You must run './configure.sh' script firtly !!" + +echo +[ -z "$1" ] && usage +TESTCASE_DIR=$1 +AUTOSTART=$2 + +[ ! -d $TESTCASE_DIR ] && _exit "Cannot found the test directory '$TESTCASE_DIR' !!" +TESTCASE=( `ls $TESTCASE_DIR/testcase*msk 2>/dev/null` ) +TESTCASE_FILES=${#TESTCASE[@]} +[ $TESTCASE_FILES -ne 1 ] && _exit "One and only one 'testcase*msk' file must be present !!" + +children_before=$(children) +while read -r line +do + instance=$(echo $line | awk '{ print $1 }') + ini_seq=$(echo $line | awk '{ print $2 }') + fin_seq=$(echo $line | awk '{ print $3 }') + ADML_DIR=`readlink -f ADMLS/$instance` + ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq 1 & + +done < $PROGRAM_LAYOUT_FILE + +# Wait background jobs to finish: +sleep 1 +echo "Waiting for clone completion ..." +while true +do + [ $(children) -eq $children_before ] && break + sleep 1 +done + +echo "Configuring repeat cycles ..." +./operation.sh "test|repeats|$REPEATS" + +start_testing= +if [ "$AUTOSTART" = "-s" ] +then + start_testing=yes +else + echo "Input desired rate (test cases per second) to start testing [0: nothing done]:" + read desired_rate + if [ "$desired_rate" != "" ] + then + rate_per_instance=$((desired_rate/$ADML_INSTANCES)) + [ $rate_per_instance -lt 1 ] && rate_per_instance=1 + ./operation.sh "test|ttps|$rate_per_instance" + fi +fi + +if [ -n "$start_testing" ] +then + echo + echo "Start testing to achieve desired rate of $DESIRED_RATE test cases per second ..." + echo + ./operation.sh "test|ttps|$RATE_PER_INSTANCE" +fi + +echo +echo "Done !" +echo + diff --git a/example/diameter/launcher/deployments/st-client/realms_example/README b/example/diameter/launcher/deployments/st-client/realms_example/README new file mode 100644 index 0000000..1ddd49b --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/realms_example/README @@ -0,0 +1,13 @@ + +Content +======= + +README: this file. +services.msk: services with some possible parseable variables: + __CLIENT_CONNECTIONS__: Number of client conections from a specific realm to the + corresponding diameter entity. +cerGx.xml: CER file for Gx referenced in the services specification. +cerRx.xml: CER file for Rx referenced in the services specification. +dictionaryBase.xml: Diameter base dictionary used in the services specification. +dictionaryGx.xml: Gx dictionary used in the services specification. +dictionaryRx.xml: Rx dictionary used in the services specification. diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/01.CER_Gx.xml b/example/diameter/launcher/deployments/st-client/realms_example/cerGx.xml similarity index 100% rename from example/diameter/launcher/deployments/test_examples/RxGx/01.CER_Gx.xml rename to example/diameter/launcher/deployments/st-client/realms_example/cerGx.xml diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/03.CER_Rx.xml b/example/diameter/launcher/deployments/st-client/realms_example/cerRx.xml similarity index 100% rename from example/diameter/launcher/deployments/test_examples/RxGx/03.CER_Rx.xml rename to example/diameter/launcher/deployments/st-client/realms_example/cerRx.xml diff --git a/example/diameter/launcher/deployments/st-client/realms_example/dictionaryBase.xml b/example/diameter/launcher/deployments/st-client/realms_example/dictionaryBase.xml new file mode 120000 index 0000000..3b80f68 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/realms_example/dictionaryBase.xml @@ -0,0 +1 @@ +../../../resources/stack_examples/0.xml \ No newline at end of file diff --git a/example/diameter/launcher/deployments/st-client/realms_example/dictionaryGx.xml b/example/diameter/launcher/deployments/st-client/realms_example/dictionaryGx.xml new file mode 120000 index 0000000..4221ca3 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/realms_example/dictionaryGx.xml @@ -0,0 +1 @@ +../../../resources/stack_examples/16777238.xml \ No newline at end of file diff --git a/example/diameter/launcher/deployments/st-client/realms_example/dictionaryRx.xml b/example/diameter/launcher/deployments/st-client/realms_example/dictionaryRx.xml new file mode 120000 index 0000000..0706e2b --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/realms_example/dictionaryRx.xml @@ -0,0 +1 @@ +../../../resources/stack_examples/16777236.xml \ No newline at end of file diff --git a/example/diameter/launcher/deployments/st-client/realms_example/services.msk b/example/diameter/launcher/deployments/st-client/realms_example/services.msk new file mode 100644 index 0000000..dc06824 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/realms_example/services.msk @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/example/diameter/launcher/deployments/st-client/run.sh b/example/diameter/launcher/deployments/st-client/run.sh deleted file mode 100755 index 27aa362..0000000 --- a/example/diameter/launcher/deployments/st-client/run.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -cd `dirname $0` -EXE_BN=`basename $PWD` -STARTED=`pgrep $EXE_BN 2>/dev/null` -[ $? -eq 0 ] && { echo "Already started!"; echo "$STARTED" ; exit 1 ; } -0> launcher.trace -rm -f counters/* test-reports/* -# Execution line: -nohup ./ADML-client --cntDir counters --tmDir test-reports --disableLogs --services $SERVICES > stdout & -echo $! > .pid - diff --git a/example/diameter/launcher/deployments/st-client/run_all.sh b/example/diameter/launcher/deployments/st-client/run_all.sh index 8f2cd56..e9014ee 100755 --- a/example/diameter/launcher/deployments/st-client/run_all.sh +++ b/example/diameter/launcher/deployments/st-client/run_all.sh @@ -1,6 +1,27 @@ #!/bin/bash cd `dirname $0` +if [ ! -d "ADMLS" ] +then + echo + echo "Run './configure.sh' first !" + echo + exit 1 +fi + for run in `ls ADMLS/*/run.sh` do - $run + cd `dirname $run` + ./run.sh + sleep 0.1 + cd - >/dev/null done + +sleep 1 +echo "Now you could program the tests by mean script 'program.sh'. For example:" +echo " ./program.sh st_examples/DynamicQualification" +echo +echo "To stop the processes, you could execute:" +echo " pgrep ADML-[0-9] | xargs kill" +echo +echo "Done!" + diff --git a/example/diameter/launcher/deployments/st-client/st_examples b/example/diameter/launcher/deployments/st-client/st_examples new file mode 120000 index 0000000..58e802a --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/st_examples @@ -0,0 +1 @@ +../../resources/st_examples \ No newline at end of file diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/02.CEA_Gx.xml b/example/diameter/launcher/deployments/test_examples/RxGx/02.CEA_Gx.xml deleted file mode 100644 index 06ce804..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/02.CEA_Gx.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/04.CEA_Rx.xml b/example/diameter/launcher/deployments/test_examples/RxGx/04.CEA_Rx.xml deleted file mode 100644 index 7b9dd52..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/04.CEA_Rx.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/06.CCA-I.xml b/example/diameter/launcher/deployments/test_examples/RxGx/06.CCA-I.xml deleted file mode 100644 index 885b867..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/06.CCA-I.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/08.AAA-flows.xml b/example/diameter/launcher/deployments/test_examples/RxGx/08.AAA-flows.xml deleted file mode 100644 index 1392535..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/08.AAA-flows.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/09.RAR-install.xml b/example/diameter/launcher/deployments/test_examples/RxGx/09.RAR-install.xml deleted file mode 100644 index 5c1d643..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/09.RAR-install.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/12.CCA-U.xml b/example/diameter/launcher/deployments/test_examples/RxGx/12.CCA-U.xml deleted file mode 100644 index 27f8e3b..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/12.CCA-U.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/14.STA_Rx.xml b/example/diameter/launcher/deployments/test_examples/RxGx/14.STA_Rx.xml deleted file mode 100644 index 24038dc..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/14.STA_Rx.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/15.RAR-remove.xml b/example/diameter/launcher/deployments/test_examples/RxGx/15.RAR-remove.xml deleted file mode 100644 index 3840a18..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/15.RAR-remove.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/18.CCA-T.xml b/example/diameter/launcher/deployments/test_examples/RxGx/18.CCA-T.xml deleted file mode 100644 index f6a6808..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/18.CCA-T.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/19.DPR_Gx.xml b/example/diameter/launcher/deployments/test_examples/RxGx/19.DPR_Gx.xml deleted file mode 100644 index b277506..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/19.DPR_Gx.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/20.DPA_Gx.xml b/example/diameter/launcher/deployments/test_examples/RxGx/20.DPA_Gx.xml deleted file mode 100644 index f4a2435..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/20.DPA_Gx.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/21.DPR_Rx.xml b/example/diameter/launcher/deployments/test_examples/RxGx/21.DPR_Rx.xml deleted file mode 100644 index 17896d0..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/21.DPR_Rx.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/22.DPA_Rx.xml b/example/diameter/launcher/deployments/test_examples/RxGx/22.DPA_Rx.xml deleted file mode 100644 index 76fcc1c..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/22.DPA_Rx.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/simple.sh b/example/diameter/launcher/deployments/test_examples/RxGx/simple.sh deleted file mode 100755 index 765401c..0000000 --- a/example/diameter/launcher/deployments/test_examples/RxGx/simple.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -pkill ADML -sleep 1 -./run.sh -sleep 1 - -SCR_DIR=`dirname $0` -./operation.sh "test|report|yes" - -./operation.sh "test|1|timeout|5000" -./operation.sh "test|1|sendxml2e|$SCR_DIR/05.CCR-I.xml" -./operation.sh "test|1|waitfe|272|0|2001|tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;1;629571" -./operation.sh "test|1|sendxml2e|$SCR_DIR/07.AAR-flows.xml" -./operation.sh "test|1|waitfe|265|0|2001|tc_01_MMTel_DynamicQualification;afNodeHostname.afNodeHostRealm.com;1;690434" -./operation.sh "test|1|waitfe|258|1||tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;1;629571" -./operation.sh "test|1|sendxml2e|$SCR_DIR/10.RAA-install.xml|6" -./operation.sh "test|1|sendxml2e|$SCR_DIR/17.CCR-T.xml" -./operation.sh "test|1|waitfe|272|0|2001|tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;1;629571|H1" -./operation.sh "test|1|waitfe|258|1||tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;1;629571" -./operation.sh "test|1|sendxml2e|$SCR_DIR/16.RAA-remove.xml|10" - -#./operation.sh "test|ttps|1" - diff --git a/example/diameter/launcher/deployments/test_examples/checkings.sh b/example/diameter/launcher/deployments/test_examples/checkings.sh deleted file mode 100755 index 11d0c70..0000000 --- a/example/diameter/launcher/deployments/test_examples/checkings.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -pkill ADML -sleep 1 -./run.sh -sleep 1 - -./operation.sh "test|1|timeout|5000" -./operation.sh "test|1|delay|5000" -./operation.sh "test|1|waitfe|258|1" -./operation.sh "test|1|waitfc|258|1" -./operation.sh "test|1|sendxml2e|aar.xml|7" - -#for id in `seq 1 2` -#do -# ./operation.sh "test|$id|timeout|5000" -# ./operation.sh "test|$id|delay|5000" -# ./operation.sh "test|$id|sendxml2e|aar${id}.xml" -## ./operation.sh "test|$id|waitfe-answer|2" -## ./operation.sh "test|$id|waitfe|258|1||Session|hbhx" -## ./operation.sh "test|$id|waitfe|258|1|rcxxx|Session" -#done - -#./operation.sh "test|ttps|40" - diff --git a/example/diameter/launcher/deployments/test_examples/cycle.sh b/example/diameter/launcher/deployments/test_examples/cycle.sh deleted file mode 100755 index a16a62e..0000000 --- a/example/diameter/launcher/deployments/test_examples/cycle.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# Checking the correct cycle repeat and reports appending -program () { - - if [ "$2" = "ok" ] - then - ./operation.sh "test|$1|timeout|5000" - ./operation.sh "test|$1|delay|2000" - ./operation.sh "test|$1|delay|2000" - else - ./operation.sh "test|$1|timeout|5000" - ./operation.sh "test|$1|delay|2000" - ./operation.sh "test|$1|delay|4000" - fi -} - -pkill ADML -sleep 1 -./run.sh -sleep 1 -./operation.sh "test|repeat|yes" -./operation.sh "test|report|yes" - -COVERED_SECONDS=1 -for id in `seq 0 $((COVERED_SECONDS/2))` -do - program $((2*id + 1)) ok - program $((2*id + 2)) nok -done - -echo "Press ENTER to continue, CTRL+C to abort ..." -read dummy -./operation.sh "test|ttps|1" - -while true -do - sleep 1 - ./operation.sh "test|look" -done - diff --git a/example/diameter/launcher/deployments/test_examples/endsOk.sh b/example/diameter/launcher/deployments/test_examples/endsOk.sh deleted file mode 100755 index b355ea1..0000000 --- a/example/diameter/launcher/deployments/test_examples/endsOk.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -pkill ADML -sleep 1 -./run.sh -sleep 1 -./operation.sh "test|report|yes" -./operation.sh "test|1|timeout|5000" -./operation.sh "test|1|delay|2000" -./operation.sh "test|1|delay|2000" -# Last timeout ignored: -./operation.sh "test|1|timeout|3000" - -echo "Press ENTER to continue, CTRL+C to abort ..." -read dummy -./operation.sh "test|ttps|1" - -while true -do - sleep 1 - ./operation.sh "test|look|1" -done - diff --git a/example/diameter/launcher/resources/scripts/clone.sh b/example/diameter/launcher/resources/scripts/clone.sh index 815a5a7..099aa7f 100755 --- a/example/diameter/launcher/resources/scripts/clone.sh +++ b/example/diameter/launcher/resources/scripts/clone.sh @@ -28,7 +28,7 @@ sig_handler() { } usage() { - echo "Usage: $0 [number of groups]" + echo "Usage: $0 [number of groups] [population]" echo echo " ADML directory: path to the ADML directory where 'operation.sh' script is used to load the test cases." echo " testcase variable file: path to the testcase file with parseable variables, for example '/testcase.txt.msk'." @@ -43,13 +43,22 @@ usage() { echo " __SRX1_SUFFIX__: \"" echo " __SGX2_SUFFIX__: 2<8-digit sequence>" echo " __SRX2_SUFFIX__: \"" + echo " Edit the variables section to add more special values if you need them." echo echo " initial sequence: initial sequence number to parse over variables." echo " final sequence: final sequence number to parse over variables." echo " number of groups: number of background group jobs to clone the provided sequence range." - echo " By default, it will be the number of items divided by 25, with a maximum of $MAX_NUMBER_GROUPS." - echo - echo + echo " By default (or if you provide \"\"), it will be the number of items divided by 25, with a maximum" + echo " of $MAX_NUMBER_GROUPS." + echo " population: Optionally, a population file (basename) can be provided. It must exist on the same directory" + echo " than other stuff (testcase, xml files). The behaviour will be the accumulation of every parsing" + echo " operation during clone procedure regarding the templated content of the population file. The" + echo " accumulated content will be dump over a new file created together with cloned and" + echo " named with the extension '.all' (.all). This population file could be useful to" + echo " specify database commands related to each sequence (each single testcase), in order to have" + echo " the whole population file. This won't include common database elements for the tested scenary," + echo " which shall be provisioned in a separated procedure." + echo _exit } @@ -78,7 +87,8 @@ clone() { local wkdir=$2 mkdir -p $wkdir - # Values: + ############################################# SPECIAL VARIABLES SECTION ############################################# + ################################ EDIT THIS SECTION IF YOU NEED NEW SPECIAL VARIABLES ################################ testid=$sequence seq8=$(printf "%08d" $testid) msisdn9=6${seq8} @@ -105,6 +115,8 @@ clone() { echo "__SRX2_SUFFIX__=$srx2_suffix" >> $target source $target #rm $target + ######################################### END SPECIAL VARIABLES SECTION ######################################### + # Parse template files: parse_file $sequence $TESTCASE_TEMPLATE $wkdir/testcase.txt.$sequence @@ -117,6 +129,13 @@ clone() { done cat $wkdir/testcase.txt.$sequence >> $wkdir/testcase.txt rm $wkdir/testcase.txt.$sequence + + # Population: + if [ -n "$POPULATION_FILE" ] + then + parse_file $sequence $POPULATION_FILE $CLONE_WKDIR/${POPULATION}.$sequence + cat $CLONE_WKDIR/${POPULATION}.$sequence >> $POPULATION_ALL + fi } # $1: group number; $2: initial subrange value; $3: final subrange value @@ -124,7 +143,7 @@ clone_group() { for i in `seq $2 $3` do clone $i $CLONE_WKDIR/$1 - #sleep 0.01 + sleep 0.01 done } @@ -136,9 +155,13 @@ trap sig_handler SIGTERM ADML_DIR=$1 TESTCASE_TEMPLATE=`readlink -f $2` +TESTCASE_TEMPLATE_DIR=`dirname $TESTCASE_TEMPLATE` CLONE_SEQ_BEGIN=$3 CLONE_SEQ_END=$4 N_GROUPS=$5 +POPULATION=$6 +POPULATION_FILE=$TESTCASE_TEMPLATE_DIR/$POPULATION +POPULATION_ALL=$TESTCASE_TEMPLATE_DIR/${POPULATION}.all [ "$4" = "" ] && usage @@ -147,7 +170,14 @@ OPERATION=$ADML_DIR/operation.sh [ ! -f $OPERATION ] && _exit "Missing '$OPERATION' file !!" [ ! -f $TESTCASE_TEMPLATE ] && _exit "Missing '$TESTCASE_TEMPLATE' testcase template file !!" -TESTCASE_TEMPLATE_DIR=`dirname $TESTCASE_TEMPLATE` +if [ -n "$POPULATION" ] +then + bn_population=`basename $POPULATION` + [ "$bn_population" != "$POPULATION" ] && _exit "Only basename is allowed for population provided !!" + [ ! -f $POPULATION_FILE ] && _exit "Missing provided population file '$POPULATION_FILE' !!" + 0> $POPULATION_ALL +fi + N_ITEMS=$((CLONE_SEQ_END - CLONE_SEQ_BEGIN + 1)) if [ -z "$N_GROUPS" ] then @@ -169,6 +199,7 @@ children_before=$(children) offset=0 $OPERATION "test|clear" echo "Please be patient, this may take a while ..." +#echo "Temporary directory: $CLONE_WKDIR" for group in `seq 1 $((N_GROUPS+1))` do n_begin=$((CLONE_SEQ_BEGIN + offset)) @@ -178,7 +209,6 @@ do clone_group $group $n_begin $n_end & offset=$((group * GROUPS_SIZE)) done -children_now=$(children) # Wait background jobs to finish: while true diff --git a/example/diameter/launcher/resources/scripts/operation_signal.sh b/example/diameter/launcher/resources/scripts/operation_signal.sh index 85b3111..1be6fa9 100755 --- a/example/diameter/launcher/resources/scripts/operation_signal.sh +++ b/example/diameter/launcher/resources/scripts/operation_signal.sh @@ -29,7 +29,10 @@ else grep -v "^#" $FILE | sed '/^[ \t]*$/d' > sigusr2.in fi 0> sigusr2.out +kill -0 $PID 2>/dev/null +[ $? -ne 0 ] && _exit "Operation error: missing process with pid $PID" kill -s SIGUSR2 $PID + # Detect EOF and print all except that last line: while [ -z "$(tail -1 sigusr2.out | grep ^EOF)" ]; do sleep 0.1; done head --lines=-1 `pwd`/sigusr2.out diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/.testcase.txt.st b/example/diameter/launcher/resources/st_examples/DynamicQualification/.testcase.txt.st new file mode 100644 index 0000000..f741b4b --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/.testcase.txt.st @@ -0,0 +1,17 @@ +test|1|delay|0 +test|1|delay|0 +test|1|delay|0 +test|1|sendxml2e|15.hex.as.xml +test|1|waitfe|272|0|||tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;|2001 +test|1|sendxml2e|20.hex.as.xml +test|1|waitfe|265|0|||tc_01_MMTel_DynamicQualification;afNodeHostname.afNodeHostRealm.com;2;|2001 +test|1|waitfe|258|1|||tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2; +test|1|sendxml2e|28.hex.as.xml|8 +test|1|sendxml2e|30.hex.as.xml +test|1|waitfe|272|0|||tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;|2001 +test|1|sendxml2e|35.hex.as.xml +test|1|waitfe|275|0|||tc_01_MMTel_DynamicQualification;afNodeHostname.afNodeHostRealm.com;2;|2001 +test|1|waitfe|258|1|||tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2; +test|1|sendxml2e|39.hex.as.xml|14 +test|1|sendxml2e|41.hex.as.xml +test|1|waitfe|272|0|||tc_01_MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;|2001 diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/05.CCR-I.xml b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.15.hex.as.xml.msk similarity index 72% rename from example/diameter/launcher/deployments/test_examples/RxGx/05.CCR-I.xml rename to example/diameter/launcher/resources/st_examples/DynamicQualification/1.15.hex.as.xml.msk index 96a031a..726b1ab 100644 --- a/example/diameter/launcher/deployments/test_examples/RxGx/05.CCR-I.xml +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.15.hex.as.xml.msk @@ -1,6 +1,6 @@ - - - + + + @@ -8,7 +8,7 @@ - + @@ -20,8 +20,8 @@ - - + + diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/07.AAR-flows.xml b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.20.hex.as.xml.msk similarity index 73% rename from example/diameter/launcher/deployments/test_examples/RxGx/07.AAR-flows.xml rename to example/diameter/launcher/resources/st_examples/DynamicQualification/1.20.hex.as.xml.msk index 3e11df3..9d0543d 100644 --- a/example/diameter/launcher/deployments/test_examples/RxGx/07.AAR-flows.xml +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.20.hex.as.xml.msk @@ -1,26 +1,26 @@ - - - + + + - + - - + + - - + + @@ -29,7 +29,7 @@ - + @@ -37,15 +37,15 @@ - - + + - - + + @@ -54,7 +54,7 @@ - + @@ -62,7 +62,7 @@ - - + + diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/10.RAA-install.xml b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.28.hex.as.xml.msk similarity index 63% rename from example/diameter/launcher/deployments/test_examples/RxGx/10.RAA-install.xml rename to example/diameter/launcher/resources/st_examples/DynamicQualification/1.28.hex.as.xml.msk index 8c7f5b5..ec101b0 100644 --- a/example/diameter/launcher/deployments/test_examples/RxGx/10.RAA-install.xml +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.28.hex.as.xml.msk @@ -1,5 +1,5 @@ - - + + diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/11.CCR-U.xml b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.30.hex.as.xml.msk similarity index 77% rename from example/diameter/launcher/deployments/test_examples/RxGx/11.CCR-U.xml rename to example/diameter/launcher/resources/st_examples/DynamicQualification/1.30.hex.as.xml.msk index 29aad50..42e6cd0 100644 --- a/example/diameter/launcher/deployments/test_examples/RxGx/11.CCR-U.xml +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.30.hex.as.xml.msk @@ -1,6 +1,6 @@ - - - + + + diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/13.STR_Rx.xml b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.35.hex.as.xml.msk similarity index 64% rename from example/diameter/launcher/deployments/test_examples/RxGx/13.STR_Rx.xml rename to example/diameter/launcher/resources/st_examples/DynamicQualification/1.35.hex.as.xml.msk index 0f823dc..1f54e3a 100644 --- a/example/diameter/launcher/deployments/test_examples/RxGx/13.STR_Rx.xml +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.35.hex.as.xml.msk @@ -1,6 +1,6 @@ - - - + + + diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/16.RAA-remove.xml b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.39.hex.as.xml.msk similarity index 63% rename from example/diameter/launcher/deployments/test_examples/RxGx/16.RAA-remove.xml rename to example/diameter/launcher/resources/st_examples/DynamicQualification/1.39.hex.as.xml.msk index 53a2386..ac0a303 100644 --- a/example/diameter/launcher/deployments/test_examples/RxGx/16.RAA-remove.xml +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.39.hex.as.xml.msk @@ -1,5 +1,5 @@ - - + + diff --git a/example/diameter/launcher/deployments/test_examples/RxGx/17.CCR-T.xml b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.41.hex.as.xml.msk similarity index 77% rename from example/diameter/launcher/deployments/test_examples/RxGx/17.CCR-T.xml rename to example/diameter/launcher/resources/st_examples/DynamicQualification/1.41.hex.as.xml.msk index 84a790a..152ad13 100644 --- a/example/diameter/launcher/deployments/test_examples/RxGx/17.CCR-T.xml +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/1.41.hex.as.xml.msk @@ -1,6 +1,6 @@ - - - + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/15.hex.as.xml.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/15.hex.as.xml.msk new file mode 100644 index 0000000..dc7332d --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/15.hex.as.xml.msk @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/20.hex.as.xml.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/20.hex.as.xml.msk new file mode 100644 index 0000000..0b4129c --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/20.hex.as.xml.msk @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/28.hex.as.xml.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/28.hex.as.xml.msk new file mode 100644 index 0000000..92d6388 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/28.hex.as.xml.msk @@ -0,0 +1,7 @@ + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/30.hex.as.xml.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/30.hex.as.xml.msk new file mode 100644 index 0000000..6e53c57 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/30.hex.as.xml.msk @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/35.hex.as.xml.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/35.hex.as.xml.msk new file mode 100644 index 0000000..31a4d35 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/35.hex.as.xml.msk @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/39.hex.as.xml.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/39.hex.as.xml.msk new file mode 100644 index 0000000..b229433 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/39.hex.as.xml.msk @@ -0,0 +1,7 @@ + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/41.hex.as.xml.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/41.hex.as.xml.msk new file mode 100644 index 0000000..242a779 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/41.hex.as.xml.msk @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/DynamicQualification/testcase.txt.msk b/example/diameter/launcher/resources/st_examples/DynamicQualification/testcase.txt.msk new file mode 100644 index 0000000..b215519 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/DynamicQualification/testcase.txt.msk @@ -0,0 +1,17 @@ +test|__TESTID__|delay|0 +test|__TESTID__|delay|0 +test|__TESTID__|delay|0 +test|__TESTID__|sendxml2e|15.hex.as.xml +test|__TESTID__|waitfe|272|0|||MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;__SGX1_SUFFIX__|2001 +test|__TESTID__|sendxml2e|20.hex.as.xml +test|__TESTID__|waitfe|265|0|||MMTel_DynamicQualification;afNodeHostname.afNodeHostRealm.com;2;__SRX1_SUFFIX__|2001 +test|__TESTID__|waitfe|258|1|||MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;__SGX1_SUFFIX__ +test|__TESTID__|sendxml2e|28.hex.as.xml|8 +test|__TESTID__|sendxml2e|30.hex.as.xml +test|__TESTID__|waitfe|272|0|||MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;__SGX1_SUFFIX__|2001 +test|__TESTID__|sendxml2e|35.hex.as.xml +test|__TESTID__|waitfe|275|0|||MMTel_DynamicQualification;afNodeHostname.afNodeHostRealm.com;2;__SRX1_SUFFIX__|2001 +test|__TESTID__|waitfe|258|1|||MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;__SGX1_SUFFIX__ +test|__TESTID__|sendxml2e|39.hex.as.xml|14 +test|__TESTID__|sendxml2e|41.hex.as.xml +test|__TESTID__|waitfe|272|0|||MMTel_DynamicQualification;ggsnNodeHostname.ggsnNodeHostRealm.com;2;__SGX1_SUFFIX__|2001 diff --git a/example/diameter/launcher/resources/st_examples/README b/example/diameter/launcher/resources/st_examples/README new file mode 100644 index 0000000..b421345 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/README @@ -0,0 +1,3 @@ +Here there are testcase to clone. For example: + + ../scripts/clone.sh DynamicQualification/testcase.txt.msk 1 40 1 diff --git a/example/diameter/launcher/resources/stack_examples/0.xml b/example/diameter/launcher/resources/stack_examples/0.xml new file mode 100644 index 0000000..c1e23cc --- /dev/null +++ b/example/diameter/launcher/resources/stack_examples/0.xml @@ -0,0 +1,438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/stack_examples/16777236.xml b/example/diameter/launcher/resources/stack_examples/16777236.xml new file mode 100644 index 0000000..a0d53e3 --- /dev/null +++ b/example/diameter/launcher/resources/stack_examples/16777236.xml @@ -0,0 +1,696 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/stack_examples/16777238.xml b/example/diameter/launcher/resources/stack_examples/16777238.xml new file mode 100644 index 0000000..efc5acd --- /dev/null +++ b/example/diameter/launcher/resources/stack_examples/16777238.xml @@ -0,0 +1,1270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/stack_examples/16777302.xml b/example/diameter/launcher/resources/stack_examples/16777302.xml new file mode 100644 index 0000000..ce4e22d --- /dev/null +++ b/example/diameter/launcher/resources/stack_examples/16777302.xml @@ -0,0 +1,553 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.20.1 From 0df06e9ac54caeec9d29bb11e0b61befec83110b Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 20 Nov 2015 16:49:31 +0100 Subject: [PATCH 15/16] Remove limit to configure diameter server sessions to negative (no limit to accept incoming connections on diameter servers), at services.xml --- example/diameter/launcher/Launcher.cpp | 39 ++++++++++--------- example/diameter/launcher/RealmNode.cpp | 2 +- .../deployments/st-client/configure.sh | 16 ++++---- .../resources/services_examples/server.xml | 2 +- .../resources/services_examples/services.dtd | 39 ++++++++++--------- 5 files changed, 50 insertions(+), 48 deletions(-) diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 45f51a9..0968b8d 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -65,50 +65,51 @@ const char *ServicesDTD = "\ \n\ originRealm: Node identifier (Origin-Realm name).\n\ applicationId: The Application-Id provided must exists as a registered 'stack id'.\n\ - originHost: Diameter application host name (system name). If missing, process sets o.s. hostname\n\ + originHost: Diameter application host name (system name). If missing, process sets o.s. hostname.\n\ Note that if you have two or more realms, the names must be different.\n\ cer: User defined CER path file to be encoded to establish diameter connections.\n\ - If missing, will be harcoded\n\ + If missing, will be harcoded.\n\ dwr: User defined DWR path file to be encoded for diameter protocol keep alive.\n\ - If missing, will be harcoded\n\ + If missing, will be harcoded.\n\ allowedInactivityTime: Milliseconds for the maximum allowed inactivity time on server sessions born over the\n\ - local server before being reset. If missing, default value of 90000 will be assigned\n\ + local server before being reset. If missing, default value of 90000 will be assigned.\n\ tcpConnectDelay: Milliseconds to wait TCP connect to any server. If missing, default value of 200 will\n\ be assigned\n\ answersTimeout: Milliseconds to wait pending application answers from diameter peers. If missing,\n\ - default value of 10000 will be assigned\n\ + default value of 10000 will be assigned.\n\ ceaTimeout: Milliseconds to wait CEA from diameter server. If missing, default value of 'answersTimeout'\n\ - will be assigned\n\ + will be assigned.\n\ watchdogPeriod: Milliseconds for watchdog timer (Tw) for diameter keep-alive procedure. If missing, default\n\ - value of 30000 will be assigned\n\ + value of 30000 will be assigned.\n\ entity: Target diameter entity (comma-separated '
:' format).\n\ - For example: 10.20.30.40:3868,10.20.30.41:3868. If missing, no entity will be enabled\n\ - entityServerSessions: Diameter entity server sessions (0: diameter entity disabled). Default value of 1\n\ + For example: 10.20.30.40:3868,10.20.30.41:3868. If missing, no entity will be enabled.\n\ + entityServerSessions: Diameter entity server sessions (0: diameter entity disabled). Default value of 1.\n\ diameterServer: Diameter own server address in '
:' format. For example: 10.20.30.40:3868.\n\ - If missing, no local server will be enabled\n\ - diameterServerSessions: Diameter own server available connections (0: diameter server disabled). Default value of 1\n\ + If missing, no local server will be enabled.\n\ + diameterServerSessions: Diameter own server available connections (0: diameter server disabled). Default value of 1.\n\ + Negative value implies no limit accepting incoming connections.\n\ balance: Balance over entity servers instead of doing standard behaviour (first primary, secondary\n\ - if fails, etc.). Default value 'no'\n\ + if fails, etc.). Default value 'no'.\n\ sessionBasedModelsClientSocketSelection: By default, round-robin will be applied for IEC model (SMS/MMS), and Session-Id Low Part\n\ will be analyzed for ECUR/SCUR model (data, voice and content). You could change ECUR/SCUR\n\ analysis behaviour providing 'SessionIdHighPart', 'SessionIdOptionalPart' (atoi applied;\n\ - usually subscriber id data, i.e. MSISDN or IMSI) and 'RoundRobin' (also 'SessionIdLowPart')\n\ - retries: Expired responses will cause a number of request retransmissions. Disabled by default (0 retries)\n\ + usually subscriber id data, i.e. MSISDN or IMSI) and 'RoundRobin' (also 'SessionIdLowPart').\n\ + retries: Expired responses will cause a number of request retransmissions. Disabled by default (0 retries).\n\ log: Process log file (operations result, traffic log, etc.). By default '.launcher.log'.\n\ Empty string or \"null\" name, to disable. Warning: there is no rotation for log files\n\ - (use logrotate or whatever you consider)\n\ + (use logrotate or whatever you consider).\n\ splitLog: Splits log file (appends to log filename, extensions with the type of event: see help on\n\ startup information-level traces). No log files for code/decode and load operations are created.\n\ - Default value 'no'\n\ + Default value 'no'.\n\ detailedLog: Insert detailed information at log files. Should be disabled on automatic tests. Useful on\n\ - 'balance' mode to know messages flow along the sockets. Default value 'no'\n\ + 'balance' mode to know messages flow along the sockets. Default value 'no'.\n\ dumpLog: Write to disk every incoming/outcoming message named as:\n\ '......xml'\n\ - Default value 'no'\n\ + Default value 'no'.\n\ burstLog: Burst operations log file. By default '.launcher.burst'. Empty string or \"null\" name, to disable.\n\ Warning: there is no rotation for log files (use logrotate or whatever). Output: dot (.) for each\n\ burst message sent/pushed, cross (x) for popped ones, and order number when multiple of 1% of burst\n\ - list size, plus OTA requests when changed\n\ + list size, plus OTA requests when changed.\n\ \n\ -->\n\ \n\ diff --git a/example/diameter/launcher/RealmNode.cpp b/example/diameter/launcher/RealmNode.cpp index d227650..ca6cfce 100644 --- a/example/diameter/launcher/RealmNode.cpp +++ b/example/diameter/launcher/RealmNode.cpp @@ -76,7 +76,7 @@ void RealmNode::createEntity(const std::string &entityRepresentation, const anna void RealmNode::startDiameterServer(const std::string &serverRepresentation, int sessions, const anna::Millisecond &inactivityTimeout) throw(anna::RuntimeException) { - if(sessions <= 0) return; + //if(sessions <= 0) return; negative implies no limit for accepted connections std::string address; int port; anna::functions::getAddressAndPortFromSocketLiteral(serverRepresentation, address, port); diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh index 3073050..9030c46 100755 --- a/example/diameter/launcher/deployments/st-client/configure.sh +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -76,14 +76,14 @@ calculate_deployment_layout() { read G_ADML_CONNECTIONS [ -z "$G_ADML_CONNECTIONS" ] && G_ADML_CONNECTIONS=1 [ $G_ADML_CONNECTIONS -lt 1 ] && G_ADML_CONNECTIONS=1 - if [ $G_ADML_CONNECTIONS -gt 1 ] - then - echo "Remember to add 'diameterServerSessions="$G_ADML_CONNECTIONS"' on servers services.xml file (node tag)" - echo " in case that you are testing against ADML servers." - echo - echo "Press ENTER to continue, CTRL-C to abort ..." - read dummy - fi +# if [ $G_ADML_CONNECTIONS -gt 1 ] +# then +# echo "Remember to add 'diameterServerSessions="$G_ADML_CONNECTIONS"' on servers services.xml file (node tag)" +# echo " in case that you are testing against ADML servers." +# echo +# echo "Press ENTER to continue, CTRL-C to abort ..." +# read dummy +# fi if [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ] then G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE diff --git a/example/diameter/launcher/resources/services_examples/server.xml b/example/diameter/launcher/resources/services_examples/server.xml index c257afc..b58ec6a 100644 --- a/example/diameter/launcher/resources/services_examples/server.xml +++ b/example/diameter/launcher/resources/services_examples/server.xml @@ -3,6 +3,6 @@ - + diff --git a/example/diameter/launcher/resources/services_examples/services.dtd b/example/diameter/launcher/resources/services_examples/services.dtd index 1e40d28..dee3f1e 100755 --- a/example/diameter/launcher/resources/services_examples/services.dtd +++ b/example/diameter/launcher/resources/services_examples/services.dtd @@ -25,50 +25,51 @@ originRealm: Node identifier (Origin-Realm name). applicationId: The Application-Id provided must exists as a registered 'stack id'. - originHost: Diameter application host name (system name). If missing, process sets o.s. hostname + originHost: Diameter application host name (system name). If missing, process sets o.s. hostname. Note that if you have two or more realms, the names must be different. cer: User defined CER path file to be encoded to establish diameter connections. - If missing, will be harcoded + If missing, will be harcoded. dwr: User defined DWR path file to be encoded for diameter protocol keep alive. - If missing, will be harcoded + If missing, will be harcoded. allowedInactivityTime: Milliseconds for the maximum allowed inactivity time on server sessions born over the - local server before being reset. If missing, default value of 90000 will be assigned + local server before being reset. If missing, default value of 90000 will be assigned. tcpConnectDelay: Milliseconds to wait TCP connect to any server. If missing, default value of 200 will - be assigned + be assigned. answersTimeout: Milliseconds to wait pending application answers from diameter peers. If missing, - default value of 10000 will be assigned + default value of 10000 will be assigned. ceaTimeout: Milliseconds to wait CEA from diameter server. If missing, default value of 'answersTimeout' - will be assigned + will be assigned. watchdogPeriod: Milliseconds for watchdog timer (Tw) for diameter keep-alive procedure. If missing, default - value of 30000 will be assigned + value of 30000 will be assigned. entity: Target diameter entity (comma-separated '
:' format). - For example: 10.20.30.40:3868,10.20.30.41:3868. If missing, no entity will be enabled - entityServerSessions: Diameter entity server sessions (0: diameter entity disabled). Default value of 1 + For example: 10.20.30.40:3868,10.20.30.41:3868. If missing, no entity will be enabled. + entityServerSessions: Diameter entity server sessions (0: diameter entity disabled). Default value of 1. diameterServer: Diameter own server address in '
:' format. For example: 10.20.30.40:3868. - If missing, no local server will be enabled - diameterServerSessions: Diameter own server available connections (0: diameter server disabled). Default value of 1 + If missing, no local server will be enabled. + diameterServerSessions: Diameter own server available connections (0: diameter server disabled). Default value of 1. + Negative value implies no limit accepting incoming connections. balance: Balance over entity servers instead of doing standard behaviour (first primary, secondary - if fails, etc.). Default value 'no' + if fails, etc.). Default value 'no'. sessionBasedModelsClientSocketSelection: By default, round-robin will be applied for IEC model (SMS/MMS), and Session-Id Low Part will be analyzed for ECUR/SCUR model (data, voice and content). You could change ECUR/SCUR analysis behaviour providing 'SessionIdHighPart', 'SessionIdOptionalPart' (atoi applied; usually subscriber id data, i.e. MSISDN or IMSI) and 'RoundRobin' (also 'SessionIdLowPart') - retries: Expired responses will cause a number of request retransmissions. Disabled by default (0 retries) + retries: Expired responses will cause a number of request retransmissions. Disabled by default (0 retries). log: Process log file (operations result, traffic log, etc.). By default '.launcher.log'. Empty string or "null" name, to disable. Warning: there is no rotation for log files - (use logrotate or whatever you consider) + (use logrotate or whatever you consider). splitLog: Splits log file (appends to log filename, extensions with the type of event: see help on startup information-level traces). No log files for code/decode and load operations are created. - Default value 'no' + Default value 'no'. detailedLog: Insert detailed information at log files. Should be disabled on automatic tests. Useful on - 'balance' mode to know messages flow along the sockets. Default value 'no' + 'balance' mode to know messages flow along the sockets. Default value 'no'. dumpLog: Write to disk every incoming/outcoming message named as: '......xml' - Default value 'no' + Default value 'no'. burstLog: Burst operations log file. By default '.launcher.burst'. Empty string or "null" name, to disable. Warning: there is no rotation for log files (use logrotate or whatever). Output: dot (.) for each burst message sent/pushed, cross (x) for popped ones, and order number when multiple of 1% of burst - list size, plus OTA requests when changed + list size, plus OTA requests when changed. --> -- 2.20.1 From 8de835b706e08eac4bb8fca78c1f373bfb29191f Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Sun, 22 Nov 2015 16:32:44 +0100 Subject: [PATCH 16/16] Separate dumps by state: enable/disable Success and Failed tests --- example/diameter/launcher/DEPLOY.sh | 3 +- example/diameter/launcher/DEPLOY_setups.sh | 27 ++++---- example/diameter/launcher/Launcher.cpp | 63 +++++++++++------- .../launcher/deployments/basic/configure.sh | 2 +- .../launcher/deployments/st-client/README | 2 +- .../deployments/st-client/configure.sh | 64 +++++++++---------- .../launcher/deployments/st-client/program.sh | 15 ++++- example/diameter/launcher/main.cpp | 2 +- .../launcher/resources/scripts/clone.sh | 4 +- .../diameter/launcher/testing/TestCase.cpp | 3 +- .../diameter/launcher/testing/TestManager.cpp | 10 ++- .../diameter/launcher/testing/TestManager.hpp | 9 ++- 12 files changed, 119 insertions(+), 85 deletions(-) diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh index 1023729..360f1bb 100755 --- a/example/diameter/launcher/DEPLOY.sh +++ b/example/diameter/launcher/DEPLOY.sh @@ -18,7 +18,6 @@ EXECS=( $EXEC_installed ./release/example_diameter_launcher ./debug/example_diam # Stack management STACKMGMT_EXEC_installed=/opt/bin/anna/example_diameter_stackManagement STACKMGMT_EXECS=( $STACKMGMT_EXEC_installed ../stackManagement/release/example_diameter_stackManagement ../stackManagement/debug/example_diameter_stackManagement ) -:1 ############# # FUNCTIONS # @@ -206,7 +205,7 @@ else fi [ -d $DPATH ] && _exit "The installation path '$DPATH' must not exists." -EXE=ADML-`basename $DPATH` +EXE=`basename $DPATH` echo "Copying to '$DPATH' ..." mkdir -p $DPATH diff --git a/example/diameter/launcher/DEPLOY_setups.sh b/example/diameter/launcher/DEPLOY_setups.sh index 5a3256d..ff55549 100755 --- a/example/diameter/launcher/DEPLOY_setups.sh +++ b/example/diameter/launcher/DEPLOY_setups.sh @@ -55,44 +55,45 @@ read DIR case $type in 1) - $DEPLOY_SCR b $DIR/client - $DEPLOY_SCR b $DIR/server + $DEPLOY_SCR b $DIR/ADML-client + $DEPLOY_SCR b $DIR/ADML-server echo "Configuring ..." - cd $DIR/client + cd $DIR/ADML-client echo c | ./configure.sh >/dev/null cd - >/dev/null - cd $DIR/server + cd $DIR/ADML-server echo s | ./configure.sh >/dev/null cd - >/dev/null ;; 2) - $DEPLOY_SCR f $DIR/ft-client - $DEPLOY_SCR b $DIR/server + $DEPLOY_SCR f $DIR/ADML-ft-client + $DEPLOY_SCR b $DIR/ADML-server echo "Configuring ..." - cd $DIR/server + cd $DIR/ADML-server echo s | ./configure.sh >/dev/null cd - >/dev/null ;; 3) - $DEPLOY_SCR s $DIR/st-client - $DEPLOY_SCR b $DIR/serverGx - $DEPLOY_SCR b $DIR/serverRx + $DEPLOY_SCR s $DIR/ADML-st-client + $DEPLOY_SCR b $DIR/ADML-serverGx + $DEPLOY_SCR b $DIR/ADML-serverRx echo "Configuring ..." - cd $DIR/st-client + cd $DIR/ADML-st-client + ln -s realms_example realms mv run.sh .run-one.sh mv run_all.sh run.sh mv operation.sh .operation-one.sh mv operation_all.sh operation.sh rm dictionary.xml cd - >/dev/null - cd $DIR/serverGx + cd $DIR/ADML-serverGx echo s | ./configure.sh >/dev/null sed -i 's/3868/3869/' services.xml ln -sf stacks/other_examples/16777238.xml dictionary.xml cd - >/dev/null - cd $DIR/serverRx + cd $DIR/ADML-serverRx echo s | ./configure.sh >/dev/null ln -sf stacks/other_examples/16777236.xml dictionary.xml cd - >/dev/null diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 0968b8d..bf80e2d 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -1340,12 +1340,16 @@ std::string Launcher::help() const throw() { result += "\n Test cases reports are not dumped on process context (too many information in general)."; result += "\n The report contains context information in every moment: this operation acts as a snapshot."; result += "\n"; - result += "\n test|report[|[yes]|no] Every time a test case is finished, its xml representation will be dump on a file under"; + result += "\n test|report|[|[yes]|no]"; + result += "\n"; + result += "\n Every time a test case is finished, its xml representation will be dump on a file under"; result += "\n the execution directory (or the one configured in process command-line 'tmDir') with"; - result += "\n the name 'cycle-.testcase-.xml'. This option is disabled by"; - result += "\n default reducing IO. ADML process context won't show test manager whole information"; - result += "\n because it could be a huge amount of data to write. Anyway, you could use the 'look'"; - result += "\n operation to see the desired report(s)."; + result += "\n the name 'cycle-.testcase-.xml'. The third parameter represents"; + result += "\n the test result condition to dump the information. By default, neither failed nor successful"; + result += "\n test cases are written to avoid IO overload (in most of cases not all the tests are going to"; + result += "\n fail and you could enable only such dumps, but you can enable both types if you want)."; + result += "\n Better, you can use the 'look' operation to see the desired report(s) and its result state,"; + result += "\n in case that you miss the xml files or you disabled all the dumps during testing."; result += "\n"; result += "\n test|report-hex[|[yes]|no] Reports could include the diameter messages in hexadecimal format. Disabled by default."; result += "\n"; @@ -1373,7 +1377,8 @@ std::string Launcher::help() const throw() { result += "\n"; result += "\n test|summary Test manager general report (number of test cases, counts by state, global configuration,"; result += "\n forced in-progress limitation, reports visibility, etc.). Be careful when you have reports"; - result += "\n dumps enabled because all the programmed test cases will be dump and that could be heavy."; + result += "\n enabled because the programmed test cases dumps could be heavy (try to disable both failed"; + result += "\n and successful dumps)."; result += "\n"; result += "\n"; result += "\nUSING OPERATIONS INTERFACE"; @@ -1769,19 +1774,19 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons } } else if((opType == "test")) { - // test||[|parameters] Add a new step to the test case ... - // test|ttps| Starts/resume the provided number of time ticks per second (ttps). The ADML starts ... - // test|next[|] Forces the execution of the next test case(s) without waiting for test manager tick ... - // test|ip-limit[|amount] In-progress limit of test cases. No new test cases will be launched over this value ... - // test|repeats| Restarts the whole programmed test list when finished the amount number of times ... - // test|report[|[yes]|no] Every time a test case is finished a report file in xml format will be created under ... - // test|report-hex[|[yes]|no] Reports could include the diameter messages in hexadecimal format. Disabled by default. - // test|goto| Updates current test pointer position. - // test|look[|id] Show programmed test case for id provided, current when missing ... - // test|interact|amount|id Makes interactive a specific test case id. The amount is the margin of execution steps ... - // test|reset|[|id] Reset the test case for id provided, all the tests when missing ... - // test|clear Clears all the programmed test cases. - // test|summary Test manager general report (number of test cases, counts by state ... + // test||[|parameters] Add a new step to the test case ... + // test|ttps| Starts/resume the provided number of time ticks per second (ttps). The ADML starts ... + // test|next[|] Forces the execution of the next test case(s) without waiting for test manager tick ... + // test|ip-limit[|amount] In-progress limit of test cases. No new test cases will be launched over this value ... + // test|repeats| Restarts the whole programmed test list when finished the amount number of times ... + // test|report|[|[yes]|no] Every time a test case is finished a report file in xml format will be created under ... + // test|report-hex[|[yes]|no] Reports could include the diameter messages in hexadecimal format. Disabled by default. + // test|goto| Updates current test pointer position. + // test|look[|id] Show programmed test case for id provided, current when missing ... + // test|interact|amount|id Makes interactive a specific test case id. The amount is the margin of execution steps ... + // test|reset|[|id] Reset the test case for id provided, all the tests when missing ... + // test|clear Clears all the programmed test cases. + // test|summary Test manager general report (number of test cases, counts by state ... if(param1 == "ttps") { @@ -1844,12 +1849,24 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons opt_response_content += anna::functions::asString("Pool repeats: %d%s (current cycle: %d)", repeats, nolimit.c_str(), testManager.getPoolCycle()); } else if(param1 == "report") { - if (numParams > 2) + if (numParams > 3) throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); - if(param2 == "") param2 = "yes"; - testManager.setDumpReports((param2 == "yes")); - opt_response_content += (testManager.getDumpReports() ? "report enabled" : "report disabled"); + if(param2 != "Failed" && param2 != "Success") + throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); + + if(param3 == "") param3 = "yes"; + bool enable = (param3 == "yes"); + + if(param2 == "Success") + testManager.setDumpSuccessfulReports(enable); + else + testManager.setDumpFailedReports(enable); + + opt_response_content += (enable ? "report enabled " : "report disabled "); + opt_response_content += "for "; + opt_response_content += param2; + opt_response_content += " tests"; } else if(param1 == "report-hex") { if (numParams > 2) diff --git a/example/diameter/launcher/deployments/basic/configure.sh b/example/diameter/launcher/deployments/basic/configure.sh index 3b326bc..c473692 100755 --- a/example/diameter/launcher/deployments/basic/configure.sh +++ b/example/diameter/launcher/deployments/basic/configure.sh @@ -88,7 +88,7 @@ then fi # Run script: -EXE_LINK=ADML-`basename $PWD` +EXE_LINK=`basename $PWD` ln -sf $EXE_BN $EXE_LINK case $tol in diff --git a/example/diameter/launcher/deployments/st-client/README b/example/diameter/launcher/deployments/st-client/README index 8950d84..8730f6e 100644 --- a/example/diameter/launcher/deployments/st-client/README +++ b/example/diameter/launcher/deployments/st-client/README @@ -18,7 +18,7 @@ you actually are establishing a total 5*N speed rate over the servers. TESTING PROCEDURE ----------------- -Firstly you shall program the test cases. For example: +Firstly you shall program the test cases by mean script './program.sh'. For example: ./program.sh st_examples/DynamicQualification Using option '-s', the testing will start after programming, with the desired rate diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh index 9030c46..728440d 100755 --- a/example/diameter/launcher/deployments/st-client/configure.sh +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -37,7 +37,7 @@ calculate_deployment_layout() { read max_server_accepted_connections [ "$max_server_accepted_connections" = "" ] && max_server_accepted_connections=5000 - echo "Input the maximum test case rate per second:" + echo "Input the maximum desired test case rate per second:" read desired_rate while [ -z "$desired_rate" ]; do read desired_rate; done @@ -47,49 +47,48 @@ calculate_deployment_layout() { G_ADML_CONNECTIONS=1 G_ADML_INSTANCES=1 return - fi - max_adml_instances=$((max_server_accepted_connections/MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE)) - if [ $max_connections -gt $max_server_accepted_connections ] + elif [ $max_connections -gt $max_server_accepted_connections ] then - echo - echo "Maximum rate reached for $max_server_accepted_connections server connections:" - G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE - G_ADML_INSTANCES=$max_adml_instances - return + _exit "Not enough server connections to fit the desired rate (requires $max_connections connections)." fi echo echo "===========================================================================================================" echo "Orientative table" echo "-----------------------------------------------------------------------------------------------------------" - echo -e "Connects per instance:\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10" echo -n "Number of instances: " - for conn in `seq 1 $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE` + for conn in `seq 1 $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE | tac` do instances=$(ceil $max_connections $conn) echo -n -e "\t$instances" done echo + echo -e "Connects per instance:\t10\t9\t8\t7\t6\t5\t4\t3\t2\t1" echo "===========================================================================================================" echo - echo "Input selection (connections per instance 1..$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) [1]:" - read G_ADML_CONNECTIONS - [ -z "$G_ADML_CONNECTIONS" ] && G_ADML_CONNECTIONS=1 - [ $G_ADML_CONNECTIONS -lt 1 ] && G_ADML_CONNECTIONS=1 -# if [ $G_ADML_CONNECTIONS -gt 1 ] -# then -# echo "Remember to add 'diameterServerSessions="$G_ADML_CONNECTIONS"' on servers services.xml file (node tag)" -# echo " in case that you are testing against ADML servers." -# echo -# echo "Press ENTER to continue, CTRL-C to abort ..." -# read dummy -# fi + #echo "Input selection (connections per instance 1..$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) [1]:" + instances__dflt=$(ceil $max_connections $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) + echo "Input the desired number of ADML instances [$instances__dflt]:" + read G_ADML_INSTANCES + [ -z "$G_ADML_INSTANCES" ] && G_ADML_INSTANCES=$instances__dflt + [ $G_ADML_INSTANCES -lt 1 ] && G_ADML_INSTANCES=1 + G_ADML_CONNECTIONS=$(ceil $max_connections $G_ADML_INSTANCES) if [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ] then - G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE + echo "Warning: the number of connections per ADML instance ($G_ADML_CONNECTIONS) is greater" + echo " than the maximum suggested: $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE" + echo + echo "Press ENTER to continue, CTRL-C to abort ..." + read dummy + fi + client_connections=$((G_ADML_INSTANCES*G_ADML_CONNECTIONS)) + if [ $client_connections -gt $max_server_accepted_connections ] + then + echo + echo "Insufficient server connections available ($max_server_accepted_connections) to accept" + echo " launcher client connections: $G_ADML_INSTANCES x $G_ADML_CONNECTIONS = $client_connections." + _exit "Configuration error" fi - - G_ADML_INSTANCES=$(ceil $max_connections $G_ADML_CONNECTIONS) } ############# @@ -104,7 +103,7 @@ echo "ADML SYSTEM TEST CONFIGURATION WIZARD" echo "=====================================" echo [ -d ADMLS ] && _exit "ADMLS directory still exists. Please remove it to continue (perhaps you have to 'pkill ADML' before) !" -[ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory). Try with 'realms-example' and see README inside it !" +[ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory) !" calculate_deployment_layout @@ -125,6 +124,7 @@ echo " - $G_ADML_INSTANCES ADML instances" echo " - $G_ADML_CONNECTIONS client connections per ADML instance" maximum_rate=$((G_ADML_INSTANCES*G_ADML_CONNECTIONS*MAXIMUM_ADML_ASYNC_RATE)) echo " - Maximum rate: $maximum_rate test cases per second" +echo " - Desired rate: $desired_rate test cases per second" echo echo "Usually, you will program a test case per subscriber. Input the number of test cases to program:" read N_TESTCASES @@ -132,8 +132,8 @@ while [ -z "$N_TESTCASES" ]; do read N_TESTCASES; done echo $N_TESTCASES > $N_TESTCASES__ST_CONF_FILE testcase_per_adml_instance=$N_TESTCASES echo -time_covered_1=$(ceil $N_TESTCASES $maximum_rate) -time_covered=$(ceil $N_TESTCASES $((maximum_rate*G_ADML_INSTANCES))) +time_covered_1=$(ceil $N_TESTCASES $desired_rate) +time_covered=$(ceil $N_TESTCASES $((desired_rate*G_ADML_INSTANCES))) echo "That amount covers $time_covered_1 seconds for one running ADML instance." if [ $G_ADML_INSTANCES -gt 1 ] then @@ -182,9 +182,9 @@ cd - >/dev/null for instance in `seq 1 $G_ADML_INSTANCES` do - echo "Creating ADMLS/$instance ..." - mkdir -p ADMLS/$instance - cd ADMLS/$instance + echo "Creating ADML instance $instance ..." + mkdir -p ADMLS/ADML-$instance + cd ADMLS/ADML-$instance # Create resources: ln -s ../../.operation-one.sh operation.sh ln -s ../../pre-start.sh diff --git a/example/diameter/launcher/deployments/st-client/program.sh b/example/diameter/launcher/deployments/st-client/program.sh index fccfe07..93cd866 100755 --- a/example/diameter/launcher/deployments/st-client/program.sh +++ b/example/diameter/launcher/deployments/st-client/program.sh @@ -27,7 +27,7 @@ usage() { echo " $0 st_examples/DynamicQualification" echo echo " -s: start testing just after programming, using desired rate: $DESIRED_RATE test cases per second." - [ $ADML_INSTANCES -gt 1 ] && echo " In your case, with $ADML_INSTANCES, a rate of $RATE_PER_INSTANCE ttps will be send per instance" + [ $ADML_INSTANCES -gt 1 ] && echo " In your case, with $ADML_INSTANCES, a rate of $RATE_PER_INSTANCE ttps will be send per instance." echo _exit } @@ -60,14 +60,19 @@ TESTCASE=( `ls $TESTCASE_DIR/testcase*msk 2>/dev/null` ) TESTCASE_FILES=${#TESTCASE[@]} [ $TESTCASE_FILES -ne 1 ] && _exit "One and only one 'testcase*msk' file must be present !!" +#CLONE_GROUPS=1 +MAX_NUMBER_GROUPS=$(grep ^MAX_NUMBER_GROUPS= clone.sh | cut -d= -f2) +ADML_INSTANCES=`cat .st_conf_adml_instances` +CLONE_GROUPS=$((MAX_NUMBER_GROUPS/ADML_INSTANCES)) + children_before=$(children) while read -r line do instance=$(echo $line | awk '{ print $1 }') ini_seq=$(echo $line | awk '{ print $2 }') fin_seq=$(echo $line | awk '{ print $3 }') - ADML_DIR=`readlink -f ADMLS/$instance` - ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq 1 & + ADML_DIR=`readlink -f ADMLS/ADML-$instance` + ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq $CLONE_GROUPS & done < $PROGRAM_LAYOUT_FILE @@ -80,6 +85,10 @@ do sleep 1 done +echo +echo "Programming has finished !" +echo + echo "Configuring repeat cycles ..." ./operation.sh "test|repeats|$REPEATS" diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index 9f45651..2d44b3a 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -32,7 +32,7 @@ int main(int argc, const char** argv) { commandLine.add("services", anna::CommandLine::Argument::Mandatory, "Services xml path file. Shall be validated against dtd schema written on warning traces: 'Services DTD schema'. Empty string or \"null\" name, to start without services (see help for management operation 'services')."); commandLine.add("trace", anna::CommandLine::Argument::Optional, "Trace level (emergency, alert, critical, error, warning, notice, information, debug, local0..local7)"); commandLine.add("cntDir", anna::CommandLine::Argument::Optional, "Counters directory. By default is the current execution directory. Warning: a counter file will be dump per record period; take care about the possible accumulation of files"); - commandLine.add("tmDir", anna::CommandLine::Argument::Optional, "Test manager directory. By default is the current execution directory. Warning: report files could be dump during system testing (see help for management operation 'test|report'); take care about the possible accumulation of files"); + commandLine.add("tmDir", anna::CommandLine::Argument::Optional, "Test manager directory. By default is the current execution directory. Warning: report files could be dump during system testing (see help for management operation 'test|report|result'); take care about the possible accumulation of files"); commandLine.add("cntRecordPeriod", anna::CommandLine::Argument::Optional, "Counters record procedure period in milliseconds. If missing, default value of 300000 (5 minutes) will be assigned. Value of 0 disables the record procedure."); commandLine.add("logStatisticSamples", anna::CommandLine::Argument::Optional, "Log statistics samples for the provided concept id list, over './sample..csv' files. For example: \"1,2\" will log concepts 1 and 2. Reserved word \"all\" activates all registered statistics concept identifiers. That ids are shown at context dump (see help to get it)."); commandLine.add("disableLogs", anna::CommandLine::Argument::Optional, "Overrides every realm configuration regarding traffic log in order to disable it and ease production or system test startup.", false); diff --git a/example/diameter/launcher/resources/scripts/clone.sh b/example/diameter/launcher/resources/scripts/clone.sh index 099aa7f..318e681 100755 --- a/example/diameter/launcher/resources/scripts/clone.sh +++ b/example/diameter/launcher/resources/scripts/clone.sh @@ -131,7 +131,7 @@ clone() { rm $wkdir/testcase.txt.$sequence # Population: - if [ -n "$POPULATION_FILE" ] + if [ -n "$POPULATION" ] then parse_file $sequence $POPULATION_FILE $CLONE_WKDIR/${POPULATION}.$sequence cat $CLONE_WKDIR/${POPULATION}.$sequence >> $POPULATION_ALL @@ -188,7 +188,7 @@ fi GROUPS_SIZE=$((N_ITEMS/N_GROUPS)) if [ "$GROUPS_SIZE" -eq 0 ] then - echo "Assuming minimum allowed number of groups: $N_ITEMS" + echo "Assuming minimum allowed number of groups (one group per item): $N_ITEMS" GROUPS_SIZE=1 N_GROUPS=$N_ITEMS fi diff --git a/example/diameter/launcher/testing/TestCase.cpp b/example/diameter/launcher/testing/TestCase.cpp index 2817248..d69a61a 100644 --- a/example/diameter/launcher/testing/TestCase.cpp +++ b/example/diameter/launcher/testing/TestCase.cpp @@ -132,7 +132,8 @@ void TestCase::setState(const State::_v &state) throw() { if (isFinished()) { - if (!testManager.getDumpReports()) return; + if ((getState() == State::Failed) && (!testManager.getDumpFailedReports())) return; + if ((getState() == State::Success) && (!testManager.getDumpSuccessfulReports())) return; // report file name: cycle-.testcase-.xml // FORMAT: We tabulate the cycle and test case in order to ease ordering of files by mean ls: diff --git a/example/diameter/launcher/testing/TestManager.cpp b/example/diameter/launcher/testing/TestManager.cpp index bd9bbfc..e9cca9b 100644 --- a/example/diameter/launcher/testing/TestManager.cpp +++ b/example/diameter/launcher/testing/TestManager.cpp @@ -82,7 +82,8 @@ TestManager::TestManager() : anna::timex::TimeEventObserver("TestManager") { a_timeController = NULL; a_reportsDirectory = "./"; - a_dumpReports = false; + a_dumpSuccessfulReports = false; + a_dumpFailedReports = false; a_dumpHexMessages = false; a_synchronousAmount = 1; a_poolRepeats = 0; // repeat disabled by default @@ -460,7 +461,8 @@ throw() { result->createAttribute("InProgressLimit", ""); else result->createAttribute("InProgressLimit", a_inProgressLimit); - result->createAttribute("DumpReports", (a_dumpReports ? "yes":"no")); + result->createAttribute("DumpSuccessfulReports", (a_dumpSuccessfulReports ? "yes":"no")); + result->createAttribute("DumpFailedReports", (a_dumpFailedReports ? "yes":"no")); result->createAttribute("DumpHexMessages", (a_dumpHexMessages ? "yes":"no")); result->createAttribute("ReportsDirectory", a_reportsDirectory); if (a_clock) { @@ -471,9 +473,11 @@ throw() { if (a_currentTestIt != a_testPool.end()) { result->createAttribute("CurrentTestCaseId", (*a_currentTestIt).first); } - if (a_dumpReports && poolSize != 0) { + if (poolSize != 0) { anna::xml::Node* testCases = result->createChild("TestCases"); for (test_pool_it it = a_testPool.begin(); it != a_testPool.end(); it++) { + if (((*it).second->getState() == TestCase::State::Success) && (!getDumpSuccessfulReports())) continue; + if (((*it).second->getState() == TestCase::State::Failed) && (!getDumpFailedReports())) continue; (*it).second->asXML(testCases); } } diff --git a/example/diameter/launcher/testing/TestManager.hpp b/example/diameter/launcher/testing/TestManager.hpp index 76abcbb..43c5340 100644 --- a/example/diameter/launcher/testing/TestManager.hpp +++ b/example/diameter/launcher/testing/TestManager.hpp @@ -76,7 +76,7 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto // reports std::string a_reportsDirectory; - bool a_dumpReports; + bool a_dumpSuccessfulReports, a_dumpFailedReports; bool a_dumpHexMessages; // Pool of test cases @@ -123,8 +123,11 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto void setDumpHex(bool dh) throw() { a_dumpHexMessages = dh; } bool getDumpHex() const throw() { return a_dumpHexMessages; } - void setDumpReports(bool dr) throw() { a_dumpReports = dr; } - bool getDumpReports() const throw() { return a_dumpReports; } + void setDumpSuccessfulReports(bool dsr) throw() { a_dumpSuccessfulReports = dsr; } + void setDumpFailedReports(bool dfr) throw() { a_dumpFailedReports = dfr; } + + bool getDumpSuccessfulReports() const throw() { return a_dumpSuccessfulReports; } + bool getDumpFailedReports() const throw() { return a_dumpFailedReports; } // Helper to calculate time interval and synchronous amount of execution tests to guarantee the input rate (tests per second) // through the time manager which has a minimum resolution of ADML minimum resolution. The first call to this method will -- 2.20.1