configurable timeout step
authorEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Thu, 27 Oct 2016 17:41:09 +0000 (19:41 +0200)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Thu, 27 Oct 2016 17:41:09 +0000 (19:41 +0200)
dynamic/launcher/gx/00001/dynamic.suffix
example/diameter/launcher/Procedure.cpp
example/diameter/launcher/deployments/st-client/program.sh

index 555d12c..07737b6 100644 (file)
@@ -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
index fff5a91..ad3b908 100644 (file)
@@ -28,7 +28,7 @@ namespace {
    void usage (std::string &response) {
      response += "\n\nInvalid arguments. Provide these ones:";
      response += "\n";
    void usage (std::string &response) {
      response += "\n\nInvalid arguments. Provide these ones:";
      response += "\n";
-     response += "\n<initial sequence>|<final sequence>|<digits>|<CCR-I xml file>[|CCR-T xml file]";
+     response += "\n<test timeout ms (0: no timeout step)><initial sequence>|<final sequence>|<digits>|<CCR-I xml file>[|CCR-T xml file]";
      response += "\n";
      response += "\nSequences are parsed when needed, over AVPs or internal values:";
      response += "\n";
      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 += "\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";
    }
 }
      response += "\n";
    }
 }
@@ -55,13 +55,14 @@ void Procedure::execute(const std::string &args, std::string &response)  throw(a
   anna::Tokenizer targs;
   targs.apply(args, "|");
 
   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();
 
     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++;
   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:
   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;
   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;
   }
 
   unsigned int ll_seq, ll_index;
-  anna::Millisecond timeout(5000);
+  anna::Millisecond timeoutMS(i_timeout);
 
   // Load xml messages:
   anna::diameter::codec::Message ccri, ccrt;
 
   // 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
 
     //    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 */);
 
     // Step 2: sendxml2e: CCR-Initial
     tc->addSendxml2e(ccri.code(), oh, -1 /* 'wait for request' step number for answers */);
index 6d0dbb1..fcfea84 100755 (executable)
@@ -54,19 +54,19 @@ Usage: $0 <test stuff directory|dynamic> [-s]
           and a file called 'dynamic.suffix' used to complete the dynamic operation
           in this way:
 
           and a file called 'dynamic.suffix' used to complete the dynamic operation
           in this way:
 
-             dynamic|<initial sequence>|<final sequence>|<dynamic.suffix content>
+             dynamic|<timeout ms>|<initial sequence>|<final sequence>|<dynamic.suffix content>
 
           For example, you could have this content for 'dynamic.suffix':
 
 
           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:
 
 
           in order to generate the operation:
 
-             dynamic|<initial sequence>|<final sequence>|7|CCR-I.xml|CCR-T.xml
+             dynamic|0|<initial sequence>|<final sequence>|7|CCR-I.xml|CCR-T.xml
 
           which would be parsed for the specific ADML instance programmed:
 
 
           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.
 
           The file 'dynamic.suffix' could have several lines for several scenaries.
           In this case, this script will prompt for the desired one.