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