From 13a7eaff727a83cdee0c4ce395b324000f02210d Mon Sep 17 00:00:00 2001 From: Ren RenJuan Date: Sat, 11 Jan 2014 00:58:45 +0000 Subject: [PATCH] * --- AusRegCliever/Makefile | 4 +-- AusRegCliever/include/ausRegTK.h | 23 ++++++++++++-- AusRegCliever/include/cliever-md.h | 3 +- AusRegCliever/include/mdcommon.h | 7 +++++ AusRegCliever/server/masterDaemon.cpp | 17 +++++++++-- AusRegCliever/server/mdAusReg.cpp | 43 +++++++++++++++++++++++++-- 6 files changed, 87 insertions(+), 10 deletions(-) diff --git a/AusRegCliever/Makefile b/AusRegCliever/Makefile index 34da321..bb61218 100644 --- a/AusRegCliever/Makefile +++ b/AusRegCliever/Makefile @@ -12,10 +12,10 @@ Cc=gcc ifeq ($(LOCATION),authoring) ARTKLIB=-L/home/jdaugherty/clients/reg.de/git/ACTK1_0/lib - ARTKINCL=-I/home/jdaugherty/clients/reg.de/git/ACTK1_0/common + ARTKINCL=-I/home/jdaugherty/clients/reg.de/git/ACTK1_0 else ARTKLIB=-L/home/jdaugherty/dnseppus/ACTK1_0/lib - ARTKINCL=-I/home/jdaugherty/dnseppus/ACTK1_0/common + ARTKINCL=-I/home/jdaugherty/dnseppus/ACTK1_0 endif SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) $(ARTKLIB) -l boost_system -l boost_thread -l log4cpp -l ACTK1_0 diff --git a/AusRegCliever/include/ausRegTK.h b/AusRegCliever/include/ausRegTK.h index d7ba54c..b4763de 100644 --- a/AusRegCliever/include/ausRegTK.h +++ b/AusRegCliever/include/ausRegTK.h @@ -1,5 +1,22 @@ -#include +#ifdef MD_AUSREG +#include "se/PollRequestCommand.hpp" +#include "se/PollResponse.hpp" +#include "session/Transaction.hpp" +#include "session/SessionManagerFactory.hpp" +#include "session/SessionManager.hpp" +#include "session/Timer.hpp" +#include "session/TestEnvironment.hpp" +#endif +#include "common/init.hpp" + +#ifdef MD_AUSREG +#include "common/Test.hpp" +#include +#include +#include +#include +#endif class ausRegEPPTK { @@ -8,8 +25,8 @@ class ausRegEPPTK { public: int tkScenario; // See the Toolkit Overview. At this level supposedly it can do everything. - ausRegEPPTK() { tkScenario = 1; } + ausRegEPPTK() { tkScenario = ACTK_OTEA; } bool didInit(const std::string propertiesFilePath); - + void doOTEA(); }; diff --git a/AusRegCliever/include/cliever-md.h b/AusRegCliever/include/cliever-md.h index 8027390..e78d123 100644 --- a/AusRegCliever/include/cliever-md.h +++ b/AusRegCliever/include/cliever-md.h @@ -26,7 +26,6 @@ namespace fsm = boost::statechart; -#include "ausRegTK.h" #include "mdcommon.h" #include "mdevents.h" #include "mdLogger.h" @@ -34,6 +33,8 @@ namespace fsm = boost::statechart; #include "mdState.h" #include "mdHost.h" +#include "ausRegTK.h" + #define MD_HAUSHALT 2000 // milliseconds between attention routine #define MD_LOCK_FILE "cliever-md.lock" diff --git a/AusRegCliever/include/mdcommon.h b/AusRegCliever/include/mdcommon.h index 98e19c1..d815558 100644 --- a/AusRegCliever/include/mdcommon.h +++ b/AusRegCliever/include/mdcommon.h @@ -141,6 +141,13 @@ enum mdDGtype { N_MDDG_TYPES }; +enum acTKScenario { + ACTK_ALONE = 0, + ACTK_INSECURE, + ACTK_OTEA, + N_ACTK_SCENARIOS +}; + typedef struct MD_DG_TYPE { unsigned inBandOnly : 1; diff --git a/AusRegCliever/server/masterDaemon.cpp b/AusRegCliever/server/masterDaemon.cpp index ce5b141..3fa0d5a 100644 --- a/AusRegCliever/server/masterDaemon.cpp +++ b/AusRegCliever/server/masterDaemon.cpp @@ -126,7 +126,7 @@ void masterDaemon::dispatch(const mdIncoming &what) { int masterDaemon::initAusRegTK(void) { int rc=OK; - const std::string nil("etc/toolkit2.conf"); + const std::string nil("/home/jdaugherty/dnseppus/etc/toolkit2.conf"); try { @@ -219,19 +219,32 @@ void masterDaemon::processEvent( const mdAPIFrame &thisFrame ) { assert(EventSender::isSending()); } +void oteA() { + + theseLogs->logNdebug(MAX_DEBUG,0,"OTE Connectivity Test BOJ."); + thisService->artk->doOTEA(); + +} void masterDaemon::run() { deviceFactory = new mdHostFabrik(); fg = new mdDGChannel( thisService->io_, 0 ); if (initAusRegTK()) return; + else switch(artk->tkScenario) { + case ACTK_OTEA: + boost::thread oteArun(oteA); + assert(oteArun.joinable()); + oteArun.join(); + theseLogs->logNdebug(MAX_DEBUG,0,"OTE Connectivity Test EOJ."); + break; + } listen(); boost::thread work(mdWQ); assert(work.joinable()); theseLogs->logNdebug(MAX_DEBUG,0,"Master Daemon worker started, foreground async i/o service joins MD worker."); io_.run(); work.join(); - } void mdDGChannel::handle_receive_from(const boost::system::error_code& error, diff --git a/AusRegCliever/server/mdAusReg.cpp b/AusRegCliever/server/mdAusReg.cpp index 8ed6354..1ab5feb 100644 --- a/AusRegCliever/server/mdAusReg.cpp +++ b/AusRegCliever/server/mdAusReg.cpp @@ -1,8 +1,13 @@ - +#define MD_AUSREG #include "cliever-md.h" +using namespace std; -bool ausRegEPPTK::didInit(const std::string propPath) { +static TestEnvironment props; + +// static void testExecuteParallelTransactions() throw (EPPException); + +bool ausRegEPPTK::didInit(const std::string propertiesFilePath) { bool did=false; @@ -16,3 +21,37 @@ bool ausRegEPPTK::didInit(const std::string propPath) { return did; } +void ausRegEPPTK::doOTEA() +{ + int hours; + string op("newInstance"); + + scenario(tkScenario); + + try { + Timer::setTime("20070101.010101"); + auto_ptr manager(SessionManagerFactory::newInstance(&props)); + op = "startup"; + manager->startup(); + op = "run (keep-alive)"; + + manager->run(); + for (hours=0;hours < 22;hours++) { + // Spawn the keep alive thread. + theseLogs->logN(1,"Start of OTE Test Hour %d.",hours); + sleep(3630); + } + manager->shutdown(); + } + catch (EPPException& e) + { const char *eMsg = e.getMessage().c_str(); + const char *opNow = op.c_str(); + theseLogs->logN(2,"EPP Exception during OTE A (%s): %s .",opNow,eMsg); + throw e; + } + catch (...) + { + theseLogs->logN(2,"General Exception during OTE A (%s).",op.c_str()); + } + +}