2e348078a729ce1a5548edc158d7458f66c676db
[demo.git] / vnfs / VES5.0 / evel / evel-library / code / evel_demo / evel_test_control.h
1 #ifndef EVEL_TEST_CONTROL
2 #define EVEL_TEST_CONTROL
3 /**************************************************************************//**
4  * @file
5  * Utility to post test control commands to the test_collector testControl API.
6  *
7  * This software is a test capability, allowing test cases to trigger
8  * expected throttling behaviours at the test collector, for automated test
9  * capabilty.
10  *
11  * License
12  * -------
13  *
14  * Copyright(c) <2016>, AT&T Intellectual Property.  All other rights reserved.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions are met:
18  *
19  * 1. Redistributions of source code must retain the above copyright notice,
20  * this list of conditions and the following disclaimer.
21  * 2. Redistributions in binary form must reproduce the above copyright notice,
22  * this list of conditions and the following disclaimer in the documentation
23  * and/or other materials provided with the distribution.
24  * 3. All advertising materials mentioning features or use of this software
25  * must display the following acknowledgement:  This product includes software
26  * developed by the AT&T.
27  * 4. Neither the name of AT&T nor the names of its contributors may be used to
28  * endorse or promote products derived from this software without specific
29  * prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY AT&T INTELLECTUAL PROPERTY ''AS IS'' AND ANY
32  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34  * DISCLAIMED. IN NO EVENT SHALL AT&T INTELLECTUAL PROPERTY BE LIABLE FOR ANY
35  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
40  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  *****************************************************************************/
42
43 /**************************************************************************//**
44  * POST provide JSON to the test_collector testControl API.
45  *
46  * This function does not take ownership of the json_buffer passed in.
47  *
48  * @param json_buffer   Pointer to the JSON to POST
49  * @param json_size     The number of bytes to POST
50  * @param secure        Whether to use HTTPS (0=HTTP, 1=HTTPS)
51  * @param fqdn          The test control API FQDN or IP address.
52  * @param port          The test control API port.
53  *****************************************************************************/
54 void evel_test_control(char * const json_buffer,
55                        const int json_size,
56                        const int secure,
57                        const char * fqdn,
58                        const int port);
59
60 typedef enum {
61   TC_RESET_ALL_DOMAINS,
62   TC_FAULT_SUPPRESS_FIELDS,
63   TC_FAULT_SUPPRESS_FIELDS_AND_PAIRS,
64   TC_FAULT_SUPPRESS_NOTHING,
65   TC_FAULT_SUPPRESS_PAIRS,
66   TC_MEAS_SUPPRESS_FIELDS_AND_PAIRS,
67   TC_MOBILE_SUPPRESS_FIELDS_AND_PAIRS,
68   TC_SIGNALING_SUPPRESS_FIELDS,
69   TC_SERVICE_SUPPRESS_FIELDS_AND_PAIRS,
70   TC_STATE_SUPPRESS_FIELDS_AND_PAIRS,
71   TC_SYSLOG_SUPPRESS_FIELDS_AND_PAIRS,
72   TC_PROVIDE_THROTTLING_SPEC
73 } EVEL_TEST_CONTROL_SCENARIO;
74
75 /**************************************************************************//**
76  * POST a pre-set test scenario to the test_collector testControl API.
77  *
78  * This function provides various pre-configured scenarios, purely to avoid
79  * duplicating them elsewhere.
80  *
81  * @param scenario      The scenario to POST.
82  * @param secure        Whether to use HTTPS (0=HTTP, 1=HTTPS)
83  * @param fqdn          The test control API FQDN or IP address.
84  * @param port          The test control API port.
85  *****************************************************************************/
86 void evel_test_control_scenario(const EVEL_TEST_CONTROL_SCENARIO scenario,
87                                 const int secure,
88                                 const char * fqdn,
89                                 const int port);
90
91 /**************************************************************************//**
92  * POST a measurement interval change to the test_collector testControl API.
93  *
94  * @param interval      The measurement interval.
95  * @param secure        Whether to use HTTPS (0=HTTP, 1=HTTPS)
96  * @param fqdn          The test control API FQDN or IP address.
97  * @param port          The test control API port.
98  *****************************************************************************/
99 void evel_test_control_meas_interval(const int interval,
100                                      const int secure,
101                                      const char * fqdn,
102                                      const int port);
103
104 #endif