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. The test environment supports both test with docker and kubernetes(still experimental)
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 ##
7 `agent_api_functions.sh` \
8 Contains functions for adapting towards the Policy Management Service (PMS) API, also via dmaap (using a message-router stub interface)
11 A common curl based function for the agent and ecs apis. Also partly used for the Callback receiver and RAPP Catalogue apis.
14 Cleans all services, deployments, pods, replica set etc started by the test environment in kubernetes.
17 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'.
19 `consul_cbs_function.sh` \
20 Contains functions for managing Consul and CBS as well as create the configuration for the PMS.
22 `control_panel_api_function.sh` \
23 Contains functions for managing Control Panel.
25 `controller_api_functions.sh` \
26 Contains functions for adaping towards the A1-controller API.
28 `count_json_elements.py` \
29 A python script returning the number of items in a json array.
31 `cr_api_functions.sh` \
32 Contains functions for adapting towards the Callback receiver for checking received callback event.
34 `create_policies_process.py` \
35 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.
37 `create_rics_json.py` \
38 A python script to create a json file from a formatted string of ric info. Helper for the test enviroment.
40 `delete_policies_process.py` \
41 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.
44 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)
46 `ecs_api_functions.sh` \
47 Contains functions for adapting towards the ECS API
49 `extract_sdnc_reply.py` \
50 A python script to extract the information from an sdnc (A1 Controller) reply json. Helper for the test environment.
52 `gateway_api_functions.sh` \
53 Contains functions for managing the Non-RT RIC Gateway
55 `http_proxy_api_functions.sh` \
56 Contains functions for managing the Http Proxy
58 `kube_proxy_api_functions.sh` \
59 Contains functions for managing the Kube Proxy - to gain access to all services pod inside a kube cluster.
61 `mr_api_functions.sh` \
62 Contains functions for managing the MR Stub and the Dmaap Message Router
64 `prodstub_api_functions.sh` \
65 Contains functions for adapting towards the Producer stub interface - simulates a producer.
67 `rapp_catalogue_api_functions.sh` \
68 Contains functions for adapting towards the RAPP Catalogue.
70 `ricsimulator_api_functions.sh` \
71 Contains functions for adapting towards the RIC (A1) simulator admin API.
74 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.
75 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'.
77 `testcase_common.sh` \
78 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.
79 The included functions are described in detail further below.
81 `testsuite_common.sh` \
82 Common functions for running two or more auto test scripts as a suite.
84 ## Integration of a new applicaton
86 Integration a new application to the test environment involves the following steps.
88 * Choose a short name for the application. Should be a uppcase name. For example, the NonRTRIC Gateway has NGW as short name.
89 This short name shall be added to the testengine_config.sh. See that file for detailed instructions.
91 * Create a file in this directory using the pattern `<application-name>_api_functions.sh`.
92 This file must implement the following functions used by the test engine. Note that functions must include the application short name in the function name. If the application does not run in kubernetes, then the last three functions in the list can be omitted.
96 | __<app-short_name>_imagesetup |
97 | __<app-short_name>_imagepull |
98 | __<app-short_name>_imagebuild |
99 | __<app-short_name>_image_data |
100 | __<app-short_name>_kube_scale_zero |
101 | __<app-short_name>_kube_scale_zero_and_wait |
102 | __<app-short_name>_kube_delete_all |
104 In addition, all other functions used for testing of the application shall also be added to the file. For example functions to start the application, setting interface parameters as well as functions to send rest call towards the api of the application and validating the result.
106 * Add the application variables to api_curl.sh. This file contains a generic function to make rest calls to an api. It also supports switching betweeen direct rest calls or rest calls via messsage router.
108 * Create a directory beneath in the simulator-group dir. This new directory shall contain docker-compose files, config files (with or without variable substitutions) and kubernetes resource files.
110 All docker-compose files and all kubernetes resource files need to defined special lables. These lables are used by the test enginge to identify containers and resources started and used by the test engine.
112 | Label for docker compose | Description |
114 | nrttest_app | shall contain the application short name |
115 | nrttest_dp | shall be set by a variable containing the display name, a short textual description of the applicaion |
117 | Label for kubernetes resource | Description |
119 | autotest | shall contain the application short name |
121 * Add mandatory image(s) and image tag(s) to the appropriate environment files for each release in the file(s) `test_env_<system>-<release-name>`.
122 In addition, all other needed environment shall also be defined in these file.
125 # Description of functions in testcase_common.sh #
128 The script can be started with these arguments
132 | `remote|remote-remove docker|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+] [--use-snapshot-image <app-nam>+] [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--image-repo <repo-address] [--repo-policy local|remote] [--cluster-timeout <timeout-in seconds>]` |
134 | parameter | description |
136 | `remote` | Use images from remote repositories. Can be overridden for individual images using the '--use_xxx' flags |
137 | `remote-remove` | Same as 'remote' but will also try to pull fresh images from remote repositories |
138 | `docker` | Use docker environment for test |
139 | `kuber` | Use kubernetes environment for test. Requires a kubernetes minikube installation |
140 | `--env-file` | The script will use the supplied file to read environment variables from |
141 | `release` | If this flag is given the script will use release version of the images |
142 | `auto-clean` | If the function 'auto_clean_containers' is present in the end of the test script then all containers will be stopped and removed. If 'auto-clean' is not given then the function has no effect |
143 | `--stop-at-error` | The script will stop when the first failed test or configuration |
144 | `--ricsim-prefix <prefix>` | The a1 simulator will use the supplied string as container prefix instead of 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
145 | `--use-local-image` | The script will use local images for the supplied apps, space separated list of app short names |
146 | `--use-snapshot-image` | The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names |
147 | `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names |
148 | `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names |
149 | `--image-repo` | Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo |
150 | `-repo-policy ` | Policy controlling which images to re-tag and push to image repo in param --image-repo. Can be set to 'local' (push on locally built images) or 'remote' (push locally built images and images from nexus repo). Default is 'local' |
151 | `--cluster-timeout` | Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds |
152 | `help` | Print this info along with the test script description and the list of app short names supported |
154 ## Function: setup_testenvironment
155 Main function to setup the test environment before any tests are started.
156 Must be called right after sourcing all component scripts.
161 ## Function: indent1 ##
162 Indent every line of a command output with one space char.
167 ## Function: indent2 ##
168 Indent every line of a command output with two space chars.
173 ## Function: print_result ##
174 Print a test report of an auto-test script.
179 ## Function: start_timer ##
180 Start a timer for time measurement. Only one timer can be running.
183 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
185 ## Function: print_timer ##
186 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.
189 | `<timer-message-to-print>` |
191 | parameter | description |
192 | --------- | ----------- |
193 | `<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`) |
195 ## Function: print_and_reset_timer ##
196 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.
199 | `<timer-message-to-print>` |
201 | parameter | description |
202 | --------- | ----------- |
203 | `<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`) |
205 ## Function: deviation ##
206 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
209 | `<deviation-message-to-print>` |
211 | parameter | description |
212 | --------- | ----------- |
213 | `<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 |
215 ## Function: clean_environment ##
216 Stop and remove all containers (docker) or resources (kubernetes). Containers not part of the test are not affected (docker only). Removes all resources started by previous kube tests (kube only).
221 ## Function: auto_clean_containers ##
222 Same function as 'clean_environment'. 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.
227 ## Function: sleep_wait ##
228 Make the script sleep for a number of seconds.
231 | `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
233 | parameter | description |
234 | --------- | ----------- |
235 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
236 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
238 ## Function: check_control_panel_logs ##
239 Check the Control Panel log for any warnings and errors and print the count of each.
244 ## Function: store_logs ##
245 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.
248 | `<logfile-prefix>` |
250 | parameter | description |
251 | --------- | ----------- |
252 | `<logfile-prefix>` | Log file prefix |
255 # Description of functions in testsuite_common.sh #
257 ## Function: suite_setup ##
258 Sets up the test suite and prints out a heading.
264 Print out the overall result of the executed test cases.
269 # Description of functions in agent_api_functions.sh #
272 Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
273 For api function in version 2, an url prefix is added if configured.
275 ## Function: use_agent_rest_http ##
276 Use http for all API calls to the Policy Agent. This is the default.
281 ## Function: use_agent_rest_https ##
282 Use https for all API calls to the Policy Agent.
287 ## Function: use_agent_dmaap_http ##
288 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
293 ## Function: use_agent_dmaap_https ##
294 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
299 ## Function: start_policy_agent ##
300 Start the Policy Agent container or corresponding kube resources depending on docker/kube mode.
302 | `<logfile-prefix>` |
303 | (docker) `PROXY|NOPROXY <config-file>` |
304 | (kube) `PROXY|NOPROXY <config-file> [ <data-file> ]` |
305 | parameter | description |
306 | --------- | ----------- |
307 | `PROXY` | Configure with http proxy, if proxy is started |
308 | `NOPROXY` | Configure without http proxy |
309 | <config-file>` | Path to application.yaml |
310 | <data-file>` | Optional path to application_configuration.json |
312 ## Function: agent_load_config ##
313 Load the config into a config map (kubernetes only).
316 | parameter | description |
317 | --------- | ----------- |
318 | <data-file>` | Path to application_configuration.json |
320 ## Function: set_agent_debug ##
321 Configure the Policy Agent log on debug level. The Policy Agent must be running.
326 ## Function: set_agent_trace ##
327 Configure the Policy Agent log on trace level. The Policy Agent must be running.
332 ## Function: use_agent_retries ##
333 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
336 | `[<response-code>]*` |
339 ## Function: check_policy_agent_logs ##
340 Check the Policy Agent log for any warnings and errors and print the count of each.
345 ## Function: api_equal() ##
347 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
348 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
349 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.
350 See the 'cr' dir for more details.
354 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
356 | parameter | description |
357 | --------- | ----------- |
358 | `<variable-name>` | Relative url. Example 'json:policy_types' - checks the json array length of the url /policy_types |
359 | `<target-value>` | Target value for the length |
360 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value |
362 ## Function: api_get_policies() ##
363 Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
364 To test the response code only, provide the response code parameter as well as the following three parameters.
365 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.
369 | `<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>]*]` |
373 | `<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>]*]` |
375 | parameter | description |
376 | --------- | ----------- |
377 | `<response-code>` | Expected http response code |
378 | `<ric-id>` | Id of the ric |
379 | `NORIC` | Indicator that no ric is provided |
380 | `<service-id>` | Id of the service |
381 | `NOSERVICE` | Indicator that no service id is provided |
382 | `<policy-type-id>` | Id of the policy type |
383 | `NOTYPE` | Indicator that no type id is provided |
384 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
385 | `<policy-id>` | Id of the policy |
386 | `EMPTY` | Indicate for the special empty policy type |
387 | `transient` | Transient, true or false |
388 | `notification-url` | Url for notifications |
389 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
392 ## Function: api_get_policy() ##
393 Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
394 To test the the response code only, provide the expected response code and policy id.
395 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
399 | `<response-code> <policy-id> [<template-file>]` |
403 | `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
405 | parameter | description |
406 | --------- | ----------- |
407 | `<response-code>` | Expected http response code |
408 | `<policy-id>` | Id of the policy |
409 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
410 | `<service-id>` | Id of the service |
411 | `<ric-id>` | Id of the ric |
412 | `<policy-type-id>` | Id of the policy type |
413 | `NOTYPE` | Indicator that no type id is provided |
414 | `transient` | Transient, true or false |
415 | `notification-url` | Url for notifications |
417 ## Function: api_put_policy() ##
418 Test of PUT '/policy' or V2 PUT '/policies'.
419 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).
423 | `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
427 | `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
429 | parameter | description |
430 | --------- | ----------- |
431 | `<response-code>` | Expected http response code |
432 | `<service-id>` | Id of the service |
433 | `<ric-id>` | Id of the ric |
434 | `<policy-type-id>` | Id of the policy type |
435 | `<policy-id>` | Id of the policy. This value shall be a numeric value if more than one policy shall be created |
436 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
437 | `notification-url` | Url for notifications |
438 |`NOURL`| Indicator for no url |
439 | `<template-file>` | Path to the template file for the policy |
440 | `<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 |
442 ## Function: api_put_policy_batch() ##
443 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.
444 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.
445 For arg list and parameters, see 'api_put_policy'.
447 ## Function: api_put_policy_parallel() ##
448 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.
452 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
456 | `<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>`
458 | parameter | description |
459 | --------- | ----------- |
460 | `<response-code>` | Expected http response code |
461 | `<service-id>` | Id of the service |
462 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
463 | `<number-of-rics>` | The number of rics, assuming the first index is '1'. The index is added to the 'ric-id-base' id |
464 | `<policy-type-id>` | Id of the policy type |
465 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
466 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
467 | `notification-url` | Url for notifications |
468 | `<template-file>` | Path to the template file for the policy |
469 | `<count-per-ric>` | Number of policies per ric |
470 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
472 ## Function: api_delete_policy() ##
473 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.
477 | `<response-code> <policy-id> [<count>]`
479 | parameter | description |
480 | --------- | ----------- |
481 | `<response-code>` | Expected http response code |
482 | `<policy-id>` | Id of the policy |
483 | `<count>` | An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
485 ## Function: api_delete_policy_batch() ##
486 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.
487 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.
488 For arg list and parameters, see 'api_delete_policy'.
490 ## Function: api_delete_policy_parallel() ##
491 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.
495 | `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
497 | parameter | description |
498 | --------- | ----------- |
499 | `<response-code>` | Expected http response code |
500 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
501 | `<number-of-rics>` | The number of rics, assuming the first index is '1' |
502 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
503 | `<count-per-ric>` | Number of policies per ric |
504 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
507 ## Function: api_get_policy_ids() ##
509 Test of GET '/policy_ids' or V2 GET '/v2/policies'.
510 To test response code only, provide the response code parameter as well as the following three parameters.
511 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.
515 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
517 | parameter | description |
518 | --------- | ----------- |
519 | `<response-code>` | Expected http response code |
520 | `<ric-id>` | Id of the ric |
521 | `NORIC` | Indicator that no ric is provided |
522 | `<service-id>` | Id of the service |
523 | `NOSERVICE` | Indicator that no service id is provided |
524 | `type-id>` | Id of the policy type |
525 | `NOTYPE` | Indicator that no type id is provided |
526 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
527 | `<policy-instance-id>` | Id of the policy |
529 ## Function: api_get_policy_schema() ##
530 Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
531 To test the response code only, provide the expected response code and policy type id.
532 To test the contents of the returned json schema, add a path to a schema file to compare with.
536 | `<response-code> <policy-type-id> [<schema-file>]` |
538 | parameter | description |
539 | --------- | ----------- |
540 | `<response-code>` | Expected http response code |
541 | `<policy-type-id>` | Id of the policy type |
542 | `<schema-file>` | Path to the schema file for the policy type |
544 ## Function: api_get_policy_schema() ##
545 Test of GET '/policy_schema' and optional check of the returned json schema.
546 To test the response code only, provide the expected response code and policy type id.
547 To test the contents of the returned json schema, add a path to a schema file to compare with.
551 | `<response-code> <policy-type-id> [<schema-file>]` |
553 | parameter | description |
554 | --------- | ----------- |
555 | `<response-code>` | Expected http response code |
556 | `<policy-type-id>` | Id of the policy type |
557 | `<schema-file>` | Path to the schema file for the policy type |
559 ## Function: api_get_policy_schemas() ##
560 Test of GET '/policy_schemas' and optional check of the returned json schemas.
561 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
562 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)
566 | `<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*` |
568 | parameter | description |
569 | --------- | ----------- |
570 | `<response-code>` | Expected http response code |
571 | `<ric-id>` | Id of the ric |
572 | `NORIC` | No ric id given |
573 | `<schema-file>` | Path to the schema file for the policy type |
574 | `NOFILE` | Indicate the template for an empty type |
576 ## Function: api_get_policy_status() ##
577 Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
581 | `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
583 | parameter | description |
584 | --------- | ----------- |
585 | `<response-code>` | Expected http response code |
586 | `<policy-id>` | Id of the policy |
587 | `STD` | Indicator of status of Standarized A1 |
588 | `STD2` | Indicator of status of Standarized A1 version 2 |
589 | `<enforce-status>` | Enforcement status |
590 | `<reason>` | Optional reason |
591 | `EMPTY` | Indicator of empty string status or reason |
592 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
593 | `<instance-status>` | Instance status |
594 | `<has-been-deleted>` | Deleted status, true or false |
596 ## Function: api_get_policy_types() ##
597 Test of GET '/policy_types' or V2 GET '/v2/policy-types' and optional check of the returned ids.
598 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
599 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
603 | `<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]` |
605 | parameter | description |
606 | --------- | ----------- |
607 | `<response-code>` | Expected http response code |
608 | `<ric-id>` | Id of the ric |
609 | `NORIC` | No ric id given |
610 | `<policy-type-id>` | Id of the policy type |
611 | `EMPTY` | Indicate the empty type |
613 ## Function: api_get_status() ##
614 Test of GET /status or V2 GET /status
618 | `<response-code>` |
620 | parameter | description |
621 | --------- | ----------- |
622 | `<response-code>` | Expected http response code |
624 ## Function: api_get_ric() ##
625 Test of GET '/ric' or V2 GET '/v2/rics/ric'
626 To test the response code only, provide the expected response code and managed element id.
627 To test the returned ric id, provide the expected ric id.
631 | `<reponse-code> <managed-element-id> [<ric-id>]` |
635 | `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
637 | parameter | description |
638 | --------- | ----------- |
639 | `<response-code>` | Expected http response code |
640 | `<managed-element-id>` | Id of the managed element |
641 | `NOME` | Indicator for no ME |
642 | `ric-id` | Id of the ric |
643 | `NORIC` | Indicator no RIC |
644 | `string-of-ricinfo` | String of ric info |
646 ## Function: api_get_rics() ##
647 Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
648 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
649 To test also the returned payload, add the formatted string of info in the returned payload.
650 Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
651 Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
655 | `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
657 | parameter | description |
658 | --------- | ----------- |
659 | `<response-code>` | Expected http response code |
660 | `<policy-type-id>` | Policy type id of the ric |
661 | `NOTYPE>` | No type given |
662 | `<space-separate-string-of-ricinfo>` | A space separated string of ric info - needs to be quoted |
664 ## Function: api_put_service() ##
665 Test of PUT '/service' or V2 PUT '/service'.
668 | `<response-code> <service-name> <keepalive-timeout> <callbackurl>` |
670 | parameter | description |
671 | --------- | ----------- |
672 | `<response-code>` | Expected http response code |
673 | `<service-name>` | Service name |
674 | `<keepalive-timeout>` | Timeout value |
675 | `<callbackurl>` | Callback url |
677 ## Function: api_get_services() ##
678 Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
679 To test only the response code, omit all parameters except the expected response code.
680 To test the returned json, provide the parameters after the response code.
684 | `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
686 | parameter | description |
687 | --------- | ----------- |
688 | `<response-code>` | Expected http response code |
689 | <query-service-name>` | Service name for the query |
690 | <target-service-name>` | Target service name|
691 | `<keepalive-timeout>` | Timeout value |
692 | `<callbackurl>` | Callback url |
693 | `NOSERVICE` | Indicator of no target service name |
695 ## Function: api_get_service_ids() ##
696 Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
700 | `<response-code> [<service-name>]*` |
702 | parameter | description |
703 | --------- | ----------- |
704 | `<response-code>` | Expected http response code |
705 | `<service-name>` | Service name |
707 ## Function: api_delete_services() ##
708 Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
712 | `<response-code> [<service-name>]*` |
714 | parameter | description |
715 | --------- | ----------- |
716 | `<response-code>` | Expected http response code |
717 | `<service-name>` | Service name |
719 ## Function: api_put_services_keepalive() ##
720 Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
724 | <response-code> <service-name>` |
726 | parameter | description |
727 | --------- | ----------- |
728 | `<response-code>` | Expected http response code |
729 | `<service-name>` | Service name |
731 ## Function: api_put_configuration() ##
732 Test of PUT '/v2/configuration'
736 | <response-code> <config-file>` |
738 | parameter | description |
739 | --------- | ----------- |
740 | `<response-code>` | Expected http response code |
741 | `<config-file>` | Path json config file |
743 ## Function: api_get_configuration() ##
744 Test of GET '/v2/configuration'
748 | <response-code> [<config-file>]` |
750 | parameter | description |
751 | --------- | ----------- |
752 | `<response-code>` | Expected http response code |
753 | `<config-file>` | Path json config file to compare the retrieved config with |
754 | parameter | description |
755 | --------- | ----------- |
756 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'. |
759 # Description of functions in consul_cbs_function.sh #
762 ## Function: consul_config_app ##
763 Function to load a json config from a file into consul for the Policy Agent
767 | `<json-config-file>` |
769 | parameter | description |
770 | --------- | ----------- |
771 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
773 ## Function: prepare_consul_config ##
774 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')
777 | `<deviation-message-to-print>` |
779 | parameter | description |
780 | --------- | ----------- |
781 | `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
782 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app' |
784 ## Function: start_consul_cbs ##
785 Start the Consul and CBS containers
790 # Description of functions in control_panel_api_function.sh #
792 ## Function: use_control_panel_http ##
793 Set http as the protocol to use for all communication to the Control Panel
798 ## Function: use_control_panel_https ##
799 Set https as the protocol to use for all communication to the Control Panel
804 ## Function: start_control_panel ##
805 Start the Control Panel container
810 # Description of functions in controller_api_functions.sh #
811 The file contains a selection of the possible API tests towards the a1-controller
813 ## Function: use_sdnc_http ##
814 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.
819 ## Function: use_sdnc_http ##
820 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
825 ## Function: start_sdnc ##
826 Start the SDNC A1 Controller container and its database container
831 ## Function: check_sdnc_logs ##
832 Check the SDNC log for any warnings and errors and print the count of each.
837 ## Function: controller_api_get_A1_policy_ids ##
838 Test of GET policy ids towards OSC or STD type simulator.
839 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
840 To test the response payload, include the ids of the expexted response.
844 | `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
846 | parameter | description |
847 | --------- | ----------- |
848 | `<response-code>` | Expected http response code |
849 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
850 | `<ric-id>` | Id of the ric |
851 | `policy-type-id>` | Id of the policy type |
852 | `<policy-id>` | Id of the policy |
853 | `STD` | Indicator of status of Standarized A1 |
856 ## Function: controller_api_get_A1_policy_type ##
857 Test of GET a policy type (OSC only)
861 | `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
863 | parameter | description |
864 | --------- | ----------- |
865 | `<response-code>` | Expected http response code |
866 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
867 | `<ric-id>` | Id of the ric |
868 | `policy-type-id>` | Id of the policy type |
869 | `policy-type-file>` | Optional schema file to compare the returned type with |
871 ## Function: controller_api_delete_A1_policy ##
872 Deletes a policy instance
876 | `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
878 | parameter | description |
879 | --------- | ----------- |
880 | `<response-code>` | Expected http response code |
881 | `STD` | Indicator of status of Standarized A1 |
882 | `<ric-id>` | Id of the ric |
883 | `<policy-id>` | Id of the policy |
884 | `policy-type-id>` | Id of the policy type |
885 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
886 | `policy-type-file>` | Optional schema file to compare the returned type with |
888 ## Function: controller_api_put_A1_policy ##
889 Creates a policy instance
893 | `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
895 | parameter | description |
896 | --------- | ----------- |
897 | `<response-code>` | Expected http response code |
898 | `STD` | Indicator of status of Standarized A1 |
899 | `<ric-id>` | Id of the ric |
900 | `<policy-id>` | Id of the policy |
901 | `<template-file>` | Path to the template file of the policy|
902 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
903 | `<policy-type-id>` | Id of the policy type |
905 ## Function: controller_api_get_A1_policy_status ##
906 Checks the status of a policy
910 | `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
912 | parameter | description |
913 | --------- | ----------- |
914 | `<response-code>` | Expected http response code |
915 | `STD` | Indicator of status of Standarized A1 |
916 | `<ric-id>` | Id of the ric |
917 | `<policy-id>` | Id of the policy |
918 | `<enforce-status>` | Enforcement status |
919 | `<reason>` | Optional reason |
920 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
921 | `<policy-type-id>` | Id of the policy type |
922 | `<instance-status>` | Instance status |
923 | `<has-been-deleted>` | Deleted status, true or false |
926 # Description of functions in cr_api_functions.sh #
928 ## Function: use_cr_http ##
929 Use http for getting event from CR. The admin API is not affected. This is the default.
934 ## Function: use_cr_https ##
935 Use https for getting event from CR. The admin API is not affected.
936 Note: Not yet used as callback event is not fully implemented/deciced.
941 ## Function: start_cr ##
942 Start the Callback Receiver container in docker or kube depending on start mode.
947 ## Function: cr_equal ##
948 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
949 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
950 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.
951 See the 'cr' dir for more details.
954 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
956 | parameter | description |
957 | --------- | ----------- |
958 | `<variable-name>` | Variable name in the CR |
959 | `<target-value>` | Target value for the variable |
960 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
962 ## Function: cr_api_check_all_sync_events() ##
963 Check the contents of all ric events received for a callback id.
967 | `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
969 | parameter | description |
970 | --------- | ----------- |
971 | `<response-code>` | Expected http response code |
972 | `<id>` | Id of the callback destination |
973 | `EMPTY` | Indicator for an empty list |
974 | `<ric-id>` | Id of the ric |
976 # Description of functions in ecs_api_functions.sh #
978 ## Function: use_ecs_rest_http ##
979 Use http for all API calls to the ECS. This is the default protocol.
984 ## Function: use_ecs_rest_https ##
985 Use https for all API calls to the ECS.
990 ## Function: use_ecs_dmaap_http ##
991 Send and recieve all API calls to the ECS over Dmaap via the MR using http.
996 ## Function: use_ecs_dmaap_https ##
997 Send and recieve all API calls to the ECS over Dmaap via the MR using https.
1002 ## Function: start_ecs ##
1003 Start the ECS container in docker or kube depending on running mode.
1008 ## Function: stop_ecs ##
1009 Stop the ECS container.
1014 ## Function: start_stopped_ecs ##
1015 Start a previously stopped ecs.
1020 ## Function: set_ecs_debug ##
1021 Configure the ECS log on debug level. The ECS must be running.
1026 ## Function: set_ecs_trace ##
1027 Configure the ECS log on trace level. The ECS must be running.
1032 ## Function: check_ecs_logs ##
1033 Check the ECS log for any warnings and errors and print the count of each.
1038 ## Function: ecs_equal ##
1039 Tests if a variable value in the ECS is equal to a target value.
1040 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1041 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.
1042 See the 'a1-interface' repo for more details.
1046 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1048 | parameter | description |
1049 | --------- | ----------- |
1050 | `<variable-name>` | Variable name in ecs |
1051 | `<target-value>` | Target value for the variable |
1052 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1054 ## Function: ecs_api_a1_get_job_ids() ##
1055 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
1056 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1057 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1061 | `<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1063 | parameter | description |
1064 | --------- | ----------- |
1065 | `<response-code>` | Expected http response code |
1066 | `<type-id>` | Id of the EI type |
1067 | `<owner-id>` | Id of the job owner |
1068 | `NOOWNER` | No owner is given |
1069 | `<job-id>` | Id of the expected job |
1070 | `EMPTY` | The expected list of job id shall be empty |
1072 ## Function: ecs_api_a1_get_type() ##
1073 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
1074 To test the response code only, provide the response code parameter as well as the type-id.
1075 To also test the response payload add a path to the expected schema file.
1079 | `<response-code> <type-id> [<schema-file>]` |
1081 | parameter | description |
1082 | --------- | ----------- |
1083 | `<response-code>` | Expected http response code |
1084 | `<type-id>` | Id of the EI type |
1085 | `<schema-file>` | Path to a schema file to compare with the returned schema |
1087 ## Function: ecs_api_a1_get_type_ids() ##
1088 Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
1089 To test the response code only, provide the response only.
1090 To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
1094 | `<response-code> [ (EMPTY | [<type-id>]+) ]` |
1096 | parameter | description |
1097 | --------- | ----------- |
1098 | `<response-code>` | Expected http response code |
1099 | `EMPTY` | The expected list of type ids shall be empty |
1100 | `<type-id>` | Id of the EI type |
1102 ## Function: ecs_api_a1_get_job_status() ##
1103 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
1104 To test the response code only, provide the response code, type id and job id.
1105 To also test the response payload add the expected status.
1109 | `<response-code> <type-id> <job-id> [<status>]` |
1111 | parameter | description |
1112 | --------- | ----------- |
1113 | `<response-code>` | Expected http response code |
1114 | `<type-id>` | Id of the EI type |
1115 | `<job-id>` | Id of the job |
1116 | `<status>` | Expected status |
1118 ## Function: ecs_api_a1_get_job() ##
1119 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
1120 To test the response code only, provide the response code, type id and job id.
1121 To also test the response payload add the remaining parameters.
1125 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1127 | parameter | description |
1128 | --------- | ----------- |
1129 | `<response-code>` | Expected http response code |
1130 | `<type-id>` | Id of the EI type |
1131 | `<job-id>` | Id of the job |
1132 | `<target-url>` | Expected target url for the job |
1133 | `<owner-id>` | Expected owner for the job |
1134 | `<template-job-file>` | Path to a job template for job parameters of the job |
1136 ## Function: ecs_api_a1_delete_job() ##
1137 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1138 To test, provide all the specified parameters.
1142 | `<response-code> <type-id> <job-id> |
1144 | parameter | description |
1145 | --------- | ----------- |
1146 | `<response-code>` | Expected http response code |
1147 | `<type-id>` | Id of the EI type |
1148 | `<job-id>` | Id of the job |
1150 ## Function: ecs_api_a1_put_job() ##
1151 Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1152 To test, provide all the specified parameters.
1156 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
1158 | parameter | description |
1159 | --------- | ----------- |
1160 | `<response-code>` | Expected http response code |
1161 | `<type-id>` | Id of the EI type |
1162 | `<job-id>` | Id of the job |
1163 | `<target-url>` | Target url for the job |
1164 | `<owner-id>` | Owner of the job |
1165 | `<template-job-file>` | Path to a job template for job parameters of the job |
1167 ## Function: ecs_api_edp_get_type_ids() ##
1168 Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
1169 To test the response code only, provide the response code.
1170 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1174 | `<response-code> [ EMPTY | <type-id>+]` |
1176 | parameter | description |
1177 | --------- | ----------- |
1178 | `<response-code>` | Expected http response code |
1179 | `<type-id>` | Id of the EI type |
1180 | `EMPTY` | The expected list of type ids shall be empty |
1182 ## Function: ecs_api_edp_get_producer_status() ##
1183 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
1184 To test the response code only, provide the response code and producer id.
1185 To also test the response payload add the expected status.
1189 | `<response-code> <producer-id> [<status>]` |
1191 | parameter | description |
1192 | --------- | ----------- |
1193 | `<response-code>` | Expected http response code |
1194 | `<producer-id>` | Id of the producer |
1195 | `<status>` | The expected status string |
1197 ## Function: ecs_api_edp_get_producer_ids() ##
1198 Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
1199 To test the response code only, provide the response.
1200 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).
1204 | `<response-code> [ EMPTY | <producer-id>+]` |
1206 | parameter | description |
1207 | --------- | ----------- |
1208 | `<response-code>` | Expected http response code |
1209 | `<producer-id>` | Id of the producer |
1210 | `EMPTY` | The expected list of type ids shall be empty |
1212 ## Function: ecs_api_edp_get_type() ##
1213 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
1214 To test the response code only, provide the response and the type-id.
1215 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).
1219 | `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
1221 | parameter | description |
1222 | --------- | ----------- |
1223 | `<response-code>` | Expected http response code |
1224 | `<type-id>` | Id of the EI type |
1225 | `<job-schema-file>` | Path to a job schema file |
1226 | `<producer-id>` | Id of the producer |
1227 | `EMPTY` | The expected list of type ids shall be empty |
1229 ## Function: ecs_api_edp_get_producer() ##
1230 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
1231 To test the response code only, provide the response and the producer-id.
1232 To also test the response payload add the remaining parameters defining thee producer.
1236 | `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
1238 | parameter | description |
1239 | --------- | ----------- |
1240 | `<response-code>` | Expected http response code |
1241 | `<producer-id>` | Id of the producer |
1242 | `<create-callback>` | Callback for create job |
1243 | `<delete-callback>` | Callback for delete job |
1244 | `<supervision-callback>` | Callback for producer supervision |
1245 | `<type-id>` | Id of the EI type |
1246 | `<schema-file>` | Path to a schema file |
1247 | `EMPTY` | The expected list of type schema pairs shall be empty |
1249 ## Function: ecs_api_edp_delete_producer() ##
1250 Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
1251 To test, provide all parameters.
1255 | `<response-code> <producer-id>` |
1257 | parameter | description |
1258 | --------- | ----------- |
1259 | `<response-code>` | Expected http response code |
1260 | `<producer-id>` | Id of the producer |
1262 ## Function: ecs_api_edp_put_producer() ##
1263 Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
1264 To test, provide all parameters. The list of type/schema pair may be empty.
1268 | `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
1270 | parameter | description |
1271 | --------- | ----------- |
1272 | `<response-code>` | Expected http response code |
1273 | `<producer-id>` | Id of the producer |
1274 | `<job-callback>` | Callback for create/delete job |
1275 | `<supervision-callback>` | Callback for producer supervision |
1276 | `<type-id>` | Id of the EI type |
1277 | `<schema-file>` | Path to a schema file |
1278 | `EMPTY` | The list of type/schema pairs is empty |
1280 ## Function: ecs_api_edp_get_producer_jobs() ##
1281 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
1282 To test the response code only, provide the response and the producer-id.
1283 To also test the response payload add the remaining parameters.
1287 | `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
1289 | parameter | description |
1290 | --------- | ----------- |
1291 | `<response-code>` | Expected http response code |
1292 | `<producer-id>` | Id of the producer |
1293 | `<job-id>` | Id of the job |
1294 | `<type-id>` | Id of the EI type |
1295 | `<target-url>` | Target url for data delivery |
1296 | `<job-owner>` | Id of the job owner |
1297 | `<template-job-file>` | Path to a job template file |
1298 | `EMPTY` | The list of job/type/target/job-file tuples is empty |
1300 ## Function: ecs_api_service_status() ##
1301 Test of GET '/status'.
1305 | `<response-code>` |
1307 | parameter | description |
1308 | --------- | ----------- |
1309 | `<response-code>` | Expected http response code |
1311 ## Function: ecs_api_idc_get_type_ids() ##
1312 Test of GET '/data-consumer/v1/info-types' and an optional check of the returned list of type ids.
1313 To test the response code only, provide the response code.
1314 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1318 | `<response-code> [ EMPTY | <type-id>+]` |
1320 | parameter | description |
1321 | --------- | ----------- |
1322 | `<response-code>` | Expected http response code |
1323 | `<type-id>` | Id of the Info type |
1324 | `EMPTY` | The expected list of type ids shall be empty |
1326 ## Function: ecs_api_idc_get_job_ids() ##
1327 Test of GET '/data-consumer/v1/info-jobs' and optional check of the array of returned job ids.
1328 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1329 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1333 | `<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1335 | parameter | description |
1336 | --------- | ----------- |
1337 | `<response-code>` | Expected http response code |
1338 | `<type-id>` | Id of the Info type |
1339 | `<owner-id>` | Id of the job owner |
1340 | `NOOWNER` | No owner is given |
1341 | `<job-id>` | Id of the expected job |
1342 | `EMPTY` | The expected list of job id shall be empty |
1344 ## Function: ecs_api_idc_get_job() ##
1345 Test of GET '/data-consumer/v1/info-jobs/{infoJobId}' and optional check of the returned job.
1346 To test the response code only, provide the response code, type id and job id.
1347 To also test the response payload add the remaining parameters.
1351 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1353 | parameter | description |
1354 | --------- | ----------- |
1355 | `<response-code>` | Expected http response code |
1356 | `<type-id>` | Id of the Info type |
1357 | `<job-id>` | Id of the job |
1358 | `<target-url>` | Expected target url for the job |
1359 | `<owner-id>` | Expected owner for the job |
1360 | `<template-job-file>` | Path to a job template for job parameters of the job |
1362 ## Function: ecs_api_idc_put_job() ##
1363 Test of PUT '​/data-consumer/v1/info-jobs/{infoJobId}'.
1364 To test, provide all the specified parameters.
1368 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file> [VALIDATE]` |
1370 | parameter | description |
1371 | --------- | ----------- |
1372 | `<response-code>` | Expected http response code |
1373 | `<type-id>` | Id of the Info type |
1374 | `<job-id>` | Id of the job |
1375 | `<target-url>` | Target url for the job |
1376 | `<owner-id>` | Owner of the job |
1377 | `<template-job-file>` | Path to a job template for job parameters of the job |
1378 | `VALIIDATE` | Indicator to preform type validation at creation |
1380 ## Function: ecs_api_idc_delete_job() ##
1381 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1382 To test, provide all the specified parameters.
1386 | `<response-code> <type-id> <job-id> |
1388 | parameter | description |
1389 | --------- | ----------- |
1390 | `<response-code>` | Expected http response code |
1391 | `<type-id>` | Id of the EI type |
1392 | `<job-id>` | Id of the job |
1394 ## Function: ecs_api_idc_get_type() ##
1395 Test of GET '/data-consumer/v1/info-types/{infoTypeId} and optional check of the returned schema.
1396 To test the response code only, provide the response code parameter as well as the type-id.
1397 To also test the response payload add a path to the expected schema file.
1401 | `<response-code> <type-id> [<schema-file>]` |
1403 | parameter | description |
1404 | --------- | ----------- |
1405 | `<response-code>` | Expected http response code |
1406 | `<type-id>` | Id of the Info type |
1407 | `<schema-file>` | Path to a schema file to compare with the returned schema |
1409 ## Function: ecs_api_idc_get_job_status() ##
1410 Test of GET '/data-consumer/v1/info-jobs/{infoJobId}/status' and optional check of the returned status.
1411 To test the response code only, provide the response code, type id and job id.
1412 To also test the response payload add the expected status.
1416 | `<response-code> <type-id> <job-id> [<status>]` |
1418 | parameter | description |
1419 | --------- | ----------- |
1420 | `<response-code>` | Expected http response code |
1421 | `<type-id>` | Id of the Info type |
1422 | `<job-id>` | Id of the job |
1423 | `<status>` | Expected status |
1426 ## Function: ecs_api_admin_reset() ##
1427 Test of GET '/status'.
1431 | `<response-code> [ <type> ]` |
1433 | parameter | description |
1434 | --------- | ----------- |
1435 | `<response-code>` | Expected http response code |
1436 | `<type>` | Type id, if the interface supports type in url |
1438 # Description of functions in gateway_api_functions.sh #
1441 ## Function: use_gateway_http ##
1442 Use http for all calls to the gateway. This is set by default.
1447 ## Function: use_gateway_https ##
1448 Use https for all calls to the gateway.
1453 ## Function: set_gateway_debug ##
1454 Set debug level logging in the gateway
1459 ## Function: set_gateway_trace ##
1460 Set debug level logging in the trace
1465 ## Function: start_gateway ##
1466 Start the the gateway container in docker or kube depending on start mode
1471 ## Function: gateway_pms_get_status ##
1472 Sample test of pms api (status)
1475 | `<response-code> ` |
1477 | parameter | description |
1478 | --------- | ----------- |
1479 | `<response-code>` | Expected http response code |
1481 ## Function: gateway_ecs_get_types ##
1482 Sample test of ecs api (get ei type)
1483 Only response code tested - not payload
1486 | `<response-code> ` |
1488 | parameter | description |
1489 | --------- | ----------- |
1490 | `<response-code>` | Expected http response code |
1492 # Description of functions in http_proxy_api_functions.sh #
1494 ## Function: use_http_proxy_http ##
1495 Use http for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1500 ## Function: use_http_proxy_https ##
1501 Use https for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1506 ## Function: start_http_proxy ##
1507 Start the http proxy container in docker or kube depending on running mode.
1512 # Description of functions in kube_proxy_api_functions.sh #
1514 ## Function: use_kube_proxy_http ##
1515 Use http for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1520 ## Function: use_kube_proxy_https ##
1521 Use https for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https.
1526 ## Function: start_kube_proxy ##
1527 Start the kube proxy container in kube. This proxy enabled the test env to access all services and pods in a kube cluster.
1528 No proxy is started if the function is called in docker mode.
1533 # Description of functions in mr_api_functions.sh #
1535 ## Function: use_mr_http ##
1536 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.
1541 ## Function: use_mr_https ##
1542 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.
1547 ## Function: start_mr ##
1548 Start the Message Router stub interface container in docker or kube depending on start mode
1554 ## Function: mr_equal ##
1555 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
1556 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1557 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.
1558 See the 'mrstub' dir for more details.
1561 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1563 | parameter | description |
1564 | --------- | ----------- |
1565 | `<variable-name>` | Variable name in the MR |
1566 | `<target-value>` | Target value for the variable |
1567 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1569 ## Function: mr_greater ##
1570 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
1571 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
1572 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.
1573 See the 'mrstub' dir for more details.
1576 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1578 | parameter | description |
1579 | --------- | ----------- |
1580 | `<variable-name>` | Variable name in the MR |
1581 | `<target-value>` | Target value for the variable |
1582 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value |
1584 ## Function: mr_read ##
1585 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.
1586 See the 'mrstub' dir for more details.
1589 | `<variable-name>` |
1591 | parameter | description |
1592 | --------- | ----------- |
1593 | `<variable-name>` | Variable name in the MR |
1595 ## Function: mr_print ##
1596 Prints the value of a variable in the Message Router (MR) simulator.
1597 See the 'mrstub' dir for more details.
1600 | `<variable-name>` |
1602 | parameter | description |
1603 | --------- | ----------- |
1604 | `<variable-name>` | Variable name in the MR |
1607 # Description of functions in prodstub_api_functions.sh #
1609 ## Function: use_prod_stub_http ##
1610 Use http for the API. The admin API is not affected. This is the default protocol.
1615 ## Function: use_prod_stub_https ##
1616 Use https for the API. The admin API is not affected.
1621 ## Function: start_prod_stub ##
1622 Start the Producer stub container in docker or kube depending on start mode
1627 ## Function: prodstub_arm_producer() ##
1628 Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
1632 | `<response-code> <producer-id> [<forced_response_code>]` |
1634 | parameter | description |
1635 | --------- | ----------- |
1636 | `<response-code>` | Expected http response code |
1637 | `<producer-id>` | Id of the producer |
1638 | `<forced_response_code>` | Forced response code for the producer callback url |
1640 ## Function: prodstub_arm_job_create() ##
1641 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.
1645 | `<response-code> <job-id> [<forced_response_code>]` |
1647 | parameter | description |
1648 | --------- | ----------- |
1649 | `<response-code>` | Expected http response code |
1650 | `<job-id>` | Id of the job |
1651 | `<forced_response_code>` | Forced response code for the create callback url |
1653 ## Function: prodstub_arm_job_delete() ##
1654 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.
1658 | `<response-code> <job-id> [<forced_response_code>]` |
1660 | parameter | description |
1661 | --------- | ----------- |
1662 | `<response-code>` | Expected http response code |
1663 | `<job-id>` | Id of the job |
1664 | `<forced_response_code>` | Forced response code for the delete callback url |
1666 ## Function: prodstub_arm_type() ##
1667 Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
1671 | `<response-code> <producer-id> <type-id>` |
1673 | parameter | description |
1674 | --------- | ----------- |
1675 | `<response-code>` | Expected http response code |
1676 | `<producer-id>` | Id of the producer |
1677 | `<type-id>` | Id of the type |
1679 ## Function: prodstub_disarm_type() ##
1680 Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
1684 | `<response-code> <producer-id> <type-id>` |
1686 | parameter | description |
1687 | --------- | ----------- |
1688 | `<response-code>` | Expected http response code |
1689 | `<producer-id>` | Id of the producer |
1690 | `<type-id>` | Id of the type |
1692 ## Function: prodstub_check_jobdata() ##
1693 Check a job in the prodstub towards the list of provided parameters.
1697 | `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
1699 | parameter | description |
1700 | --------- | ----------- |
1701 | `<response-code>` | Expected http response code |
1702 | `<producer-id>` | Id of the producer |
1703 | `<job-id>` | Id of the job |
1704 | `<type-id>` | Id of the type |
1705 | `<target-url>` | Target url for data delivery |
1706 | `<job-owner>` | Id of the job owner |
1707 | `<template-job-file>` | Path to a job template file |
1709 ## Function: prodstub_delete_jobdata() ##
1710 Delete the job parameters, job data, for a job.
1714 | `<response-code> <producer-id> <job-id>` |
1716 | parameter | description |
1717 | --------- | ----------- |
1718 | `<response-code>` | Expected http response code |
1719 | `<producer-id>` | Id of the producer |
1720 | `<job-id>` | Id of the job |
1723 ## Function: prodstub_equal ##
1724 Tests if a variable value in the prodstub is equal to a target value.
1725 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1726 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.
1730 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1732 | parameter | description |
1733 | --------- | ----------- |
1734 | `<variable-name>` | Variable name in the prostub |
1735 | `<target-value>` | Target value for the variable |
1736 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1739 # Description of functions in rapp_catalogue_api_function.sh #
1741 ## Function: use_rapp_catalogue_http ##
1742 Use http for the API. This is the default protocol.
1747 ## Function: use_rapp_catalogue_https ##
1748 Use https for the API.
1753 ## Function: start_rapp_catalogue ##
1754 Start the rapp catalogue container in docker or kube depending on start mode
1759 ## Function: rc_equal ##
1760 Tests if a variable value in the RAPP Catalogue is equal to a target value.
1761 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1762 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.
1763 See the 'cr' dir for more details.
1766 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1768 | parameter | description |
1769 | --------- | ----------- |
1770 | `<variable-name>` | Variable name in the RC |
1771 | `<target-value>` | Target value for the variable |
1772 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1774 ## Function: rapp_cat_api_get_services() ##
1775 Check all registered services.
1779 | `<response-code> [(<service-id> <version> <display-name> <description>)+ | EMPTY ]` |
1781 | parameter | description |
1782 | --------- | ----------- |
1783 | `<response-code>` | Expected http response code |
1784 | `<service-id>` | Id of the service |
1785 | `<version>` | Version of the service |
1786 | `<display-name>` | Dislay name of the service |
1787 | `<description>` | Description of the service |
1788 | `EMPTY` | Indicator for an empty list |
1790 ## Function: rapp_cat_api_put_service() ##
1791 Register a services.
1795 | `<response-code> <service-id> <version> <display-name> <description>` |
1797 | parameter | description |
1798 | --------- | ----------- |
1799 | `<response-code>` | Expected http response code |
1800 | `<service-id>` | Id of the service |
1801 | `<version>` | Version of the service |
1802 | `<display-name>` | Dislay name of the service |
1803 | `<description>` | Description of the service |
1805 ## Function: rapp_cat_api_get_service() ##
1806 Check a registered service.
1810 | `<response-code> <service-id> <version> <display-name> <description>` |
1812 | parameter | description |
1813 | --------- | ----------- |
1814 | `<response-code>` | Expected http response code |
1815 | `<service-id>` | Id of the service |
1816 | `<version>` | Version of the service |
1817 | `<display-name>` | Dislay name of the service |
1818 | `<description>` | Description of the service |
1820 ## Function: rapp_cat_api_delete_service() ##
1821 Check a registered service.
1825 | `<response-code> <service-id>` |
1827 | parameter | description |
1828 | --------- | ----------- |
1829 | `<response-code>` | Expected http response code |
1830 | `<service-id>` | Id of the service |
1833 # Description of functions in ricsimulator_api_functions.sh #
1834 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
1837 ## Function: use_simulator_http ##
1838 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.
1843 ## Function: use_simulator_https ##
1844 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.
1849 ## Function: start_ric_simulators ##
1850 Start a group of simulator where a group may contain 1 more simulators. Started in docker or kube depending on start mode
1853 | `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
1855 | parameter | description |
1856 | --------- | ----------- |
1857 | `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 |
1858 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
1859 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
1861 ## Function: get_kube_sim_host ##
1862 Translate ric name to kube host name.
1867 | parameter | description |
1868 | --------- | ----------- |
1869 | `<ric-name>` | The name of the ric to translate into a host name (ip) |
1871 ## Function: generate_policy_uuid ##
1872 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
1873 UUID is then automatically added to the policy id in GET/PUT/DELETE.
1878 ## Function: sim_equal ##
1879 Tests if a variable value in the RIC simulator is equal to a target value.
1880 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1881 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.
1882 See the 'a1-interface' repo for more details.
1886 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1888 | parameter | description |
1889 | --------- | ----------- |
1890 | `<variable-name>` | Variable name in the ric simulator |
1891 | `<target-value>` | Target value for the variable |
1892 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1894 ## Function: sim_print ##
1895 Prints the value of a variable in the RIC simulator.
1896 See the 'a1-interface' repo for more details.
1900 | `<variable-name>` |
1902 | parameter | description |
1903 | --------- | ----------- |
1904 | `<variable-name>` | Variable name in the RIC simulator |
1907 ## Function: sim_contains_str ##
1908 Tests if a variable value in the RIC simulator contains a target string.
1909 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
1910 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.
1911 See the 'a1-interface' repo for more details.
1915 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1917 | parameter | description |
1918 | --------- | ----------- |
1919 | `<variable-name>` | Variable name in the ric simulator |
1920 | `<target-value>` | Target substring for the variable |
1921 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1923 ## Function: sim_put_policy_type ##
1924 Loads a policy type to the simulator
1928 | `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
1930 | parameter | description |
1931 | --------- | ----------- |
1932 | `<response-code>` | Expected http response code |
1933 | `<ric-id>` | Id of the ric |
1934 | `<policy-type-id>` | Id of the policy type |
1935 | `<policy-type-file>` | Path to the schema file of the policy type |
1937 ## Function: sim_delete_policy_type ##
1938 Deletes a policy type from the simulator
1942 | `<response-code> <ric-id> <policy_type_id>` |
1944 | parameter | description |
1945 | --------- | ----------- |
1946 | `<response-code>` | Expected http response code |
1947 | `<ric-id>` | Id of the ric |
1948 | `<policy-type-id>` | Id of the policy type |
1950 ## Function: sim_post_delete_instances ##
1951 Deletes all instances (and status), for one ric
1955 | `<response-code> <ric-id>` |
1957 | parameter | description |
1958 | --------- | ----------- |
1959 | `<response-code>` | Expected http response code |
1960 | `<ric-id>` | Id of the ric |
1963 ## Function: sim_post_delete_all ##
1964 Deletes all types, instances (and status), for one ric
1968 | `<response-code> <ric-id>` |
1970 | parameter | description |
1971 | --------- | ----------- |
1972 | `<response-code>` | Expected http response code |
1973 | `<ric-id>` | Id of the ric |
1975 ## Function: sim_post_forcedresponse ##
1976 Sets (or resets) response code for next (one) A1 message, for one ric.
1977 The intention is to simulate error response on the A1 interface.
1981 | `<response-code> <ric-id> [<forced_response_code>]`|
1983 | parameter | description |
1984 | --------- | ----------- |
1985 | `<response-code>` | Expected http response code |
1986 | `<ric-id>` | Id of the ric |
1987 | `<forced_response_code>` | Http response code to send |
1989 ## Function: sim_post_forcedelay ##
1990 Sets (or resets) A1 response delay, for one ric
1991 The intention is to delay responses on the A1 interface. Setting remains until removed.
1995 | `<response-code> <ric-id> [<delay-in-seconds>]`|
1997 | parameter | description |
1998 | --------- | ----------- |
1999 | `<response-code>` | Expected http response code |
2000 | `<ric-id>` | Id of the ric |
2001 | `<delay-in-seconds>` | Delay in seconds. If omitted, the delay is removed |
2006 Copyright (C) 2020 Nordix Foundation. All rights reserved.
2007 Licensed under the Apache License, Version 2.0 (the "License");
2008 you may not use this file except in compliance with the License.
2009 You may obtain a copy of the License at
2011 http://www.apache.org/licenses/LICENSE-2.0
2013 Unless required by applicable law or agreed to in writing, software
2014 distributed under the License is distributed on an "AS IS" BASIS,
2015 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2016 See the License for the specific language governing permissions and
2017 limitations under the License.