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 api.
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.
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'.
39 `count_json_elements.py` \
40 A python script returning the number of items in a json array.
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.
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.
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.
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.
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)
57 `cr_api_functions.sh` \
58 Contains functions for adapting towards the Callback receiver for checking received callback event.
61 # Description of functions in testcase_common.sh #
64 The script can be started with these arguments
68 | `local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ] [--use-local-image <app-nam> [<app-name>]*]` |
70 | parameter | description |
72 | `local` | only locally built images (in local docker respository) will be used for the Non-RT RIC components. CBS, Consul, DB will still use remote nexus images |
73 | `remote` | only remote images from nexus will be used. Images pulled if not present in local docker repository |
74 | `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
75 | `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
76 | `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
77 | `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
78 | `--env-file` | point to a file with environment variables (the previous default, test_env.sh, replaced with one env file for each branch in test/common) |
79 | `--use-local-image <app-nam> [<app-name>]*` | nnly applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC for Policy Agent, Control Panel, A1-controller and the Ric simulator |
82 ## Function: print_result ##
83 Print a test report of an auto-test script.
88 ## Function: start_timer ##
89 Start a timer for time measurement. Only one timer can be running.
92 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
94 ## Function: print_timer ##
95 Print the value of the timer (in seconds) previously started by 'start_timer'. (Note that timer is still running after this function). The result of the timer as well as the args to the function will also be printed in the test report.
98 | `<timer-message-to-print>` |
100 | parameter | description |
101 | --------- | ----------- |
102 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
104 ## Function: print_and_reset_timer ##
105 Print the value of the timer (in seconds) previously started by 'start_timer'. Also reset the timer to 0. The result of the timer as well as the args to the function will also be printed in the test report.
108 | `<timer-message-to-print>` |
110 | parameter | description |
111 | --------- | ----------- |
112 | `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
114 ## Function: deviation ##
115 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
118 | `<deviation-message-to-print>` |
120 | parameter | description |
121 | --------- | ----------- |
122 | `<deviation-message-to-print>` | Any text message describing the deviation. The text will also be printed in the test report. The intention is to mark known deviations, compared to required functionality |
124 ## Function: clean_containers ##
125 Stop and remove all containers. Containers not part of the test are not affected.
130 ## Function: auto_clean_containers ##
131 Stop and remove all containers. Containers not part of the test are not affected. This function has effect only if the test script is started with arg `auto-clean`. This intention is to use this function as the last step in an auto-test script.
136 ## Function: sleep_wait ##
137 Make the script sleep for a number of seconds.
140 | `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
142 | parameter | description |
143 | --------- | ----------- |
144 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
145 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
147 ## Function: generate_uuid ##
148 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
149 UUID is then automatically added to the policy id in GET/PUT/DELETE.
154 ## Function: consul_config_app ##
155 Function to load a json config from a file into consul for the Policy Agent
159 | `<json-config-file>` |
161 | parameter | description |
162 | --------- | ----------- |
163 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
165 ## Function: prepare_consul_config ##
166 Function to prepare a Consul config based on the previously configured (and started simulators). Note that all simulator must be running and the test script has to configure if http or https shall be used for the components (this is done by the functions 'use_simulator_http', 'use_simulator_https', 'use_sdnc_http', 'use_sdnc_https', 'use_mr_http', 'use_mr_https')
169 | `<deviation-message-to-print>` |
171 | parameter | description |
172 | --------- | ----------- |
173 | `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
174 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app' |
176 ## Function: start_consul_cbs ##
177 Start the Consul and CBS containers
182 ## Function: use_simulator_http ##
183 Use http for all API calls (A1) toward the simulator. This is the default. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
188 ## Function: use_simulator_https ##
189 Use https for all API calls (A1) toward the simulator. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
194 ## Function: start_ric_simulators ##
195 Start a group of simulator where a group may contain 1 more simulators.
198 | `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
200 | parameter | description |
201 | --------- | ----------- |
202 | `ricsim_g1|ricsim_g2|ricsim_g3` | Base name of the simulator. Each instance will have an postfix instance id added, starting on '1'. For examplle 'ricsim_g1_1', 'ricsim_g1_2' etc |
203 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
204 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
206 ## Function: start_control_panel ##
207 Start the Control Panel container
212 ## Function: start_sdnc ##
213 Start the SDNC A1 Controller container and its database container
218 ## Function: use_sdnc_http ##
219 Use http for all API calls towards the SDNC A1 Controller. This is the default. Note that this function shall be called before preparing the config for Consul.
224 ## Function: use_sdnc_http ##
225 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
230 ## Function: start_mr ##
231 Start the Message Router stub interface container
236 ## Function: use_mr_http ##
237 Use http for all Dmaap calls to the MR. This is the default. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
242 ## Function: use_mr_https ##
243 Use https for all Dmaap call to the MR. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
248 ## Function: start_cr ##
249 Start the Callback Receiver container
254 ## Function: use_cr_http ##
255 Use http for getting event from CR. The admin API is not affected. This is the default.
260 ## Function: use_cr_https ##
261 Use https for getting event from CR. The admin API is not affected.
262 Note: Not yet used as callback event is not fully implemented/deciced.
267 ## Function: start_prod_stub ##
268 Start the Producer stubb container
273 ## Function: use_prod_stub_http ##
274 Use http for the API. The admin API is not affected. This is the default protocol.
279 ## Function: use_prod_stub_https ##
280 Use https for the API. The admin API is not affected.
285 ## Function: start_policy_agent ##
286 Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent.
291 ## Function: use_agent_stand_alone ##
292 Configure to run the Policy Agent as a stand alone container or app. See also 'start_policy_agent'
297 ## Function: use_agent_rest_http ##
298 Use http for all API calls to the Policy Agent. This is the default.
303 ## Function: use_agent_rest_https ##
304 Use https for all API calls to the Policy Agent.
309 ## Function: use_agent_dmaap_http ##
310 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
315 ## Function: use_agent_dmaap_https ##
316 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
321 ## Function: set_agent_debug ##
322 Configure the Policy Agent log on debug level. The Policy Agent must be running.
327 ## Function: set_agent_trace ##
328 Configure the Policy Agent log on trace level. The Policy Agent must be running.
333 ## Function: use_agent_retries ##
334 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
337 | `[<response-code>]*` |
339 | parameter | description |
340 | --------- | ----------- |
341 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'. |
343 ## Function: start_ecs ##
344 Start the ECS container.
349 ## Function: restart_ecs ##
350 Restart the ECS container.
355 ## Function: use_ecs_rest_http ##
356 Use http for all API calls to the ECS. This is the default protocol.
361 ## Function: use_ecs_rest_https ##
362 Use https for all API calls to the ECS.
367 ## Function: use_ecs_dmaap_http ##
368 Send and recieve all API calls to the ECS over Dmaap via the MR using http.
373 ## Function: use_ecs_dmaap_https ##
374 Send and recieve all API calls to the ECS over Dmaap via the MR using https.
379 ## Function: set_ecs_debug ##
380 Configure the ECS log on debug level. The ECS must be running.
385 ## Function: set_ecs_trace ##
386 Configure the ECS log on trace level. The ECS must be running.
391 ## Function: check_policy_agent_logs ##
392 Check the Policy Agent log for any warnings and errors and print the count of each.
397 ## Function: check_ecs_logs ##
398 Check the ECS log for any warnings and errors and print the count of each.
403 ## Function: check_control_panel_logs ##
404 Check the Control Panel log for any warnings and errors and print the count of each.
409 ## Function: check_sdnc_logs ##
410 Check the SDNC log for any warnings and errors and print the count of each.
415 ## Function: store_logs ##
416 Take a snap-shot of all logs for all running containers and stores them in `./logs/<ATC-id>`. All logs will get the specified prefix in the file name. In general, one of the last steps in an auto-test script shall be to call this function. If logs shall be taken several times during a test script, different prefixes shall be used each time.
419 | `<logfile-prefix>` |
421 | parameter | description |
422 | --------- | ----------- |
423 | `<logfile-prefix>` | Log file prefix |
426 ## Function: mr_equal ##
427 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
428 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
429 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes equal to the target value or not.
430 See the 'mrstub' dir for more details.
433 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
435 | parameter | description |
436 | --------- | ----------- |
437 | `<variable-name>` | Variable name in the MR |
438 | `<target-value>` | Target value for the variable |
439 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
441 ## Function: mr_greater ##
442 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
443 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
444 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the variable value becomes greater than the target value or not.
445 See the 'mrstub' dir for more details.
448 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
450 | parameter | description |
451 | --------- | ----------- |
452 | `<variable-name>` | Variable name in the MR |
453 | `<target-value>` | Target value for the variable |
454 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value |
456 ## Function: mr_read ##
457 Reads the value of a variable in the Message Router (MR) simulator. The value is intended to be passed to a env variable in the test script.
458 See the 'mrstub' dir for more details.
461 | `<variable-name>` |
463 | parameter | description |
464 | --------- | ----------- |
465 | `<variable-name>` | Variable name in the MR |
467 ## Function: mr_print ##
468 Prints the value of a variable in the Message Router (MR) simulator.
469 See the 'mrstub' dir for more details.
472 | `<variable-name>` |
474 | parameter | description |
475 | --------- | ----------- |
476 | `<variable-name>` | Variable name in the MR |
478 ## Function: indent1 ##
479 Indent every line of a command output with one space char.
484 ## Function: indent2 ##
485 Indent every line of a command output with two space chars.
490 # Description of functions in testsuite_common.sh #
492 ## Function: suite_setup ##
493 Sets up the test suite and prints out a heading.
499 Print out the overall result of the executed test cases.
504 # Description of functions in agent_api_function.sh #
507 Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
509 ## Function: api_equal() ##
511 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
512 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
513 With the timeout, the test waits up to the timeout seconds before setting pass or fail depending on if the array length becomes equal to the target value or not.
514 See the 'cr' dir for more details.
518 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
520 | parameter | description |
521 | --------- | ----------- |
522 | `<variable-name>` | Relative url. Example 'json:policy_types' - checks the json array length of the url /policy_types |
523 | `<target-value>` | Target value for the length |
524 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value |
526 ## Function: api_get_policies() ##
527 Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
528 To test the response code only, provide the response code parameter as well as the following three parameters.
529 To also test the response payload add the 'NOID' for an expected empty array or repeat the last five/seven parameters for each expected policy.
533 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]` |
537 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]` |
539 | parameter | description |
540 | --------- | ----------- |
541 | `<response-code>` | Expected http response code |
542 | `<ric-id>` | Id of the ric |
543 | `NORIC` | Indicator that no ric is provided |
544 | `<service-id>` | Id of the service |
545 | `NOSERVICE` | Indicator that no service id is provided |
546 | `<policy-type-id>` | Id of the policy type |
547 | `NOTYPE` | Indicator that no type id is provided |
548 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
549 | `<policy-id>` | Id of the policy |
550 | `EMPTY` | Indicate for the special empty policy type |
551 | `transient` | Transient, true or false |
552 | `notification-url` | Url for notifications |
553 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
556 ## Function: api_get_policy() ##
557 Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
558 To test the the response code only, provide the expected response code and policy id.
559 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
563 | `<response-code> <policy-id> [<template-file>]` |
567 | `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
569 | parameter | description |
570 | --------- | ----------- |
571 | `<response-code>` | Expected http response code |
572 | `<policy-id>` | Id of the policy |
573 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
574 | `<service-id>` | Id of the service |
575 | `<ric-id>` | Id of the ric |
576 | `<policy-type-id>` | Id of the policy type |
577 | `NOTYPE` | Indicator that no type id is provided |
578 | `transient` | Transient, true or false |
579 | `notification-url` | Url for notifications |
581 ## Function: api_put_policy() ##
582 Test of PUT '/policy' or V2 PUT '/policies'.
583 If more than one policy shall be created, add a count value to indicate the number of policies to create. Note that if more than one policy shall be created the provided policy-id must be numerical (will be used as the starting id).
587 | `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
591 | `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
593 | parameter | description |
594 | --------- | ----------- |
595 | `<response-code>` | Expected http response code |
596 | `<service-id>` | Id of the service |
597 | `<ric-id>` | Id of the ric |
598 | `<policy-type-id>` | Id of the policy type |
599 | `<policy-id>` | Id of the policy. This value shall be a numeric value if more than one policy shall be created |
600 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
601 | `notification-url` | Url for notifications |
602 |`NOURL`| Indicator for no url |
603 | `<template-file>` | Path to the template file for the policy |
604 | `<count>` | An optional count (default is 1). If a value greater than 1 is given, the policy ids will use the given policy id as the first id and add 1 to that id for each new policy |
606 ## Function: api_put_policy_batch() ##
607 This tests the same as function 'api_put_policy' except that all put requests are sent to dmaap in one go and then the responses are polled one by one.
608 If the agent api is not configured to use dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
609 For arg list and parameters, see 'api_put_policy'.
611 ## Function: api_put_policy_parallel() ##
612 This tests the same as function 'api_put_policy' except that the policy create is spread out over a number of processes and it only uses the agent rest API. The total number of policies created is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the creation of all the policies in one ric.
616 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
620 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>`
622 | parameter | description |
623 | --------- | ----------- |
624 | `<response-code>` | Expected http response code |
625 | `<service-id>` | Id of the service |
626 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
627 | `<number-of-rics>` | The number of rics, assuming the first index is '1'. The index is added to the 'ric-id-base' id |
628 | `<policy-type-id>` | Id of the policy type |
629 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
630 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
631 | `notification-url` | Url for notifications |
632 | `<template-file>` | Path to the template file for the policy |
633 | `<count-per-ric>` | Number of policies per ric |
634 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
636 ## Function: api_delete_policy() ##
637 This tests the DELETE '/policy' or V2 DELETE '/v2/policies/{policy_id}'. Removes the indicated policy or a 'count' number of policies starting with 'policy-id' as the first id.
641 | `<response-code> <policy-id> [<count>]`
643 | parameter | description |
644 | --------- | ----------- |
645 | `<response-code>` | Expected http response code |
646 | `<policy-id>` | Id of the policy |
647 | `<count>` | An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
649 ## Function: api_delete_policy_batch() ##
650 This tests the same as function 'api_delete_policy' except that all delete requests are sent to dmaap in one go and then the responses are polled one by one.
651 If the agent api is not configured to used dmaap (see 'use_agent_dmaap', 'use_agent_rest_http' and 'use_agent_rest_https'), an error message is printed.
652 For arg list and parameters, see 'api_delete_policy'.
654 ## Function: api_delete_policy_parallel() ##
655 This tests the same as function 'api_delete_policy' except that the policy delete is spread out over a number of processes and it only uses the agent rest API. The total number of policies deleted is determined by the product of the parameters 'number-of-rics' and 'count'. The parameter 'number-of-threads' shall be selected to be not evenly divisible by the product of the parameters 'number-of-rics' and 'count' - this is to ensure that one process does not handle the deletion of all the policies in one ric.
659 | `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
661 | parameter | description |
662 | --------- | ----------- |
663 | `<response-code>` | Expected http response code |
664 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
665 | `<number-of-rics>` | The number of rics, assuming the first index is '1' |
666 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
667 | `<count-per-ric>` | Number of policies per ric |
668 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
671 ## Function: api_get_policy_ids() ##
673 Test of GET '/policy_ids' or V2 GET '/v2/policies'.
674 To test response code only, provide the response code parameter as well as the following three parameters.
675 To also test the response payload add the 'NOID' for an expected empty array or repeat the 'policy-instance-id' for each expected policy id.
679 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
681 | parameter | description |
682 | --------- | ----------- |
683 | `<response-code>` | Expected http response code |
684 | `<ric-id>` | Id of the ric |
685 | `NORIC` | Indicator that no ric is provided |
686 | `<service-id>` | Id of the service |
687 | `NOSERVICE` | Indicator that no service id is provided |
688 | `type-id>` | Id of the policy type |
689 | `NOTYPE` | Indicator that no type id is provided |
690 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
691 | `<policy-instance-id>` | Id of the policy |
693 ## Function: api_get_policy_schema() ##
694 Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
695 To test the response code only, provide the expected response code and policy type id.
696 To test the contents of the returned json schema, add a path to a schema file to compare with.
700 | `<response-code> <policy-type-id> [<schema-file>]` |
702 | parameter | description |
703 | --------- | ----------- |
704 | `<response-code>` | Expected http response code |
705 | `<policy-type-id>` | Id of the policy type |
706 | `<schema-file>` | Path to the schema file for the policy type |
708 ## Function: api_get_policy_schema() ##
709 Test of GET '/policy_schema' and optional check of the returned json schema.
710 To test the response code only, provide the expected response code and policy type id.
711 To test the contents of the returned json schema, add a path to a schema file to compare with.
715 | `<response-code> <policy-type-id> [<schema-file>]` |
717 | parameter | description |
718 | --------- | ----------- |
719 | `<response-code>` | Expected http response code |
720 | `<policy-type-id>` | Id of the policy type |
721 | `<schema-file>` | Path to the schema file for the policy type |
723 ## Function: api_get_policy_schemas() ##
724 Test of GET '/policy_schemas' and optional check of the returned json schemas.
725 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
726 To test the contents of the returned json schema, add a path to a schema file to compare with (or NOFILE to represent an empty '{}' type)
730 | `<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*` |
732 | parameter | description |
733 | --------- | ----------- |
734 | `<response-code>` | Expected http response code |
735 | `<ric-id>` | Id of the ric |
736 | `NORIC` | No ric id given |
737 | `<schema-file>` | Path to the schema file for the policy type |
738 | `NOFILE` | Indicate the template for an empty type |
740 ## Function: api_get_policy_status() ##
741 Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
745 | `<response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)` |
747 | parameter | description |
748 | --------- | ----------- |
749 | `<response-code>` | Expected http response code |
750 | `<policy-id>` | Id of the policy |
751 | `STD` | Indicator of status of Standarized A1 |
752 | `<enforce-status>` | Enforcement status |
753 | `<reason>` | Optional reason |
754 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
755 | `<instance-status>` | Instance status |
756 | `<has-been-deleted>` | Deleted status, true or false |
758 ## Function: api_get_policy_types() ##
759 Test of GET '/policy_types' or V2 GET '/v2/policy-types' and optional check of the returned ids.
760 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
761 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
765 | `<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]` |
767 | parameter | description |
768 | --------- | ----------- |
769 | `<response-code>` | Expected http response code |
770 | `<ric-id>` | Id of the ric |
771 | `NORIC` | No ric id given |
772 | `<policy-type-id>` | Id of the policy type |
773 | `EMPTY` | Indicate the empty type |
775 ## Function: api_get_status() ##
776 Test of GET /status or V2 GET /status
780 | `<response-code>` |
782 | parameter | description |
783 | --------- | ----------- |
784 | `<response-code>` | Expected http response code |
786 ## Function: api_get_ric() ##
787 Test of GET '/ric' or V2 GET '/v2/rics/ric'
788 To test the response code only, provide the expected response code and managed element id.
789 To test the returned ric id, provide the expected ric id.
793 | `<reponse-code> <managed-element-id> [<ric-id>]` |
797 | `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
799 | parameter | description |
800 | --------- | ----------- |
801 | `<response-code>` | Expected http response code |
802 | `<managed-element-id>` | Id of the managed element |
803 | `NOME` | Indicator for no ME |
804 | `ric-id` | Id of the ric |
805 | `NORIC` | Indicator no RIC |
806 | `string-of-ricinfo` | String of ric info |
808 ## Function: api_get_rics() ##
809 Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
810 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
811 To test also the returned payload, add the formatted string of info in the returned payload.
812 Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
813 Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
817 | `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
819 | parameter | description |
820 | --------- | ----------- |
821 | `<response-code>` | Expected http response code |
822 | `<policy-type-id>` | Policy type id of the ric |
823 | `NOTYPE>` | No type given |
824 | `<space-separate-string-of-ricinfo>` | A space separated string of ric info - needs to be quoted |
826 ## Function: api_put_service() ##
827 Test of PUT '/service' or V2 PUT '/service'.
830 | `<response-code> <service-name> <keepalive-timeout> <callbackurl>` |
832 | parameter | description |
833 | --------- | ----------- |
834 | `<response-code>` | Expected http response code |
835 | `<service-name>` | Service name |
836 | `<keepalive-timeout>` | Timeout value |
837 | `<callbackurl>` | Callback url |
839 ## Function: api_get_services() ##
840 Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
841 To test only the response code, omit all parameters except the expected response code.
842 To test the returned json, provide the parameters after the response code.
846 | `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
848 | parameter | description |
849 | --------- | ----------- |
850 | `<response-code>` | Expected http response code |
851 | <query-service-name>` | Service name for the query |
852 | <target-service-name>` | Target service name|
853 | `<keepalive-timeout>` | Timeout value |
854 | `<callbackurl>` | Callback url |
855 | `NOSERVICE` | Indicator of no target service name |
857 ## Function: api_get_service_ids() ##
858 Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
862 | `<response-code> [<service-name>]*` |
864 | parameter | description |
865 | --------- | ----------- |
866 | `<response-code>` | Expected http response code |
867 | `<service-name>` | Service name |
869 ## Function: api_delete_services() ##
870 Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
874 | `<response-code> [<service-name>]*` |
876 | parameter | description |
877 | --------- | ----------- |
878 | `<response-code>` | Expected http response code |
879 | `<service-name>` | Service name |
881 ## Function: api_put_services_keepalive() ##
882 Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
886 | <response-code> <service-name>` |
888 | parameter | description |
889 | --------- | ----------- |
890 | `<response-code>` | Expected http response code |
891 | `<service-name>` | Service name |
893 # Description of functions in ricsimulator_api_functions.sh #
894 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
896 ## Function: sim_equal ##
897 Tests if a variable value in the RIC simulator is equal to a target value.
898 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
899 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.
900 See the 'a1-interface' repo for more details.
904 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
906 | parameter | description |
907 | --------- | ----------- |
908 | `<variable-name>` | Variable name in the ric simulator |
909 | `<target-value>` | Target value for the variable |
910 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
912 ## Function: sim_print ##
913 Prints the value of a variable in the RIC simulator.
914 See the 'a1-interface' repo for more details.
918 | `<variable-name>` |
920 | parameter | description |
921 | --------- | ----------- |
922 | `<variable-name>` | Variable name in the RIC simulator |
925 ## Function: sim_contains_str ##
926 Tests if a variable value in the RIC simulator contains a target string.
927 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string 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 contains the target string 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 substring for the variable |
939 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
941 ## Function: sim_put_policy_type ##
942 Loads a policy type to the simulator
946 | `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
948 | parameter | description |
949 | --------- | ----------- |
950 | `<response-code>` | Expected http response code |
951 | `<ric-id>` | Id of the ric |
952 | `<policy-type-id>` | Id of the policy type |
953 | `<policy-type-file>` | Path to the schema file of the policy type |
955 ## Function: sim_delete_policy_type ##
956 Deletes a policy type from the simulator
960 | `<response-code> <ric-id> <policy_type_id>` |
962 | parameter | description |
963 | --------- | ----------- |
964 | `<response-code>` | Expected http response code |
965 | `<ric-id>` | Id of the ric |
966 | `<policy-type-id>` | Id of the policy type |
968 ## Function: sim_post_delete_instances ##
969 Deletes all instances (and status), for one ric
973 | `<response-code> <ric-id>` |
975 | parameter | description |
976 | --------- | ----------- |
977 | `<response-code>` | Expected http response code |
978 | `<ric-id>` | Id of the ric |
981 ## Function: sim_post_delete_all ##
982 Deletes all types, instances (and status), for one ric
986 | `<response-code> <ric-id>` |
988 | parameter | description |
989 | --------- | ----------- |
990 | `<response-code>` | Expected http response code |
991 | `<ric-id>` | Id of the ric |
993 ## Function: sim_post_forcedresponse ##
994 Sets (or resets) response code for next (one) A1 message, for one ric.
995 The intention is to simulate error response on the A1 interface.
999 | `<response-code> <ric-id> [<forced_response_code>]`|
1001 | parameter | description |
1002 | --------- | ----------- |
1003 | `<response-code>` | Expected http response code |
1004 | `<ric-id>` | Id of the ric |
1005 | `<forced_response_code>` | Http response code to send |
1007 ## Function: sim_post_forcedelay ##
1008 Sets (or resets) A1 response delay, for one ric
1009 The intention is to delay responses on the A1 interface. Setting remains until removed.
1013 | `<response-code> <ric-id> [<delay-in-seconds>]`|
1015 | parameter | description |
1016 | --------- | ----------- |
1017 | `<response-code>` | Expected http response code |
1018 | `<ric-id>` | Id of the ric |
1019 | `<delay-in-seconds>` | Delay in seconds. If omitted, the delay is removed |
1022 # Description of functions in controller_api_functions.sh #
1023 The file contains a selection of the possible API tests towards the a1-controller
1025 ## Function: controller_api_get_A1_policy_ids ##
1026 Test of GET policy ids towards OSC or STD type simulator.
1027 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
1028 To test the response payload, include the ids of the expexted response.
1032 | `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
1034 | parameter | description |
1035 | --------- | ----------- |
1036 | `<response-code>` | Expected http response code |
1037 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1038 | `<ric-id>` | Id of the ric |
1039 | `policy-type-id>` | Id of the policy type |
1040 | `<policy-id>` | Id of the policy |
1041 | `STD` | Indicator of status of Standarized A1 |
1044 ## Function: controller_api_get_A1_policy_type ##
1045 Test of GET a policy type (OSC only)
1049 | `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
1051 | parameter | description |
1052 | --------- | ----------- |
1053 | `<response-code>` | Expected http response code |
1054 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1055 | `<ric-id>` | Id of the ric |
1056 | `policy-type-id>` | Id of the policy type |
1057 | `policy-type-file>` | Optional schema file to compare the returned type with |
1059 ## Function: controller_api_delete_A1_policy ##
1060 Deletes a policy instance
1064 | `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
1066 | parameter | description |
1067 | --------- | ----------- |
1068 | `<response-code>` | Expected http response code |
1069 | `STD` | Indicator of status of Standarized A1 |
1070 | `<ric-id>` | Id of the ric |
1071 | `<policy-id>` | Id of the policy |
1072 | `policy-type-id>` | Id of the policy type |
1073 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1074 | `policy-type-file>` | Optional schema file to compare the returned type with |
1076 ## Function: controller_api_put_A1_policy ##
1077 Creates a policy instance
1081 | `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
1083 | parameter | description |
1084 | --------- | ----------- |
1085 | `<response-code>` | Expected http response code |
1086 | `STD` | Indicator of status of Standarized A1 |
1087 | `<ric-id>` | Id of the ric |
1088 | `<policy-id>` | Id of the policy |
1089 | `<template-file>` | Path to the template file of the policy|
1090 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1091 | `<policy-type-id>` | Id of the policy type |
1093 ## Function: controller_api_get_A1_policy_status ##
1094 Checks the status of a policy
1098 | `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
1100 | parameter | description |
1101 | --------- | ----------- |
1102 | `<response-code>` | Expected http response code |
1103 | `STD` | Indicator of status of Standarized A1 |
1104 | `<ric-id>` | Id of the ric |
1105 | `<policy-id>` | Id of the policy |
1106 | `<enforce-status>` | Enforcement status |
1107 | `<reason>` | Optional reason |
1108 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
1109 | `<policy-type-id>` | Id of the policy type |
1110 | `<instance-status>` | Instance status |
1111 | `<has-been-deleted>` | Deleted status, true or false |
1116 # Description of functions in ecs_api_function.sh #
1118 ## Function: ecs_api_a1_get_job_ids() ##
1119 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
1120 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1121 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1125 | `<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1127 | parameter | description |
1128 | --------- | ----------- |
1129 | `<response-code>` | Expected http response code |
1130 | `<type-id>` | Id of the EI type |
1131 | `<owner-id>` | Id of the job owner |
1132 | `NOOWNER` | No owner is given |
1133 | `<job-id>` | Id of the expected job |
1134 | `EMPTY` | The expected list of job id shall be empty |
1136 ## Function: ecs_api_a1_get_type() ##
1137 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
1138 To test the response code only, provide the response code parameter as well as the type-id.
1139 To also test the response payload add a path to the expected schema file.
1143 | `<response-code> <type-id> [<schema-file>]` |
1145 | parameter | description |
1146 | --------- | ----------- |
1147 | `<response-code>` | Expected http response code |
1148 | `<type-id>` | Id of the EI type |
1149 | `<schema-file>` | Path to a schema file to compare with the returned schema |
1151 ## Function: ecs_api_a1_get_type_ids() ##
1152 Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
1153 To test the response code only, provide the response only.
1154 To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
1158 | `<response-code> [ (EMPTY | [<type-id>]+) ]` |
1160 | parameter | description |
1161 | --------- | ----------- |
1162 | `<response-code>` | Expected http response code |
1163 | `EMPTY` | The expected list of type ids shall be empty |
1164 | `<type-id>` | Id of the EI type |
1166 ## Function: ecs_api_a1_get_job_status() ##
1167 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
1168 To test the response code only, provide the response code, type id and job id.
1169 To also test the response payload add the expected status.
1173 | `<response-code> <type-id> <job-id> [<status>]` |
1175 | parameter | description |
1176 | --------- | ----------- |
1177 | `<response-code>` | Expected http response code |
1178 | `<type-id>` | Id of the EI type |
1179 | `<job-id>` | Id of the job |
1180 | `<status>` | Expected status |
1182 ## Function: ecs_api_a1_get_job() ##
1183 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
1184 To test the response code only, provide the response code, type id and job id.
1185 To also test the response payload add the remaining parameters.
1189 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1191 | parameter | description |
1192 | --------- | ----------- |
1193 | `<response-code>` | Expected http response code |
1194 | `<type-id>` | Id of the EI type |
1195 | `<job-id>` | Id of the job |
1196 | `<target-url>` | Expected target url for the job |
1197 | `<owner-id>` | Expected owner for the job |
1198 | `<template-job-file>` | Path to a job template for job parameters of the job |
1200 ## Function: ecs_api_a1_delete_job() ##
1201 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1202 To test, provide all the specified parameters.
1206 | `<response-code> <type-id> <job-id> |
1208 | parameter | description |
1209 | --------- | ----------- |
1210 | `<response-code>` | Expected http response code |
1211 | `<type-id>` | Id of the EI type |
1212 | `<job-id>` | Id of the job |
1214 ## Function: ecs_api_a1_put_job() ##
1215 Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1216 To test, provide all the specified parameters.
1220 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
1222 | parameter | description |
1223 | --------- | ----------- |
1224 | `<response-code>` | Expected http response code |
1225 | `<type-id>` | Id of the EI type |
1226 | `<job-id>` | Id of the job |
1227 | `<target-url>` | Target url for the job |
1228 | `<owner-id>` | Owner of the job |
1229 | `<template-job-file>` | Path to a job template for job parameters of the job |
1231 ## Function: ecs_api_edp_get_type_ids() ##
1232 Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
1233 To test the response code only, provide the response code.
1234 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1238 | `<response-code> [ EMPTY | <type-id>+]` |
1240 | parameter | description |
1241 | --------- | ----------- |
1242 | `<response-code>` | Expected http response code |
1243 | `<type-id>` | Id of the EI type |
1244 | `EMPTY` | The expected list of type ids shall be empty |
1246 ## Function: ecs_api_edp_get_producer_status() ##
1247 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
1248 To test the response code only, provide the response code and producer id.
1249 To also test the response payload add the expected status.
1253 | `<response-code> <producer-id> [<status>]` |
1255 | parameter | description |
1256 | --------- | ----------- |
1257 | `<response-code>` | Expected http response code |
1258 | `<producer-id>` | Id of the producer |
1259 | `<status>` | The expected status string |
1261 ## Function: ecs_api_edp_get_producer_ids() ##
1262 Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
1263 To test the response code only, provide the response.
1264 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).
1268 | `<response-code> [ EMPTY | <producer-id>+]` |
1270 | parameter | description |
1271 | --------- | ----------- |
1272 | `<response-code>` | Expected http response code |
1273 | `<producer-id>` | Id of the producer |
1274 | `EMPTY` | The expected list of type ids shall be empty |
1276 ## Function: ecs_api_edp_get_type() ##
1277 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
1278 To test the response code only, provide the response and the type-id.
1279 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).
1283 | `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
1285 | parameter | description |
1286 | --------- | ----------- |
1287 | `<response-code>` | Expected http response code |
1288 | `<type-id>` | Id of the EI type |
1289 | `<job-schema-file>` | Path to a job schema file |
1290 | `<producer-id>` | Id of the producer |
1291 | `EMPTY` | The expected list of type ids shall be empty |
1293 ## Function: ecs_api_edp_get_producer() ##
1294 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
1295 To test the response code only, provide the response and the producer-id.
1296 To also test the response payload add the remaining parameters defining thee producer.
1300 | `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
1302 | parameter | description |
1303 | --------- | ----------- |
1304 | `<response-code>` | Expected http response code |
1305 | `<producer-id>` | Id of the producer |
1306 | `<create-callback>` | Callback for create job |
1307 | `<delete-callback>` | Callback for delete job |
1308 | `<supervision-callback>` | Callback for producer supervision |
1309 | `<type-id>` | Id of the EI type |
1310 | `<schema-file>` | Path to a schema file |
1311 | `EMPTY` | The expected list of type schema pairs shall be empty |
1313 ## Function: ecs_api_edp_delete_producer() ##
1314 Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
1315 To test, provide all parameters.
1319 | `<response-code> <producer-id>` |
1321 | parameter | description |
1322 | --------- | ----------- |
1323 | `<response-code>` | Expected http response code |
1324 | `<producer-id>` | Id of the producer |
1326 ## Function: ecs_api_edp_put_producer() ##
1327 Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
1328 To test, provide all parameters. The list of type/schema pair may be empty.
1332 | `<response-code> <producer-id> <create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
1334 | parameter | description |
1335 | --------- | ----------- |
1336 | `<response-code>` | Expected http response code |
1337 | `<producer-id>` | Id of the producer |
1338 | `<create-callback>` | Callback for create job |
1339 | `<delete-callback>` | Callback for delete job |
1340 | `<supervision-callback>` | Callback for producer supervision |
1341 | `<type-id>` | Id of the EI type |
1342 | `<schema-file>` | Path to a schema file |
1343 | `EMPTY` | The list of type/schema pairs is empty |
1345 ## Function: ecs_api_edp_get_producer_jobs() ##
1346 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
1347 To test the response code only, provide the response and the producer-id.
1348 To also test the response payload add the remaining parameters.
1352 | `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)` |
1354 | parameter | description |
1355 | --------- | ----------- |
1356 | `<response-code>` | Expected http response code |
1357 | `<producer-id>` | Id of the producer |
1358 | `<job-id>` | Id of the job |
1359 | `<type-id>` | Id of the EI type |
1360 | `<target-url>` | Target url for data delivery |
1361 | `<template-job-file>` | Path to a job template file |
1362 | `EMPTY` | The list of job/type/target/job-file tuples is empty |
1364 ## Function: ecs_api_service_status() ##
1365 Test of GET '/status'.
1369 | `<response-code>` |
1371 | parameter | description |
1372 | --------- | ----------- |
1373 | `<response-code>` | Expected http response code |
1376 # Description of functions in prodstub_api_function.sh #
1378 ## Function: prodstub_arm_producer() ##
1379 Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
1383 | `<response-code> <producer-id> [<forced_response_code>]` |
1385 | parameter | description |
1386 | --------- | ----------- |
1387 | `<response-code>` | Expected http response code |
1388 | `<producer-id>` | Id of the producer |
1389 | `<forced_response_code>` | Forced response code for the producer callback url |
1391 ## Function: prodstub_arm_job_create() ##
1392 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.
1396 | `<response-code> <job-id> [<forced_response_code>]` |
1398 | parameter | description |
1399 | --------- | ----------- |
1400 | `<response-code>` | Expected http response code |
1401 | `<job-id>` | Id of the job |
1402 | `<forced_response_code>` | Forced response code for the create callback url |
1404 ## Function: prodstub_arm_job_delete() ##
1405 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.
1409 | `<response-code> <job-id> [<forced_response_code>]` |
1411 | parameter | description |
1412 | --------- | ----------- |
1413 | `<response-code>` | Expected http response code |
1414 | `<job-id>` | Id of the job |
1415 | `<forced_response_code>` | Forced response code for the delete callback url |
1417 ## Function: prodstub_arm_type() ##
1418 Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
1422 | `<response-code> <producer-id> <type-id>` |
1424 | parameter | description |
1425 | --------- | ----------- |
1426 | `<response-code>` | Expected http response code |
1427 | `<producer-id>` | Id of the producer |
1428 | `<type-id>` | Id of the type |
1430 ## Function: prodstub_disarm_type() ##
1431 Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
1435 | `<response-code> <producer-id> <type-id>` |
1437 | parameter | description |
1438 | --------- | ----------- |
1439 | `<response-code>` | Expected http response code |
1440 | `<producer-id>` | Id of the producer |
1441 | `<type-id>` | Id of the type |
1443 ## Function: prodstub_check_jobdata() ##
1444 Check a job in the prodstub towards the list of provided parameters.
1448 | `<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>` |
1450 | parameter | description |
1451 | --------- | ----------- |
1452 | `<response-code>` | Expected http response code |
1453 | `<producer-id>` | Id of the producer |
1454 | `<job-id>` | Id of the job |
1455 | `<type-id>` | Id of the type |
1456 | `<target-url>` | Target url for data delivery |
1457 | `<template-job-file>` | Path to a job template file |
1459 ## Function: prodstub_equal ##
1460 Tests if a variable value in the prodstub is equal to a target value.
1461 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1462 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.
1466 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1468 | parameter | description |
1469 | --------- | ----------- |
1470 | `<variable-name>` | Variable name in the prostub |
1471 | `<target-value>` | Target value for the variable |
1472 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1474 # Description of functions in cr_api_function.sh #
1478 ## Function: cr_equal ##
1479 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
1480 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1481 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.
1482 See the 'cr' dir for more details.
1485 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1487 | parameter | description |
1488 | --------- | ----------- |
1489 | `<variable-name>` | Variable name in the CR |
1490 | `<target-value>` | Target value for the variable |
1491 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1493 ## Function: cr_api_check_all_sync_events() ##
1494 Check the contents of all ric events received for a callback id.
1498 | `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
1500 | parameter | description |
1501 | --------- | ----------- |
1502 | `<response-code>` | Expected http response code |
1503 | `<id>` | Id of the callback destination |
1504 | `EMPTY` | Indicator for an empty list |
1505 | `<ric-id>` | Id of the ric |
1510 Copyright (C) 2020 Nordix Foundation. All rights reserved.
1511 Licensed under the Apache License, Version 2.0 (the "License");
1512 you may not use this file except in compliance with the License.
1513 You may obtain a copy of the License at
1515 http://www.apache.org/licenses/LICENSE-2.0
1517 Unless required by applicable law or agreed to in writing, software
1518 distributed under the License is distributed on an "AS IS" BASIS,
1519 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1520 See the License for the specific language governing permissions and
1521 limitations under the License.