From 738a3ff47facda294182c0fc8a5eee200c1fbc15 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Thu, 27 Oct 2016 19:41:09 +0200 Subject: [PATCH] configurable timeout step --- dynamic/launcher/gx/00001/dynamic.suffix | 4 ++-- example/diameter/launcher/Procedure.cpp | 16 ++++++++++------ .../launcher/deployments/st-client/program.sh | 8 ++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dynamic/launcher/gx/00001/dynamic.suffix b/dynamic/launcher/gx/00001/dynamic.suffix index 555d12c..07737b6 100644 --- a/dynamic/launcher/gx/00001/dynamic.suffix +++ b/dynamic/launcher/gx/00001/dynamic.suffix @@ -1,2 +1,2 @@ -7|CCR-I.xml -7|CCR-I.xml|CCR-T.xml +0|7|CCR-I.xml +0|7|CCR-I.xml|CCR-T.xml diff --git a/example/diameter/launcher/Procedure.cpp b/example/diameter/launcher/Procedure.cpp index fff5a91..ad3b908 100644 --- a/example/diameter/launcher/Procedure.cpp +++ b/example/diameter/launcher/Procedure.cpp @@ -28,7 +28,7 @@ namespace { void usage (std::string &response) { response += "\n\nInvalid arguments. Provide these ones:"; response += "\n"; - response += "\n|||[|CCR-T xml file]"; + response += "\n|||[|CCR-T xml file]"; response += "\n"; response += "\nSequences are parsed when needed, over AVPs or internal values:"; response += "\n"; @@ -43,7 +43,7 @@ namespace { response += "\nThe same will be done in MSISDN and IMSI (Subscription-Data AVPs)."; response += "\nFramed-IP-Address will be sequenced with a direct correspondence to hex value."; response += "\n"; - response += "\nThen, you could provide these arguments: \"2000000|9000000|7|CCR-I.xml|CCR-T.xml\""; + response += "\nThen, you could provide these arguments: \"5000|2000000|9000000|7|CCR-I.xml|CCR-T.xml\""; response += "\n"; } } @@ -55,13 +55,14 @@ void Procedure::execute(const std::string &args, std::string &response) throw(a anna::Tokenizer targs; targs.apply(args, "|"); - if (targs.size() < 4) { + if (targs.size() < 5) { usage(response); return; } anna::Tokenizer::const_iterator tok_it = targs.begin(); + std::string timeout = anna::Tokenizer::data(tok_it); tok_it++; std::string seq_i = anna::Tokenizer::data(tok_it); tok_it++; std::string seq_f = anna::Tokenizer::data(tok_it); tok_it++; std::string digits = anna::Tokenizer::data(tok_it); tok_it++; @@ -70,6 +71,7 @@ void Procedure::execute(const std::string &args, std::string &response) throw(a bool haveTermination = (ccr_t != ""); // Test cases cycles: + int i_timeout = std::atoi(timeout.c_str()); unsigned int ll_seq_i = std::atol(seq_i.c_str()); unsigned int ll_seq_f = std::atol(seq_f.c_str()); unsigned int ll_seq_size = ll_seq_f - ll_seq_i + 1; @@ -86,7 +88,7 @@ void Procedure::execute(const std::string &args, std::string &response) throw(a } unsigned int ll_seq, ll_index; - anna::Millisecond timeout(5000); + anna::Millisecond timeoutMS(i_timeout); // Load xml messages: anna::diameter::codec::Message ccri, ccrt; @@ -253,8 +255,10 @@ void Procedure::execute(const std::string &args, std::string &response) throw(a // test|__TESTID__|sendxml2e|ccr-t.xml // test|__TESTID__|waitfe|272|0|||11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__|2001 - // Step 1: timeout 5000 ms: - tc->addTimeout(timeout); + if (i_timeout != 0) { + // Step 1: timeout 5000 ms: + tc->addTimeout(timeoutMS); + } // Step 2: sendxml2e: CCR-Initial tc->addSendxml2e(ccri.code(), oh, -1 /* 'wait for request' step number for answers */); diff --git a/example/diameter/launcher/deployments/st-client/program.sh b/example/diameter/launcher/deployments/st-client/program.sh index 6d0dbb1..fcfea84 100755 --- a/example/diameter/launcher/deployments/st-client/program.sh +++ b/example/diameter/launcher/deployments/st-client/program.sh @@ -54,19 +54,19 @@ Usage: $0 [-s] and a file called 'dynamic.suffix' used to complete the dynamic operation in this way: - dynamic||| + dynamic|||| For example, you could have this content for 'dynamic.suffix': - 7|CCR-I.xml|CCR-T.xml + 0|7|CCR-I.xml|CCR-T.xml (0 for timeout means no timeout step) in order to generate the operation: - dynamic|||7|CCR-I.xml|CCR-T.xml + dynamic|0|||7|CCR-I.xml|CCR-T.xml which would be parsed for the specific ADML instance programmed: - dynamic|2000001|2001000|7|CCR-I.xml|CCR-T.xml + dynamic|0|2000001|2001000|7|CCR-I.xml|CCR-T.xml The file 'dynamic.suffix' could have several lines for several scenaries. In this case, this script will prompt for the desired one. -- 2.20.1