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