#define example_diameter_launcher_Launcher_hpp
// Standard
+#include <fstream>
#include <string>
#include <map>
-#include <fstream>
// Project
+#include <anna/core/core.hpp>
#include <anna/comm/comm.hpp>
-#include <anna/diameter.comm/Entity.hpp>
#include <anna/time/Date.hpp>
-#include <anna/timex/Engine.hpp>
+#include <anna/diameter/codec/Message.hpp>
+
+// Process
+#include <MyCommunicator.hpp>
+#include <MyCounterRecorder.hpp>
+#include <TestManager.hpp>
+
+
+#define SH_COMMAND_TAG_FOR_REPLACE__CYCLE_ID "##cycleid##"
+#define SH_COMMAND_TAG_FOR_REPLACE__TESTCASE_ID "##testcaseid##"
+#define SH_COMMAND_TAG_FOR_REPLACE__TESTSTEP_ID "##teststepid##"
+
namespace anna {
+ namespace timex {
+ class Engine;
+ }
namespace diameter {
- namespace comm {
- //class Entity;
- //class Response;
- class LocalServer;
+ namespace codec {
+ class Engine;
}
}
}
-// Process
-#include "MyCommunicator.hpp"
-#include "MyCounterRecorder.hpp"
-#include "MyDiameterEngine.hpp"
+class TestManager;
+class RealmNode;
+class MyDiameterEntity;
+class MyLocalServer;
+class MyDiameterEngine;
+
+// RealmNode resources
+class RealmNode;
+typedef std::map<std::string, RealmNode*> realm_nodes_t;
+typedef std::map<std::string, RealmNode*>::const_iterator realm_nodes_it;
+typedef std::map<std::string, RealmNode*>::iterator realm_nodes_nc_it;
class Launcher : public anna::comm::Application {
- MyCommunicator *a_communicator;
- MyDiameterEngine *a_myDiameterEngine;
- MyDiameterEntity *a_entity;
- std::string a_logFile, a_burstLogFile;
- std::ofstream a_burstLogStream;
- bool a_splitLog, a_detailedLog, a_dumpLog;
+ // Start time:
anna::time::Date a_start_time;
+
+ // Core engines:
+ MyCommunicator *a_communicator;
anna::timex::Engine* a_timeEngine;
MyCounterRecorder *a_counterRecorder;
+ anna::Millisecond a_admlMinResolution;
MyCounterRecorderClock *a_counterRecorderClock;
- std::string a_cerPathfile;
- std::string a_dwrPathfile;
-
- // Burst feature
- int a_burstCycle;
- bool a_burstRepeat;
- bool a_burstActive;
- std::map < int /* dummy, p.e. used for order number */, anna::diameter::comm::Message* > a_burstMessages;
- int a_burstLoadIndx;
- std::map<int, anna::diameter::comm::Message*>::const_iterator a_burstDeliveryIt;
- int a_otaRequest;
- int a_burstPopCounter;
+ // Nodes deployment:
+ realm_nodes_t a_nodes;
+ RealmNode *a_workingNode;
+ RealmNode *a_operatedRealm; // auxiliary for eventOperation
+
+ // comm resources:
anna::comm::ServerSocket* a_httpServerSocket; // HTTP
- MyLocalServer* a_diameterLocalServer; // DIAMETER
- void checkTimeMeasure(const char * commandLineParameter, bool optional = true) throw(anna::RuntimeException);
+
+ const anna::Millisecond &getADMLMinResolution() const throw() { return a_admlMinResolution; }
+
+ void servicesFromXML(const anna::xml::Node* servicesNode, bool eventOperation) throw(anna::RuntimeException);
+ anna::Millisecond checkTimeMeasure(const std::string ¶meter, const std::string &value) throw(anna::RuntimeException);
void initialize() throw(anna::RuntimeException); // HTTP
void run() throw(anna::RuntimeException);
public:
Launcher();
+ //~Launcher(); TODO
+
+ void loadServices(const std::string & xmlPathFile, bool eventOperation = false) throw(anna::RuntimeException);
+ void startServices() throw(anna::RuntimeException);
+
+ bool setWorkingNode(const std::string &name) throw();
+ RealmNode *getRealmNode(const std::string &realmName) const throw(anna::RuntimeException);
+ RealmNode *getRealmNode(const anna::diameter::codec::Message &message) const throw(anna::RuntimeException);
+ bool uniqueRealm() const throw() { return (a_nodes.size() == 1); }
+
+ // Operated realm for communication resources smart assignment ////////////////////////////////////////////////////////////
+ void updateOperatedRealmNodeWithMessage(const anna::diameter::codec::Message &message) throw(anna::RuntimeException);
+ RealmNode *getOperatedRealm() const throw(anna::RuntimeException);
+ MyDiameterEntity *getOperatedEntity() const throw(anna::RuntimeException);
+ MyLocalServer *getOperatedServer() const throw(anna::RuntimeException);
+ MyDiameterEngine *getOperatedEngine() const throw(anna::RuntimeException);
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
MyCommunicator *getCommunicator() throw() { return a_communicator; }
- MyDiameterEngine* getMyDiameterEngine() const throw() { return (a_myDiameterEngine); }
- void baseProtocolSetupAsClient(void) throw(anna::RuntimeException);
- MyDiameterEntity *getEntity() throw() { return a_entity; }
- MyLocalServer* getDiameterLocalServer() throw() { return a_diameterLocalServer; }
void eventOperation(const std::string &, std::string &) throw(anna::RuntimeException);
- bool logEnabled() const throw() { return (((a_logFile == "") || (a_logFile == "null")) ? false : true); }
- void writeLogFile(const anna::DataBlock & db, const std::string &logExtension, const std::string &detail) const throw();
- void writeLogFile(const anna::diameter::codec::Message & decodedMessage, const std::string &logExtension, const std::string &detail) const throw();
- void writeBurstLogFile(const std::string &buffer) throw();
- bool burstLogEnabled() const throw() { return (((a_burstLogFile == "") || (a_burstLogFile == "null")) ? false : true); }
- void startDiameterServer(int) throw(anna::RuntimeException);
void forceCountersRecord() throw(anna::RuntimeException) { if (a_counterRecorderClock) a_counterRecorderClock->tick(); }
anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
- void resetStatistics() throw() { a_myDiameterEngine->resetStatistics(); }
+ void resetStatistics() throw();
void resetCounters() throw();
void signalUSR2() throw(anna::RuntimeException);
std::string help() const throw();
+ anna::xml::Node* oamAndStatsAsXML(anna::xml::Node* parent) const throw();
// helpers
bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw();
- // Burst feature
- int clearBurst() throw(); // returns removed
- int loadBurstMessage(const anna::DataBlock & db) throw(anna::RuntimeException);
- void repeatBurst(bool repeat) throw() { a_burstRepeat = repeat; }
- int startBurst(int initialLoad) throw(); // return processed on start, or -1 if burst list is empty, -2 if invalid initial load (0 or negative)
- int pushBurst(int loadAmount) throw(); // returns pushed (perhaps is less than provided because of no repeat mode and burst list exhausted), or -1 if burst list is empty, -2 if invalid load (0 or negative)
- int sendBurst(int loadAmount) throw(); // returns sent (burst always cycled using send), returns -1 if burst list is empty, -2 if invalid load (0 or negative)
- int popBurst(int releaseAmount) throw(); // returns popped (perhaps is less than provided because of OTA request), or -1 if burst stopped
- int stopBurst() throw(); // returns remaining on cycle, or -1 if burst already stopped
- bool burstActive() const throw() { return a_burstActive; }
- bool sendBurstMessage(bool anyway = false) throw();
- std::string lookBurst(int order) const throw();
- std::string gotoBurst(int order) throw();
+ friend class TestManager;
};
#endif