Merge "Updated test of info-types"
[nonrtric.git] / test / common / README.md
1 # Introduction #
2 This dir contains most scripts needed for the auto-test environment. There are scripts with functions to adapt to the apis of the components of the Non-RT RIC; Policy Agent, A1 Controller and Ric (A1) simulator. The test environment supports both test with docker and kubernetes(still experimental)
3 Some of the scripts can also be used for other kinds of tests, for example basic tests.
4
5 ## Overview for common test scripts and files ##
6
7 `agent_api_functions.sh` \
8 Contains functions for adapting towards the Policy Management Service (PMS) API, also via dmaap (using a message-router stub interface)
9
10 `api_curl.sh` \
11 A common curl based function for the agent and ecs apis. Also partly used for the Callback receiver and RAPP Catalogue apis.
12
13 `clean-kube.sh` \
14 Cleans all services, deployments, pods, replica set etc started by the test environment in kubernetes.
15
16 `compare_json.py` \
17 A python script to compare two json obects for equality. Note that the comparsion always sort json-arrays before comparing (that is, it does not care about the order of items within the array). In addition, the target json object may specify individual parameter values where equality is 'dont care'.
18
19 `consul_cbs_function.sh` \
20 Contains functions for managing Consul and CBS as well as create the configuration for the PMS.
21
22 `control_panel_api_function.sh` \
23 Contains functions for managing Control Panel.
24
25 `controller_api_functions.sh` \
26 Contains functions for adaping towards the A1-controller API.
27
28 `count_json_elements.py` \
29 A python script returning the number of items in a json array.
30
31 `cr_api_functions.sh` \
32 Contains functions for adapting towards the Callback receiver for checking received callback event.
33
34 `create_policies_process.py` \
35 A python script to create a batch of policies. The script is intended to run in a number of processes to create policies in parallel.
36
37 `create_rics_json.py` \
38 A python script to create a json file from a formatted string of ric info. Helper for the test enviroment.
39
40 `delete_policies_process.py` \
41 A python script to delete a batch of policies. The script is intended to run in a number of processes to delete policies in parallel.
42
43 `do_curl_function.sh`
44 A script for executing a curl call with a specific url and optional payload. It also compare the response with an expected result in terms of response code and optional returned payload. Intended to be used by test script (for example basic test scripts of other components)
45
46 `ecs_api_functions.sh` \
47 Contains functions for adapting towards the ECS API
48
49 `extract_sdnc_reply.py` \
50 A python script to extract the information from an sdnc (A1 Controller) reply json. Helper for the test environment.
51
52 `gateway_api_functions.sh` \
53 Contains functions for managing the Non-RT RIC Gateway
54
55 `http_proxy_api_functions.sh` \
56 Contains functions for managing the Http Proxy
57
58 `kube_proxy_api_functions.sh` \
59 Contains functions for managing the Kube Proxy - to gain access to all services pod inside a kube cluster.
60
61 `mr_api_functions.sh` \
62 Contains functions for managing the MR Stub and the Dmaap Message Router
63
64 `prodstub_api_functions.sh` \
65 Contains functions for adapting towards the Producer stub interface - simulates a producer.
66
67 `rapp_catalogue_api_functions.sh` \
68 Contains functions for adapting towards the RAPP Catalogue.
69
70 `ricsimulator_api_functions.sh` \
71 Contains functions for adapting towards the RIC (A1) simulator admin API.
72
73 `test_env*.sh` \
74 Common env variables for test in the auto-test dir. All configuration of port numbers, image names and version etc shall be made in this file.
75 Used by the auto test scripts/suites but could be used for other test script as well. The test cases shall be started with the file for the intended target using command line argument '--env-file'.
76
77 `testcase_common.sh` \
78 Common functions for auto test cases in the auto-test dir. This script is the foundation of test auto environment which sets up images and enviroment variables needed by this script as well as the script adapting to the APIs.
79 The included functions are described in detail further below.
80
81 `testsuite_common.sh` \
82 Common functions for running two or more auto test scripts as a suite.
83
84 ## Integration of a new applicaton
85
86 Integration a new application to the test environment involves the following steps.
87
88 * Choose a short name for the application. Should be a uppcase name. For example, the NonRTRIC Gateway has NGW as short name.
89 This short name shall be added to the testengine_config.sh. See that file for detailed instructions.
90
91 * Create a file in this directory using the pattern `<application-name>_api_functions.sh`.
92 This file must implement the following functions used by the test engine. Note that functions must include the application short name in the function name. If the application does not run in kubernetes, then the last three functions in the list can be omitted.
93
94 | Function |
95 |--|
96 | __<app-short_name>_imagesetup |
97 | __<app-short_name>_imagepull |
98 | __<app-short_name>_imagebuild |
99 | __<app-short_name>_image_data |
100 | __<app-short_name>_kube_scale_zero |
101 | __<app-short_name>_kube_scale_zero_and_wait |
102 | __<app-short_name>_kube_delete_all |
103
104 In addition, all other functions used for testing of the application shall also be added to the file. For example functions to start the application, setting interface parameters as well as functions to send rest call towards the api of the application and validating the result.
105
106 * Add the application variables to api_curl.sh. This file contains a generic function to make rest calls to an api. It also supports switching betweeen direct rest calls or rest calls via messsage router.
107
108 * Create a directory beneath in the simulator-group dir. This new directory shall contain docker-compose files, config files (with or without variable substitutions) and kubernetes resource files.
109
110 All docker-compose files and all kubernetes resource files need to defined special lables. These lables are used by the test enginge to identify containers and resources started and used by the test engine.
111
112 | Label for docker compose | Description |
113 |--|--|
114 | nrttest_app | shall contain the application short name |
115 | nrttest_dp  | shall be set by a variable containing the display name, a short textual description of the applicaion |
116
117 | Label for kubernetes resource | Description |
118 |--|--|
119 | autotest | shall contain the application short name |
120
121 * Add mandatory image(s) and image tag(s) to the appropriate environment files for each release in the file(s) `test_env_<system>-<release-name>`.
122 In addition, all other needed environment shall also be defined in these file.
123
124
125 # Description of functions in testcase_common.sh #
126
127 ## Script args ##
128 The script can be started with these arguments
129
130 | arg list |
131 |--|
132 | `remote|remote-remove docker|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+] [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--image-repo <repo-address] [--repo-policy local|remote] [--cluster-timeout <timeout-in seconds>]` |
133
134 | parameter | description |
135 |-|-|
136 | `remote` | Use images from remote repositories. Can be overridden for individual images using the '--use_xxx' flags |
137 | `remote-remove` | Same as 'remote' but will also try to pull fresh images from remote repositories |
138 | `docker` | Use docker environment for test |
139 | `kuber` | Use kubernetes environment for test. Requires a kubernetes minikube installation |
140 | `--env-file` | The script will use the supplied file to read environment variables from |
141 | `release` | If this flag is given the script will use release version of the images |
142 | `auto-clean` | If the function 'auto_clean_containers' is present in the end of the test script then all containers will be stopped and removed. If 'auto-clean' is not given then the function has no effect |
143 | `--stop-at-error` | The script will stop when the first failed test or configuration |
144 | `--ricsim-prefix <prefix>` | The a1 simulator will use the supplied string as container prefix instead of 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
145 | `--use-local-image` | The script will use local images for the supplied apps, space separated list of app short names |
146 | `--use-snapshot-image` | The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names |
147 | `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names |
148 | `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names |
149 | `--image-repo` |  Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo |
150 | `-repo-policy ` |  Policy controlling which images to re-tag and push to image repo in param --image-repo. Can be set to 'local' (push on locally built images) or 'remote' (push locally built images and images from nexus repo). Default is 'local' |
151 | `--cluster-timeout` |  Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds |
152 | `help` | Print this info along with the test script description and the list of app short names supported |
153
154 ## Function: setup_testenvironment
155 Main function to setup the test environment before any tests are started.
156 Must be called right after sourcing all component scripts.
157 | arg list |
158 |--|
159 | None |
160
161 ## Function: indent1 ##
162 Indent every line of a command output with one space char.
163 | arg list |
164 |--|
165 | None |
166
167 ## Function: indent2 ##
168 Indent every line of a command output with two space chars.
169 | arg list |
170 |--|
171 | None |
172
173 ## Function: print_result ##
174 Print a test report of an auto-test script.
175 | arg list |
176 |--|
177 | None |
178
179 ## Function: start_timer ##
180 Start a timer for time measurement. Only one timer can be running.
181 | arg list |
182 |--|
183 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
184
185 ## Function: print_timer ##
186 Print the value of the timer (in seconds) previously started by 'start_timer'. (Note that timer is still running after this function). The result of the timer as well as the args to the function will also be printed in the test report.
187 | arg list |
188 |--|
189 | `<timer-message-to-print>` |
190
191 | parameter | description |
192 | --------- | ----------- |
193 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
194
195 ## Function: print_and_reset_timer ##
196 Print the value of the timer (in seconds) previously started by 'start_timer'. Also reset the timer to 0. The result of the timer as well as the args to the function will also be printed in the test report.
197 | arg list |
198 |--|
199 | `<timer-message-to-print>` |
200
201 | parameter | description |
202 | --------- | ----------- |
203 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
204
205 ## Function: deviation ##
206 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
207 | arg list |
208 |--|
209 | `<deviation-message-to-print>` |
210
211 | parameter | description |
212 | --------- | ----------- |
213 | `<deviation-message-to-print>` | Any text message describing the deviation. The text will also be printed in the test report. The intention is to mark known deviations, compared to required functionality |
214
215 ## Function: clean_environment ##
216 Stop and remove all containers (docker) or resources (kubernetes). Containers not part of the test are not affected (docker only). Removes all resources started by previous kube tests (kube only).
217 | arg list |
218 |--|
219 | None |
220
221 ## Function: auto_clean_containers ##
222 Same function as 'clean_environment'. This function has effect only if the test script is started with arg `auto-clean`. This intention is to use this function as the last step in an auto-test script.
223 | arg list |
224 |--|
225 | None |
226
227 ## Function: sleep_wait ##
228 Make the script sleep for a number of seconds.
229 | arg list |
230 |--|
231 | `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
232
233 | parameter | description |
234 | --------- | ----------- |
235 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
236 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
237
238 ## Function: check_control_panel_logs ##
239 Check the Control Panel log for any warnings and errors and print the count of each.
240 | arg list |
241 |--|
242 | None |
243
244 ## Function: store_logs ##
245 Take a snap-shot of all logs for all running containers and stores them in `./logs/<ATC-id>`. All logs will get the specified prefix in the file name. In general, one of the last steps in an auto-test script shall be to call this function. If logs shall be taken several times during a test script, different prefixes shall be used each time.
246 | arg list |
247 |--|
248 | `<logfile-prefix>` |
249
250 | parameter | description |
251 | --------- | ----------- |
252 | `<logfile-prefix>` | Log file prefix  |
253
254
255 # Description of functions in testsuite_common.sh #
256
257 ## Function: suite_setup ##
258 Sets up the test suite and prints out a heading.
259 | arg list |
260 |--|
261 | None |
262
263 ## suite_complete ##
264 Print out the overall result of the executed test cases.
265 | arg list |
266 |--|
267 | None |
268
269 # Description of functions in agent_api_functions.sh #
270
271 ## General ##
272 Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
273 For api function in version 2, an url prefix is added if configured.
274
275 ## Function: use_agent_rest_http ##
276 Use http for all API calls to the Policy Agent. This is the default.
277 | arg list |
278 |--|
279 | None |
280
281 ## Function: use_agent_rest_https ##
282 Use https for all API calls to the Policy Agent.
283 | arg list |
284 |--|
285 | None |
286
287 ## Function: use_agent_dmaap_http ##
288 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
289 | arg list |
290 |--|
291 | None |
292
293 ## Function: use_agent_dmaap_https ##
294 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
295 | arg list |
296 |--|
297 | None |
298
299 ## Function: start_policy_agent ##
300 Start the Policy Agent container or corresponding kube resources depending on docker/kube mode.
301 | arg list |
302 | `<logfile-prefix>` |
303 | (docker) `PROXY|NOPROXY <config-file>` |
304 | (kube) `PROXY|NOPROXY <config-file> [ <data-file> ]` |
305 | parameter | description |
306 | --------- | ----------- |
307 | `PROXY` | Configure with http proxy, if proxy is started  |
308 | `NOPROXY` | Configure without http proxy  |
309 | <config-file>` | Path to application.yaml  |
310 |  <data-file>` | Optional path to application_configuration.json  |
311
312 ## Function: agent_load_config ##
313 Load the config into a config map (kubernetes only).
314 | arg list |
315 |  <data-file> ]` |
316 | parameter | description |
317 | --------- | ----------- |
318 |  <data-file>` | Path to application_configuration.json  |
319
320 ## Function: set_agent_debug ##
321 Configure the Policy Agent log on debug level. The Policy Agent must be running.
322 | arg list |
323 |--|
324 | None |
325
326 ## Function: set_agent_trace ##
327 Configure the Policy Agent log on trace level. The Policy Agent must be running.
328 | arg list |
329 |--|
330 | None |
331
332 ## Function: use_agent_retries ##
333 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
334 | arg list |
335 |--|
336 | `[<response-code>]*` |
337
338
339 ## Function: check_policy_agent_logs ##
340 Check the Policy Agent log for any warnings and errors and print the count of each.
341 | arg list |
342 |--|
343 | None |
344
345 ## Function: api_equal() ##
346
347 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
348 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
349 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the array length becomes equal to the target value or not.
350 See the 'cr' dir for more details.
351
352 | arg list |
353 |--|
354 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
355
356 | parameter | description |
357 | --------- | ----------- |
358 | `<variable-name>` | Relative url. Example 'json:policy_types' - checks the json array length of the url /policy_types  |
359 | `<target-value>` | Target value for the length  |
360 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value  |
361
362 ## Function: api_get_policies() ##
363 Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
364 To test the response code only, provide the response code parameter as well as the following three parameters.
365 To also test the response payload add the 'NOID' for an expected empty array or repeat the last five/seven parameters for each expected policy.
366
367 | arg list |
368 |--|
369 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]` |
370
371 | arg list V2 |
372 |--|
373 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]` |
374
375 | parameter | description |
376 | --------- | ----------- |
377 | `<response-code>` | Expected http response code |
378 | `<ric-id>` | Id of the ric  |
379 | `NORIC` | Indicator that no ric is provided  |
380 | `<service-id>` | Id of the service  |
381 | `NOSERVICE` | Indicator that no service id is provided  |
382 | `<policy-type-id>` |  Id of the policy type |
383 | `NOTYPE` | Indicator that no type id is provided  |
384 | `NOID` |  Indicator that no policy id is provided - indicate empty list of policies|
385 | `<policy-id>` |  Id of the policy |
386 | `EMPTY` |  Indicate for the special empty policy type |
387 | `transient` |  Transient, true or false |
388 | `notification-url` |  Url for notifications |
389 | `<template-file>` |  Path to the template file for the policy (same template used when creating the policy) |
390
391
392 ## Function: api_get_policy() ##
393 Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
394 To test the the response code only, provide the expected response code and policy id.
395 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
396
397 | arg list |
398 |--|
399 | `<response-code>  <policy-id> [<template-file>]` |
400
401 | arg list V2|
402 |--|
403 | `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
404
405 | parameter | description |
406 | --------- | ----------- |
407 | `<response-code>` | Expected http response code |
408 | `<policy-id>` |  Id of the policy |
409 | `<template-file>` |  Path to the template file for the policy (same template used when creating the policy) |
410 | `<service-id>` | Id of the service  |
411 | `<ric-id>` | Id of the ric  |
412 | `<policy-type-id>` |  Id of the policy type |
413 | `NOTYPE` | Indicator that no type id is provided  |
414 | `transient` |  Transient, true or false |
415 | `notification-url` |  Url for notifications |
416
417 ## Function: api_put_policy() ##
418 Test of PUT '/policy' or V2 PUT '/policies'.
419 If more than one policy shall be created, add a count value to indicate the number of policies to create. Note that if more than one policy shall be created the provided policy-id must be numerical (will be used as the starting id).
420
421 | arg list |
422 |--|
423 | `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
424
425 | arg list V2 |
426 |--|
427 | `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
428
429 | parameter | description |
430 | --------- | ----------- |
431 | `<response-code>` | Expected http response code |
432 | `<service-id>` | Id of the service  |
433 | `<ric-id>` | Id of the ric  |
434 | `<policy-type-id>` |  Id of the policy type |
435 | `<policy-id>` |  Id of the policy. This value shall be a numeric value if more than one policy shall be created |
436 | `transient>` |  Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
437 | `notification-url` |  Url for notifications |
438 |`NOURL`| Indicator for no url |
439 | `<template-file>` |  Path to the template file for the policy |
440 | `<count>` |  An optional count (default is 1). If a value greater than 1 is given, the policy ids will use the given policy id as the first id and add 1 to that id for each new policy |
441
442 ## Function: api_put_policy_batch() ##
443 This tests the same as function 'api_put_policy' except that all put requests are sent to dmaap in one go and then the responses are polled one by one.
444 If the agent api is not configured to use dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
445 For arg list and parameters, see 'api_put_policy'.
446
447 ## Function: api_put_policy_parallel() ##
448 This tests the same as function 'api_put_policy' except that the policy create is spread out over a number of processes and it only uses the agent rest API. The total number of policies created is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the creation of all the policies in one ric.
449
450 | arg list |
451 |--|
452 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
453
454 | arg list |
455 |--|
456 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>`
457
458 | parameter | description |
459 | --------- | ----------- |
460 | `<response-code>` | Expected http response code |
461 | `<service-id>` | Id of the service  |
462 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing  |
463 | `<number-of-rics>` | The number of rics, assuming the first index is '1'. The index is added to the 'ric-id-base' id  |
464 | `<policy-type-id>` |  Id of the policy type |
465 | `<policy-start-id>` |  Id of the policy. This value shall be a numeric value and will be the id of the first policy |
466 | `transient>` |  Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
467 | `notification-url` |  Url for notifications |
468 | `<template-file>` |  Path to the template file for the policy |
469 | `<count-per-ric>` |  Number of policies per ric |
470 | `<number-of-threads>` |  Number of threads (processes) to run in parallel |
471
472 ## Function: api_delete_policy() ##
473 This tests the DELETE '/policy' or V2 DELETE '/v2/policies/{policy_id}'. Removes the indicated policy or a 'count' number of policies starting with 'policy-id' as the first id.
474
475 | arg list |
476 |--|
477 | `<response-code> <policy-id> [<count>]`
478
479 | parameter | description |
480 | --------- | ----------- |
481 | `<response-code>` | Expected http response code |
482 | `<policy-id>` |  Id of the policy |
483 | `<count>` |  An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
484
485 ## Function: api_delete_policy_batch() ##
486 This tests the same as function 'api_delete_policy' except that all delete requests are sent to dmaap in one go and then the responses are polled one by one.
487 If the agent api is not configured to used dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
488 For arg list and parameters, see 'api_delete_policy'.
489
490 ## Function: api_delete_policy_parallel() ##
491 This tests the same as function 'api_delete_policy' except that the policy delete is spread out over a number of processes and it only uses the agent rest API. The total number of policies deleted is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the deletion of all the policies in one ric.
492
493 | arg list |
494 |--|
495 | `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
496
497 | parameter | description |
498 | --------- | ----------- |
499 | `<response-code>` | Expected http response code |
500 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing  |
501 | `<number-of-rics>` | The number of rics, assuming the first index is '1'  |
502 | `<policy-start-id>` |  Id of the policy. This value shall be a numeric value and will be the id of the first policy |
503 | `<count-per-ric>` |  Number of policies per ric |
504 | `<number-of-threads>` |  Number of threads (processes) to run in parallel |
505
506
507 ## Function: api_get_policy_ids() ##
508
509 Test of GET '/policy_ids' or V2 GET '/v2/policies'.
510 To test response code only, provide the response code parameter as well as the following three parameters.
511 To also test the response payload add the 'NOID' for an expected empty array or repeat the 'policy-instance-id' for each expected policy id.
512
513 | arg list |
514 |--|
515 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
516
517 | parameter | description |
518 | --------- | ----------- |
519 | `<response-code>` | Expected http response code |
520 | `<ric-id>` | Id of the ric  |
521 | `NORIC` | Indicator that no ric is provided  |
522 | `<service-id>` | Id of the service  |
523 | `NOSERVICE` | Indicator that no service id is provided  |
524 | `type-id>` |  Id of the policy type |
525 | `NOTYPE` | Indicator that no type id is provided  |
526 | `NOID` |  Indicator that no policy id is provided - indicate empty list of policies|
527 | `<policy-instance-id>` |  Id of the policy |
528
529 ## Function: api_get_policy_schema() ##
530 Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
531 To test the response code only, provide the expected response code and policy type id.
532 To test the contents of the returned json schema, add a path to a schema file to compare with.
533
534 | arg list |
535 |--|
536 | `<response-code> <policy-type-id> [<schema-file>]` |
537
538 | parameter | description |
539 | --------- | ----------- |
540 | `<response-code>` | Expected http response code |
541 | `<policy-type-id>` |  Id of the policy type |
542 | `<schema-file>` |  Path to the schema file for the policy type |
543
544 ## Function: api_get_policy_schema() ##
545 Test of GET '/policy_schema' and optional check of the returned json schema.
546 To test the response code only, provide the expected response code and policy type id.
547 To test the contents of the returned json schema, add a path to a schema file to compare with.
548
549 | arg list |
550 |--|
551 | `<response-code> <policy-type-id> [<schema-file>]` |
552
553 | parameter | description |
554 | --------- | ----------- |
555 | `<response-code>` | Expected http response code |
556 | `<policy-type-id>` |  Id of the policy type |
557 | `<schema-file>` |  Path to the schema file for the policy type |
558
559 ## Function: api_get_policy_schemas() ##
560 Test of GET '/policy_schemas' and optional check of the returned json schemas.
561 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
562 To test the contents of the returned json schema, add a path to a schema file to compare with (or NOFILE to represent an empty '{}' type)
563
564 | arg list |
565 |--|
566 | `<response-code>  <ric-id>|NORIC [<schema-file>|NOFILE]*` |
567
568 | parameter | description |
569 | --------- | ----------- |
570 | `<response-code>` | Expected http response code |
571 | `<ric-id>` |  Id of the ric |
572 | `NORIC` |  No ric id given |
573 | `<schema-file>` |  Path to the schema file for the policy type |
574 | `NOFILE` |  Indicate the template for an empty type |
575
576 ## Function: api_get_policy_status() ##
577 Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
578
579 | arg list |
580 |--|
581 | `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
582
583 | parameter | description |
584 | --------- | ----------- |
585 | `<response-code>` | Expected http response code |
586 | `<policy-id>` |  Id of the policy |
587 | `STD` |  Indicator of status of Standarized A1 |
588 | `STD2` |  Indicator of status of Standarized A1 version 2 |
589 | `<enforce-status>` |  Enforcement status |
590 | `<reason>` |  Optional reason |
591 | `EMPTY` |  Indicator of empty string status or reason |
592 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
593 | `<instance-status>` |  Instance status |
594 | `<has-been-deleted>` |  Deleted status, true or false |
595
596 ## Function: api_get_policy_types() ##
597 Test of GET '/policy_types' or  V2 GET '/v2/policy-types' and optional check of the returned ids.
598 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
599 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
600
601 | arg list |
602 |--|
603 | `<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]` |
604
605 | parameter | description |
606 | --------- | ----------- |
607 | `<response-code>` | Expected http response code |
608 | `<ric-id>` |  Id of the ric |
609 | `NORIC` |  No ric id given |
610 | `<policy-type-id>` |  Id of the policy type |
611 | `EMPTY` |  Indicate the empty type |
612
613 ## Function: api_get_status() ##
614 Test of GET /status or V2 GET /status
615
616 | arg list |
617 |--|
618 | `<response-code>` |
619
620 | parameter | description |
621 | --------- | ----------- |
622 | `<response-code>` | Expected http response code |
623
624 ## Function: api_get_ric() ##
625 Test of GET '/ric' or V2 GET '/v2/rics/ric'
626 To test the response code only, provide the expected response code and managed element id.
627 To test the returned ric id, provide the expected ric id.
628
629 | arg list |
630 |--|
631 | `<reponse-code> <managed-element-id> [<ric-id>]` |
632
633 | arg list V2 |
634 |--|
635 | `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
636
637 | parameter | description |
638 | --------- | ----------- |
639 | `<response-code>` | Expected http response code |
640 | `<managed-element-id>` |  Id of the managed element |
641 | `NOME` |  Indicator for no ME |
642 | `ric-id` |  Id of the ric |
643 | `NORIC` |  Indicator no RIC |
644 | `string-of-ricinfo` |  String of ric info |
645
646 ## Function: api_get_rics() ##
647 Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
648 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
649 To test also the returned payload, add the formatted string of info in the returned payload.
650 Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
651 Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
652
653 | arg list |
654 |--|
655 | `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
656
657 | parameter | description |
658 | --------- | ----------- |
659 | `<response-code>` | Expected http response code |
660 | `<policy-type-id>` |  Policy type id of the ric |
661 | `NOTYPE>` |  No type given |
662 | `<space-separate-string-of-ricinfo>` |  A space separated string of ric info - needs to be quoted |
663
664 ## Function: api_put_service() ##
665 Test of PUT '/service' or V2 PUT '/service'.
666 | arg list |
667 |--|
668 | `<response-code>  <service-name> <keepalive-timeout> <callbackurl>` |
669
670 | parameter | description |
671 | --------- | ----------- |
672 | `<response-code>` | Expected http response code |
673 | `<service-name>` |  Service name |
674 | `<keepalive-timeout>` |  Timeout value |
675 | `<callbackurl>` |  Callback url |
676
677 ## Function: api_get_services() ##
678 Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
679 To test only the response code, omit all parameters except the expected response code.
680 To test the returned json, provide the parameters after the response code.
681
682 | arg list |
683 |--|
684 | `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
685
686 | parameter | description |
687 | --------- | ----------- |
688 | `<response-code>` | Expected http response code |
689 | <query-service-name>` |  Service name for the query |
690 | <target-service-name>` |  Target service name|
691 | `<keepalive-timeout>` |  Timeout value |
692 | `<callbackurl>` |  Callback url |
693 | `NOSERVICE` |  Indicator of no target service name |
694
695 ## Function: api_get_service_ids() ##
696 Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
697
698 | arg list |
699 |--|
700 | `<response-code> [<service-name>]*` |
701
702 | parameter | description |
703 | --------- | ----------- |
704 | `<response-code>` | Expected http response code |
705 | `<service-name>` |  Service name |
706
707 ## Function: api_delete_services() ##
708 Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
709
710 | arg list |
711 |--|
712 | `<response-code> [<service-name>]*` |
713
714 | parameter | description |
715 | --------- | ----------- |
716 | `<response-code>` | Expected http response code |
717 | `<service-name>` |  Service name |
718
719 ## Function: api_put_services_keepalive() ##
720 Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
721
722 | arg list |
723 |--|
724 | <response-code> <service-name>` |
725
726 | parameter | description |
727 | --------- | ----------- |
728 | `<response-code>` | Expected http response code |
729 | `<service-name>` |  Service name |
730
731 ## Function: api_put_configuration() ##
732 Test of PUT '/v2/configuration'
733
734 | arg list |
735 |--|
736 | <response-code> <config-file>` |
737
738 | parameter | description |
739 | --------- | ----------- |
740 | `<response-code>` | Expected http response code |
741 | `<config-file>` |  Path json config file |
742
743 ## Function: api_get_configuration() ##
744 Test of GET '/v2/configuration'
745
746 | arg list |
747 |--|
748 | <response-code> [<config-file>]` |
749
750 | parameter | description |
751 | --------- | ----------- |
752 | `<response-code>` | Expected http response code |
753 | `<config-file>` |  Path json config file to compare the retrieved config with |
754 | parameter | description |
755 | --------- | ----------- |
756 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'.  |
757
758
759 # Description of functions in consul_cbs_function.sh #
760
761
762 ## Function: consul_config_app ##
763 Function to load a json config from a file into consul for the Policy Agent
764
765 | arg list |
766 |--|
767 | `<json-config-file>` |
768
769 | parameter | description |
770 | --------- | ----------- |
771 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
772
773 ## Function: prepare_consul_config ##
774 Function to prepare a Consul config based on the previously configured (and started simulators). Note that all simulator must be running and the test script has to configure if http or https shall be used for the components (this is done by the functions 'use_simulator_http', 'use_simulator_https', 'use_sdnc_http', 'use_sdnc_https', 'use_mr_http', 'use_mr_https')
775 | arg list |
776 |--|
777 | `<deviation-message-to-print>` |
778
779 | parameter | description |
780 | --------- | ----------- |
781 | `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
782 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app'  |
783
784 ## Function: start_consul_cbs ##
785 Start the Consul and CBS containers
786 | arg list |
787 |--|
788 | None |
789
790 # Description of functions in control_panel_api_function.sh #
791
792 ## Function: use_control_panel_http ##
793 Set http as the protocol to use for all communication to the Control Panel
794 | arg list |
795 |--|
796 | None |
797
798 ## Function: use_control_panel_https ##
799 Set https as the protocol to use for all communication to the Control Panel
800 | arg list |
801 |--|
802 | None |
803
804 ## Function: start_control_panel ##
805 Start the Control Panel container
806 | arg list |
807 |--|
808 | None |
809
810 # Description of functions in controller_api_functions.sh #
811 The file contains a selection of the possible API tests towards the a1-controller
812
813 ## Function: use_sdnc_http ##
814 Use http for all API calls towards the SDNC A1 Controller. This is the default. Note that this function shall be called before preparing the config for Consul.
815 | arg list |
816 |--|
817 | None |
818
819 ## Function: use_sdnc_http ##
820 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
821 | arg list |
822 |--|
823 | None |
824
825 ## Function: start_sdnc ##
826 Start the SDNC A1 Controller container and its database container
827 | arg list |
828 |--|
829 | None |
830
831 ## Function: check_sdnc_logs ##
832 Check the SDNC log for any warnings and errors and print the count of each.
833 | arg list |
834 |--|
835 | None |
836
837 ## Function: controller_api_get_A1_policy_ids ##
838 Test of GET policy ids towards OSC or STD type simulator.
839 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
840 To test the response payload, include the ids of the expexted response.
841
842 | arg list |
843 |--|
844 | `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
845
846 | parameter | description |
847 | --------- | ----------- |
848 | `<response-code>` | Expected http response code |
849 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
850 | `<ric-id>` | Id of the ric  |
851 | `policy-type-id>` |  Id of the policy type |
852 | `<policy-id>` |  Id of the policy |
853 | `STD` |  Indicator of status of Standarized A1 |
854
855
856 ## Function: controller_api_get_A1_policy_type ##
857 Test of GET a policy type (OSC only)
858
859 | arg list |
860 |--|
861 | `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
862
863 | parameter | description |
864 | --------- | ----------- |
865 | `<response-code>` | Expected http response code |
866 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
867 | `<ric-id>` | Id of the ric  |
868 | `policy-type-id>` |  Id of the policy type |
869 | `policy-type-file>` |  Optional schema file to compare the returned type with |
870
871 ## Function: controller_api_delete_A1_policy ##
872 Deletes a policy instance
873
874 | arg list |
875 |--|
876 | `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
877
878 | parameter | description |
879 | --------- | ----------- |
880 | `<response-code>` | Expected http response code |
881 | `STD` |  Indicator of status of Standarized A1 |
882 | `<ric-id>` | Id of the ric  |
883 | `<policy-id>` |  Id of the policy |
884 | `policy-type-id>` |  Id of the policy type |
885 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
886 | `policy-type-file>` |  Optional schema file to compare the returned type with |
887
888 ## Function: controller_api_put_A1_policy ##
889 Creates a policy instance
890
891 | arg list |
892 |--|
893 | `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
894
895 | parameter | description |
896 | --------- | ----------- |
897 | `<response-code>` | Expected http response code |
898 | `STD` |  Indicator of status of Standarized A1 |
899 | `<ric-id>` | Id of the ric  |
900 | `<policy-id>` |  Id of the policy |
901 | `<template-file>` |  Path to the template file of the policy|
902 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
903 | `<policy-type-id>` |  Id of the policy type |
904
905 ## Function: controller_api_get_A1_policy_status ##
906 Checks the status of a policy
907
908  arg list |
909 |--|
910 | `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
911
912 | parameter | description |
913 | --------- | ----------- |
914 | `<response-code>` | Expected http response code |
915 | `STD` |  Indicator of status of Standarized A1 |
916 | `<ric-id>` | Id of the ric  |
917 | `<policy-id>` |  Id of the policy |
918 | `<enforce-status>` |  Enforcement status |
919 | `<reason>` |  Optional reason |
920 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
921 | `<policy-type-id>` |  Id of the policy type |
922 | `<instance-status>` |  Instance status |
923 | `<has-been-deleted>` |  Deleted status, true or false |
924
925
926 # Description of functions in cr_api_functions.sh #
927
928 ## Function: use_cr_http ##
929 Use http for getting event from CR.  The admin API is not affected. This is the default.
930 | arg list |
931 |--|
932 | None |
933
934 ## Function: use_cr_https ##
935 Use https for getting event from CR. The admin API is not affected.
936 Note: Not yet used as callback event is not fully implemented/deciced.
937 | arg list |
938 |--|
939 | None |
940
941 ## Function: start_cr ##
942 Start the Callback Receiver container in docker or kube depending on start mode.
943 | arg list |
944 |--|
945 | None |
946
947 ## Function: cr_equal ##
948 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
949 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
950 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
951 See the 'cr' dir for more details.
952 | arg list |
953 |--|
954 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
955
956 | parameter | description |
957 | --------- | ----------- |
958 | `<variable-name>` | Variable name in the CR  |
959 | `<target-value>` | Target value for the variable  |
960 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
961
962 ## Function: cr_api_check_all_sync_events() ##
963 Check the contents of all ric events received for a callback id.
964
965 | arg list |
966 |--|
967 | `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
968
969 | parameter | description |
970 | --------- | ----------- |
971 | `<response-code>` | Expected http response code |
972 | `<id>` | Id of the callback destination  |
973 | `EMPTY` | Indicator for an empty list  |
974 | `<ric-id>` | Id of the ric  |
975
976 # Description of functions in ecs_api_functions.sh #
977
978 ## Function: use_ecs_rest_http ##
979 Use http for all API calls to the ECS. This is the default protocol.
980 | arg list |
981 |--|
982 | None |
983
984 ## Function: use_ecs_rest_https ##
985 Use https for all API calls to the ECS.
986 | arg list |
987 |--|
988 | None |
989
990 ## Function: use_ecs_dmaap_http ##
991 Send and recieve all API calls to the ECS over Dmaap via the MR using http.
992 | arg list |
993 |--|
994 | None |
995
996 ## Function: use_ecs_dmaap_https ##
997 Send and recieve all API calls to the ECS over Dmaap via the MR using https.
998 | arg list |
999 |--|
1000 | None |
1001
1002 ## Function: start_ecs ##
1003 Start the ECS container in docker or kube depending on running mode.
1004 | arg list |
1005 |--|
1006 | None |
1007
1008 ## Function: stop_ecs ##
1009 Stop the ECS container.
1010 | arg list |
1011 |--|
1012 | None |
1013
1014 ## Function: start_stopped_ecs ##
1015 Start a previously stopped ecs.
1016 | arg list |
1017 |--|
1018 | None |
1019
1020 ## Function: set_ecs_debug ##
1021 Configure the ECS log on debug level. The ECS must be running.
1022 | arg list |
1023 |--|
1024 | None |
1025
1026 ## Function: set_ecs_trace ##
1027 Configure the ECS log on trace level. The ECS must be running.
1028 | arg list |
1029 |--|
1030 | None |
1031
1032 ## Function: check_ecs_logs ##
1033 Check the ECS log for any warnings and errors and print the count of each.
1034 | arg list |
1035 |--|
1036 | None |
1037
1038 ## Function: ecs_equal ##
1039 Tests if a variable value in the ECS is equal to a target value.
1040 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1041 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
1042 See the 'a1-interface' repo for more details.
1043
1044 | arg list |
1045 |--|
1046 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1047
1048 | parameter | description |
1049 | --------- | ----------- |
1050 | `<variable-name>` | Variable name in ecs  |
1051 | `<target-value>` | Target value for the variable  |
1052 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1053
1054 ## Function: ecs_api_a1_get_job_ids() ##
1055 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
1056 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1057 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1058
1059 | arg list |
1060 |--|
1061 | `<response-code> <type-id>  <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1062
1063 | parameter | description |
1064 | --------- | ----------- |
1065 | `<response-code>` | Expected http response code |
1066 | `<type-id>` | Id of the EI type  |
1067 | `<owner-id>` | Id of the job owner  |
1068 | `NOOWNER` | No owner is given  |
1069 | `<job-id>` | Id of the expected job  |
1070 | `EMPTY` | The expected list of job id shall be empty  |
1071
1072 ## Function: ecs_api_a1_get_type() ##
1073 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
1074 To test the response code only, provide the response code parameter as well as the type-id.
1075 To also test the response payload add a path to the expected schema file.
1076
1077 | arg list |
1078 |--|
1079 | `<response-code> <type-id> [<schema-file>]` |
1080
1081 | parameter | description |
1082 | --------- | ----------- |
1083 | `<response-code>` | Expected http response code |
1084 | `<type-id>` | Id of the EI type  |
1085 | `<schema-file>` | Path to a schema file to compare with the returned schema  |
1086
1087 ## Function: ecs_api_a1_get_type_ids() ##
1088 Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
1089 To test the response code only, provide the response only.
1090 To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
1091
1092 | arg list |
1093 |--|
1094 | `<response-code> [ (EMPTY | [<type-id>]+) ]` |
1095
1096 | parameter | description |
1097 | --------- | ----------- |
1098 | `<response-code>` | Expected http response code |
1099 | `EMPTY` | The expected list of type ids shall be empty  |
1100 | `<type-id>` | Id of the EI type  |
1101
1102 ## Function: ecs_api_a1_get_job_status() ##
1103 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
1104 To test the response code only, provide the response code, type id and job id.
1105 To also test the response payload add the expected status.
1106
1107 | arg list |
1108 |--|
1109 | `<response-code> <type-id> <job-id> [<status>]` |
1110
1111 | parameter | description |
1112 | --------- | ----------- |
1113 | `<response-code>` | Expected http response code |
1114 | `<type-id>` | Id of the EI type  |
1115 | `<job-id>` | Id of the job  |
1116 | `<status>` | Expected status  |
1117
1118 ## Function: ecs_api_a1_get_job() ##
1119 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
1120 To test the response code only, provide the response code, type id and job id.
1121 To also test the response payload add the remaining parameters.
1122
1123 | arg list |
1124 |--|
1125 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1126
1127 | parameter | description |
1128 | --------- | ----------- |
1129 | `<response-code>` | Expected http response code |
1130 | `<type-id>` | Id of the EI type  |
1131 | `<job-id>` | Id of the job  |
1132 | `<target-url>` | Expected target url for the job  |
1133 | `<owner-id>` | Expected owner for the job  |
1134 | `<template-job-file>` | Path to a job template for job parameters of the job  |
1135
1136 ## Function: ecs_api_a1_delete_job() ##
1137 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1138 To test, provide all the specified parameters.
1139
1140 | arg list |
1141 |--|
1142 | `<response-code> <type-id> <job-id> |
1143
1144 | parameter | description |
1145 | --------- | ----------- |
1146 | `<response-code>` | Expected http response code |
1147 | `<type-id>` | Id of the EI type  |
1148 | `<job-id>` | Id of the job  |
1149
1150 ## Function: ecs_api_a1_put_job() ##
1151 Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1152 To test, provide all the specified parameters.
1153
1154 | arg list |
1155 |--|
1156 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
1157
1158 | parameter | description |
1159 | --------- | ----------- |
1160 | `<response-code>` | Expected http response code |
1161 | `<type-id>` | Id of the EI type  |
1162 | `<job-id>` | Id of the job  |
1163 | `<target-url>` | Target url for the job  |
1164 | `<owner-id>` | Owner of the job  |
1165 | `<template-job-file>` | Path to a job template for job parameters of the job  |
1166
1167 ## Function: ecs_api_edp_get_type_ids() ##
1168 Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
1169 To test the response code only, provide the response code.
1170 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1171
1172 | arg list |
1173 |--|
1174 | `<response-code> [ EMPTY | <type-id>+]` |
1175
1176 | parameter | description |
1177 | --------- | ----------- |
1178 | `<response-code>` | Expected http response code |
1179 | `<type-id>` | Id of the EI type  |
1180 | `EMPTY` | The expected list of type ids shall be empty  |
1181
1182 ## Function: ecs_api_edp_get_producer_status() ##
1183 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
1184 To test the response code only, provide the response code and producer id.
1185 To also test the response payload add the expected status.
1186
1187 | arg list |
1188 |--|
1189 | `<response-code> <producer-id> [<status>]` |
1190
1191 | parameter | description |
1192 | --------- | ----------- |
1193 | `<response-code>` | Expected http response code |
1194 | `<producer-id>` | Id of the producer  |
1195 | `<status>` | The expected status string  |
1196
1197 ## Function: ecs_api_edp_get_producer_ids() ##
1198 Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
1199 To test the response code only, provide the response.
1200 To also test the response payload add the list of expected producer-ids (or EMPTY if the list of ids is expected to be empty).
1201
1202 | arg list |
1203 |--|
1204 | `<response-code> [ EMPTY | <producer-id>+]` |
1205
1206 | parameter | description |
1207 | --------- | ----------- |
1208 | `<response-code>` | Expected http response code |
1209 | `<producer-id>` | Id of the producer  |
1210 | `EMPTY` | The expected list of type ids shall be empty  |
1211
1212 ## Function: ecs_api_edp_get_type() ##
1213 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
1214 To test the response code only, provide the response and the type-id.
1215 To also test the response payload add a path to a job schema file and a list expected producer-id (or EMPTY if the list of ids is expected to be empty).
1216
1217 | arg list |
1218 |--|
1219 | `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
1220
1221 | parameter | description |
1222 | --------- | ----------- |
1223 | `<response-code>` | Expected http response code |
1224 | `<type-id>` | Id of the EI type  |
1225 | `<job-schema-file>` | Path to a job schema file  |
1226 | `<producer-id>` | Id of the producer  |
1227 | `EMPTY` | The expected list of type ids shall be empty  |
1228
1229 ## Function: ecs_api_edp_get_producer() ##
1230 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
1231 To test the response code only, provide the response and the producer-id.
1232 To also test the response payload add the remaining parameters defining thee producer.
1233
1234 | arg list |
1235 |--|
1236 | `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
1237
1238 | parameter | description |
1239 | --------- | ----------- |
1240 | `<response-code>` | Expected http response code |
1241 | `<producer-id>` | Id of the producer  |
1242 | `<create-callback>` | Callback for create job  |
1243 | `<delete-callback>` | Callback for delete job  |
1244 | `<supervision-callback>` | Callback for producer supervision  |
1245 | `<type-id>` | Id of the EI type  |
1246 | `<schema-file>` | Path to a schema file  |
1247 | `EMPTY` | The expected list of type schema pairs shall be empty  |
1248
1249 ## Function: ecs_api_edp_delete_producer() ##
1250 Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
1251 To test, provide all parameters.
1252
1253 | arg list |
1254 |--|
1255 | `<response-code> <producer-id>` |
1256
1257 | parameter | description |
1258 | --------- | ----------- |
1259 | `<response-code>` | Expected http response code |
1260 | `<producer-id>` | Id of the producer  |
1261
1262 ## Function: ecs_api_edp_put_producer() ##
1263 Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
1264 To test, provide all parameters. The list of type/schema pair may be empty.
1265
1266 | arg list |
1267 |--|
1268 | `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
1269
1270 | parameter | description |
1271 | --------- | ----------- |
1272 | `<response-code>` | Expected http response code |
1273 | `<producer-id>` | Id of the producer  |
1274 | `<job-callback>` | Callback for create/delete job  |
1275 | `<supervision-callback>` | Callback for producer supervision  |
1276 | `<type-id>` | Id of the EI type  |
1277 | `<schema-file>` | Path to a schema file  |
1278 | `EMPTY` | The list of type/schema pairs is empty  |
1279
1280 ## Function: ecs_api_edp_get_producer_jobs() ##
1281 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
1282 To test the response code only, provide the response and the producer-id.
1283 To also test the response payload add the remaining parameters.
1284
1285 | arg list |
1286 |--|
1287 | `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
1288
1289 | parameter | description |
1290 | --------- | ----------- |
1291 | `<response-code>` | Expected http response code |
1292 | `<producer-id>` | Id of the producer  |
1293 | `<job-id>` | Id of the job  |
1294 | `<type-id>` | Id of the EI type  |
1295 | `<target-url>` | Target url for data delivery  |
1296 | `<job-owner>` | Id of the job owner  |
1297 | `<template-job-file>` | Path to a job template file  |
1298 | `EMPTY` | The list of job/type/target/job-file tuples is empty  |
1299
1300 ## Function: ecs_api_service_status() ##
1301 Test of GET '/status'.
1302
1303 | arg list |
1304 |--|
1305 | `<response-code>` |
1306
1307 | parameter | description |
1308 | --------- | ----------- |
1309 | `<response-code>` | Expected http response code |
1310
1311 ## Function: ecs_api_idc_get_type_ids() ##
1312 Test of GET '/data-consumer/v1/info-types' and an optional check of the returned list of type ids.
1313 To test the response code only, provide the response code.
1314 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1315
1316 | arg list |
1317 |--|
1318 | `<response-code> [ EMPTY | <type-id>+]` |
1319
1320 | parameter | description |
1321 | --------- | ----------- |
1322 | `<response-code>` | Expected http response code |
1323 | `<type-id>` | Id of the Info type  |
1324 | `EMPTY` | The expected list of type ids shall be empty  |
1325
1326 ## Function: ecs_api_idc_get_job_ids() ##
1327 Test of GET '/data-consumer/v1/info-jobs' and optional check of the array of returned job ids.
1328 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1329 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1330
1331 | arg list |
1332 |--|
1333 | `<response-code> <type-id>  <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1334
1335 | parameter | description |
1336 | --------- | ----------- |
1337 | `<response-code>` | Expected http response code |
1338 | `<type-id>` | Id of the Info type  |
1339 | `<owner-id>` | Id of the job owner  |
1340 | `NOOWNER` | No owner is given  |
1341 | `<job-id>` | Id of the expected job  |
1342 | `EMPTY` | The expected list of job id shall be empty  |
1343
1344 ## Function: ecs_api_idc_get_job() ##
1345 Test of GET '/data-consumer/v1/info-jobs/{infoJobId}' and optional check of the returned job.
1346 To test the response code only, provide the response code, type id and job id.
1347 To also test the response payload add the remaining parameters.
1348
1349 | arg list |
1350 |--|
1351 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1352
1353 | parameter | description |
1354 | --------- | ----------- |
1355 | `<response-code>` | Expected http response code |
1356 | `<type-id>` | Id of the Info type  |
1357 | `<job-id>` | Id of the job  |
1358 | `<target-url>` | Expected target url for the job  |
1359 | `<owner-id>` | Expected owner for the job  |
1360 | `<template-job-file>` | Path to a job template for job parameters of the job  |
1361
1362 ## Function: ecs_api_idc_put_job() ##
1363 Test of PUT '​/data-consumer/v1/info-jobs/{infoJobId}'.
1364 To test, provide all the specified parameters.
1365
1366 | arg list |
1367 |--|
1368 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file> [VALIDATE]` |
1369
1370 | parameter | description |
1371 | --------- | ----------- |
1372 | `<response-code>` | Expected http response code |
1373 | `<type-id>` | Id of the Info type  |
1374 | `<job-id>` | Id of the job  |
1375 | `<target-url>` | Target url for the job  |
1376 | `<owner-id>` | Owner of the job  |
1377 | `<template-job-file>` | Path to a job template for job parameters of the job  |
1378 | `VALIIDATE` | Indicator to preform type validation at creation  |
1379
1380 ## Function: ecs_api_idc_delete_job() ##
1381 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1382 To test, provide all the specified parameters.
1383
1384 | arg list |
1385 |--|
1386 | `<response-code> <type-id> <job-id> |
1387
1388 | parameter | description |
1389 | --------- | ----------- |
1390 | `<response-code>` | Expected http response code |
1391 | `<type-id>` | Id of the EI type  |
1392 | `<job-id>` | Id of the job  |
1393
1394 ## Function: ecs_api_idc_get_type() ##
1395 Test of GET '/data-consumer/v1/info-types/{infoTypeId} and optional check of the returned schema.
1396 To test the response code only, provide the response code parameter as well as the type-id.
1397 To also test the response payload add a path to the expected schema file.
1398
1399 | arg list |
1400 |--|
1401 | `<response-code> <type-id> [<schema-file>]` |
1402
1403 | parameter | description |
1404 | --------- | ----------- |
1405 | `<response-code>` | Expected http response code |
1406 | `<type-id>` | Id of the Info type  |
1407 | `<schema-file>` | Path to a schema file to compare with the returned schema  |
1408
1409 ## Function: ecs_api_idc_get_job_status() ##
1410 Test of GET '/data-consumer/v1/info-jobs/{infoJobId}/status' and optional check of the returned status.
1411 To test the response code only, provide the response code, type id and job id.
1412 To also test the response payload add the expected status.
1413
1414 | arg list |
1415 |--|
1416 | `<response-code> <type-id> <job-id> [<status>]` |
1417
1418 | parameter | description |
1419 | --------- | ----------- |
1420 | `<response-code>` | Expected http response code |
1421 | `<type-id>` | Id of the Info type  |
1422 | `<job-id>` | Id of the job  |
1423 | `<status>` | Expected status  |
1424
1425
1426 ## Function: ecs_api_admin_reset() ##
1427 Test of GET '/status'.
1428
1429 | arg list |
1430 |--|
1431 | `<response-code> [ <type> ]` |
1432
1433 | parameter | description |
1434 | --------- | ----------- |
1435 | `<response-code>` | Expected http response code |
1436 | `<type>` | Type id, if the interface supports type in url |
1437
1438 # Description of functions in gateway_api_functions.sh #
1439
1440
1441 ## Function: use_gateway_http ##
1442 Use http for all calls to the gateway. This is set by default.
1443 | arg list |
1444 |--|
1445 | None |
1446
1447 ## Function: use_gateway_https ##
1448 Use https for all calls to the gateway.
1449 | arg list |
1450 |--|
1451 | None |
1452
1453 ## Function: set_gateway_debug ##
1454 Set debug level logging in the gateway
1455 | arg list |
1456 |--|
1457 | None |
1458
1459 ## Function: set_gateway_trace ##
1460 Set debug level logging in the trace
1461 | arg list |
1462 |--|
1463 | None |
1464
1465 ## Function: start_gateway ##
1466 Start the the gateway container in docker or kube depending on start mode
1467 | arg list |
1468 |--|
1469 | None |
1470
1471 ## Function: gateway_pms_get_status ##
1472 Sample test of pms api (status)
1473 | arg list |
1474 |--|
1475 | `<response-code> ` |
1476
1477 | parameter | description |
1478 | --------- | ----------- |
1479 | `<response-code>` | Expected http response code |
1480
1481 ## Function: gateway_ecs_get_types ##
1482 Sample test of ecs api (get ei type)
1483 Only response code tested - not payload
1484 | arg list |
1485 |--|
1486 | `<response-code> ` |
1487
1488 | parameter | description |
1489 | --------- | ----------- |
1490 | `<response-code>` | Expected http response code |
1491
1492 # Description of functions in http_proxy_api_functions.sh #
1493
1494 ## Function: use_http_proxy_http ##
1495 Use http for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1496 | arg list |
1497 |--|
1498 | None |
1499
1500 ## Function: use_http_proxy_https ##
1501 Use https for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1502 | arg list |
1503 |--|
1504 | None |
1505
1506 ## Function: start_http_proxy ##
1507 Start the http proxy container in docker or kube depending on running mode.
1508 | arg list |
1509 |--|
1510 | None |
1511
1512 # Description of functions in kube_proxy_api_functions.sh #
1513
1514 ## Function: use_kube_proxy_http ##
1515 Use http for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1516 | arg list |
1517 |--|
1518 | None |
1519
1520 ## Function: use_kube_proxy_https ##
1521 Use https for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1522 | arg list |
1523 |--|
1524 | None |
1525
1526 ## Function: start_kube_proxy ##
1527 Start the kube proxy container in kube. This proxy enabled the test env to access all services and pods in a kube cluster.
1528 No proxy is started if the function is called in docker mode.
1529 | arg list |
1530 |--|
1531 | None |
1532
1533 # Description of functions in mr_api_functions.sh #
1534
1535 ## Function: use_mr_http ##
1536 Use http for all Dmaap calls to the MR. This is the default. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
1537 | arg list |
1538 |--|
1539 | None |
1540
1541 ## Function: use_mr_https ##
1542 Use https for all Dmaap call to the MR. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
1543 | arg list |
1544 |--|
1545 | None |
1546
1547 ## Function: start_mr ##
1548 Start the Message Router stub interface container in docker or kube depending on start mode
1549 | arg list |
1550 |--|
1551 | None |
1552
1553
1554 ## Function: mr_equal ##
1555 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
1556 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1557 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
1558 See the 'mrstub' dir for more details.
1559 | arg list |
1560 |--|
1561 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1562
1563 | parameter | description |
1564 | --------- | ----------- |
1565 | `<variable-name>` | Variable name in the MR  |
1566 | `<target-value>` | Target value for the variable  |
1567 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1568
1569 ## Function: mr_greater ##
1570 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
1571 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
1572 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes greater than the target value or not.
1573 See the 'mrstub' dir for more details.
1574 | arg list |
1575 |--|
1576 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1577
1578 | parameter | description |
1579 | --------- | ----------- |
1580 | `<variable-name>` | Variable name in the MR  |
1581 | `<target-value>` | Target value for the variable  |
1582 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value  |
1583
1584 ## Function: mr_read ##
1585 Reads the value of a variable in the Message Router (MR) simulator. The value is intended to be passed to a env variable in the test script.
1586 See the 'mrstub' dir for more details.
1587 | arg list |
1588 |--|
1589 | `<variable-name>` |
1590
1591 | parameter | description |
1592 | --------- | ----------- |
1593 | `<variable-name>` | Variable name in the MR  |
1594
1595 ## Function: mr_print ##
1596 Prints the value of a variable in the Message Router (MR) simulator.
1597 See the 'mrstub' dir for more details.
1598 | arg list |
1599 |--|
1600 | `<variable-name>` |
1601
1602 | parameter | description |
1603 | --------- | ----------- |
1604 | `<variable-name>` | Variable name in the MR  |
1605
1606
1607 # Description of functions in prodstub_api_functions.sh #
1608
1609 ## Function: use_prod_stub_http ##
1610 Use http for the API.  The admin API is not affected. This is the default protocol.
1611 | arg list |
1612 |--|
1613 | None |
1614
1615 ## Function: use_prod_stub_https ##
1616 Use https for the API. The admin API is not affected.
1617 | arg list |
1618 |--|
1619 | None |
1620
1621 ## Function: start_prod_stub ##
1622 Start the Producer stub container in docker or kube depending on start mode
1623 | arg list |
1624 |--|
1625 | None |
1626
1627 ## Function: prodstub_arm_producer() ##
1628 Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
1629
1630 | arg list |
1631 |--|
1632 | `<response-code> <producer-id> [<forced_response_code>]` |
1633
1634 | parameter | description |
1635 | --------- | ----------- |
1636 | `<response-code>` | Expected http response code |
1637 | `<producer-id>` | Id of the producer  |
1638 | `<forced_response_code>` | Forced response code for the producer callback url |
1639
1640 ## Function: prodstub_arm_job_create() ##
1641 Preconfigure the prodstub with a job or update an existing job. Optional create/update job response code, if not given the response code will be set to 200/201 depending on if the job has been previously created or not.
1642
1643 | arg list |
1644 |--|
1645 | `<response-code> <job-id> [<forced_response_code>]` |
1646
1647 | parameter | description |
1648 | --------- | ----------- |
1649 | `<response-code>` | Expected http response code |
1650 | `<job-id>` | Id of the job  |
1651 | `<forced_response_code>` | Forced response code for the create callback url |
1652
1653 ## Function: prodstub_arm_job_delete() ##
1654 Preconfigure the prodstub with a job. Optional delete job response code, if not given the response code will be set to 204/404 depending on if the job exists or not.
1655
1656 | arg list |
1657 |--|
1658 | `<response-code> <job-id> [<forced_response_code>]` |
1659
1660 | parameter | description |
1661 | --------- | ----------- |
1662 | `<response-code>` | Expected http response code |
1663 | `<job-id>` | Id of the job  |
1664 | `<forced_response_code>` | Forced response code for the delete callback url |
1665
1666 ## Function: prodstub_arm_type() ##
1667 Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
1668
1669 | arg list |
1670 |--|
1671 | `<response-code> <producer-id> <type-id>` |
1672
1673 | parameter | description |
1674 | --------- | ----------- |
1675 | `<response-code>` | Expected http response code |
1676 | `<producer-id>` | Id of the producer  |
1677 | `<type-id>` | Id of the type  |
1678
1679 ## Function: prodstub_disarm_type() ##
1680 Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
1681
1682 | arg list |
1683 |--|
1684 | `<response-code> <producer-id> <type-id>` |
1685
1686 | parameter | description |
1687 | --------- | ----------- |
1688 | `<response-code>` | Expected http response code |
1689 | `<producer-id>` | Id of the producer  |
1690 | `<type-id>` | Id of the type  |
1691
1692 ## Function: prodstub_check_jobdata() ##
1693 Check a job in the prodstub towards the list of provided parameters.
1694
1695 | arg list |
1696 |--|
1697 | `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
1698
1699 | parameter | description |
1700 | --------- | ----------- |
1701 | `<response-code>` | Expected http response code |
1702 | `<producer-id>` | Id of the producer  |
1703 | `<job-id>` | Id of the job  |
1704 | `<type-id>` | Id of the type  |
1705 | `<target-url>` | Target url for data delivery  |
1706 | `<job-owner>` | Id of the job owner  |
1707 | `<template-job-file>` | Path to a job template file  |
1708
1709 ## Function: prodstub_delete_jobdata() ##
1710 Delete the job parameters, job data, for a job.
1711
1712 | arg list |
1713 |--|
1714 | `<response-code> <producer-id> <job-id>` |
1715
1716 | parameter | description |
1717 | --------- | ----------- |
1718 | `<response-code>` | Expected http response code |
1719 | `<producer-id>` | Id of the producer  |
1720 | `<job-id>` | Id of the job  |
1721
1722
1723 ## Function: prodstub_equal ##
1724 Tests if a variable value in the prodstub is equal to a target value.
1725 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1726 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
1727
1728 | arg list |
1729 |--|
1730 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1731
1732 | parameter | description |
1733 | --------- | ----------- |
1734 | `<variable-name>` | Variable name in the prostub  |
1735 | `<target-value>` | Target value for the variable  |
1736 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1737
1738
1739 # Description of functions in rapp_catalogue_api_function.sh #
1740
1741 ## Function: use_rapp_catalogue_http ##
1742 Use http for the API. This is the default protocol.
1743 | arg list |
1744 |--|
1745 | None |
1746
1747 ## Function: use_rapp_catalogue_https ##
1748 Use https for the API.
1749 | arg list |
1750 |--|
1751 | None |
1752
1753 ## Function: start_rapp_catalogue ##
1754 Start the rapp catalogue container in docker or kube depending on start mode
1755 | arg list |
1756 |--|
1757 | None |
1758
1759 ## Function: rc_equal ##
1760 Tests if a variable value in the RAPP Catalogue is equal to a target value.
1761 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1762 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
1763 See the 'cr' dir for more details.
1764 | arg list |
1765 |--|
1766 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1767
1768 | parameter | description |
1769 | --------- | ----------- |
1770 | `<variable-name>` | Variable name in the RC  |
1771 | `<target-value>` | Target value for the variable  |
1772 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1773
1774 ## Function: rapp_cat_api_get_services() ##
1775 Check all registered services.
1776
1777 | arg list |
1778 |--|
1779 | `<response-code> [(<service-id> <version> <display-name> <description>)+ | EMPTY ]` |
1780
1781 | parameter | description |
1782 | --------- | ----------- |
1783 | `<response-code>` | Expected http response code |
1784 | `<service-id>` | Id of the service  |
1785 | `<version>` | Version of the service  |
1786 | `<display-name>` | Dislay name of the service  |
1787 | `<description>` | Description of the service  |
1788 | `EMPTY` | Indicator for an empty list  |
1789
1790 ## Function: rapp_cat_api_put_service() ##
1791 Register a services.
1792
1793 | arg list |
1794 |--|
1795 | `<response-code> <service-id> <version> <display-name> <description>` |
1796
1797 | parameter | description |
1798 | --------- | ----------- |
1799 | `<response-code>` | Expected http response code |
1800 | `<service-id>` | Id of the service  |
1801 | `<version>` | Version of the service  |
1802 | `<display-name>` | Dislay name of the service  |
1803 | `<description>` | Description of the service  |
1804
1805 ## Function: rapp_cat_api_get_service() ##
1806 Check a registered service.
1807
1808 | arg list |
1809 |--|
1810 | `<response-code> <service-id> <version> <display-name> <description>` |
1811
1812 | parameter | description |
1813 | --------- | ----------- |
1814 | `<response-code>` | Expected http response code |
1815 | `<service-id>` | Id of the service  |
1816 | `<version>` | Version of the service  |
1817 | `<display-name>` | Dislay name of the service  |
1818 | `<description>` | Description of the service  |
1819
1820 ## Function: rapp_cat_api_delete_service() ##
1821 Check a registered service.
1822
1823 | arg list |
1824 |--|
1825 | `<response-code> <service-id>` |
1826
1827 | parameter | description |
1828 | --------- | ----------- |
1829 | `<response-code>` | Expected http response code |
1830 | `<service-id>` | Id of the service  |
1831
1832
1833 # Description of functions in ricsimulator_api_functions.sh #
1834 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
1835
1836
1837 ## Function: use_simulator_http ##
1838 Use http for all API calls (A1) toward the simulator. This is the default. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
1839 | arg list |
1840 |--|
1841 | None |
1842
1843 ## Function: use_simulator_https ##
1844 Use https for all API calls (A1) toward the simulator. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
1845 | arg list |
1846 |--|
1847 | None |
1848
1849 ## Function: start_ric_simulators ##
1850 Start a group of simulator where a group may contain 1 more simulators. Started in docker or kube depending on start mode
1851 | arg list |
1852 |--|
1853 | `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
1854
1855 | parameter | description |
1856 | --------- | ----------- |
1857 | `ricsim_g1|ricsim_g2|ricsim_g3` | Base name of the simulator. Each instance will have an postfix instance id added, starting on '1'. For examplle 'ricsim_g1_1', 'ricsim_g1_2' etc  |
1858 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
1859 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
1860
1861 ## Function: get_kube_sim_host ##
1862 Translate ric name to kube host name.
1863 | arg list |
1864 |--|
1865 | `<ric-name>` |
1866
1867 | parameter | description |
1868 | --------- | ----------- |
1869 | `<ric-name>` | The name of the ric to translate into a host name (ip) |
1870
1871 ## Function: generate_policy_uuid ##
1872 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
1873 UUID is then automatically added to the policy id in GET/PUT/DELETE.
1874 | arg list |
1875 |--|
1876 | None |
1877
1878 ## Function: sim_equal ##
1879 Tests if a variable value in the RIC simulator is equal to a target value.
1880 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1881 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
1882 See the 'a1-interface' repo for more details.
1883
1884 | arg list |
1885 |--|
1886 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1887
1888 | parameter | description |
1889 | --------- | ----------- |
1890 | `<variable-name>` | Variable name in the ric simulator  |
1891 | `<target-value>` | Target value for the variable  |
1892 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1893
1894 ## Function: sim_print ##
1895 Prints the value of a variable in the RIC simulator.
1896 See the 'a1-interface' repo for more details.
1897
1898 | arg list |
1899 |--|
1900 | `<variable-name>` |
1901
1902 | parameter | description |
1903 | --------- | ----------- |
1904 | `<variable-name>` | Variable name in the RIC simulator  |
1905
1906
1907 ## Function: sim_contains_str ##
1908 Tests if a variable value in the RIC simulator contains a target string.
1909 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
1910 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value contains the target string or not.
1911 See the 'a1-interface' repo for more details.
1912
1913 | arg list |
1914 |--|
1915 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1916
1917 | parameter | description |
1918 | --------- | ----------- |
1919 | `<variable-name>` | Variable name in the ric simulator  |
1920 | `<target-value>` | Target substring for the variable  |
1921 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1922
1923 ## Function: sim_put_policy_type ##
1924 Loads a policy type to the simulator
1925
1926 | arg list |
1927 |--|
1928 | `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
1929
1930 | parameter | description |
1931 | --------- | ----------- |
1932 | `<response-code>` | Expected http response code |
1933 | `<ric-id>` |  Id of the ric |
1934 | `<policy-type-id>` |  Id of the policy type |
1935 | `<policy-type-file>` |  Path to the schema file of the policy type |
1936
1937 ## Function: sim_delete_policy_type ##
1938 Deletes a policy type from the simulator
1939
1940 | arg list |
1941 |--|
1942 | `<response-code> <ric-id> <policy_type_id>` |
1943
1944 | parameter | description |
1945 | --------- | ----------- |
1946 | `<response-code>` | Expected http response code |
1947 | `<ric-id>` |  Id of the ric |
1948 | `<policy-type-id>` |  Id of the policy type |
1949
1950 ## Function: sim_post_delete_instances ##
1951 Deletes all instances (and status), for one ric
1952
1953 | arg list |
1954 |--|
1955 | `<response-code> <ric-id>` |
1956
1957 | parameter | description |
1958 | --------- | ----------- |
1959 | `<response-code>` | Expected http response code |
1960 | `<ric-id>` |  Id of the ric |
1961
1962
1963 ## Function: sim_post_delete_all ##
1964 Deletes all types, instances (and status), for one ric
1965
1966 | arg list |
1967 |--|
1968 | `<response-code> <ric-id>` |
1969
1970 | parameter | description |
1971 | --------- | ----------- |
1972 | `<response-code>` | Expected http response code |
1973 | `<ric-id>` |  Id of the ric |
1974
1975 ## Function: sim_post_forcedresponse ##
1976 Sets (or resets) response code for next (one) A1 message, for one ric.
1977 The intention is to simulate error response on the A1 interface.
1978
1979 | arg list |
1980 |--|
1981 | `<response-code> <ric-id> [<forced_response_code>]`|
1982
1983 | parameter | description |
1984 | --------- | ----------- |
1985 | `<response-code>` | Expected http response code |
1986 | `<ric-id>` |  Id of the ric |
1987 | `<forced_response_code>` |  Http response code to send |
1988
1989 ## Function: sim_post_forcedelay ##
1990 Sets (or resets) A1 response delay, for one ric
1991 The intention is to delay responses on the A1 interface. Setting remains until removed.
1992
1993 | arg list |
1994 |--|
1995 | `<response-code> <ric-id> [<delay-in-seconds>]`|
1996
1997 | parameter | description |
1998 | --------- | ----------- |
1999 | `<response-code>` | Expected http response code |
2000 | `<ric-id>` |  Id of the ric |
2001 | `<delay-in-seconds>` |  Delay in seconds. If omitted, the delay is removed |
2002
2003
2004 ## License
2005
2006 Copyright (C) 2020 Nordix Foundation. All rights reserved.
2007 Licensed under the Apache License, Version 2.0 (the "License");
2008 you may not use this file except in compliance with the License.
2009 You may obtain a copy of the License at
2010
2011      http://www.apache.org/licenses/LICENSE-2.0
2012
2013 Unless required by applicable law or agreed to in writing, software
2014 distributed under the License is distributed on an "AS IS" BASIS,
2015 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2016 See the License for the specific language governing permissions and
2017 limitations under the License.