OAM and statistics specific operation
[anna.git] / example / diameter / launcher / Launcher.cpp
index eac8b26..fbced4a 100644 (file)
@@ -971,12 +971,10 @@ std::string Launcher::help() const throw() {
   result += "\n------------------------------------------------------------------------------------------- Hot changes";
   result += "\n";
   result += "\nservices[|source file]               Adds and starts the services specified in the xml file provided.";
-  result += "\n                                      (if missing, the file 'services.xml' will be used).";
-  result += "\n                                     The last loaded realm node will be automatically the new current";
-  result += "\n                                      working node. This is used to load new nodes once the ADML is";
-  result += "\n                                      started, regardless if '--services' command line parameter was";
-  result += "\n                                      used or not. Those services which are not correctly loaded, will";
-  result += "\n                                      be ignored, keeping the process alive.";
+  result += "\n                                      (if missing, the file 'services.xml' will be used). This is used";
+  result += "\n                                      to load new nodes once the ADML is started, regardless if command";
+  result += "\n                                      line '--services' parameter was used or not. Those services which";
+  result += "\n                                      are not correctly loaded will be ignored to keep the process alive.";
   result += "\n";
   result += "\ndiameterServerSessions|<integer>     Updates the maximum number of accepted connections to diameter";
   result += "\n                                      server socket.";
@@ -990,6 +988,8 @@ std::string Launcher::help() const throw() {
   result += "\n                                     This operation applies over all the registered realm nodes";
   result += "\n                                      except if one specific working node has been set.";
   result += "\nforceCountersRecord                  Forces dump to file the current counters of the process.";
+  result += "\noam-and-stats                        Dumps current counters and statistics of the process. This is";
+  result += "\n                                      also done at process context dump.";
   result += "\n";
   result += "\n<visibility action>[|<address>:<port>][|socket id]";
   result += "\n";
@@ -1356,6 +1356,10 @@ std::string Launcher::help() const throw() {
   result += "\n";
   result += "\n   test|clear                    Clears all the programmed test cases and stop testing (if in progress).";
   result += "\n";
+  result += "\n   test|summary                  Test manager general report (number of test cases, counts by state, global configuration,";
+  result += "\n                                 forced in-progress limitation, reports visibility, etc.). Be careful when you have reports";
+  result += "\n                                 dumps enabled because all the programmed test cases will be dump and that could be heavy.";
+  result += "\n";
   result += "\n";
   result += "\nUSING OPERATIONS INTERFACE";
   result += "\n--------------------------";
@@ -1436,6 +1440,13 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
     return;
   }
 
+  // OAM & statistics:
+  if(operation == "oam-and-stats") {
+    anna::xml::Node root("root");
+    response_content = anna::xml::Compiler().apply(oamAndStatsAsXML(&root));
+    return;
+  }
+
   ///////////////////////////////////////////////////////////////////
   // Tokenize operation
   Tokenizer params;
@@ -1747,6 +1758,8 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
     // test|interact|amount|id            Makes interactive a specific test case id. The amount is the margin of execution steps ...
     // test|reset|<soft/hard>[|id]        Reset the test case for id provided, all the tests when missing ...
     // test|clear                         Clears all the programmed test cases.
+    // test|summary                       Test manager general report (number of test cases, counts by state ...
+
 
     if(param1 == "ttps") {
       if (numParams > 2)
@@ -1896,7 +1909,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
       else {
         if (id == -1) {
           bool anyReset = testManager.resetPool((param2 == "hard") ? true:false);
-          opt_response_content = "reset have been sent to all programmed tests: "; opt_response_content += anyReset ? "some/all was actually reset" : "nothing was reset";
+          opt_response_content = "reset have been sent to all programmed tests: "; opt_response_content += anyReset ? "some/all have been reset" : "nothing was reset";
         }
         else {
           opt_response_content = "cannot found test id (";
@@ -1916,6 +1929,10 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
         opt_response_content = "there are not programmed test cases to be removed";
       }
     }
+    else if(param1 == "summary") {
+      response_content = testManager.asXMLString();
+      return;
+    }
     else {
       int id = atoi(param1.c_str());
       if(id < 0)
@@ -2111,6 +2128,19 @@ throw() {
     it->second->asXML(result);
   }
 
+  // OAM & statistics:
+  oamAndStatsAsXML(result);
+
+  // Testing: could be heavy if test case reports are enabled
+  TestManager::instantiate().asXML(result);
+
+  return result;
+}
+
+anna::xml::Node* Launcher::oamAndStatsAsXML(anna::xml::Node* parent) const
+throw() {
+  anna::xml::Node* result = parent->createChild("OamAndStatistics");
+
   // OAM:
   anna::diameter::comm::OamModule::instantiate().asXML(result);
   anna::diameter::comm::ApplicationMessageOamModule::instantiate().asXML(result);
@@ -2118,8 +2148,6 @@ throw() {
   // Statistics:
   anna::statistics::Engine::instantiate().asXML(result);
 
-  // Testing: could be heavy if test case reports are enabled
-  //TestManager::instantiate().asXML(result);
-
   return result;
 }
+