X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FEventOperation.hpp;h=59ede335073e8c9220f41d81dc8716bf59f6eb22;hp=2d9e056dd2eb9f97a3c65f203f11dd87b3efca60;hb=c881c12ed7e116f1d43760a0d9873f860c10a357;hpb=af14877201a9856708ec43086a229777d9cb3da7 diff --git a/example/diameter/launcher/EventOperation.hpp b/example/diameter/launcher/EventOperation.hpp index 2d9e056..59ede33 100644 --- a/example/diameter/launcher/EventOperation.hpp +++ b/example/diameter/launcher/EventOperation.hpp @@ -10,17 +10,145 @@ #define example_diameter_launcher_EventOperation_hpp // Project -#include // STL #include -using json = nlohmann::json; +//// Standard +//#include // std::istringstream +//#include // std::cout +//#include // ceil +//#include +//#include // chdir +//#include +// +// Project +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +// +//// Process +//#include +//#include +//#include +//#include +//#include +//#include + class EventOperation { + bool a_http; + public: - static std::string json2piped(const json &j); + /** + * EventOperation constructor + * + * @param http Indicates that HTTP interface is used. + * + * At signal interface, the response is written directly as output, but HTTP + * one answers json. + * + * TODO: xml2json implementation (i.e., https://github.com/Cheedoong/xml2json). + * As only 3 operations are going to answer xml content: + * - working node report ('node') + * - diameter hex decode ('decode') + * - reinterpret json into xml ('loadmsg') + * the effort does not compensate having them responding full json representation. + * + * So, base64 encoding will be used for those xml representations. + * + * Anna Suite used xml natively for many things, json will be only used for + * REST API on requests and will be transformed internally. + */ + EventOperation(bool http) : a_http(http) {;} + + // Node management + bool node(std::string &response, const std::string & name); + bool node_auto(std::string &response); + + // Parsing operations + bool code(std::string &response, const std::string & diameterJson); + bool decode(std::string &response, const std::string & diameterHex); + bool loadmsg(std::string &response, const std::string & diameterJson); + + // Hot changes + bool services(std::string &response, const std::string & servicesJson); + bool diameterServerSessions(std::string &response, int sessions); + bool change_dir(std::string &response, const std::string & directory = ""); + + // Client sessions visibility + bool visibility(std::string &response, const std::string & action, const std::string &addressPort = "", int socket = -1); + + // Snapshots + bool collect(std::string &response); + bool context(std::string &response, const std::string & targetFile = ""); + bool forceCountersRecord(std::string &response); + bool log_statistics_samples(std::string &response, const std::string & list); + bool show_oam(std::string &response); + bool show_stats(std::string &response); + + // Flow operations + bool sendmsg2e(std::string &response, const std::string & diameterJson); + bool sendmsg2c(std::string &response, const std::string & diameterJson); + bool answermsg2e(std::string &response, const std::string & diameterJson); + bool answermsg2c(std::string &response, const std::string & diameterJson); + bool answermsg2e_action(std::string &response, const std::string & action = "list"); + bool answermsg2c_action(std::string &response, const std::string & action = "list"); + bool sendhex2e(std::string &response, const std::string & diameterHex); + bool sendhex2c(std::string &response, const std::string & diameterHex); + + // FSM testing + // test_id__ + bool test_id__description(std::string &response, unsigned int id, const std::string & description); + bool test_id__ip_limit(std::string &response, unsigned int id, int amount = 1); + bool test_id__timeout(std::string &response, unsigned int id, int msecs); + bool test_id__sendmsg2e(std::string &response, unsigned int id, const std::string & diameterJson, int stepNumber = -1); + bool test_id__sendmsg2c(std::string &response, unsigned int id, const std::string & diameterJson, int stepNumber = -1); + bool test_id__delay(std::string &response, unsigned int id, int msecs); + bool test_id__sh_command(std::string &response, unsigned int id, const std::string & script); + bool test_id__waitfe_hex(std::string &response, unsigned int id, const std::string & hex, bool strict = false); + bool test_id__waitfc_hex(std::string &response, unsigned int id, const std::string & hex, bool strict = false); + bool test_id__waitfe_msg(std::string &response, unsigned int id, const std::string & diameterJson, bool strict = false); + bool test_id__waitfc_msg(std::string &response, unsigned int id, const std::string & diameterJson, bool strict = false); + bool test_id__waitfe(std::string &response, unsigned int id, const std::string & condition); + bool test_id__waitfc(std::string &response, unsigned int id, const std::string & condition); + + // Testcases execution + // test__ + bool test__ttps(std::string &response, int amount); + bool test__next(std::string &response, int syncAmount = 1); + bool test__ip_limit(std::string &response, int amount = -2 /* show current ip-limit and in-progress test cases amount */); + bool test__goto(std::string &response, int id); + bool test__run(std::string &response, int id); + bool test__look(std::string &response, int id = -1 /* current */); + bool test__state(std::string &response, int id = -1 /* current */); + bool test__interact(std::string &response, int amount, unsigned int id = -1 /* current */); + bool test__reset(std::string &response, bool soft_hard = true, unsigned int id = -2 /* apply to all the tests */); + bool test__repeats(std::string &response, int amount); + bool test__auto_reset(std::string &response, bool soft_hard); + bool test__initialized(std::string &response); + bool test__finished(std::string &response); + bool test__clear(std::string &response); + bool test__junit(std::string &response, const std::string & targetFile); + bool test__summary_counts(std::string &response); + bool test__summary_states(std::string &response); + bool test__summary(std::string &response); + bool test__report(std::string &response, + const std::string & state = "all" /* initialized|in-progress|failed|success|[all]|none */, bool enable = true); + bool test__report_hex(std::string &response, bool enable = true); + bool test__dump_stdout(std::string &response, bool enable = true); }; #endif