Added r-app catalogue to demo test case
[nonrtric.git] / test / common / README.md
1 # Introduction #
2 This dir contains most scripts needed for the auto-test environment. There are scripts with functions to adapt to the apis of the components of the Non-RT RIC; Policy Agent, A1 Controller and Ric (A1) simulator.
3 Some of the scripts can also be used for other kinds of tests, for example basic tests.
4
5 ## Overview for common test scripts and files ##
6
7 `test_env*.sh` \
8 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.
9 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'. There are preconfigured env files, pattern 'test_env*.sh', in ../common.
10
11 `testcase_common.sh` \
12 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.
13 The included functions are described in detail further below.
14
15 `testsuite_common.sh` \
16 Common functions for running two or more auto test scripts as a suite.
17
18 `api_curl.sh` \
19 A common curl based function for the agent and ecs apis. Also partly used for the Callback receiver and RAPP Catalogue apis.
20
21 `agent_api_functions.sh` \
22 Contains functions for adapting towards the Policy Agent API, also via dmaap (using a message-router stub interface)
23
24 `ecs_api_functions.sh` \
25 Contains functions for adapting towards the ECS API
26
27 `controller_api_functions.sh` \
28 Contains functions for adaping towards the A1-controller API.
29
30 `ricsimulator_api_functions.sh` \
31 Contains functions for adapting towards the RIC (A1) simulator admin API.
32
33 `prodstub_api_functions.sh` \
34 Contains functions for adapting towards the Producer stub interface - simulates a producer.
35
36 `rapp_catalogue_api_functions.sh` \
37 Contains functions for adapting towards the RAPP Catalogue.
38
39 `compare_json.py` \
40 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'.
41
42 `count_json_elements.py` \
43 A python script returning the number of items in a json array.
44
45 `create_policies_process.py` \
46 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.
47
48 `create_rics_json.py` \
49 A python script to create a json file from a formatted string of ric info. Helper for the test enviroment.
50
51 `delete_policies_process.py` \
52 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.
53
54 `extract_sdnc_reply.py` \
55 A python script to extract the information from an sdnc (A1 Controller) reply json. Helper for the test environment.
56
57 `do_curl_function.sh`
58 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)
59
60 `cr_api_functions.sh` \
61 Contains functions for adapting towards the Callback receiver for checking received callback event.
62
63
64 # Description of functions in testcase_common.sh #
65
66 ## Script args ##
67 The script can be started with these arguments
68
69 | arg list |
70 |--|
71 | `local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ]  [--use-local-image <app-nam> [<app-name>]*]` |
72
73 | parameter | description |
74 |-|-|
75 | `local` | only locally built images (in local docker respository) will be used for the Non-RT RIC components. CBS, Consul, DB will still use remote nexus images |
76 | `remote` | only remote images from nexus will be used. Images pulled if not present in local docker repository |
77 | `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
78 | `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
79 | `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
80 | `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard '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). |
81 | `--env-file` | point to a file with environment variables (the previous default, test_env.sh, replaced with one env file for each branch in test/common) |
82 | `--use-local-image <app-nam> [<app-name>]*` | only applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC, RC for Policy Agent, Control Panel, A1-controller, Ric simulator, RAPP Catalogue |
83
84
85 ## Function: print_result ##
86 Print a test report of an auto-test script.
87 | arg list |
88 |--|
89 | None |
90
91 ## Function: start_timer ##
92 Start a timer for time measurement. Only one timer can be running.
93 | arg list |
94 |--|
95 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
96
97 ## Function: print_timer ##
98 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.
99 | arg list |
100 |--|
101 | `<timer-message-to-print>` |
102
103 | parameter | description |
104 | --------- | ----------- |
105 | `<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`) |
106
107 ## Function: print_and_reset_timer ##
108 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.
109 | arg list |
110 |--|
111 | `<timer-message-to-print>` |
112
113 | parameter | description |
114 | --------- | ----------- |
115 | `<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`) |
116
117 ## Function: deviation ##
118 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
119 | arg list |
120 |--|
121 | `<deviation-message-to-print>` |
122
123 | parameter | description |
124 | --------- | ----------- |
125 | `<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 |
126
127 ## Function: clean_containers ##
128 Stop and remove all containers. Containers not part of the test are not affected.
129 | arg list |
130 |--|
131 | None |
132
133 ## Function: auto_clean_containers ##
134 Stop and remove all containers. Containers not part of the test are not affected. 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.
135 | arg list |
136 |--|
137 | None |
138
139 ## Function: sleep_wait ##
140 Make the script sleep for a number of seconds.
141 | arg list |
142 |--|
143 | `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
144
145 | parameter | description |
146 | --------- | ----------- |
147 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
148 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
149
150 ## Function: generate_uuid ##
151 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
152 UUID is then automatically added to the policy id in GET/PUT/DELETE.
153 | arg list |
154 |--|
155 | None |
156
157 ## Function: consul_config_app ##
158 Function to load a json config from a file into consul for the Policy Agent
159
160 | arg list |
161 |--|
162 | `<json-config-file>` |
163
164 | parameter | description |
165 | --------- | ----------- |
166 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
167
168 ## Function: prepare_consul_config ##
169 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')
170 | arg list |
171 |--|
172 | `<deviation-message-to-print>` |
173
174 | parameter | description |
175 | --------- | ----------- |
176 | `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
177 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app'  |
178
179 ## Function: start_consul_cbs ##
180 Start the Consul and CBS containers
181 | arg list |
182 |--|
183 | None |
184
185 ## Function: use_simulator_http ##
186 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.
187 | arg list |
188 |--|
189 | None |
190
191 ## Function: use_simulator_https ##
192 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.
193 | arg list |
194 |--|
195 | None |
196
197 ## Function: start_ric_simulators ##
198 Start a group of simulator where a group may contain 1 more simulators.
199 | arg list |
200 |--|
201 | `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
202
203 | parameter | description |
204 | --------- | ----------- |
205 | `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  |
206 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
207 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
208
209 ## Function: start_control_panel ##
210 Start the Control Panel container
211 | arg list |
212 |--|
213 | None |
214
215 ## Function: start_sdnc ##
216 Start the SDNC A1 Controller container and its database container
217 | arg list |
218 |--|
219 | None |
220
221 ## Function: use_sdnc_http ##
222 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.
223 | arg list |
224 |--|
225 | None |
226
227 ## Function: use_sdnc_http ##
228 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
229 | arg list |
230 |--|
231 | None |
232
233 ## Function: start_mr ##
234 Start the Message Router stub interface container
235 | arg list |
236 |--|
237 | None |
238
239 ## Function: use_mr_http ##
240 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.
241 | arg list |
242 |--|
243 | None |
244
245 ## Function: use_mr_https ##
246 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.
247 | arg list |
248 |--|
249 | None |
250
251 ## Function: start_cr ##
252 Start the Callback Receiver container
253 | arg list |
254 |--|
255 | None |
256
257 ## Function: use_cr_http ##
258 Use http for getting event from CR.  The admin API is not affected. This is the default.
259 | arg list |
260 |--|
261 | None |
262
263 ## Function: use_cr_https ##
264 Use https for getting event from CR. The admin API is not affected.
265 Note: Not yet used as callback event is not fully implemented/deciced.
266 | arg list |
267 |--|
268 | None |
269
270 ## Function: start_prod_stub ##
271 Start the Producer stubb container
272 | arg list |
273 |--|
274 | None |
275
276 ## Function: use_prod_stub_http ##
277 Use http for the API.  The admin API is not affected. This is the default protocol.
278 | arg list |
279 |--|
280 | None |
281
282 ## Function: use_prod_stub_https ##
283 Use https for the API. The admin API is not affected.
284 | arg list |
285 |--|
286 | None |
287
288 ## Function: start_policy_agent ##
289 Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent.
290 | arg list |
291 |--|
292 | None |
293
294 ## Function: use_agent_stand_alone ##
295 Configure to run the Policy Agent as a stand alone container or app. See also 'start_policy_agent'
296 | arg list |
297 |--|
298 | None |
299
300 ## Function: use_agent_rest_http ##
301 Use http for all API calls to the Policy Agent. This is the default.
302 | arg list |
303 |--|
304 | None |
305
306 ## Function: use_agent_rest_https ##
307 Use https for all API calls to the Policy Agent.
308 | arg list |
309 |--|
310 | None |
311
312 ## Function: use_agent_dmaap_http ##
313 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
314 | arg list |
315 |--|
316 | None |
317
318 ## Function: use_agent_dmaap_https ##
319 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
320 | arg list |
321 |--|
322 | None |
323
324 ## Function: set_agent_debug ##
325 Configure the Policy Agent log on debug level. The Policy Agent must be running.
326 | arg list |
327 |--|
328 | None |
329
330 ## Function: set_agent_trace ##
331 Configure the Policy Agent log on trace level. The Policy Agent must be running.
332 | arg list |
333 |--|
334 | None |
335
336 ## Function: use_agent_retries ##
337 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
338 | arg list |
339 |--|
340 | `[<response-code>]*` |
341
342 | parameter | description |
343 | --------- | ----------- |
344 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'.  |
345
346 ## Function: start_ecs ##
347 Start the ECS container.
348 | arg list |
349 |--|
350 | None |
351
352 ## Function: restart_ecs ##
353 Restart the ECS container.
354 | arg list |
355 |--|
356 | None |
357
358 ## Function: use_ecs_rest_http ##
359 Use http for all API calls to the ECS. This is the default protocol.
360 | arg list |
361 |--|
362 | None |
363
364 ## Function: use_ecs_rest_https ##
365 Use https for all API calls to the ECS.
366 | arg list |
367 |--|
368 | None |
369
370 ## Function: use_ecs_dmaap_http ##
371 Send and recieve all API calls to the ECS over Dmaap via the MR using http.
372 | arg list |
373 |--|
374 | None |
375
376 ## Function: use_ecs_dmaap_https ##
377 Send and recieve all API calls to the ECS over Dmaap via the MR using https.
378 | arg list |
379 |--|
380 | None |
381
382 ## Function: set_ecs_debug ##
383 Configure the ECS log on debug level. The ECS must be running.
384 | arg list |
385 |--|
386 | None |
387
388 ## Function: set_ecs_trace ##
389 Configure the ECS log on trace level. The ECS must be running.
390 | arg list |
391 |--|
392 | None |
393
394 ## Function: check_policy_agent_logs ##
395 Check the Policy Agent log for any warnings and errors and print the count of each.
396 | arg list |
397 |--|
398 | None |
399
400 ## Function: check_ecs_logs ##
401 Check the ECS log for any warnings and errors and print the count of each.
402 | arg list |
403 |--|
404 | None |
405
406 ## Function: check_control_panel_logs ##
407 Check the Control Panel log for any warnings and errors and print the count of each.
408 | arg list |
409 |--|
410 | None |
411
412 ## Function: check_sdnc_logs ##
413 Check the SDNC log for any warnings and errors and print the count of each.
414 | arg list |
415 |--|
416 | None |
417
418 ## Function: store_logs ##
419 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.
420 | arg list |
421 |--|
422 | `<logfile-prefix>` |
423
424 | parameter | description |
425 | --------- | ----------- |
426 | `<logfile-prefix>` | Log file prefix  |
427
428
429 ## Function: mr_equal ##
430 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
431 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
432 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.
433 See the 'mrstub' dir for more details.
434 | arg list |
435 |--|
436 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
437
438 | parameter | description |
439 | --------- | ----------- |
440 | `<variable-name>` | Variable name in the MR  |
441 | `<target-value>` | Target value for the variable  |
442 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
443
444 ## Function: mr_greater ##
445 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
446 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
447 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.
448 See the 'mrstub' dir for more details.
449 | arg list |
450 |--|
451 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
452
453 | parameter | description |
454 | --------- | ----------- |
455 | `<variable-name>` | Variable name in the MR  |
456 | `<target-value>` | Target value for the variable  |
457 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value  |
458
459 ## Function: mr_read ##
460 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.
461 See the 'mrstub' dir for more details.
462 | arg list |
463 |--|
464 | `<variable-name>` |
465
466 | parameter | description |
467 | --------- | ----------- |
468 | `<variable-name>` | Variable name in the MR  |
469
470 ## Function: mr_print ##
471 Prints the value of a variable in the Message Router (MR) simulator.
472 See the 'mrstub' dir for more details.
473 | arg list |
474 |--|
475 | `<variable-name>` |
476
477 | parameter | description |
478 | --------- | ----------- |
479 | `<variable-name>` | Variable name in the MR  |
480
481 ## Function: indent1 ##
482 Indent every line of a command output with one space char.
483 | arg list |
484 |--|
485 | None |
486
487 ## Function: indent2 ##
488 Indent every line of a command output with two space chars.
489 | arg list |
490 |--|
491 | None |
492
493 # Description of functions in testsuite_common.sh #
494
495 ## Function: suite_setup ##
496 Sets up the test suite and prints out a heading.
497 | arg list |
498 |--|
499 | None |
500
501 ## suite_complete ##
502 Print out the overall result of the executed test cases.
503 | arg list |
504 |--|
505 | None |
506
507 # Description of functions in agent_api_function.sh #
508
509 ## General ##
510 Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
511
512 ## Function: api_equal() ##
513
514 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
515 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
516 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.
517 See the 'cr' dir for more details.
518
519 | arg list |
520 |--|
521 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
522
523 | parameter | description |
524 | --------- | ----------- |
525 | `<variable-name>` | Relative url. Example 'json:policy_types' - checks the json array length of the url /policy_types  |
526 | `<target-value>` | Target value for the length  |
527 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value  |
528
529 ## Function: api_get_policies() ##
530 Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
531 To test the response code only, provide the response code parameter as well as the following three parameters.
532 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.
533
534 | arg list |
535 |--|
536 | `<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>]*]` |
537
538 | arg list V2 |
539 |--|
540 | `<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>]*]` |
541
542 | parameter | description |
543 | --------- | ----------- |
544 | `<response-code>` | Expected http response code |
545 | `<ric-id>` | Id of the ric  |
546 | `NORIC` | Indicator that no ric is provided  |
547 | `<service-id>` | Id of the service  |
548 | `NOSERVICE` | Indicator that no service id is provided  |
549 | `<policy-type-id>` |  Id of the policy type |
550 | `NOTYPE` | Indicator that no type id is provided  |
551 | `NOID` |  Indicator that no policy id is provided - indicate empty list of policies|
552 | `<policy-id>` |  Id of the policy |
553 | `EMPTY` |  Indicate for the special empty policy type |
554 | `transient` |  Transient, true or false |
555 | `notification-url` |  Url for notifications |
556 | `<template-file>` |  Path to the template file for the policy (same template used when creating the policy) |
557
558
559 ## Function: api_get_policy() ##
560 Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
561 To test the the response code only, provide the expected response code and policy id.
562 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
563
564 | arg list |
565 |--|
566 | `<response-code>  <policy-id> [<template-file>]` |
567
568 | arg list V2|
569 |--|
570 | `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
571
572 | parameter | description |
573 | --------- | ----------- |
574 | `<response-code>` | Expected http response code |
575 | `<policy-id>` |  Id of the policy |
576 | `<template-file>` |  Path to the template file for the policy (same template used when creating the policy) |
577 | `<service-id>` | Id of the service  |
578 | `<ric-id>` | Id of the ric  |
579 | `<policy-type-id>` |  Id of the policy type |
580 | `NOTYPE` | Indicator that no type id is provided  |
581 | `transient` |  Transient, true or false |
582 | `notification-url` |  Url for notifications |
583
584 ## Function: api_put_policy() ##
585 Test of PUT '/policy' or V2 PUT '/policies'.
586 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).
587
588 | arg list |
589 |--|
590 | `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
591
592 | arg list V2 |
593 |--|
594 | `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
595
596 | parameter | description |
597 | --------- | ----------- |
598 | `<response-code>` | Expected http response code |
599 | `<service-id>` | Id of the service  |
600 | `<ric-id>` | Id of the ric  |
601 | `<policy-type-id>` |  Id of the policy type |
602 | `<policy-id>` |  Id of the policy. This value shall be a numeric value if more than one policy shall be created |
603 | `transient>` |  Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
604 | `notification-url` |  Url for notifications |
605 |`NOURL`| Indicator for no url |
606 | `<template-file>` |  Path to the template file for the policy |
607 | `<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 |
608
609 ## Function: api_put_policy_batch() ##
610 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.
611 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.
612 For arg list and parameters, see 'api_put_policy'.
613
614 ## Function: api_put_policy_parallel() ##
615 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.
616
617 | arg list |
618 |--|
619 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
620
621 | arg list |
622 |--|
623 | `<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>`
624
625 | parameter | description |
626 | --------- | ----------- |
627 | `<response-code>` | Expected http response code |
628 | `<service-id>` | Id of the service  |
629 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing  |
630 | `<number-of-rics>` | The number of rics, assuming the first index is '1'. The index is added to the 'ric-id-base' id  |
631 | `<policy-type-id>` |  Id of the policy type |
632 | `<policy-start-id>` |  Id of the policy. This value shall be a numeric value and will be the id of the first policy |
633 | `transient>` |  Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
634 | `notification-url` |  Url for notifications |
635 | `<template-file>` |  Path to the template file for the policy |
636 | `<count-per-ric>` |  Number of policies per ric |
637 | `<number-of-threads>` |  Number of threads (processes) to run in parallel |
638
639 ## Function: api_delete_policy() ##
640 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.
641
642 | arg list |
643 |--|
644 | `<response-code> <policy-id> [<count>]`
645
646 | parameter | description |
647 | --------- | ----------- |
648 | `<response-code>` | Expected http response code |
649 | `<policy-id>` |  Id of the policy |
650 | `<count>` |  An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
651
652 ## Function: api_delete_policy_batch() ##
653 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.
654 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.
655 For arg list and parameters, see 'api_delete_policy'.
656
657 ## Function: api_delete_policy_parallel() ##
658 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.
659
660 | arg list |
661 |--|
662 | `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
663
664 | parameter | description |
665 | --------- | ----------- |
666 | `<response-code>` | Expected http response code |
667 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing  |
668 | `<number-of-rics>` | The number of rics, assuming the first index is '1'  |
669 | `<policy-start-id>` |  Id of the policy. This value shall be a numeric value and will be the id of the first policy |
670 | `<count-per-ric>` |  Number of policies per ric |
671 | `<number-of-threads>` |  Number of threads (processes) to run in parallel |
672
673
674 ## Function: api_get_policy_ids() ##
675
676 Test of GET '/policy_ids' or V2 GET '/v2/policies'.
677 To test response code only, provide the response code parameter as well as the following three parameters.
678 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.
679
680 | arg list |
681 |--|
682 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
683
684 | parameter | description |
685 | --------- | ----------- |
686 | `<response-code>` | Expected http response code |
687 | `<ric-id>` | Id of the ric  |
688 | `NORIC` | Indicator that no ric is provided  |
689 | `<service-id>` | Id of the service  |
690 | `NOSERVICE` | Indicator that no service id is provided  |
691 | `type-id>` |  Id of the policy type |
692 | `NOTYPE` | Indicator that no type id is provided  |
693 | `NOID` |  Indicator that no policy id is provided - indicate empty list of policies|
694 | `<policy-instance-id>` |  Id of the policy |
695
696 ## Function: api_get_policy_schema() ##
697 Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
698 To test the response code only, provide the expected response code and policy type id.
699 To test the contents of the returned json schema, add a path to a schema file to compare with.
700
701 | arg list |
702 |--|
703 | `<response-code> <policy-type-id> [<schema-file>]` |
704
705 | parameter | description |
706 | --------- | ----------- |
707 | `<response-code>` | Expected http response code |
708 | `<policy-type-id>` |  Id of the policy type |
709 | `<schema-file>` |  Path to the schema file for the policy type |
710
711 ## Function: api_get_policy_schema() ##
712 Test of GET '/policy_schema' and optional check of the returned json schema.
713 To test the response code only, provide the expected response code and policy type id.
714 To test the contents of the returned json schema, add a path to a schema file to compare with.
715
716 | arg list |
717 |--|
718 | `<response-code> <policy-type-id> [<schema-file>]` |
719
720 | parameter | description |
721 | --------- | ----------- |
722 | `<response-code>` | Expected http response code |
723 | `<policy-type-id>` |  Id of the policy type |
724 | `<schema-file>` |  Path to the schema file for the policy type |
725
726 ## Function: api_get_policy_schemas() ##
727 Test of GET '/policy_schemas' and optional check of the returned json schemas.
728 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
729 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)
730
731 | arg list |
732 |--|
733 | `<response-code>  <ric-id>|NORIC [<schema-file>|NOFILE]*` |
734
735 | parameter | description |
736 | --------- | ----------- |
737 | `<response-code>` | Expected http response code |
738 | `<ric-id>` |  Id of the ric |
739 | `NORIC` |  No ric id given |
740 | `<schema-file>` |  Path to the schema file for the policy type |
741 | `NOFILE` |  Indicate the template for an empty type |
742
743 ## Function: api_get_policy_status() ##
744 Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
745
746 | arg list |
747 |--|
748 | `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
749
750 | parameter | description |
751 | --------- | ----------- |
752 | `<response-code>` | Expected http response code |
753 | `<policy-id>` |  Id of the policy |
754 | `STD` |  Indicator of status of Standarized A1 |
755 | `STD2` |  Indicator of status of Standarized A1 version 2 |
756 | `<enforce-status>` |  Enforcement status |
757 | `<reason>` |  Optional reason |
758 | `EMPTY` |  Indicator of empty string status or reason |
759 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
760 | `<instance-status>` |  Instance status |
761 | `<has-been-deleted>` |  Deleted status, true or false |
762
763 ## Function: api_get_policy_types() ##
764 Test of GET '/policy_types' or  V2 GET '/v2/policy-types' and optional check of the returned ids.
765 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
766 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
767
768 | arg list |
769 |--|
770 | `<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]` |
771
772 | parameter | description |
773 | --------- | ----------- |
774 | `<response-code>` | Expected http response code |
775 | `<ric-id>` |  Id of the ric |
776 | `NORIC` |  No ric id given |
777 | `<policy-type-id>` |  Id of the policy type |
778 | `EMPTY` |  Indicate the empty type |
779
780 ## Function: api_get_status() ##
781 Test of GET /status or V2 GET /status
782
783 | arg list |
784 |--|
785 | `<response-code>` |
786
787 | parameter | description |
788 | --------- | ----------- |
789 | `<response-code>` | Expected http response code |
790
791 ## Function: api_get_ric() ##
792 Test of GET '/ric' or V2 GET '/v2/rics/ric'
793 To test the response code only, provide the expected response code and managed element id.
794 To test the returned ric id, provide the expected ric id.
795
796 | arg list |
797 |--|
798 | `<reponse-code> <managed-element-id> [<ric-id>]` |
799
800 | arg list V2 |
801 |--|
802 | `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
803
804 | parameter | description |
805 | --------- | ----------- |
806 | `<response-code>` | Expected http response code |
807 | `<managed-element-id>` |  Id of the managed element |
808 | `NOME` |  Indicator for no ME |
809 | `ric-id` |  Id of the ric |
810 | `NORIC` |  Indicator no RIC |
811 | `string-of-ricinfo` |  String of ric info |
812
813 ## Function: api_get_rics() ##
814 Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
815 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
816 To test also the returned payload, add the formatted string of info in the returned payload.
817 Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
818 Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
819
820 | arg list |
821 |--|
822 | `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
823
824 | parameter | description |
825 | --------- | ----------- |
826 | `<response-code>` | Expected http response code |
827 | `<policy-type-id>` |  Policy type id of the ric |
828 | `NOTYPE>` |  No type given |
829 | `<space-separate-string-of-ricinfo>` |  A space separated string of ric info - needs to be quoted |
830
831 ## Function: api_put_service() ##
832 Test of PUT '/service' or V2 PUT '/service'.
833 | arg list |
834 |--|
835 | `<response-code>  <service-name> <keepalive-timeout> <callbackurl>` |
836
837 | parameter | description |
838 | --------- | ----------- |
839 | `<response-code>` | Expected http response code |
840 | `<service-name>` |  Service name |
841 | `<keepalive-timeout>` |  Timeout value |
842 | `<callbackurl>` |  Callback url |
843
844 ## Function: api_get_services() ##
845 Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
846 To test only the response code, omit all parameters except the expected response code.
847 To test the returned json, provide the parameters after the response code.
848
849 | arg list |
850 |--|
851 | `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
852
853 | parameter | description |
854 | --------- | ----------- |
855 | `<response-code>` | Expected http response code |
856 | <query-service-name>` |  Service name for the query |
857 | <target-service-name>` |  Target service name|
858 | `<keepalive-timeout>` |  Timeout value |
859 | `<callbackurl>` |  Callback url |
860 | `NOSERVICE` |  Indicator of no target service name |
861
862 ## Function: api_get_service_ids() ##
863 Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
864
865 | arg list |
866 |--|
867 | `<response-code> [<service-name>]*` |
868
869 | parameter | description |
870 | --------- | ----------- |
871 | `<response-code>` | Expected http response code |
872 | `<service-name>` |  Service name |
873
874 ## Function: api_delete_services() ##
875 Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
876
877 | arg list |
878 |--|
879 | `<response-code> [<service-name>]*` |
880
881 | parameter | description |
882 | --------- | ----------- |
883 | `<response-code>` | Expected http response code |
884 | `<service-name>` |  Service name |
885
886 ## Function: api_put_services_keepalive() ##
887 Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
888
889 | arg list |
890 |--|
891 | <response-code> <service-name>` |
892
893 | parameter | description |
894 | --------- | ----------- |
895 | `<response-code>` | Expected http response code |
896 | `<service-name>` |  Service name |
897
898 ## Function: api_put_configuration() ##
899 Test of PUT '/v2/configuration'
900
901 | arg list |
902 |--|
903 | <response-code> <config-file>` |
904
905 | parameter | description |
906 | --------- | ----------- |
907 | `<response-code>` | Expected http response code |
908 | `<config-file>` |  Path json config file |
909
910 ## Function: api_get_configuration() ##
911 Test of GET '/v2/configuration'
912
913 | arg list |
914 |--|
915 | <response-code> [<config-file>]` |
916
917 | parameter | description |
918 | --------- | ----------- |
919 | `<response-code>` | Expected http response code |
920 | `<config-file>` |  Path json config file to compare the retrieved config with |
921
922 # Description of functions in ricsimulator_api_functions.sh #
923 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
924
925 ## Function: sim_equal ##
926 Tests if a variable value in the RIC simulator is equal to a target value.
927 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
928 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.
929 See the 'a1-interface' repo for more details.
930
931 | arg list |
932 |--|
933 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
934
935 | parameter | description |
936 | --------- | ----------- |
937 | `<variable-name>` | Variable name in the ric simulator  |
938 | `<target-value>` | Target value for the variable  |
939 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
940
941 ## Function: sim_print ##
942 Prints the value of a variable in the RIC simulator.
943 See the 'a1-interface' repo for more details.
944
945 | arg list |
946 |--|
947 | `<variable-name>` |
948
949 | parameter | description |
950 | --------- | ----------- |
951 | `<variable-name>` | Variable name in the RIC simulator  |
952
953
954 ## Function: sim_contains_str ##
955 Tests if a variable value in the RIC simulator contains a target string.
956 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
957 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.
958 See the 'a1-interface' repo for more details.
959
960 | arg list |
961 |--|
962 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
963
964 | parameter | description |
965 | --------- | ----------- |
966 | `<variable-name>` | Variable name in the ric simulator  |
967 | `<target-value>` | Target substring for the variable  |
968 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
969
970 ## Function: sim_put_policy_type ##
971 Loads a policy type to the simulator
972
973 | arg list |
974 |--|
975 | `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
976
977 | parameter | description |
978 | --------- | ----------- |
979 | `<response-code>` | Expected http response code |
980 | `<ric-id>` |  Id of the ric |
981 | `<policy-type-id>` |  Id of the policy type |
982 | `<policy-type-file>` |  Path to the schema file of the policy type |
983
984 ## Function: sim_delete_policy_type ##
985 Deletes a policy type from the simulator
986
987 | arg list |
988 |--|
989 | `<response-code> <ric-id> <policy_type_id>` |
990
991 | parameter | description |
992 | --------- | ----------- |
993 | `<response-code>` | Expected http response code |
994 | `<ric-id>` |  Id of the ric |
995 | `<policy-type-id>` |  Id of the policy type |
996
997 ## Function: sim_post_delete_instances ##
998 Deletes all instances (and status), for one ric
999
1000 | arg list |
1001 |--|
1002 | `<response-code> <ric-id>` |
1003
1004 | parameter | description |
1005 | --------- | ----------- |
1006 | `<response-code>` | Expected http response code |
1007 | `<ric-id>` |  Id of the ric |
1008
1009
1010 ## Function: sim_post_delete_all ##
1011 Deletes all types, instances (and status), for one ric
1012
1013 | arg list |
1014 |--|
1015 | `<response-code> <ric-id>` |
1016
1017 | parameter | description |
1018 | --------- | ----------- |
1019 | `<response-code>` | Expected http response code |
1020 | `<ric-id>` |  Id of the ric |
1021
1022 ## Function: sim_post_forcedresponse ##
1023 Sets (or resets) response code for next (one) A1 message, for one ric.
1024 The intention is to simulate error response on the A1 interface.
1025
1026 | arg list |
1027 |--|
1028 | `<response-code> <ric-id> [<forced_response_code>]`|
1029
1030 | parameter | description |
1031 | --------- | ----------- |
1032 | `<response-code>` | Expected http response code |
1033 | `<ric-id>` |  Id of the ric |
1034 | `<forced_response_code>` |  Http response code to send |
1035
1036 ## Function: sim_post_forcedelay ##
1037 Sets (or resets) A1 response delay, for one ric
1038 The intention is to delay responses on the A1 interface. Setting remains until removed.
1039
1040 | arg list |
1041 |--|
1042 | `<response-code> <ric-id> [<delay-in-seconds>]`|
1043
1044 | parameter | description |
1045 | --------- | ----------- |
1046 | `<response-code>` | Expected http response code |
1047 | `<ric-id>` |  Id of the ric |
1048 | `<delay-in-seconds>` |  Delay in seconds. If omitted, the delay is removed |
1049
1050
1051 # Description of functions in controller_api_functions.sh #
1052 The file contains a selection of the possible API tests towards the a1-controller
1053
1054 ## Function: controller_api_get_A1_policy_ids ##
1055 Test of GET policy ids towards OSC or STD type simulator.
1056 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
1057 To test the response payload, include the ids of the expexted response.
1058
1059 | arg list |
1060 |--|
1061 | `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
1062
1063 | parameter | description |
1064 | --------- | ----------- |
1065 | `<response-code>` | Expected http response code |
1066 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
1067 | `<ric-id>` | Id of the ric  |
1068 | `policy-type-id>` |  Id of the policy type |
1069 | `<policy-id>` |  Id of the policy |
1070 | `STD` |  Indicator of status of Standarized A1 |
1071
1072
1073 ## Function: controller_api_get_A1_policy_type ##
1074 Test of GET a policy type (OSC only)
1075
1076 | arg list |
1077 |--|
1078 | `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
1079
1080 | parameter | description |
1081 | --------- | ----------- |
1082 | `<response-code>` | Expected http response code |
1083 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
1084 | `<ric-id>` | Id of the ric  |
1085 | `policy-type-id>` |  Id of the policy type |
1086 | `policy-type-file>` |  Optional schema file to compare the returned type with |
1087
1088 ## Function: controller_api_delete_A1_policy ##
1089 Deletes a policy instance
1090
1091 | arg list |
1092 |--|
1093 | `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
1094
1095 | parameter | description |
1096 | --------- | ----------- |
1097 | `<response-code>` | Expected http response code |
1098 | `STD` |  Indicator of status of Standarized A1 |
1099 | `<ric-id>` | Id of the ric  |
1100 | `<policy-id>` |  Id of the policy |
1101 | `policy-type-id>` |  Id of the policy type |
1102 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
1103 | `policy-type-file>` |  Optional schema file to compare the returned type with |
1104
1105 ## Function: controller_api_put_A1_policy ##
1106 Creates a policy instance
1107
1108 | arg list |
1109 |--|
1110 | `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
1111
1112 | parameter | description |
1113 | --------- | ----------- |
1114 | `<response-code>` | Expected http response code |
1115 | `STD` |  Indicator of status of Standarized A1 |
1116 | `<ric-id>` | Id of the ric  |
1117 | `<policy-id>` |  Id of the policy |
1118 | `<template-file>` |  Path to the template file of the policy|
1119 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
1120 | `<policy-type-id>` |  Id of the policy type |
1121
1122 ## Function: controller_api_get_A1_policy_status ##
1123 Checks the status of a policy
1124
1125  arg list |
1126 |--|
1127 | `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
1128
1129 | parameter | description |
1130 | --------- | ----------- |
1131 | `<response-code>` | Expected http response code |
1132 | `STD` |  Indicator of status of Standarized A1 |
1133 | `<ric-id>` | Id of the ric  |
1134 | `<policy-id>` |  Id of the policy |
1135 | `<enforce-status>` |  Enforcement status |
1136 | `<reason>` |  Optional reason |
1137 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
1138 | `<policy-type-id>` |  Id of the policy type |
1139 | `<instance-status>` |  Instance status |
1140 | `<has-been-deleted>` |  Deleted status, true or false |
1141
1142
1143
1144
1145 # Description of functions in ecs_api_function.sh #
1146
1147 ## Function: ecs_equal ##
1148 Tests if a variable value in the ECS is equal to a target value.
1149 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1150 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.
1151 See the 'a1-interface' repo for more details.
1152
1153 | arg list |
1154 |--|
1155 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1156
1157 | parameter | description |
1158 | --------- | ----------- |
1159 | `<variable-name>` | Variable name in ecs  |
1160 | `<target-value>` | Target value for the variable  |
1161 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1162
1163 ## Function: ecs_api_a1_get_job_ids() ##
1164 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
1165 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1166 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1167
1168 | arg list |
1169 |--|
1170 | `<response-code> <type-id>  <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1171
1172 | parameter | description |
1173 | --------- | ----------- |
1174 | `<response-code>` | Expected http response code |
1175 | `<type-id>` | Id of the EI type  |
1176 | `<owner-id>` | Id of the job owner  |
1177 | `NOOWNER` | No owner is given  |
1178 | `<job-id>` | Id of the expected job  |
1179 | `EMPTY` | The expected list of job id shall be empty  |
1180
1181 ## Function: ecs_api_a1_get_type() ##
1182 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
1183 To test the response code only, provide the response code parameter as well as the type-id.
1184 To also test the response payload add a path to the expected schema file.
1185
1186 | arg list |
1187 |--|
1188 | `<response-code> <type-id> [<schema-file>]` |
1189
1190 | parameter | description |
1191 | --------- | ----------- |
1192 | `<response-code>` | Expected http response code |
1193 | `<type-id>` | Id of the EI type  |
1194 | `<schema-file>` | Path to a schema file to compare with the returned schema  |
1195
1196 ## Function: ecs_api_a1_get_type_ids() ##
1197 Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
1198 To test the response code only, provide the response only.
1199 To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
1200
1201 | arg list |
1202 |--|
1203 | `<response-code> [ (EMPTY | [<type-id>]+) ]` |
1204
1205 | parameter | description |
1206 | --------- | ----------- |
1207 | `<response-code>` | Expected http response code |
1208 | `EMPTY` | The expected list of type ids shall be empty  |
1209 | `<type-id>` | Id of the EI type  |
1210
1211 ## Function: ecs_api_a1_get_job_status() ##
1212 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
1213 To test the response code only, provide the response code, type id and job id.
1214 To also test the response payload add the expected status.
1215
1216 | arg list |
1217 |--|
1218 | `<response-code> <type-id> <job-id> [<status>]` |
1219
1220 | parameter | description |
1221 | --------- | ----------- |
1222 | `<response-code>` | Expected http response code |
1223 | `<type-id>` | Id of the EI type  |
1224 | `<job-id>` | Id of the job  |
1225 | `<status>` | Expected status  |
1226
1227 ## Function: ecs_api_a1_get_job() ##
1228 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
1229 To test the response code only, provide the response code, type id and job id.
1230 To also test the response payload add the remaining parameters.
1231
1232 | arg list |
1233 |--|
1234 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1235
1236 | parameter | description |
1237 | --------- | ----------- |
1238 | `<response-code>` | Expected http response code |
1239 | `<type-id>` | Id of the EI type  |
1240 | `<job-id>` | Id of the job  |
1241 | `<target-url>` | Expected target url for the job  |
1242 | `<owner-id>` | Expected owner for the job  |
1243 | `<template-job-file>` | Path to a job template for job parameters of the job  |
1244
1245 ## Function: ecs_api_a1_delete_job() ##
1246 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1247 To test, provide all the specified parameters.
1248
1249 | arg list |
1250 |--|
1251 | `<response-code> <type-id> <job-id> |
1252
1253 | parameter | description |
1254 | --------- | ----------- |
1255 | `<response-code>` | Expected http response code |
1256 | `<type-id>` | Id of the EI type  |
1257 | `<job-id>` | Id of the job  |
1258
1259 ## Function: ecs_api_a1_put_job() ##
1260 Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1261 To test, provide all the specified parameters.
1262
1263 | arg list |
1264 |--|
1265 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
1266
1267 | parameter | description |
1268 | --------- | ----------- |
1269 | `<response-code>` | Expected http response code |
1270 | `<type-id>` | Id of the EI type  |
1271 | `<job-id>` | Id of the job  |
1272 | `<target-url>` | Target url for the job  |
1273 | `<owner-id>` | Owner of the job  |
1274 | `<template-job-file>` | Path to a job template for job parameters of the job  |
1275
1276 ## Function: ecs_api_edp_get_type_ids() ##
1277 Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
1278 To test the response code only, provide the response code.
1279 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1280
1281 | arg list |
1282 |--|
1283 | `<response-code> [ EMPTY | <type-id>+]` |
1284
1285 | parameter | description |
1286 | --------- | ----------- |
1287 | `<response-code>` | Expected http response code |
1288 | `<type-id>` | Id of the EI type  |
1289 | `EMPTY` | The expected list of type ids shall be empty  |
1290
1291 ## Function: ecs_api_edp_get_producer_status() ##
1292 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
1293 To test the response code only, provide the response code and producer id.
1294 To also test the response payload add the expected status.
1295
1296 | arg list |
1297 |--|
1298 | `<response-code> <producer-id> [<status>]` |
1299
1300 | parameter | description |
1301 | --------- | ----------- |
1302 | `<response-code>` | Expected http response code |
1303 | `<producer-id>` | Id of the producer  |
1304 | `<status>` | The expected status string  |
1305
1306 ## Function: ecs_api_edp_get_producer_ids() ##
1307 Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
1308 To test the response code only, provide the response.
1309 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).
1310
1311 | arg list |
1312 |--|
1313 | `<response-code> [ EMPTY | <producer-id>+]` |
1314
1315 | parameter | description |
1316 | --------- | ----------- |
1317 | `<response-code>` | Expected http response code |
1318 | `<producer-id>` | Id of the producer  |
1319 | `EMPTY` | The expected list of type ids shall be empty  |
1320
1321 ## Function: ecs_api_edp_get_type() ##
1322 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
1323 To test the response code only, provide the response and the type-id.
1324 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).
1325
1326 | arg list |
1327 |--|
1328 | `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
1329
1330 | parameter | description |
1331 | --------- | ----------- |
1332 | `<response-code>` | Expected http response code |
1333 | `<type-id>` | Id of the EI type  |
1334 | `<job-schema-file>` | Path to a job schema file  |
1335 | `<producer-id>` | Id of the producer  |
1336 | `EMPTY` | The expected list of type ids shall be empty  |
1337
1338 ## Function: ecs_api_edp_get_producer() ##
1339 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
1340 To test the response code only, provide the response and the producer-id.
1341 To also test the response payload add the remaining parameters defining thee producer.
1342
1343 | arg list |
1344 |--|
1345 | `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
1346
1347 | parameter | description |
1348 | --------- | ----------- |
1349 | `<response-code>` | Expected http response code |
1350 | `<producer-id>` | Id of the producer  |
1351 | `<create-callback>` | Callback for create job  |
1352 | `<delete-callback>` | Callback for delete job  |
1353 | `<supervision-callback>` | Callback for producer supervision  |
1354 | `<type-id>` | Id of the EI type  |
1355 | `<schema-file>` | Path to a schema file  |
1356 | `EMPTY` | The expected list of type schema pairs shall be empty  |
1357
1358 ## Function: ecs_api_edp_delete_producer() ##
1359 Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
1360 To test, provide all parameters.
1361
1362 | arg list |
1363 |--|
1364 | `<response-code> <producer-id>` |
1365
1366 | parameter | description |
1367 | --------- | ----------- |
1368 | `<response-code>` | Expected http response code |
1369 | `<producer-id>` | Id of the producer  |
1370
1371 ## Function: ecs_api_edp_put_producer() ##
1372 Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
1373 To test, provide all parameters. The list of type/schema pair may be empty.
1374
1375 | arg list |
1376 |--|
1377 | `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
1378
1379 | parameter | description |
1380 | --------- | ----------- |
1381 | `<response-code>` | Expected http response code |
1382 | `<producer-id>` | Id of the producer  |
1383 | `<job-callback>` | Callback for create/delete job  |
1384 | `<supervision-callback>` | Callback for producer supervision  |
1385 | `<type-id>` | Id of the EI type  |
1386 | `<schema-file>` | Path to a schema file  |
1387 | `EMPTY` | The list of type/schema pairs is empty  |
1388
1389 ## Function: ecs_api_edp_get_producer_jobs() ##
1390 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
1391 To test the response code only, provide the response and the producer-id.
1392 To also test the response payload add the remaining parameters.
1393
1394 | arg list |
1395 |--|
1396 | `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)` |
1397
1398 | parameter | description |
1399 | --------- | ----------- |
1400 | `<response-code>` | Expected http response code |
1401 | `<producer-id>` | Id of the producer  |
1402 | `<job-id>` | Id of the job  |
1403 | `<type-id>` | Id of the EI type  |
1404 | `<target-url>` | Target url for data delivery  |
1405 | `<template-job-file>` | Path to a job template file  |
1406 | `EMPTY` | The list of job/type/target/job-file tuples is empty  |
1407
1408 ## Function: ecs_api_service_status() ##
1409 Test of GET '/status'.
1410
1411 | arg list |
1412 |--|
1413 | `<response-code>` |
1414
1415 | parameter | description |
1416 | --------- | ----------- |
1417 | `<response-code>` | Expected http response code |
1418
1419
1420 # Description of functions in prodstub_api_function.sh #
1421
1422 ## Function: prodstub_arm_producer() ##
1423 Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
1424
1425 | arg list |
1426 |--|
1427 | `<response-code> <producer-id> [<forced_response_code>]` |
1428
1429 | parameter | description |
1430 | --------- | ----------- |
1431 | `<response-code>` | Expected http response code |
1432 | `<producer-id>` | Id of the producer  |
1433 | `<forced_response_code>` | Forced response code for the producer callback url |
1434
1435 ## Function: prodstub_arm_job_create() ##
1436 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.
1437
1438 | arg list |
1439 |--|
1440 | `<response-code> <job-id> [<forced_response_code>]` |
1441
1442 | parameter | description |
1443 | --------- | ----------- |
1444 | `<response-code>` | Expected http response code |
1445 | `<job-id>` | Id of the job  |
1446 | `<forced_response_code>` | Forced response code for the create callback url |
1447
1448 ## Function: prodstub_arm_job_delete() ##
1449 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.
1450
1451 | arg list |
1452 |--|
1453 | `<response-code> <job-id> [<forced_response_code>]` |
1454
1455 | parameter | description |
1456 | --------- | ----------- |
1457 | `<response-code>` | Expected http response code |
1458 | `<job-id>` | Id of the job  |
1459 | `<forced_response_code>` | Forced response code for the delete callback url |
1460
1461 ## Function: prodstub_arm_type() ##
1462 Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
1463
1464 | arg list |
1465 |--|
1466 | `<response-code> <producer-id> <type-id>` |
1467
1468 | parameter | description |
1469 | --------- | ----------- |
1470 | `<response-code>` | Expected http response code |
1471 | `<producer-id>` | Id of the producer  |
1472 | `<type-id>` | Id of the type  |
1473
1474 ## Function: prodstub_disarm_type() ##
1475 Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
1476
1477 | arg list |
1478 |--|
1479 | `<response-code> <producer-id> <type-id>` |
1480
1481 | parameter | description |
1482 | --------- | ----------- |
1483 | `<response-code>` | Expected http response code |
1484 | `<producer-id>` | Id of the producer  |
1485 | `<type-id>` | Id of the type  |
1486
1487 ## Function: prodstub_check_jobdata() ##
1488 Check a job in the prodstub towards the list of provided parameters.
1489
1490 | arg list |
1491 |--|
1492 | `<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>` |
1493
1494 | parameter | description |
1495 | --------- | ----------- |
1496 | `<response-code>` | Expected http response code |
1497 | `<producer-id>` | Id of the producer  |
1498 | `<job-id>` | Id of the job  |
1499 | `<type-id>` | Id of the type  |
1500 | `<target-url>` | Target url for data delivery  |
1501 | `<template-job-file>` | Path to a job template file  |
1502
1503 ## Function: prodstub_delete_jobdata() ##
1504 Delete the job parameters, job data, for a job.
1505
1506 | arg list |
1507 |--|
1508 | `<response-code> <producer-id> <job-id>` |
1509
1510 | parameter | description |
1511 | --------- | ----------- |
1512 | `<response-code>` | Expected http response code |
1513 | `<producer-id>` | Id of the producer  |
1514 | `<job-id>` | Id of the job  |
1515
1516
1517 ## Function: prodstub_equal ##
1518 Tests if a variable value in the prodstub is equal to a target value.
1519 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1520 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.
1521
1522 | arg list |
1523 |--|
1524 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1525
1526 | parameter | description |
1527 | --------- | ----------- |
1528 | `<variable-name>` | Variable name in the prostub  |
1529 | `<target-value>` | Target value for the variable  |
1530 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1531
1532 # Description of functions in cr_api_function.sh #
1533
1534 ## Function: cr_equal ##
1535 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
1536 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1537 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.
1538 See the 'cr' dir for more details.
1539 | arg list |
1540 |--|
1541 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1542
1543 | parameter | description |
1544 | --------- | ----------- |
1545 | `<variable-name>` | Variable name in the CR  |
1546 | `<target-value>` | Target value for the variable  |
1547 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1548
1549 ## Function: cr_api_check_all_sync_events() ##
1550 Check the contents of all ric events received for a callback id.
1551
1552 | arg list |
1553 |--|
1554 | `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
1555
1556 | parameter | description |
1557 | --------- | ----------- |
1558 | `<response-code>` | Expected http response code |
1559 | `<id>` | Id of the callback destination  |
1560 | `EMPTY` | Indicator for an empty list  |
1561 | `<ric-id>` | Id of the ric  |
1562
1563 # Description of functions in rapp_catalogue_api_function.sh #
1564
1565 ## Function: rc_equal ##
1566 Tests if a variable value in the RAPP Catalogue is equal to a target value.
1567 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1568 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.
1569 See the 'cr' dir for more details.
1570 | arg list |
1571 |--|
1572 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1573
1574 | parameter | description |
1575 | --------- | ----------- |
1576 | `<variable-name>` | Variable name in the RC  |
1577 | `<target-value>` | Target value for the variable  |
1578 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
1579
1580 ## Function: rapp_cat_api_get_services() ##
1581 Check all registered services.
1582
1583 | arg list |
1584 |--|
1585 | `<response-code> [(<service-id> <version> <display-name> <description>)+ | EMPTY ]` |
1586
1587 | parameter | description |
1588 | --------- | ----------- |
1589 | `<response-code>` | Expected http response code |
1590 | `<service-id>` | Id of the service  |
1591 | `<version>` | Version of the service  |
1592 | `<display-name>` | Dislay name of the service  |
1593 | `<description>` | Description of the service  |
1594 | `EMPTY` | Indicator for an empty list  |
1595
1596 ## Function: rapp_cat_api_put_service() ##
1597 Register a services.
1598
1599 | arg list |
1600 |--|
1601 | `<response-code> <service-id> <version> <display-name> <description>` |
1602
1603 | parameter | description |
1604 | --------- | ----------- |
1605 | `<response-code>` | Expected http response code |
1606 | `<service-id>` | Id of the service  |
1607 | `<version>` | Version of the service  |
1608 | `<display-name>` | Dislay name of the service  |
1609 | `<description>` | Description of the service  |
1610
1611 ## Function: rapp_cat_api_get_service() ##
1612 Check a registered service.
1613
1614 | arg list |
1615 |--|
1616 | `<response-code> <service-id> <version> <display-name> <description>` |
1617
1618 | parameter | description |
1619 | --------- | ----------- |
1620 | `<response-code>` | Expected http response code |
1621 | `<service-id>` | Id of the service  |
1622 | `<version>` | Version of the service  |
1623 | `<display-name>` | Dislay name of the service  |
1624 | `<description>` | Description of the service  |
1625
1626 ## Function: rapp_cat_api_delete_service() ##
1627 Check a registered service.
1628
1629 | arg list |
1630 |--|
1631 | `<response-code> <service-id>` |
1632
1633 | parameter | description |
1634 | --------- | ----------- |
1635 | `<response-code>` | Expected http response code |
1636 | `<service-id>` | Id of the service  |
1637
1638
1639 ## License
1640
1641 Copyright (C) 2020 Nordix Foundation. All rights reserved.
1642 Licensed under the Apache License, Version 2.0 (the "License");
1643 you may not use this file except in compliance with the License.
1644 You may obtain a copy of the License at
1645
1646      http://www.apache.org/licenses/LICENSE-2.0
1647
1648 Unless required by applicable law or agreed to in writing, software
1649 distributed under the License is distributed on an "AS IS" BASIS,
1650 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1651 See the License for the specific language governing permissions and
1652 limitations under the License.