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