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.
5 ## Overview for common test scripts and files ##
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.
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.
15 `testsuite_common.sh` \
16 Common functions for running two or more auto test scripts as a suite.
19 A common curl based function for the agent and ecs apis. Also partly used for the Callback receiver and RAPP Catalogue apis.
21 `agent_api_functions.sh` \
22 Contains functions for adapting towards the Policy Agent API, also via dmaap (using a message-router stub interface)
24 `ecs_api_functions.sh` \
25 Contains functions for adapting towards the ECS API
27 `controller_api_functions.sh` \
28 Contains functions for adaping towards the A1-controller API.
30 `ricsimulator_api_functions.sh` \
31 Contains functions for adapting towards the RIC (A1) simulator admin API.
33 `prodstub_api_functions.sh` \
34 Contains functions for adapting towards the Producer stub interface - simulates a producer.
36 `rapp_catalogue_api_functions.sh` \
37 Contains functions for adapting towards the RAPP Catalogue.
40 A python script to compare two json obects for equality. Note that the comparsion always sort json-arrays before comparing (that is, it does not care about the order of items within the array). In addition, the target json object may specify individual parameter values where equality is 'dont care'.
42 `count_json_elements.py` \
43 A python script returning the number of items in a json array.
45 `create_policies_process.py` \
46 A python script to create a batch of policies. The script is intended to run in a number of processes to create policies in parallel.
48 `create_rics_json.py` \
49 A python script to create a json file from a formatted string of ric info. Helper for the test enviroment.
51 `delete_policies_process.py` \
52 A python script to delete a batch of policies. The script is intended to run in a number of processes to delete policies in parallel.
54 `extract_sdnc_reply.py` \
55 A python script to extract the information from an sdnc (A1 Controller) reply json. Helper for the test environment.
58 A script for executing a curl call with a specific url and optional payload. It also compare the response with an expected result in terms of response code and optional returned payload. Intended to be used by test script (for example basic test scripts of other components)
60 `cr_api_functions.sh` \
61 Contains functions for adapting towards the Callback receiver for checking received callback event.
64 # Description of functions in testcase_common.sh #
67 The script can be started with these arguments
71 | `local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ] [--use-local-image <app-nam> [<app-name>]*]` |
73 | parameter | description |
75 | `local` | only locally built images (in local docker respository) will be used for the Non-RT RIC components. CBS, Consul, DB will still use remote nexus images |
76 | `remote` | only remote images from nexus will be used. Images pulled if not present in local docker repository |
77 | `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
78 | `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
79 | `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
80 | `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
81 | `--env-file` | point to a file with environment variables (the previous default, test_env.sh, replaced with one env file for each branch in test/common) |
82 | `--use-local-image <app-nam> [<app-name>]*` | only applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC, RC for Policy Agent, Control Panel, A1-controller, Ric simulator, RAPP Catalogue |
85 ## Function: print_result ##
86 Print a test report of an auto-test script.
91 ## Function: start_timer ##
92 Start a timer for time measurement. Only one timer can be running.
95 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
97 ## Function: print_timer ##
98 Print the value of the timer (in seconds) previously started by 'start_timer'. (Note that timer is still running after this function). The result of the timer as well as the args to the function will also be printed in the test report.
101 | `<timer-message-to-print>` |
103 | parameter | description |
104 | --------- | ----------- |
105 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
107 ## Function: print_and_reset_timer ##
108 Print the value of the timer (in seconds) previously started by 'start_timer'. Also reset the timer to 0. The result of the timer as well as the args to the function will also be printed in the test report.
111 | `<timer-message-to-print>` |
113 | parameter | description |
114 | --------- | ----------- |
115 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
117 ## Function: deviation ##
118 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
121 | `<deviation-message-to-print>` |
123 | parameter | description |
124 | --------- | ----------- |
125 | `<deviation-message-to-print>` | Any text message describing the deviation. The text will also be printed in the test report. The intention is to mark known deviations, compared to required functionality |
127 ## Function: clean_containers ##
128 Stop and remove all containers. Containers not part of the test are not affected.
133 ## Function: auto_clean_containers ##
134 Stop and remove all containers. Containers not part of the test are not affected. This function has effect only if the test script is started with arg `auto-clean`. This intention is to use this function as the last step in an auto-test script.
139 ## Function: sleep_wait ##
140 Make the script sleep for a number of seconds.
143 | `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
145 | parameter | description |
146 | --------- | ----------- |
147 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
148 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
150 ## Function: generate_uuid ##
151 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
152 UUID is then automatically added to the policy id in GET/PUT/DELETE.
157 ## Function: consul_config_app ##
158 Function to load a json config from a file into consul for the Policy Agent
162 | `<json-config-file>` |
164 | parameter | description |
165 | --------- | ----------- |
166 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
168 ## Function: prepare_consul_config ##
169 Function to prepare a Consul config based on the previously configured (and started simulators). Note that all simulator must be running and the test script has to configure if http or https shall be used for the components (this is done by the functions 'use_simulator_http', 'use_simulator_https', 'use_sdnc_http', 'use_sdnc_https', 'use_mr_http', 'use_mr_https')
172 | `<deviation-message-to-print>` |
174 | parameter | description |
175 | --------- | ----------- |
176 | `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
177 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app' |
179 ## Function: start_consul_cbs ##
180 Start the Consul and CBS containers
185 ## Function: use_simulator_http ##
186 Use http for all API calls (A1) toward the simulator. This is the default. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
191 ## Function: use_simulator_https ##
192 Use https for all API calls (A1) toward the simulator. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
197 ## Function: start_ric_simulators ##
198 Start a group of simulator where a group may contain 1 more simulators.
201 | `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
203 | parameter | description |
204 | --------- | ----------- |
205 | `ricsim_g1|ricsim_g2|ricsim_g3` | Base name of the simulator. Each instance will have an postfix instance id added, starting on '1'. For examplle 'ricsim_g1_1', 'ricsim_g1_2' etc |
206 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
207 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
209 ## Function: start_control_panel ##
210 Start the Control Panel container
215 ## Function: start_sdnc ##
216 Start the SDNC A1 Controller container and its database container
221 ## Function: use_sdnc_http ##
222 Use http for all API calls towards the SDNC A1 Controller. This is the default. Note that this function shall be called before preparing the config for Consul.
227 ## Function: use_sdnc_http ##
228 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
233 ## Function: start_mr ##
234 Start the Message Router stub interface container
239 ## Function: use_mr_http ##
240 Use http for all Dmaap calls to the MR. This is the default. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
245 ## Function: use_mr_https ##
246 Use https for all Dmaap call to the MR. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
251 ## Function: start_cr ##
252 Start the Callback Receiver container
257 ## Function: use_cr_http ##
258 Use http for getting event from CR. The admin API is not affected. This is the default.
263 ## Function: use_cr_https ##
264 Use https for getting event from CR. The admin API is not affected.
265 Note: Not yet used as callback event is not fully implemented/deciced.
270 ## Function: start_prod_stub ##
271 Start the Producer stubb container
276 ## Function: use_prod_stub_http ##
277 Use http for the API. The admin API is not affected. This is the default protocol.
282 ## Function: use_prod_stub_https ##
283 Use https for the API. The admin API is not affected.
288 ## Function: start_policy_agent ##
289 Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent.
294 ## Function: use_agent_stand_alone ##
295 Configure to run the Policy Agent as a stand alone container or app. See also 'start_policy_agent'
300 ## Function: use_agent_rest_http ##
301 Use http for all API calls to the Policy Agent. This is the default.
306 ## Function: use_agent_rest_https ##
307 Use https for all API calls to the Policy Agent.
312 ## Function: use_agent_dmaap_http ##
313 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
318 ## Function: use_agent_dmaap_https ##
319 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
324 ## Function: set_agent_debug ##
325 Configure the Policy Agent log on debug level. The Policy Agent must be running.
330 ## Function: set_agent_trace ##
331 Configure the Policy Agent log on trace level. The Policy Agent must be running.
336 ## Function: use_agent_retries ##
337 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
340 | `[<response-code>]*` |
342 | parameter | description |
343 | --------- | ----------- |
344 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'. |
346 ## Function: start_ecs ##
347 Start the ECS container.
352 ## Function: restart_ecs ##
353 Restart the ECS container.
358 ## Function: use_ecs_rest_http ##
359 Use http for all API calls to the ECS. This is the default protocol.
364 ## Function: use_ecs_rest_https ##
365 Use https for all API calls to the ECS.
370 ## Function: use_ecs_dmaap_http ##
371 Send and recieve all API calls to the ECS over Dmaap via the MR using http.
376 ## Function: use_ecs_dmaap_https ##
377 Send and recieve all API calls to the ECS over Dmaap via the MR using https.
382 ## Function: set_ecs_debug ##
383 Configure the ECS log on debug level. The ECS must be running.
388 ## Function: set_ecs_trace ##
389 Configure the ECS log on trace level. The ECS must be running.
394 ## Function: check_policy_agent_logs ##
395 Check the Policy Agent log for any warnings and errors and print the count of each.
400 ## Function: check_ecs_logs ##
401 Check the ECS log for any warnings and errors and print the count of each.
406 ## Function: check_control_panel_logs ##
407 Check the Control Panel log for any warnings and errors and print the count of each.
412 ## Function: check_sdnc_logs ##
413 Check the SDNC log for any warnings and errors and print the count of each.
418 ## Function: store_logs ##
419 Take a snap-shot of all logs for all running containers and stores them in `./logs/<ATC-id>`. All logs will get the specified prefix in the file name. In general, one of the last steps in an auto-test script shall be to call this function. If logs shall be taken several times during a test script, different prefixes shall be used each time.
422 | `<logfile-prefix>` |
424 | parameter | description |
425 | --------- | ----------- |
426 | `<logfile-prefix>` | Log file prefix |
429 ## Function: mr_equal ##
430 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
431 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
432 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
433 See the 'mrstub' dir for more details.
436 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
438 | parameter | description |
439 | --------- | ----------- |
440 | `<variable-name>` | Variable name in the MR |
441 | `<target-value>` | Target value for the variable |
442 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
444 ## Function: mr_greater ##
445 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
446 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
447 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes greater than the target value or not.
448 See the 'mrstub' dir for more details.
451 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
453 | parameter | description |
454 | --------- | ----------- |
455 | `<variable-name>` | Variable name in the MR |
456 | `<target-value>` | Target value for the variable |
457 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value |
459 ## Function: mr_read ##
460 Reads the value of a variable in the Message Router (MR) simulator. The value is intended to be passed to a env variable in the test script.
461 See the 'mrstub' dir for more details.
464 | `<variable-name>` |
466 | parameter | description |
467 | --------- | ----------- |
468 | `<variable-name>` | Variable name in the MR |
470 ## Function: mr_print ##
471 Prints the value of a variable in the Message Router (MR) simulator.
472 See the 'mrstub' dir for more details.
475 | `<variable-name>` |
477 | parameter | description |
478 | --------- | ----------- |
479 | `<variable-name>` | Variable name in the MR |
481 ## Function: indent1 ##
482 Indent every line of a command output with one space char.
487 ## Function: indent2 ##
488 Indent every line of a command output with two space chars.
493 # Description of functions in testsuite_common.sh #
495 ## Function: suite_setup ##
496 Sets up the test suite and prints out a heading.
502 Print out the overall result of the executed test cases.
507 # Description of functions in agent_api_function.sh #
510 Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
512 ## Function: api_equal() ##
514 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
515 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
516 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the array length becomes equal to the target value or not.
517 See the 'cr' dir for more details.
521 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
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 |
529 ## Function: api_get_policies() ##
530 Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
531 To test the response code only, provide the response code parameter as well as the following three parameters.
532 To also test the response payload add the 'NOID' for an expected empty array or repeat the last five/seven parameters for each expected policy.
536 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]` |
540 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]` |
542 | parameter | description |
543 | --------- | ----------- |
544 | `<response-code>` | Expected http response code |
545 | `<ric-id>` | Id of the ric |
546 | `NORIC` | Indicator that no ric is provided |
547 | `<service-id>` | Id of the service |
548 | `NOSERVICE` | Indicator that no service id is provided |
549 | `<policy-type-id>` | Id of the policy type |
550 | `NOTYPE` | Indicator that no type id is provided |
551 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
552 | `<policy-id>` | Id of the policy |
553 | `EMPTY` | Indicate for the special empty policy type |
554 | `transient` | Transient, true or false |
555 | `notification-url` | Url for notifications |
556 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
559 ## Function: api_get_policy() ##
560 Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
561 To test the the response code only, provide the expected response code and policy id.
562 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
566 | `<response-code> <policy-id> [<template-file>]` |
570 | `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
572 | parameter | description |
573 | --------- | ----------- |
574 | `<response-code>` | Expected http response code |
575 | `<policy-id>` | Id of the policy |
576 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
577 | `<service-id>` | Id of the service |
578 | `<ric-id>` | Id of the ric |
579 | `<policy-type-id>` | Id of the policy type |
580 | `NOTYPE` | Indicator that no type id is provided |
581 | `transient` | Transient, true or false |
582 | `notification-url` | Url for notifications |
584 ## Function: api_put_policy() ##
585 Test of PUT '/policy' or V2 PUT '/policies'.
586 If more than one policy shall be created, add a count value to indicate the number of policies to create. Note that if more than one policy shall be created the provided policy-id must be numerical (will be used as the starting id).
590 | `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
594 | `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
596 | parameter | description |
597 | --------- | ----------- |
598 | `<response-code>` | Expected http response code |
599 | `<service-id>` | Id of the service |
600 | `<ric-id>` | Id of the ric |
601 | `<policy-type-id>` | Id of the policy type |
602 | `<policy-id>` | Id of the policy. This value shall be a numeric value if more than one policy shall be created |
603 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
604 | `notification-url` | Url for notifications |
605 |`NOURL`| Indicator for no url |
606 | `<template-file>` | Path to the template file for the policy |
607 | `<count>` | An optional count (default is 1). If a value greater than 1 is given, the policy ids will use the given policy id as the first id and add 1 to that id for each new policy |
609 ## Function: api_put_policy_batch() ##
610 This tests the same as function 'api_put_policy' except that all put requests are sent to dmaap in one go and then the responses are polled one by one.
611 If the agent api is not configured to use dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
612 For arg list and parameters, see 'api_put_policy'.
614 ## Function: api_put_policy_parallel() ##
615 This tests the same as function 'api_put_policy' except that the policy create is spread out over a number of processes and it only uses the agent rest API. The total number of policies created is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the creation of all the policies in one ric.
619 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
623 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>`
625 | parameter | description |
626 | --------- | ----------- |
627 | `<response-code>` | Expected http response code |
628 | `<service-id>` | Id of the service |
629 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
630 | `<number-of-rics>` | The number of rics, assuming the first index is '1'. The index is added to the 'ric-id-base' id |
631 | `<policy-type-id>` | Id of the policy type |
632 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
633 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
634 | `notification-url` | Url for notifications |
635 | `<template-file>` | Path to the template file for the policy |
636 | `<count-per-ric>` | Number of policies per ric |
637 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
639 ## Function: api_delete_policy() ##
640 This tests the DELETE '/policy' or V2 DELETE '/v2/policies/{policy_id}'. Removes the indicated policy or a 'count' number of policies starting with 'policy-id' as the first id.
644 | `<response-code> <policy-id> [<count>]`
646 | parameter | description |
647 | --------- | ----------- |
648 | `<response-code>` | Expected http response code |
649 | `<policy-id>` | Id of the policy |
650 | `<count>` | An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
652 ## Function: api_delete_policy_batch() ##
653 This tests the same as function 'api_delete_policy' except that all delete requests are sent to dmaap in one go and then the responses are polled one by one.
654 If the agent api is not configured to used dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
655 For arg list and parameters, see 'api_delete_policy'.
657 ## Function: api_delete_policy_parallel() ##
658 This tests the same as function 'api_delete_policy' except that the policy delete is spread out over a number of processes and it only uses the agent rest API. The total number of policies deleted is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the deletion of all the policies in one ric.
662 | `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
664 | parameter | description |
665 | --------- | ----------- |
666 | `<response-code>` | Expected http response code |
667 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
668 | `<number-of-rics>` | The number of rics, assuming the first index is '1' |
669 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
670 | `<count-per-ric>` | Number of policies per ric |
671 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
674 ## Function: api_get_policy_ids() ##
676 Test of GET '/policy_ids' or V2 GET '/v2/policies'.
677 To test response code only, provide the response code parameter as well as the following three parameters.
678 To also test the response payload add the 'NOID' for an expected empty array or repeat the 'policy-instance-id' for each expected policy id.
682 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
684 | parameter | description |
685 | --------- | ----------- |
686 | `<response-code>` | Expected http response code |
687 | `<ric-id>` | Id of the ric |
688 | `NORIC` | Indicator that no ric is provided |
689 | `<service-id>` | Id of the service |
690 | `NOSERVICE` | Indicator that no service id is provided |
691 | `type-id>` | Id of the policy type |
692 | `NOTYPE` | Indicator that no type id is provided |
693 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
694 | `<policy-instance-id>` | Id of the policy |
696 ## Function: api_get_policy_schema() ##
697 Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
698 To test the response code only, provide the expected response code and policy type id.
699 To test the contents of the returned json schema, add a path to a schema file to compare with.
703 | `<response-code> <policy-type-id> [<schema-file>]` |
705 | parameter | description |
706 | --------- | ----------- |
707 | `<response-code>` | Expected http response code |
708 | `<policy-type-id>` | Id of the policy type |
709 | `<schema-file>` | Path to the schema file for the policy type |
711 ## Function: api_get_policy_schema() ##
712 Test of GET '/policy_schema' and optional check of the returned json schema.
713 To test the response code only, provide the expected response code and policy type id.
714 To test the contents of the returned json schema, add a path to a schema file to compare with.
718 | `<response-code> <policy-type-id> [<schema-file>]` |
720 | parameter | description |
721 | --------- | ----------- |
722 | `<response-code>` | Expected http response code |
723 | `<policy-type-id>` | Id of the policy type |
724 | `<schema-file>` | Path to the schema file for the policy type |
726 ## Function: api_get_policy_schemas() ##
727 Test of GET '/policy_schemas' and optional check of the returned json schemas.
728 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
729 To test the contents of the returned json schema, add a path to a schema file to compare with (or NOFILE to represent an empty '{}' type)
733 | `<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*` |
735 | parameter | description |
736 | --------- | ----------- |
737 | `<response-code>` | Expected http response code |
738 | `<ric-id>` | Id of the ric |
739 | `NORIC` | No ric id given |
740 | `<schema-file>` | Path to the schema file for the policy type |
741 | `NOFILE` | Indicate the template for an empty type |
743 ## Function: api_get_policy_status() ##
744 Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
748 | `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
750 | parameter | description |
751 | --------- | ----------- |
752 | `<response-code>` | Expected http response code |
753 | `<policy-id>` | Id of the policy |
754 | `STD` | Indicator of status of Standarized A1 |
755 | `STD2` | Indicator of status of Standarized A1 version 2 |
756 | `<enforce-status>` | Enforcement status |
757 | `<reason>` | Optional reason |
758 | `EMPTY` | Indicator of empty string status or reason |
759 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
760 | `<instance-status>` | Instance status |
761 | `<has-been-deleted>` | Deleted status, true or false |
763 ## Function: api_get_policy_types() ##
764 Test of GET '/policy_types' or V2 GET '/v2/policy-types' and optional check of the returned ids.
765 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
766 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
770 | `<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]` |
772 | parameter | description |
773 | --------- | ----------- |
774 | `<response-code>` | Expected http response code |
775 | `<ric-id>` | Id of the ric |
776 | `NORIC` | No ric id given |
777 | `<policy-type-id>` | Id of the policy type |
778 | `EMPTY` | Indicate the empty type |
780 ## Function: api_get_status() ##
781 Test of GET /status or V2 GET /status
785 | `<response-code>` |
787 | parameter | description |
788 | --------- | ----------- |
789 | `<response-code>` | Expected http response code |
791 ## Function: api_get_ric() ##
792 Test of GET '/ric' or V2 GET '/v2/rics/ric'
793 To test the response code only, provide the expected response code and managed element id.
794 To test the returned ric id, provide the expected ric id.
798 | `<reponse-code> <managed-element-id> [<ric-id>]` |
802 | `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
804 | parameter | description |
805 | --------- | ----------- |
806 | `<response-code>` | Expected http response code |
807 | `<managed-element-id>` | Id of the managed element |
808 | `NOME` | Indicator for no ME |
809 | `ric-id` | Id of the ric |
810 | `NORIC` | Indicator no RIC |
811 | `string-of-ricinfo` | String of ric info |
813 ## Function: api_get_rics() ##
814 Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
815 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
816 To test also the returned payload, add the formatted string of info in the returned payload.
817 Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
818 Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
822 | `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
824 | parameter | description |
825 | --------- | ----------- |
826 | `<response-code>` | Expected http response code |
827 | `<policy-type-id>` | Policy type id of the ric |
828 | `NOTYPE>` | No type given |
829 | `<space-separate-string-of-ricinfo>` | A space separated string of ric info - needs to be quoted |
831 ## Function: api_put_service() ##
832 Test of PUT '/service' or V2 PUT '/service'.
835 | `<response-code> <service-name> <keepalive-timeout> <callbackurl>` |
837 | parameter | description |
838 | --------- | ----------- |
839 | `<response-code>` | Expected http response code |
840 | `<service-name>` | Service name |
841 | `<keepalive-timeout>` | Timeout value |
842 | `<callbackurl>` | Callback url |
844 ## Function: api_get_services() ##
845 Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
846 To test only the response code, omit all parameters except the expected response code.
847 To test the returned json, provide the parameters after the response code.
851 | `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
853 | parameter | description |
854 | --------- | ----------- |
855 | `<response-code>` | Expected http response code |
856 | <query-service-name>` | Service name for the query |
857 | <target-service-name>` | Target service name|
858 | `<keepalive-timeout>` | Timeout value |
859 | `<callbackurl>` | Callback url |
860 | `NOSERVICE` | Indicator of no target service name |
862 ## Function: api_get_service_ids() ##
863 Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
867 | `<response-code> [<service-name>]*` |
869 | parameter | description |
870 | --------- | ----------- |
871 | `<response-code>` | Expected http response code |
872 | `<service-name>` | Service name |
874 ## Function: api_delete_services() ##
875 Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
879 | `<response-code> [<service-name>]*` |
881 | parameter | description |
882 | --------- | ----------- |
883 | `<response-code>` | Expected http response code |
884 | `<service-name>` | Service name |
886 ## Function: api_put_services_keepalive() ##
887 Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
891 | <response-code> <service-name>` |
893 | parameter | description |
894 | --------- | ----------- |
895 | `<response-code>` | Expected http response code |
896 | `<service-name>` | Service name |
898 ## Function: api_put_configuration() ##
899 Test of PUT '/v2/configuration'
903 | <response-code> <config-file>` |
905 | parameter | description |
906 | --------- | ----------- |
907 | `<response-code>` | Expected http response code |
908 | `<config-file>` | Path json config file |
910 ## Function: api_get_configuration() ##
911 Test of GET '/v2/configuration'
915 | <response-code> [<config-file>]` |
917 | parameter | description |
918 | --------- | ----------- |
919 | `<response-code>` | Expected http response code |
920 | `<config-file>` | Path json config file to compare the retrieved config with |
922 # Description of functions in ricsimulator_api_functions.sh #
923 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
925 ## Function: sim_equal ##
926 Tests if a variable value in the RIC simulator is equal to a target value.
927 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
928 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
929 See the 'a1-interface' repo for more details.
933 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
935 | parameter | description |
936 | --------- | ----------- |
937 | `<variable-name>` | Variable name in the ric simulator |
938 | `<target-value>` | Target value for the variable |
939 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
941 ## Function: sim_print ##
942 Prints the value of a variable in the RIC simulator.
943 See the 'a1-interface' repo for more details.
947 | `<variable-name>` |
949 | parameter | description |
950 | --------- | ----------- |
951 | `<variable-name>` | Variable name in the RIC simulator |
954 ## Function: sim_contains_str ##
955 Tests if a variable value in the RIC simulator contains a target string.
956 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
957 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value contains the target string or not.
958 See the 'a1-interface' repo for more details.
962 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
964 | parameter | description |
965 | --------- | ----------- |
966 | `<variable-name>` | Variable name in the ric simulator |
967 | `<target-value>` | Target substring for the variable |
968 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
970 ## Function: sim_put_policy_type ##
971 Loads a policy type to the simulator
975 | `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
977 | parameter | description |
978 | --------- | ----------- |
979 | `<response-code>` | Expected http response code |
980 | `<ric-id>` | Id of the ric |
981 | `<policy-type-id>` | Id of the policy type |
982 | `<policy-type-file>` | Path to the schema file of the policy type |
984 ## Function: sim_delete_policy_type ##
985 Deletes a policy type from the simulator
989 | `<response-code> <ric-id> <policy_type_id>` |
991 | parameter | description |
992 | --------- | ----------- |
993 | `<response-code>` | Expected http response code |
994 | `<ric-id>` | Id of the ric |
995 | `<policy-type-id>` | Id of the policy type |
997 ## Function: sim_post_delete_instances ##
998 Deletes all instances (and status), for one ric
1002 | `<response-code> <ric-id>` |
1004 | parameter | description |
1005 | --------- | ----------- |
1006 | `<response-code>` | Expected http response code |
1007 | `<ric-id>` | Id of the ric |
1010 ## Function: sim_post_delete_all ##
1011 Deletes all types, instances (and status), for one ric
1015 | `<response-code> <ric-id>` |
1017 | parameter | description |
1018 | --------- | ----------- |
1019 | `<response-code>` | Expected http response code |
1020 | `<ric-id>` | Id of the ric |
1022 ## Function: sim_post_forcedresponse ##
1023 Sets (or resets) response code for next (one) A1 message, for one ric.
1024 The intention is to simulate error response on the A1 interface.
1028 | `<response-code> <ric-id> [<forced_response_code>]`|
1030 | parameter | description |
1031 | --------- | ----------- |
1032 | `<response-code>` | Expected http response code |
1033 | `<ric-id>` | Id of the ric |
1034 | `<forced_response_code>` | Http response code to send |
1036 ## Function: sim_post_forcedelay ##
1037 Sets (or resets) A1 response delay, for one ric
1038 The intention is to delay responses on the A1 interface. Setting remains until removed.
1042 | `<response-code> <ric-id> [<delay-in-seconds>]`|
1044 | parameter | description |
1045 | --------- | ----------- |
1046 | `<response-code>` | Expected http response code |
1047 | `<ric-id>` | Id of the ric |
1048 | `<delay-in-seconds>` | Delay in seconds. If omitted, the delay is removed |
1051 # Description of functions in controller_api_functions.sh #
1052 The file contains a selection of the possible API tests towards the a1-controller
1054 ## Function: controller_api_get_A1_policy_ids ##
1055 Test of GET policy ids towards OSC or STD type simulator.
1056 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
1057 To test the response payload, include the ids of the expexted response.
1061 | `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
1063 | parameter | description |
1064 | --------- | ----------- |
1065 | `<response-code>` | Expected http response code |
1066 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1067 | `<ric-id>` | Id of the ric |
1068 | `policy-type-id>` | Id of the policy type |
1069 | `<policy-id>` | Id of the policy |
1070 | `STD` | Indicator of status of Standarized A1 |
1073 ## Function: controller_api_get_A1_policy_type ##
1074 Test of GET a policy type (OSC only)
1078 | `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
1080 | parameter | description |
1081 | --------- | ----------- |
1082 | `<response-code>` | Expected http response code |
1083 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1084 | `<ric-id>` | Id of the ric |
1085 | `policy-type-id>` | Id of the policy type |
1086 | `policy-type-file>` | Optional schema file to compare the returned type with |
1088 ## Function: controller_api_delete_A1_policy ##
1089 Deletes a policy instance
1093 | `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
1095 | parameter | description |
1096 | --------- | ----------- |
1097 | `<response-code>` | Expected http response code |
1098 | `STD` | Indicator of status of Standarized A1 |
1099 | `<ric-id>` | Id of the ric |
1100 | `<policy-id>` | Id of the policy |
1101 | `policy-type-id>` | Id of the policy type |
1102 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1103 | `policy-type-file>` | Optional schema file to compare the returned type with |
1105 ## Function: controller_api_put_A1_policy ##
1106 Creates a policy instance
1110 | `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
1112 | parameter | description |
1113 | --------- | ----------- |
1114 | `<response-code>` | Expected http response code |
1115 | `STD` | Indicator of status of Standarized A1 |
1116 | `<ric-id>` | Id of the ric |
1117 | `<policy-id>` | Id of the policy |
1118 | `<template-file>` | Path to the template file of the policy|
1119 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1120 | `<policy-type-id>` | Id of the policy type |
1122 ## Function: controller_api_get_A1_policy_status ##
1123 Checks the status of a policy
1127 | `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
1129 | parameter | description |
1130 | --------- | ----------- |
1131 | `<response-code>` | Expected http response code |
1132 | `STD` | Indicator of status of Standarized A1 |
1133 | `<ric-id>` | Id of the ric |
1134 | `<policy-id>` | Id of the policy |
1135 | `<enforce-status>` | Enforcement status |
1136 | `<reason>` | Optional reason |
1137 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1138 | `<policy-type-id>` | Id of the policy type |
1139 | `<instance-status>` | Instance status |
1140 | `<has-been-deleted>` | Deleted status, true or false |
1145 # Description of functions in ecs_api_function.sh #
1147 ## Function: ecs_equal ##
1148 Tests if a variable value in the ECS is equal to a target value.
1149 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1150 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
1151 See the 'a1-interface' repo for more details.
1155 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1157 | parameter | description |
1158 | --------- | ----------- |
1159 | `<variable-name>` | Variable name in ecs |
1160 | `<target-value>` | Target value for the variable |
1161 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1163 ## Function: ecs_api_a1_get_job_ids() ##
1164 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
1165 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1166 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1170 | `<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1172 | parameter | description |
1173 | --------- | ----------- |
1174 | `<response-code>` | Expected http response code |
1175 | `<type-id>` | Id of the EI type |
1176 | `<owner-id>` | Id of the job owner |
1177 | `NOOWNER` | No owner is given |
1178 | `<job-id>` | Id of the expected job |
1179 | `EMPTY` | The expected list of job id shall be empty |
1181 ## Function: ecs_api_a1_get_type() ##
1182 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
1183 To test the response code only, provide the response code parameter as well as the type-id.
1184 To also test the response payload add a path to the expected schema file.
1188 | `<response-code> <type-id> [<schema-file>]` |
1190 | parameter | description |
1191 | --------- | ----------- |
1192 | `<response-code>` | Expected http response code |
1193 | `<type-id>` | Id of the EI type |
1194 | `<schema-file>` | Path to a schema file to compare with the returned schema |
1196 ## Function: ecs_api_a1_get_type_ids() ##
1197 Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
1198 To test the response code only, provide the response only.
1199 To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
1203 | `<response-code> [ (EMPTY | [<type-id>]+) ]` |
1205 | parameter | description |
1206 | --------- | ----------- |
1207 | `<response-code>` | Expected http response code |
1208 | `EMPTY` | The expected list of type ids shall be empty |
1209 | `<type-id>` | Id of the EI type |
1211 ## Function: ecs_api_a1_get_job_status() ##
1212 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
1213 To test the response code only, provide the response code, type id and job id.
1214 To also test the response payload add the expected status.
1218 | `<response-code> <type-id> <job-id> [<status>]` |
1220 | parameter | description |
1221 | --------- | ----------- |
1222 | `<response-code>` | Expected http response code |
1223 | `<type-id>` | Id of the EI type |
1224 | `<job-id>` | Id of the job |
1225 | `<status>` | Expected status |
1227 ## Function: ecs_api_a1_get_job() ##
1228 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
1229 To test the response code only, provide the response code, type id and job id.
1230 To also test the response payload add the remaining parameters.
1234 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1236 | parameter | description |
1237 | --------- | ----------- |
1238 | `<response-code>` | Expected http response code |
1239 | `<type-id>` | Id of the EI type |
1240 | `<job-id>` | Id of the job |
1241 | `<target-url>` | Expected target url for the job |
1242 | `<owner-id>` | Expected owner for the job |
1243 | `<template-job-file>` | Path to a job template for job parameters of the job |
1245 ## Function: ecs_api_a1_delete_job() ##
1246 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1247 To test, provide all the specified parameters.
1251 | `<response-code> <type-id> <job-id> |
1253 | parameter | description |
1254 | --------- | ----------- |
1255 | `<response-code>` | Expected http response code |
1256 | `<type-id>` | Id of the EI type |
1257 | `<job-id>` | Id of the job |
1259 ## Function: ecs_api_a1_put_job() ##
1260 Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1261 To test, provide all the specified parameters.
1265 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
1267 | parameter | description |
1268 | --------- | ----------- |
1269 | `<response-code>` | Expected http response code |
1270 | `<type-id>` | Id of the EI type |
1271 | `<job-id>` | Id of the job |
1272 | `<target-url>` | Target url for the job |
1273 | `<owner-id>` | Owner of the job |
1274 | `<template-job-file>` | Path to a job template for job parameters of the job |
1276 ## Function: ecs_api_edp_get_type_ids() ##
1277 Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
1278 To test the response code only, provide the response code.
1279 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1283 | `<response-code> [ EMPTY | <type-id>+]` |
1285 | parameter | description |
1286 | --------- | ----------- |
1287 | `<response-code>` | Expected http response code |
1288 | `<type-id>` | Id of the EI type |
1289 | `EMPTY` | The expected list of type ids shall be empty |
1291 ## Function: ecs_api_edp_get_producer_status() ##
1292 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
1293 To test the response code only, provide the response code and producer id.
1294 To also test the response payload add the expected status.
1298 | `<response-code> <producer-id> [<status>]` |
1300 | parameter | description |
1301 | --------- | ----------- |
1302 | `<response-code>` | Expected http response code |
1303 | `<producer-id>` | Id of the producer |
1304 | `<status>` | The expected status string |
1306 ## Function: ecs_api_edp_get_producer_ids() ##
1307 Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
1308 To test the response code only, provide the response.
1309 To also test the response payload add the list of expected producer-ids (or EMPTY if the list of ids is expected to be empty).
1313 | `<response-code> [ EMPTY | <producer-id>+]` |
1315 | parameter | description |
1316 | --------- | ----------- |
1317 | `<response-code>` | Expected http response code |
1318 | `<producer-id>` | Id of the producer |
1319 | `EMPTY` | The expected list of type ids shall be empty |
1321 ## Function: ecs_api_edp_get_type() ##
1322 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
1323 To test the response code only, provide the response and the type-id.
1324 To also test the response payload add a path to a job schema file and a list expected producer-id (or EMPTY if the list of ids is expected to be empty).
1328 | `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
1330 | parameter | description |
1331 | --------- | ----------- |
1332 | `<response-code>` | Expected http response code |
1333 | `<type-id>` | Id of the EI type |
1334 | `<job-schema-file>` | Path to a job schema file |
1335 | `<producer-id>` | Id of the producer |
1336 | `EMPTY` | The expected list of type ids shall be empty |
1338 ## Function: ecs_api_edp_get_producer() ##
1339 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
1340 To test the response code only, provide the response and the producer-id.
1341 To also test the response payload add the remaining parameters defining thee producer.
1345 | `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
1347 | parameter | description |
1348 | --------- | ----------- |
1349 | `<response-code>` | Expected http response code |
1350 | `<producer-id>` | Id of the producer |
1351 | `<create-callback>` | Callback for create job |
1352 | `<delete-callback>` | Callback for delete job |
1353 | `<supervision-callback>` | Callback for producer supervision |
1354 | `<type-id>` | Id of the EI type |
1355 | `<schema-file>` | Path to a schema file |
1356 | `EMPTY` | The expected list of type schema pairs shall be empty |
1358 ## Function: ecs_api_edp_delete_producer() ##
1359 Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
1360 To test, provide all parameters.
1364 | `<response-code> <producer-id>` |
1366 | parameter | description |
1367 | --------- | ----------- |
1368 | `<response-code>` | Expected http response code |
1369 | `<producer-id>` | Id of the producer |
1371 ## Function: ecs_api_edp_put_producer() ##
1372 Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
1373 To test, provide all parameters. The list of type/schema pair may be empty.
1377 | `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
1379 | parameter | description |
1380 | --------- | ----------- |
1381 | `<response-code>` | Expected http response code |
1382 | `<producer-id>` | Id of the producer |
1383 | `<job-callback>` | Callback for create/delete job |
1384 | `<supervision-callback>` | Callback for producer supervision |
1385 | `<type-id>` | Id of the EI type |
1386 | `<schema-file>` | Path to a schema file |
1387 | `EMPTY` | The list of type/schema pairs is empty |
1389 ## Function: ecs_api_edp_get_producer_jobs() ##
1390 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
1391 To test the response code only, provide the response and the producer-id.
1392 To also test the response payload add the remaining parameters.
1396 | `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
1398 | parameter | description |
1399 | --------- | ----------- |
1400 | `<response-code>` | Expected http response code |
1401 | `<producer-id>` | Id of the producer |
1402 | `<job-id>` | Id of the job |
1403 | `<type-id>` | Id of the EI type |
1404 | `<target-url>` | Target url for data delivery |
1405 | `<job-owner>` | Id of the job owner |
1406 | `<template-job-file>` | Path to a job template file |
1407 | `EMPTY` | The list of job/type/target/job-file tuples is empty |
1409 ## Function: ecs_api_service_status() ##
1410 Test of GET '/status'.
1414 | `<response-code>` |
1416 | parameter | description |
1417 | --------- | ----------- |
1418 | `<response-code>` | Expected http response code |
1421 # Description of functions in prodstub_api_function.sh #
1423 ## Function: prodstub_arm_producer() ##
1424 Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
1428 | `<response-code> <producer-id> [<forced_response_code>]` |
1430 | parameter | description |
1431 | --------- | ----------- |
1432 | `<response-code>` | Expected http response code |
1433 | `<producer-id>` | Id of the producer |
1434 | `<forced_response_code>` | Forced response code for the producer callback url |
1436 ## Function: prodstub_arm_job_create() ##
1437 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.
1441 | `<response-code> <job-id> [<forced_response_code>]` |
1443 | parameter | description |
1444 | --------- | ----------- |
1445 | `<response-code>` | Expected http response code |
1446 | `<job-id>` | Id of the job |
1447 | `<forced_response_code>` | Forced response code for the create callback url |
1449 ## Function: prodstub_arm_job_delete() ##
1450 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.
1454 | `<response-code> <job-id> [<forced_response_code>]` |
1456 | parameter | description |
1457 | --------- | ----------- |
1458 | `<response-code>` | Expected http response code |
1459 | `<job-id>` | Id of the job |
1460 | `<forced_response_code>` | Forced response code for the delete callback url |
1462 ## Function: prodstub_arm_type() ##
1463 Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
1467 | `<response-code> <producer-id> <type-id>` |
1469 | parameter | description |
1470 | --------- | ----------- |
1471 | `<response-code>` | Expected http response code |
1472 | `<producer-id>` | Id of the producer |
1473 | `<type-id>` | Id of the type |
1475 ## Function: prodstub_disarm_type() ##
1476 Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
1480 | `<response-code> <producer-id> <type-id>` |
1482 | parameter | description |
1483 | --------- | ----------- |
1484 | `<response-code>` | Expected http response code |
1485 | `<producer-id>` | Id of the producer |
1486 | `<type-id>` | Id of the type |
1488 ## Function: prodstub_check_jobdata() ##
1489 Check a job in the prodstub towards the list of provided parameters.
1493 | `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
1495 | parameter | description |
1496 | --------- | ----------- |
1497 | `<response-code>` | Expected http response code |
1498 | `<producer-id>` | Id of the producer |
1499 | `<job-id>` | Id of the job |
1500 | `<type-id>` | Id of the type |
1501 | `<target-url>` | Target url for data delivery |
1502 | `<job-owner>` | Id of the job owner |
1503 | `<template-job-file>` | Path to a job template file |
1505 ## Function: prodstub_delete_jobdata() ##
1506 Delete the job parameters, job data, for a job.
1510 | `<response-code> <producer-id> <job-id>` |
1512 | parameter | description |
1513 | --------- | ----------- |
1514 | `<response-code>` | Expected http response code |
1515 | `<producer-id>` | Id of the producer |
1516 | `<job-id>` | Id of the job |
1519 ## Function: prodstub_equal ##
1520 Tests if a variable value in the prodstub is equal to a target value.
1521 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1522 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.
1526 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1528 | parameter | description |
1529 | --------- | ----------- |
1530 | `<variable-name>` | Variable name in the prostub |
1531 | `<target-value>` | Target value for the variable |
1532 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1534 # Description of functions in cr_api_function.sh #
1536 ## Function: cr_equal ##
1537 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
1538 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1539 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.
1540 See the 'cr' dir for more details.
1543 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1545 | parameter | description |
1546 | --------- | ----------- |
1547 | `<variable-name>` | Variable name in the CR |
1548 | `<target-value>` | Target value for the variable |
1549 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1551 ## Function: cr_api_check_all_sync_events() ##
1552 Check the contents of all ric events received for a callback id.
1556 | `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
1558 | parameter | description |
1559 | --------- | ----------- |
1560 | `<response-code>` | Expected http response code |
1561 | `<id>` | Id of the callback destination |
1562 | `EMPTY` | Indicator for an empty list |
1563 | `<ric-id>` | Id of the ric |
1565 # Description of functions in rapp_catalogue_api_function.sh #
1567 ## Function: rc_equal ##
1568 Tests if a variable value in the RAPP Catalogue is equal to a target value.
1569 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1570 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.
1571 See the 'cr' dir for more details.
1574 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1576 | parameter | description |
1577 | --------- | ----------- |
1578 | `<variable-name>` | Variable name in the RC |
1579 | `<target-value>` | Target value for the variable |
1580 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1582 ## Function: rapp_cat_api_get_services() ##
1583 Check all registered services.
1587 | `<response-code> [(<service-id> <version> <display-name> <description>)+ | EMPTY ]` |
1589 | parameter | description |
1590 | --------- | ----------- |
1591 | `<response-code>` | Expected http response code |
1592 | `<service-id>` | Id of the service |
1593 | `<version>` | Version of the service |
1594 | `<display-name>` | Dislay name of the service |
1595 | `<description>` | Description of the service |
1596 | `EMPTY` | Indicator for an empty list |
1598 ## Function: rapp_cat_api_put_service() ##
1599 Register a services.
1603 | `<response-code> <service-id> <version> <display-name> <description>` |
1605 | parameter | description |
1606 | --------- | ----------- |
1607 | `<response-code>` | Expected http response code |
1608 | `<service-id>` | Id of the service |
1609 | `<version>` | Version of the service |
1610 | `<display-name>` | Dislay name of the service |
1611 | `<description>` | Description of the service |
1613 ## Function: rapp_cat_api_get_service() ##
1614 Check a registered service.
1618 | `<response-code> <service-id> <version> <display-name> <description>` |
1620 | parameter | description |
1621 | --------- | ----------- |
1622 | `<response-code>` | Expected http response code |
1623 | `<service-id>` | Id of the service |
1624 | `<version>` | Version of the service |
1625 | `<display-name>` | Dislay name of the service |
1626 | `<description>` | Description of the service |
1628 ## Function: rapp_cat_api_delete_service() ##
1629 Check a registered service.
1633 | `<response-code> <service-id>` |
1635 | parameter | description |
1636 | --------- | ----------- |
1637 | `<response-code>` | Expected http response code |
1638 | `<service-id>` | Id of the service |
1643 Copyright (C) 2020 Nordix Foundation. All rights reserved.
1644 Licensed under the Apache License, Version 2.0 (the "License");
1645 you may not use this file except in compliance with the License.
1646 You may obtain a copy of the License at
1648 http://www.apache.org/licenses/LICENSE-2.0
1650 Unless required by applicable law or agreed to in writing, software
1651 distributed under the License is distributed on an "AS IS" BASIS,
1652 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1653 See the License for the specific language governing permissions and
1654 limitations under the License.