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