DRDE/AusRegCliever/server/mdAusReg.cpp

368 lines
12 KiB
C++
Raw Normal View History

2014-01-11 00:58:45 +00:00
#define MD_AUSREG
#include "cliever-md.h"
2014-01-13 03:41:09 +00:00
#include "session/SessionFactory.hpp"
#include "session/SessionManagerProperties.hpp"
2014-01-21 01:34:40 +00:00
#include "session/Transaction.hpp"
2014-01-13 03:41:09 +00:00
#include "common/SystemProperties.hpp"
#include "session/Session.hpp"
#include "session/StatsManager.hpp"
2014-01-18 20:35:18 +00:00
#include "se/DomainCheckCommand.hpp"
#include "se/DomainCheckResponse.hpp"
2014-01-23 21:06:09 +00:00
#include "se/LPE/LPCheck.hpp"
#include "se/LPE/LPCreate.hpp"
2014-01-21 01:34:40 +00:00
#include "se/TransferOp.hpp"
2014-01-21 23:01:41 +00:00
#include "se/IntPostalInfo.hpp"
2014-01-21 01:34:40 +00:00
#include "se/ContactCreateCommand.hpp"
#include "se/ContactCreateResponse.hpp"
2014-01-18 20:35:18 +00:00
#include "se/DomainCreateCommand.hpp"
#include "se/DomainCreateResponse.hpp"
2014-01-21 01:34:40 +00:00
#include "se/DomainTransferCommand.hpp"
#include "se/DomainTransferResponse.hpp"
2014-01-07 17:59:27 +00:00
2014-01-11 00:58:45 +00:00
using namespace std;
2014-01-21 23:01:41 +00:00
//class RRJPI : public PostalInfo {
// public:
// RRJPI(const PostalInfoType *type,const string& name, const string& org,
// const std::vector<std::string>& street, const string& city,
// const string& state,const string& pc, const string& guo)
// : PostalInfo (type, name, org, street, city, state, pc, guo) { };
//};
char *name1 = "bestever.camera";
char *name2 = "yoda.guru";
char *name3 = "pricey.holdings";
char *name4 = "unicycles.bike";
char *name5 = "greedy.ventures";
char *name6 = "shady.ventures";
char *name7 = "hemmarhoid.camera";
2014-01-21 01:34:40 +00:00
2014-01-11 00:58:45 +00:00
static TestEnvironment props;
2014-01-07 17:59:27 +00:00
2014-01-13 03:41:09 +00:00
static std::string TEST_SE =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd\"><hello/></epp>";
2014-01-11 00:58:45 +00:00
// static void testExecuteParallelTransactions() throw (EPPException);
2014-01-16 15:35:39 +00:00
bool ausRegEPPTK::doNothing(const std::string propertiesFilePath) { // Just verify load
2014-01-07 17:59:27 +00:00
2014-01-10 20:05:42 +00:00
bool did=false;
2014-01-07 17:59:27 +00:00
2014-01-10 20:05:42 +00:00
try {
2014-01-16 15:35:39 +00:00
scenario( 0, propertiesFilePath ); // tkScenario 0 assumed
2014-01-10 20:05:42 +00:00
did = true;
}
catch(std::exception &e) {
2014-01-10 22:01:44 +00:00
theseLogs->logN(2,"Scenario %d TK Exception: %s .",tkScenario,e.what());
2014-01-10 20:05:42 +00:00
}
2014-01-10 22:01:44 +00:00
return did;
2014-01-07 17:59:27 +00:00
}
2014-01-11 00:58:45 +00:00
void ausRegEPPTK::doOTEA()
{
2014-01-13 23:19:10 +00:00
int hours,hoops;
2014-01-11 00:58:45 +00:00
string op("newInstance");
2014-01-16 05:39:38 +00:00
scenario(tkScenario,thisConfig->cfg_path);
2014-01-11 00:58:45 +00:00
try {
2014-01-18 20:35:18 +00:00
Timer::setTime("20140101.010101");
2014-01-11 00:58:45 +00:00
auto_ptr<SessionManager> manager(SessionManagerFactory::newInstance(&props));
2014-01-13 03:41:09 +00:00
auto_ptr<Session> sess(SessionFactory::newInstance(&props));
2014-01-11 00:58:45 +00:00
op = "startup";
manager->startup();
op = "run (keep-alive)";
manager->run();
2014-01-13 23:19:10 +00:00
sess->open();
2014-01-13 03:41:09 +00:00
2014-01-13 23:19:10 +00:00
for (hours=0;hours < 24;hours++) {
2014-01-11 00:58:45 +00:00
// Spawn the keep alive thread.
2014-01-13 23:19:10 +00:00
theseLogs->logN(1,"Send Test SEs on or about start OTE Test Hour %d.",hours);
for (hoops=0;hoops<7;hoops++) {
sess->writeXML(TEST_SE);
sess->read();
sleep(857);
}
2014-01-13 03:41:09 +00:00
2014-01-11 00:58:45 +00:00
}
2014-01-13 03:41:09 +00:00
sess->close();
2014-01-11 00:58:45 +00:00
manager->shutdown();
2014-01-11 03:01:32 +00:00
2014-01-11 00:58:45 +00:00
}
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());
}
2014-01-13 23:19:10 +00:00
}
2014-01-16 04:42:18 +00:00
void ausRegEPPTK::doOTEB()
2014-01-21 23:01:41 +00:00
{
bool addDomains = true, debug=true, contactCreated = true, doTransfers = false,
transferGainer = false;
2014-01-21 23:01:41 +00:00
int cmd=0;
const char *thatAccount="secura2-ote", *thisAccount="secura1-ote";
2014-01-21 23:01:41 +00:00
2014-01-13 23:19:10 +00:00
string op("newInstance");
2014-01-21 01:34:40 +00:00
Transaction thisTest;
2014-01-23 21:06:09 +00:00
LPLaunch *lpExts;
2014-01-13 23:19:10 +00:00
2014-01-21 01:34:40 +00:00
scenario(thisConfig->tkScenario,thisConfig->cfg_path);
2014-01-13 23:19:10 +00:00
2014-01-21 01:34:40 +00:00
while(debug) { debug=false; // debugger needs this
2014-01-13 23:19:10 +00:00
try {
2014-01-18 20:35:18 +00:00
Timer::setTime("20140101.010101");
2014-01-13 23:19:10 +00:00
auto_ptr<SessionManager> manager(SessionManagerFactory::newInstance(&props));
auto_ptr<Session> sess(SessionFactory::newInstance(&props));
op = "startup";
manager->startup();
op = "run (keep-alive)";
manager->run();
sess->open();
2014-01-16 04:42:18 +00:00
2014-01-18 20:35:18 +00:00
theseLogs->logN(1,"OTE Basic Access [Hello] (%d).",cmd++);
2014-01-16 04:42:18 +00:00
sess->writeXML(TEST_SE);
sess->read();
2014-01-21 01:34:40 +00:00
theseLogs->logN(1,"OTE Basic Access Setup (%d).",cmd++);
2014-01-21 23:01:41 +00:00
// const PostalInfoType *pits=new PostalInfoType(string("int"));
2014-01-21 01:34:40 +00:00
const std::string rrj("renjuan");
const std::string rrjPW("Ab9dW@rd");
const std::string rrjEmail("juan@acm.org");
const std::string rrjName("Ren Ren-Juan");
const std::string rrjCity("Niagara Falls");
const std::vector<std::string>
rrjCrib(1,"2926 2nd Strt");
const std::string rrjProv("NY");
const std::string rrjPC("14305");
const std::string rrjGuo("US");
const std::string rrjOrg("American Kybernetik");
2014-01-21 23:01:41 +00:00
const IntPostalInfo rrjPO(rrjName,rrjOrg,
2014-01-21 01:34:40 +00:00
rrjCrib,rrjCity,rrjProv,rrjPC,rrjGuo);
2014-01-23 02:59:22 +00:00
ContactCreateCommand oteCommand_0(rrj,rrjPW,&rrjPO,rrjEmail);
ContactCreateResponse oteResponse_0;
theseLogs->logN(1,"(skip) Create Contact(s).");
2014-01-21 01:34:40 +00:00
2014-01-21 23:01:41 +00:00
if (!contactCreated) try {
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_0, &oteResponse_0);
2014-01-21 01:34:40 +00:00
manager->execute(thisTest);
}
2014-01-21 23:01:41 +00:00
catch(const std::exception e)
{
theseLogs->logN(1,"Case %d: %s.",cmd++,e.what());
}
2014-01-21 01:34:40 +00:00
catch(...)
{
theseLogs->logN(1,"Case %d Failed, harness catch.",cmd++);
}
2014-01-23 02:59:22 +00:00
theseLogs->logN(1,"Continue OTE Transactions.");
2014-01-16 04:42:18 +00:00
sleep(2);
2014-01-23 04:05:35 +00:00
theseLogs->logN(1,"(%d) Non-LPE check of yoda.guru",cmd++);
2014-01-18 20:35:18 +00:00
2014-01-23 02:59:22 +00:00
DomainCheckCommand oteCommand_1(name2);
DomainCheckResponse oteResponse_1;
2014-01-18 20:35:18 +00:00
2014-01-21 01:34:40 +00:00
try {
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_1, &oteResponse_1);
2014-01-21 01:34:40 +00:00
manager->execute(thisTest);
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++);
}
2014-01-23 02:59:22 +00:00
theseLogs->logN(1,"(%d) LPE Check of unicycles.bike",cmd++);
2014-01-18 20:35:18 +00:00
2014-01-23 21:06:09 +00:00
LPCheck oteCommand_2("unicycles.bike");
2014-01-23 02:59:22 +00:00
DomainCheckResponse oteResponse_2;
try {
thisTest = Transaction(&oteCommand_2, &oteResponse_2);
manager->execute(thisTest);
}
catch (EPPException& e)
2014-01-24 16:38:51 +00:00
{ const char *eMsg = e.getMessage().c_str();
2014-01-23 02:59:22 +00:00
const char *opNow = op.c_str();
theseLogs->logN(2,"EPP Exception during OTE B (%s): %s .",opNow,eMsg);
throw e;
}
catch (...)
{
theseLogs->logN(2,"General Exception OTE B (%s).",op.c_str());
}
// Used in all of below
2014-01-18 20:35:18 +00:00
2014-01-21 01:34:40 +00:00
const std::string pw("Ab9dW@rd");
const std::string RID("renjuan");
std::vector<std::string> tech(1,std::string("renjuan") );
std::vector<std::string> admin(1,std::string("renjuan") );
std::vector<std::string> billing(1,std::string("renjuan") );
std::vector<std::string> ns(1,std::string("ns1.google.com") );;
2014-01-18 20:35:18 +00:00
2014-01-21 01:34:40 +00:00
2014-01-23 02:59:22 +00:00
theseLogs->logN(2,"skip: (%d) create more domains in OTE %s.",cmd++, thisAccount);
2014-01-21 01:34:40 +00:00
2014-01-23 02:59:22 +00:00
if (addDomains) {
try {
2014-01-21 23:01:41 +00:00
DomainCreateCommand
2014-01-23 02:59:22 +00:00
oteCommand_3(name3,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3;
2014-01-18 20:35:18 +00:00
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_3, &oteResponse_3);
2014-01-21 01:34:40 +00:00
manager->execute(thisTest);
2014-01-21 23:01:41 +00:00
DomainCreateCommand
2014-01-23 02:59:22 +00:00
oteCommand_3a(name2,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3a;
2014-01-21 23:01:41 +00:00
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_3a, &oteResponse_3a);
2014-01-21 23:01:41 +00:00
manager->execute(thisTest);
2014-01-21 23:01:41 +00:00
DomainCreateCommand
2014-01-23 02:59:22 +00:00
oteCommand_3b(name5,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3b;
2014-01-21 23:01:41 +00:00
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_3b, &oteResponse_3b);
2014-01-21 23:01:41 +00:00
manager->execute(thisTest);
DomainCreateCommand
2014-01-23 02:59:22 +00:00
oteCommand_3c(name4,pw,&RID, &tech, &ns, &admin, &billing);
DomainCreateResponse oteResponse_3c;
2014-01-21 23:01:41 +00:00
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_3c, &oteResponse_3c);
2014-01-21 23:01:41 +00:00
manager->execute(thisTest);
2014-01-23 02:59:22 +00:00
}
catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str();
const char *opNow = op.c_str();
theseLogs->logN(2,"EPP Exception during OTE B (%s): %s .",opNow,eMsg);
throw e;
2014-01-21 01:34:40 +00:00
}
2014-01-23 02:59:22 +00:00
catch (...)
2014-01-21 01:34:40 +00:00
{
2014-01-23 02:59:22 +00:00
theseLogs->logN(2,"General Exception OTE B (%s).",op.c_str());
2014-01-21 01:34:40 +00:00
}
2014-01-23 02:59:22 +00:00
}
2014-01-18 20:35:18 +00:00
2014-01-23 02:59:22 +00:00
theseLogs->logN(2,"skip %s (%d) %s -> %s.",
(transferGainer ? "Request" : "Approve"),cmd++,
name1,thatAccount);
2014-01-21 01:34:40 +00:00
2014-01-21 23:01:41 +00:00
if (doTransfers) {
2014-01-18 20:35:18 +00:00
const TransferOp *thisTransfer =
transferGainer ? new TransferOp("request") : new TransferOp("approve") ;
2014-01-21 01:34:40 +00:00
DomainTransferCommand
2014-01-23 02:59:22 +00:00
oteCommand_4(thisTransfer,name1);
DomainTransferResponse oteResponse_4;
2014-01-21 01:34:40 +00:00
try {
2014-01-18 20:35:18 +00:00
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_4, &oteResponse_4);
2014-01-21 01:34:40 +00:00
manager->execute(thisTest);
2014-01-18 20:35:18 +00:00
2014-01-21 01:34:40 +00:00
}
catch(...)
{
theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++);
}
2014-01-18 20:35:18 +00:00
2014-01-23 02:59:22 +00:00
}
2014-01-21 23:01:41 +00:00
2014-01-23 02:59:22 +00:00
theseLogs->logN(1,"(%d) Sunrise create %s with ICANN SMD test files.",cmd++,name5);
2014-01-21 01:34:40 +00:00
2014-01-23 21:06:09 +00:00
LPCreate oteCommand_5(name5,pw,&RID, &tech, &ns, &admin, &billing);
2014-01-23 02:59:22 +00:00
DomainCreateResponse oteResponse_5;
2014-01-18 20:35:18 +00:00
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_5, &oteResponse_5);
2014-01-21 01:34:40 +00:00
manager->execute(thisTest);
theseLogs->logN(1,"(%d) Create test-validate.claimsgasix (TCN).",cmd++);
2014-01-18 20:35:18 +00:00
2014-01-23 21:06:09 +00:00
LPCreate oteCommand_6("test-validate.claimsgasix",pw,&RID, &tech, &ns, &admin, &billing);
2014-01-23 02:59:22 +00:00
DomainCreateResponse oteResponse_6;
2014-01-18 20:35:18 +00:00
2014-01-23 02:59:22 +00:00
thisTest = Transaction(&oteCommand_6, &oteResponse_6);
2014-01-21 01:34:40 +00:00
manager->execute(thisTest);
2014-01-23 02:59:22 +00:00
theseLogs->logN(0,"End OTE Session.");
2014-01-16 04:42:18 +00:00
2014-01-13 23:19:10 +00:00
sess->close();
manager->shutdown();
}
catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str();
const char *opNow = op.c_str();
2014-01-23 02:59:22 +00:00
theseLogs->logN(2,"Outer EPP Exception during OTE (%s): %s .",opNow,eMsg);
2014-01-13 23:19:10 +00:00
throw e;
}
catch (...)
{
2014-01-23 02:59:22 +00:00
theseLogs->logN(2,"Outer General Exception in OTE (%s).",op.c_str());
2014-01-13 23:19:10 +00:00
}
2014-01-11 00:58:45 +00:00
2014-01-21 01:34:40 +00:00
}// debug while
2014-01-11 00:58:45 +00:00
}
2014-01-18 20:35:18 +00:00
void ausRegEPPTK::doOTEP()
{
int hours,hoops;
string op("newInstance");
scenario(thisConfig->tkScenario,thisConfig->cfg_path);
try {
Timer::setTime("20140101.010101");
auto_ptr<SessionManager> manager(SessionManagerFactory::newInstance(&props));
auto_ptr<Session> sess(SessionFactory::newInstance(&props));
op = "startup";
manager->startup();
op = "run (keep-alive)";
manager->run();
sess->open();
for (hours=0;hours < 24;hours++) {
// Spawn the keep alive thread.
theseLogs->logN(1,"AC Production Hour %d.",hours);
// if thisEPPServer(mdStdDevIdx).vendor == "Donuts"
for (hoops=0;hoops<7;hoops++) {
sess->writeXML(TEST_SE);
sess->read();
sleep(857);
}
}
sess->close();
manager->shutdown();
}
catch (EPPException& e)
{ const char *eMsg = e.getMessage().c_str();
const char *opNow = op.c_str();
theseLogs->logN(2,"EPP Exception in Production (%s): %s .",opNow,eMsg);
throw e;
}
catch (...)
{
theseLogs->logN(2,"General Exception Production (%s).",op.c_str());
}
}