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]` |
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 image repo. Only required in when running in multi-node kube cluster, otherwise optional. All used images will be re-tagged and pushed to this repo
151 | `help` | Print this info along with the test script description and the list of app short names supported |
153 ## Function: setup_testenvironment
154 Main function to setup the test environment before any tests are started.
155 Must be called right after sourcing all component scripts.
160 ## Function: indent1 ##
161 Indent every line of a command output with one space char.
166 ## Function: indent2 ##
167 Indent every line of a command output with two space chars.
172 ## Function: print_result ##
173 Print a test report of an auto-test script.
178 ## Function: start_timer ##
179 Start a timer for time measurement. Only one timer can be running.
182 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
184 ## Function: print_timer ##
185 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.
188 | `<timer-message-to-print>` |
190 | parameter | description |
191 | --------- | ----------- |
192 | `<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`) |
194 ## Function: print_and_reset_timer ##
195 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.
198 | `<timer-message-to-print>` |
200 | parameter | description |
201 | --------- | ----------- |
202 | `<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`) |
204 ## Function: deviation ##
205 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
208 | `<deviation-message-to-print>` |
210 | parameter | description |
211 | --------- | ----------- |
212 | `<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 |
214 ## Function: clean_environment ##
215 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).
220 ## Function: auto_clean_containers ##
221 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.
226 ## Function: sleep_wait ##
227 Make the script sleep for a number of seconds.
230 | `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
232 | parameter | description |
233 | --------- | ----------- |
234 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
235 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
237 ## Function: check_control_panel_logs ##
238 Check the Control Panel log for any warnings and errors and print the count of each.
243 ## Function: store_logs ##
244 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.
247 | `<logfile-prefix>` |
249 | parameter | description |
250 | --------- | ----------- |
251 | `<logfile-prefix>` | Log file prefix |
254 # Description of functions in testsuite_common.sh #
256 ## Function: suite_setup ##
257 Sets up the test suite and prints out a heading.
263 Print out the overall result of the executed test cases.
268 # Description of functions in agent_api_functions.sh #
271 Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
272 For api function in version 2, an url prefix is added if configured.
274 ## Function: use_agent_rest_http ##
275 Use http for all API calls to the Policy Agent. This is the default.
280 ## Function: use_agent_rest_https ##
281 Use https for all API calls to the Policy Agent.
286 ## Function: use_agent_dmaap_http ##
287 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
292 ## Function: use_agent_dmaap_https ##
293 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
298 ## Function: start_policy_agent ##
299 Start the Policy Agent container or corresponding kube resources depending on docker/kube mode.
301 | `<logfile-prefix>` |
302 | (docker) `PROXY|NOPROXY <config-file>` |
303 | (kube) `PROXY|NOPROXY <config-file> [ <data-file> ]` |
304 | parameter | description |
305 | --------- | ----------- |
306 | `PROXY` | Configure with http proxy, if proxy is started |
307 | `NOPROXY` | Configure without http proxy |
308 | <config-file>` | Path to application.yaml |
309 | <data-file>` | Optional path to application_configuration.json |
311 ## Function: agent_load_config ##
312 Load the config into a config map (kubernetes only).
315 | parameter | description |
316 | --------- | ----------- |
317 | <data-file>` | Path to application_configuration.json |
319 ## Function: set_agent_debug ##
320 Configure the Policy Agent log on debug level. The Policy Agent must be running.
325 ## Function: set_agent_trace ##
326 Configure the Policy Agent log on trace level. The Policy Agent must be running.
331 ## Function: use_agent_retries ##
332 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
335 | `[<response-code>]*` |
338 ## Function: check_policy_agent_logs ##
339 Check the Policy Agent log for any warnings and errors and print the count of each.
344 ## Function: api_equal() ##
346 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
347 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
348 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.
349 See the 'cr' dir for more details.
353 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
355 | parameter | description |
356 | --------- | ----------- |
357 | `<variable-name>` | Relative url. Example 'json:policy_types' - checks the json array length of the url /policy_types |
358 | `<target-value>` | Target value for the length |
359 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value |
361 ## Function: api_get_policies() ##
362 Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
363 To test the response code only, provide the response code parameter as well as the following three parameters.
364 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.
368 | `<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>]*]` |
372 | `<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>]*]` |
374 | parameter | description |
375 | --------- | ----------- |
376 | `<response-code>` | Expected http response code |
377 | `<ric-id>` | Id of the ric |
378 | `NORIC` | Indicator that no ric is provided |
379 | `<service-id>` | Id of the service |
380 | `NOSERVICE` | Indicator that no service id is provided |
381 | `<policy-type-id>` | Id of the policy type |
382 | `NOTYPE` | Indicator that no type id is provided |
383 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
384 | `<policy-id>` | Id of the policy |
385 | `EMPTY` | Indicate for the special empty policy type |
386 | `transient` | Transient, true or false |
387 | `notification-url` | Url for notifications |
388 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
391 ## Function: api_get_policy() ##
392 Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
393 To test the the response code only, provide the expected response code and policy id.
394 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
398 | `<response-code> <policy-id> [<template-file>]` |
402 | `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
404 | parameter | description |
405 | --------- | ----------- |
406 | `<response-code>` | Expected http response code |
407 | `<policy-id>` | Id of the policy |
408 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
409 | `<service-id>` | Id of the service |
410 | `<ric-id>` | Id of the ric |
411 | `<policy-type-id>` | Id of the policy type |
412 | `NOTYPE` | Indicator that no type id is provided |
413 | `transient` | Transient, true or false |
414 | `notification-url` | Url for notifications |
416 ## Function: api_put_policy() ##
417 Test of PUT '/policy' or V2 PUT '/policies'.
418 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).
422 | `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
426 | `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
428 | parameter | description |
429 | --------- | ----------- |
430 | `<response-code>` | Expected http response code |
431 | `<service-id>` | Id of the service |
432 | `<ric-id>` | Id of the ric |
433 | `<policy-type-id>` | Id of the policy type |
434 | `<policy-id>` | Id of the policy. This value shall be a numeric value if more than one policy shall be created |
435 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
436 | `notification-url` | Url for notifications |
437 |`NOURL`| Indicator for no url |
438 | `<template-file>` | Path to the template file for the policy |
439 | `<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 |
441 ## Function: api_put_policy_batch() ##
442 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.
443 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.
444 For arg list and parameters, see 'api_put_policy'.
446 ## Function: api_put_policy_parallel() ##
447 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.
451 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
455 | `<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>`
457 | parameter | description |
458 | --------- | ----------- |
459 | `<response-code>` | Expected http response code |
460 | `<service-id>` | Id of the service |
461 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
462 | `<number-of-rics>` | The number of rics, assuming the first index is '1'. The index is added to the 'ric-id-base' id |
463 | `<policy-type-id>` | Id of the policy type |
464 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
465 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
466 | `notification-url` | Url for notifications |
467 | `<template-file>` | Path to the template file for the policy |
468 | `<count-per-ric>` | Number of policies per ric |
469 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
471 ## Function: api_delete_policy() ##
472 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.
476 | `<response-code> <policy-id> [<count>]`
478 | parameter | description |
479 | --------- | ----------- |
480 | `<response-code>` | Expected http response code |
481 | `<policy-id>` | Id of the policy |
482 | `<count>` | An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
484 ## Function: api_delete_policy_batch() ##
485 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.
486 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.
487 For arg list and parameters, see 'api_delete_policy'.
489 ## Function: api_delete_policy_parallel() ##
490 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.
494 | `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
496 | parameter | description |
497 | --------- | ----------- |
498 | `<response-code>` | Expected http response code |
499 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
500 | `<number-of-rics>` | The number of rics, assuming the first index is '1' |
501 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
502 | `<count-per-ric>` | Number of policies per ric |
503 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
506 ## Function: api_get_policy_ids() ##
508 Test of GET '/policy_ids' or V2 GET '/v2/policies'.
509 To test response code only, provide the response code parameter as well as the following three parameters.
510 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.
514 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
516 | parameter | description |
517 | --------- | ----------- |
518 | `<response-code>` | Expected http response code |
519 | `<ric-id>` | Id of the ric |
520 | `NORIC` | Indicator that no ric is provided |
521 | `<service-id>` | Id of the service |
522 | `NOSERVICE` | Indicator that no service id is provided |
523 | `type-id>` | Id of the policy type |
524 | `NOTYPE` | Indicator that no type id is provided |
525 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
526 | `<policy-instance-id>` | Id of the policy |
528 ## Function: api_get_policy_schema() ##
529 Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
530 To test the response code only, provide the expected response code and policy type id.
531 To test the contents of the returned json schema, add a path to a schema file to compare with.
535 | `<response-code> <policy-type-id> [<schema-file>]` |
537 | parameter | description |
538 | --------- | ----------- |
539 | `<response-code>` | Expected http response code |
540 | `<policy-type-id>` | Id of the policy type |
541 | `<schema-file>` | Path to the schema file for the policy type |
543 ## Function: api_get_policy_schema() ##
544 Test of GET '/policy_schema' and optional check of the returned json schema.
545 To test the response code only, provide the expected response code and policy type id.
546 To test the contents of the returned json schema, add a path to a schema file to compare with.
550 | `<response-code> <policy-type-id> [<schema-file>]` |
552 | parameter | description |
553 | --------- | ----------- |
554 | `<response-code>` | Expected http response code |
555 | `<policy-type-id>` | Id of the policy type |
556 | `<schema-file>` | Path to the schema file for the policy type |
558 ## Function: api_get_policy_schemas() ##
559 Test of GET '/policy_schemas' and optional check of the returned json schemas.
560 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
561 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)
565 | `<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*` |
567 | parameter | description |
568 | --------- | ----------- |
569 | `<response-code>` | Expected http response code |
570 | `<ric-id>` | Id of the ric |
571 | `NORIC` | No ric id given |
572 | `<schema-file>` | Path to the schema file for the policy type |
573 | `NOFILE` | Indicate the template for an empty type |
575 ## Function: api_get_policy_status() ##
576 Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
580 | `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
582 | parameter | description |
583 | --------- | ----------- |
584 | `<response-code>` | Expected http response code |
585 | `<policy-id>` | Id of the policy |
586 | `STD` | Indicator of status of Standarized A1 |
587 | `STD2` | Indicator of status of Standarized A1 version 2 |
588 | `<enforce-status>` | Enforcement status |
589 | `<reason>` | Optional reason |
590 | `EMPTY` | Indicator of empty string status or reason |
591 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
592 | `<instance-status>` | Instance status |
593 | `<has-been-deleted>` | Deleted status, true or false |
595 ## Function: api_get_policy_types() ##
596 Test of GET '/policy_types' or V2 GET '/v2/policy-types' and optional check of the returned ids.
597 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
598 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
602 | `<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]` |
604 | parameter | description |
605 | --------- | ----------- |
606 | `<response-code>` | Expected http response code |
607 | `<ric-id>` | Id of the ric |
608 | `NORIC` | No ric id given |
609 | `<policy-type-id>` | Id of the policy type |
610 | `EMPTY` | Indicate the empty type |
612 ## Function: api_get_status() ##
613 Test of GET /status or V2 GET /status
617 | `<response-code>` |
619 | parameter | description |
620 | --------- | ----------- |
621 | `<response-code>` | Expected http response code |
623 ## Function: api_get_ric() ##
624 Test of GET '/ric' or V2 GET '/v2/rics/ric'
625 To test the response code only, provide the expected response code and managed element id.
626 To test the returned ric id, provide the expected ric id.
630 | `<reponse-code> <managed-element-id> [<ric-id>]` |
634 | `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
636 | parameter | description |
637 | --------- | ----------- |
638 | `<response-code>` | Expected http response code |
639 | `<managed-element-id>` | Id of the managed element |
640 | `NOME` | Indicator for no ME |
641 | `ric-id` | Id of the ric |
642 | `NORIC` | Indicator no RIC |
643 | `string-of-ricinfo` | String of ric info |
645 ## Function: api_get_rics() ##
646 Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
647 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
648 To test also the returned payload, add the formatted string of info in the returned payload.
649 Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
650 Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
654 | `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
656 | parameter | description |
657 | --------- | ----------- |
658 | `<response-code>` | Expected http response code |
659 | `<policy-type-id>` | Policy type id of the ric |
660 | `NOTYPE>` | No type given |
661 | `<space-separate-string-of-ricinfo>` | A space separated string of ric info - needs to be quoted |
663 ## Function: api_put_service() ##
664 Test of PUT '/service' or V2 PUT '/service'.
667 | `<response-code> <service-name> <keepalive-timeout> <callbackurl>` |
669 | parameter | description |
670 | --------- | ----------- |
671 | `<response-code>` | Expected http response code |
672 | `<service-name>` | Service name |
673 | `<keepalive-timeout>` | Timeout value |
674 | `<callbackurl>` | Callback url |
676 ## Function: api_get_services() ##
677 Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
678 To test only the response code, omit all parameters except the expected response code.
679 To test the returned json, provide the parameters after the response code.
683 | `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
685 | parameter | description |
686 | --------- | ----------- |
687 | `<response-code>` | Expected http response code |
688 | <query-service-name>` | Service name for the query |
689 | <target-service-name>` | Target service name|
690 | `<keepalive-timeout>` | Timeout value |
691 | `<callbackurl>` | Callback url |
692 | `NOSERVICE` | Indicator of no target service name |
694 ## Function: api_get_service_ids() ##
695 Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
699 | `<response-code> [<service-name>]*` |
701 | parameter | description |
702 | --------- | ----------- |
703 | `<response-code>` | Expected http response code |
704 | `<service-name>` | Service name |
706 ## Function: api_delete_services() ##
707 Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
711 | `<response-code> [<service-name>]*` |
713 | parameter | description |
714 | --------- | ----------- |
715 | `<response-code>` | Expected http response code |
716 | `<service-name>` | Service name |
718 ## Function: api_put_services_keepalive() ##
719 Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
723 | <response-code> <service-name>` |
725 | parameter | description |
726 | --------- | ----------- |
727 | `<response-code>` | Expected http response code |
728 | `<service-name>` | Service name |
730 ## Function: api_put_configuration() ##
731 Test of PUT '/v2/configuration'
735 | <response-code> <config-file>` |
737 | parameter | description |
738 | --------- | ----------- |
739 | `<response-code>` | Expected http response code |
740 | `<config-file>` | Path json config file |
742 ## Function: api_get_configuration() ##
743 Test of GET '/v2/configuration'
747 | <response-code> [<config-file>]` |
749 | parameter | description |
750 | --------- | ----------- |
751 | `<response-code>` | Expected http response code |
752 | `<config-file>` | Path json config file to compare the retrieved config with |
753 | parameter | description |
754 | --------- | ----------- |
755 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'. |
758 # Description of functions in consul_cbs_function.sh #
761 ## Function: consul_config_app ##
762 Function to load a json config from a file into consul for the Policy Agent
766 | `<json-config-file>` |
768 | parameter | description |
769 | --------- | ----------- |
770 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
772 ## Function: prepare_consul_config ##
773 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')
776 | `<deviation-message-to-print>` |
778 | parameter | description |
779 | --------- | ----------- |
780 | `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
781 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app' |
783 ## Function: start_consul_cbs ##
784 Start the Consul and CBS containers
789 # Description of functions in control_panel_api_function.sh #
791 ## Function: use_control_panel_http ##
792 Set http as the protocol to use for all communication to the Control Panel
797 ## Function: use_control_panel_https ##
798 Set https as the protocol to use for all communication to the Control Panel
803 ## Function: start_control_panel ##
804 Start the Control Panel container
809 # Description of functions in controller_api_functions.sh #
810 The file contains a selection of the possible API tests towards the a1-controller
812 ## Function: use_sdnc_http ##
813 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.
818 ## Function: use_sdnc_http ##
819 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
824 ## Function: start_sdnc ##
825 Start the SDNC A1 Controller container and its database container
830 ## Function: check_sdnc_logs ##
831 Check the SDNC log for any warnings and errors and print the count of each.
836 ## Function: controller_api_get_A1_policy_ids ##
837 Test of GET policy ids towards OSC or STD type simulator.
838 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
839 To test the response payload, include the ids of the expexted response.
843 | `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
845 | parameter | description |
846 | --------- | ----------- |
847 | `<response-code>` | Expected http response code |
848 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
849 | `<ric-id>` | Id of the ric |
850 | `policy-type-id>` | Id of the policy type |
851 | `<policy-id>` | Id of the policy |
852 | `STD` | Indicator of status of Standarized A1 |
855 ## Function: controller_api_get_A1_policy_type ##
856 Test of GET a policy type (OSC only)
860 | `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
862 | parameter | description |
863 | --------- | ----------- |
864 | `<response-code>` | Expected http response code |
865 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
866 | `<ric-id>` | Id of the ric |
867 | `policy-type-id>` | Id of the policy type |
868 | `policy-type-file>` | Optional schema file to compare the returned type with |
870 ## Function: controller_api_delete_A1_policy ##
871 Deletes a policy instance
875 | `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
877 | parameter | description |
878 | --------- | ----------- |
879 | `<response-code>` | Expected http response code |
880 | `STD` | Indicator of status of Standarized A1 |
881 | `<ric-id>` | Id of the ric |
882 | `<policy-id>` | Id of the policy |
883 | `policy-type-id>` | Id of the policy type |
884 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
885 | `policy-type-file>` | Optional schema file to compare the returned type with |
887 ## Function: controller_api_put_A1_policy ##
888 Creates a policy instance
892 | `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
894 | parameter | description |
895 | --------- | ----------- |
896 | `<response-code>` | Expected http response code |
897 | `STD` | Indicator of status of Standarized A1 |
898 | `<ric-id>` | Id of the ric |
899 | `<policy-id>` | Id of the policy |
900 | `<template-file>` | Path to the template file of the policy|
901 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
902 | `<policy-type-id>` | Id of the policy type |
904 ## Function: controller_api_get_A1_policy_status ##
905 Checks the status of a policy
909 | `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
911 | parameter | description |
912 | --------- | ----------- |
913 | `<response-code>` | Expected http response code |
914 | `STD` | Indicator of status of Standarized A1 |
915 | `<ric-id>` | Id of the ric |
916 | `<policy-id>` | Id of the policy |
917 | `<enforce-status>` | Enforcement status |
918 | `<reason>` | Optional reason |
919 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
920 | `<policy-type-id>` | Id of the policy type |
921 | `<instance-status>` | Instance status |
922 | `<has-been-deleted>` | Deleted status, true or false |
925 # Description of functions in cr_api_functions.sh #
927 ## Function: use_cr_http ##
928 Use http for getting event from CR. The admin API is not affected. This is the default.
933 ## Function: use_cr_https ##
934 Use https for getting event from CR. The admin API is not affected.
935 Note: Not yet used as callback event is not fully implemented/deciced.
940 ## Function: start_cr ##
941 Start the Callback Receiver container in docker or kube depending on start mode.
946 ## Function: cr_equal ##
947 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
948 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
949 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.
950 See the 'cr' dir for more details.
953 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
955 | parameter | description |
956 | --------- | ----------- |
957 | `<variable-name>` | Variable name in the CR |
958 | `<target-value>` | Target value for the variable |
959 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
961 ## Function: cr_api_check_all_sync_events() ##
962 Check the contents of all ric events received for a callback id.
966 | `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
968 | parameter | description |
969 | --------- | ----------- |
970 | `<response-code>` | Expected http response code |
971 | `<id>` | Id of the callback destination |
972 | `EMPTY` | Indicator for an empty list |
973 | `<ric-id>` | Id of the ric |
975 # Description of functions in ecs_api_functions.sh #
977 ## Function: use_ecs_rest_http ##
978 Use http for all API calls to the ECS. This is the default protocol.
983 ## Function: use_ecs_rest_https ##
984 Use https for all API calls to the ECS.
989 ## Function: use_ecs_dmaap_http ##
990 Send and recieve all API calls to the ECS over Dmaap via the MR using http.
995 ## Function: use_ecs_dmaap_https ##
996 Send and recieve all API calls to the ECS over Dmaap via the MR using https.
1001 ## Function: start_ecs ##
1002 Start the ECS container in docker or kube depending on running mode.
1007 ## Function: restart_ecs ##
1008 Restart the ECS container.
1013 ## Function: set_ecs_debug ##
1014 Configure the ECS log on debug level. The ECS must be running.
1019 ## Function: set_ecs_trace ##
1020 Configure the ECS log on trace level. The ECS must be running.
1025 ## Function: check_ecs_logs ##
1026 Check the ECS log for any warnings and errors and print the count of each.
1031 ## Function: ecs_equal ##
1032 Tests if a variable value in the ECS is equal to a target value.
1033 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1034 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.
1035 See the 'a1-interface' repo for more details.
1039 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1041 | parameter | description |
1042 | --------- | ----------- |
1043 | `<variable-name>` | Variable name in ecs |
1044 | `<target-value>` | Target value for the variable |
1045 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1047 ## Function: ecs_api_a1_get_job_ids() ##
1048 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
1049 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1050 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1054 | `<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1056 | parameter | description |
1057 | --------- | ----------- |
1058 | `<response-code>` | Expected http response code |
1059 | `<type-id>` | Id of the EI type |
1060 | `<owner-id>` | Id of the job owner |
1061 | `NOOWNER` | No owner is given |
1062 | `<job-id>` | Id of the expected job |
1063 | `EMPTY` | The expected list of job id shall be empty |
1065 ## Function: ecs_api_a1_get_type() ##
1066 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
1067 To test the response code only, provide the response code parameter as well as the type-id.
1068 To also test the response payload add a path to the expected schema file.
1072 | `<response-code> <type-id> [<schema-file>]` |
1074 | parameter | description |
1075 | --------- | ----------- |
1076 | `<response-code>` | Expected http response code |
1077 | `<type-id>` | Id of the EI type |
1078 | `<schema-file>` | Path to a schema file to compare with the returned schema |
1080 ## Function: ecs_api_a1_get_type_ids() ##
1081 Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
1082 To test the response code only, provide the response only.
1083 To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
1087 | `<response-code> [ (EMPTY | [<type-id>]+) ]` |
1089 | parameter | description |
1090 | --------- | ----------- |
1091 | `<response-code>` | Expected http response code |
1092 | `EMPTY` | The expected list of type ids shall be empty |
1093 | `<type-id>` | Id of the EI type |
1095 ## Function: ecs_api_a1_get_job_status() ##
1096 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
1097 To test the response code only, provide the response code, type id and job id.
1098 To also test the response payload add the expected status.
1102 | `<response-code> <type-id> <job-id> [<status>]` |
1104 | parameter | description |
1105 | --------- | ----------- |
1106 | `<response-code>` | Expected http response code |
1107 | `<type-id>` | Id of the EI type |
1108 | `<job-id>` | Id of the job |
1109 | `<status>` | Expected status |
1111 ## Function: ecs_api_a1_get_job() ##
1112 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
1113 To test the response code only, provide the response code, type id and job id.
1114 To also test the response payload add the remaining parameters.
1118 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1120 | parameter | description |
1121 | --------- | ----------- |
1122 | `<response-code>` | Expected http response code |
1123 | `<type-id>` | Id of the EI type |
1124 | `<job-id>` | Id of the job |
1125 | `<target-url>` | Expected target url for the job |
1126 | `<owner-id>` | Expected owner for the job |
1127 | `<template-job-file>` | Path to a job template for job parameters of the job |
1129 ## Function: ecs_api_a1_delete_job() ##
1130 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1131 To test, provide all the specified parameters.
1135 | `<response-code> <type-id> <job-id> |
1137 | parameter | description |
1138 | --------- | ----------- |
1139 | `<response-code>` | Expected http response code |
1140 | `<type-id>` | Id of the EI type |
1141 | `<job-id>` | Id of the job |
1143 ## Function: ecs_api_a1_put_job() ##
1144 Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1145 To test, provide all the specified parameters.
1149 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
1151 | parameter | description |
1152 | --------- | ----------- |
1153 | `<response-code>` | Expected http response code |
1154 | `<type-id>` | Id of the EI type |
1155 | `<job-id>` | Id of the job |
1156 | `<target-url>` | Target url for the job |
1157 | `<owner-id>` | Owner of the job |
1158 | `<template-job-file>` | Path to a job template for job parameters of the job |
1160 ## Function: ecs_api_edp_get_type_ids() ##
1161 Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
1162 To test the response code only, provide the response code.
1163 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1167 | `<response-code> [ EMPTY | <type-id>+]` |
1169 | parameter | description |
1170 | --------- | ----------- |
1171 | `<response-code>` | Expected http response code |
1172 | `<type-id>` | Id of the EI type |
1173 | `EMPTY` | The expected list of type ids shall be empty |
1175 ## Function: ecs_api_edp_get_producer_status() ##
1176 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
1177 To test the response code only, provide the response code and producer id.
1178 To also test the response payload add the expected status.
1182 | `<response-code> <producer-id> [<status>]` |
1184 | parameter | description |
1185 | --------- | ----------- |
1186 | `<response-code>` | Expected http response code |
1187 | `<producer-id>` | Id of the producer |
1188 | `<status>` | The expected status string |
1190 ## Function: ecs_api_edp_get_producer_ids() ##
1191 Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
1192 To test the response code only, provide the response.
1193 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).
1197 | `<response-code> [ EMPTY | <producer-id>+]` |
1199 | parameter | description |
1200 | --------- | ----------- |
1201 | `<response-code>` | Expected http response code |
1202 | `<producer-id>` | Id of the producer |
1203 | `EMPTY` | The expected list of type ids shall be empty |
1205 ## Function: ecs_api_edp_get_type() ##
1206 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
1207 To test the response code only, provide the response and the type-id.
1208 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).
1212 | `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
1214 | parameter | description |
1215 | --------- | ----------- |
1216 | `<response-code>` | Expected http response code |
1217 | `<type-id>` | Id of the EI type |
1218 | `<job-schema-file>` | Path to a job schema file |
1219 | `<producer-id>` | Id of the producer |
1220 | `EMPTY` | The expected list of type ids shall be empty |
1222 ## Function: ecs_api_edp_get_producer() ##
1223 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
1224 To test the response code only, provide the response and the producer-id.
1225 To also test the response payload add the remaining parameters defining thee producer.
1229 | `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
1231 | parameter | description |
1232 | --------- | ----------- |
1233 | `<response-code>` | Expected http response code |
1234 | `<producer-id>` | Id of the producer |
1235 | `<create-callback>` | Callback for create job |
1236 | `<delete-callback>` | Callback for delete job |
1237 | `<supervision-callback>` | Callback for producer supervision |
1238 | `<type-id>` | Id of the EI type |
1239 | `<schema-file>` | Path to a schema file |
1240 | `EMPTY` | The expected list of type schema pairs shall be empty |
1242 ## Function: ecs_api_edp_delete_producer() ##
1243 Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
1244 To test, provide all parameters.
1248 | `<response-code> <producer-id>` |
1250 | parameter | description |
1251 | --------- | ----------- |
1252 | `<response-code>` | Expected http response code |
1253 | `<producer-id>` | Id of the producer |
1255 ## Function: ecs_api_edp_put_producer() ##
1256 Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
1257 To test, provide all parameters. The list of type/schema pair may be empty.
1261 | `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
1263 | parameter | description |
1264 | --------- | ----------- |
1265 | `<response-code>` | Expected http response code |
1266 | `<producer-id>` | Id of the producer |
1267 | `<job-callback>` | Callback for create/delete job |
1268 | `<supervision-callback>` | Callback for producer supervision |
1269 | `<type-id>` | Id of the EI type |
1270 | `<schema-file>` | Path to a schema file |
1271 | `EMPTY` | The list of type/schema pairs is empty |
1273 ## Function: ecs_api_edp_get_producer_jobs() ##
1274 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
1275 To test the response code only, provide the response and the producer-id.
1276 To also test the response payload add the remaining parameters.
1280 | `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
1282 | parameter | description |
1283 | --------- | ----------- |
1284 | `<response-code>` | Expected http response code |
1285 | `<producer-id>` | Id of the producer |
1286 | `<job-id>` | Id of the job |
1287 | `<type-id>` | Id of the EI type |
1288 | `<target-url>` | Target url for data delivery |
1289 | `<job-owner>` | Id of the job owner |
1290 | `<template-job-file>` | Path to a job template file |
1291 | `EMPTY` | The list of job/type/target/job-file tuples is empty |
1293 ## Function: ecs_api_service_status() ##
1294 Test of GET '/status'.
1298 | `<response-code>` |
1300 | parameter | description |
1301 | --------- | ----------- |
1302 | `<response-code>` | Expected http response code |
1304 ## Function: ecs_api_admin_reset() ##
1305 Test of GET '/status'.
1309 | `<response-code> [ <type> ]` |
1311 | parameter | description |
1312 | --------- | ----------- |
1313 | `<response-code>` | Expected http response code |
1314 | `<type>` | Type id, if the interface supports type in url |
1316 # Description of functions in gateway_api_functions.sh #
1319 ## Function: use_gateway_http ##
1320 Use http for all calls to the gateway. This is set by default.
1325 ## Function: use_gateway_https ##
1326 Use https for all calls to the gateway.
1331 ## Function: set_gateway_debug ##
1332 Set debug level logging in the gateway
1337 ## Function: set_gateway_trace ##
1338 Set debug level logging in the trace
1343 ## Function: start_gateway ##
1344 Start the the gateway container in docker or kube depending on start mode
1349 ## Function: gateway_pms_get_status ##
1350 Sample test of pms api (status)
1353 | `<response-code> ` |
1355 | parameter | description |
1356 | --------- | ----------- |
1357 | `<response-code>` | Expected http response code |
1359 ## Function: gateway_ecs_get_types ##
1360 Sample test of ecs api (get ei type)
1361 Only response code tested - not payload
1364 | `<response-code> ` |
1366 | parameter | description |
1367 | --------- | ----------- |
1368 | `<response-code>` | Expected http response code |
1370 # Description of functions in http_proxy_api_functions.sh #
1372 ## Function: start_http_proxy ##
1373 Start the http proxy container in docker or kube depending on running mode.
1378 # Description of functions in kube_proxy_api_functions.sh #
1380 ## Function: start_kube_proxy ##
1381 Start the kube proxy container in kube. This proxy enabled the test env to access all services and pods in a kube cluster.
1382 No proxy is started if the function is called in docker mode.
1387 # Description of functions in mr_api_functions.sh #
1389 ## Function: use_mr_http ##
1390 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.
1395 ## Function: use_mr_https ##
1396 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.
1401 ## Function: start_mr ##
1402 Start the Message Router stub interface container in docker or kube depending on start mode
1408 ## Function: mr_equal ##
1409 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
1410 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1411 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.
1412 See the 'mrstub' dir for more details.
1415 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1417 | parameter | description |
1418 | --------- | ----------- |
1419 | `<variable-name>` | Variable name in the MR |
1420 | `<target-value>` | Target value for the variable |
1421 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1423 ## Function: mr_greater ##
1424 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
1425 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
1426 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.
1427 See the 'mrstub' dir for more details.
1430 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1432 | parameter | description |
1433 | --------- | ----------- |
1434 | `<variable-name>` | Variable name in the MR |
1435 | `<target-value>` | Target value for the variable |
1436 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value |
1438 ## Function: mr_read ##
1439 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.
1440 See the 'mrstub' dir for more details.
1443 | `<variable-name>` |
1445 | parameter | description |
1446 | --------- | ----------- |
1447 | `<variable-name>` | Variable name in the MR |
1449 ## Function: mr_print ##
1450 Prints the value of a variable in the Message Router (MR) simulator.
1451 See the 'mrstub' dir for more details.
1454 | `<variable-name>` |
1456 | parameter | description |
1457 | --------- | ----------- |
1458 | `<variable-name>` | Variable name in the MR |
1461 # Description of functions in prodstub_api_functions.sh #
1463 ## Function: use_prod_stub_http ##
1464 Use http for the API. The admin API is not affected. This is the default protocol.
1469 ## Function: use_prod_stub_https ##
1470 Use https for the API. The admin API is not affected.
1475 ## Function: start_prod_stub ##
1476 Start the Producer stub container in docker or kube depending on start mode
1481 ## Function: prodstub_arm_producer() ##
1482 Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
1486 | `<response-code> <producer-id> [<forced_response_code>]` |
1488 | parameter | description |
1489 | --------- | ----------- |
1490 | `<response-code>` | Expected http response code |
1491 | `<producer-id>` | Id of the producer |
1492 | `<forced_response_code>` | Forced response code for the producer callback url |
1494 ## Function: prodstub_arm_job_create() ##
1495 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.
1499 | `<response-code> <job-id> [<forced_response_code>]` |
1501 | parameter | description |
1502 | --------- | ----------- |
1503 | `<response-code>` | Expected http response code |
1504 | `<job-id>` | Id of the job |
1505 | `<forced_response_code>` | Forced response code for the create callback url |
1507 ## Function: prodstub_arm_job_delete() ##
1508 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.
1512 | `<response-code> <job-id> [<forced_response_code>]` |
1514 | parameter | description |
1515 | --------- | ----------- |
1516 | `<response-code>` | Expected http response code |
1517 | `<job-id>` | Id of the job |
1518 | `<forced_response_code>` | Forced response code for the delete callback url |
1520 ## Function: prodstub_arm_type() ##
1521 Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
1525 | `<response-code> <producer-id> <type-id>` |
1527 | parameter | description |
1528 | --------- | ----------- |
1529 | `<response-code>` | Expected http response code |
1530 | `<producer-id>` | Id of the producer |
1531 | `<type-id>` | Id of the type |
1533 ## Function: prodstub_disarm_type() ##
1534 Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
1538 | `<response-code> <producer-id> <type-id>` |
1540 | parameter | description |
1541 | --------- | ----------- |
1542 | `<response-code>` | Expected http response code |
1543 | `<producer-id>` | Id of the producer |
1544 | `<type-id>` | Id of the type |
1546 ## Function: prodstub_check_jobdata() ##
1547 Check a job in the prodstub towards the list of provided parameters.
1551 | `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
1553 | parameter | description |
1554 | --------- | ----------- |
1555 | `<response-code>` | Expected http response code |
1556 | `<producer-id>` | Id of the producer |
1557 | `<job-id>` | Id of the job |
1558 | `<type-id>` | Id of the type |
1559 | `<target-url>` | Target url for data delivery |
1560 | `<job-owner>` | Id of the job owner |
1561 | `<template-job-file>` | Path to a job template file |
1563 ## Function: prodstub_delete_jobdata() ##
1564 Delete the job parameters, job data, for a job.
1568 | `<response-code> <producer-id> <job-id>` |
1570 | parameter | description |
1571 | --------- | ----------- |
1572 | `<response-code>` | Expected http response code |
1573 | `<producer-id>` | Id of the producer |
1574 | `<job-id>` | Id of the job |
1577 ## Function: prodstub_equal ##
1578 Tests if a variable value in the prodstub is equal to a target value.
1579 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1580 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.
1584 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1586 | parameter | description |
1587 | --------- | ----------- |
1588 | `<variable-name>` | Variable name in the prostub |
1589 | `<target-value>` | Target value for the variable |
1590 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1593 # Description of functions in rapp_catalogue_api_function.sh #
1595 ## Function: use_rapp_catalogue_http ##
1596 Use http for the API. This is the default protocol.
1601 ## Function: use_rapp_catalogue_https ##
1602 Use https for the API.
1607 ## Function: start_rapp_catalogue ##
1608 Start the rapp catalogue container in docker or kube depending on start mode
1613 ## Function: rc_equal ##
1614 Tests if a variable value in the RAPP Catalogue is equal to a target value.
1615 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1616 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.
1617 See the 'cr' dir for more details.
1620 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1622 | parameter | description |
1623 | --------- | ----------- |
1624 | `<variable-name>` | Variable name in the RC |
1625 | `<target-value>` | Target value for the variable |
1626 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1628 ## Function: rapp_cat_api_get_services() ##
1629 Check all registered services.
1633 | `<response-code> [(<service-id> <version> <display-name> <description>)+ | EMPTY ]` |
1635 | parameter | description |
1636 | --------- | ----------- |
1637 | `<response-code>` | Expected http response code |
1638 | `<service-id>` | Id of the service |
1639 | `<version>` | Version of the service |
1640 | `<display-name>` | Dislay name of the service |
1641 | `<description>` | Description of the service |
1642 | `EMPTY` | Indicator for an empty list |
1644 ## Function: rapp_cat_api_put_service() ##
1645 Register a services.
1649 | `<response-code> <service-id> <version> <display-name> <description>` |
1651 | parameter | description |
1652 | --------- | ----------- |
1653 | `<response-code>` | Expected http response code |
1654 | `<service-id>` | Id of the service |
1655 | `<version>` | Version of the service |
1656 | `<display-name>` | Dislay name of the service |
1657 | `<description>` | Description of the service |
1659 ## Function: rapp_cat_api_get_service() ##
1660 Check a registered service.
1664 | `<response-code> <service-id> <version> <display-name> <description>` |
1666 | parameter | description |
1667 | --------- | ----------- |
1668 | `<response-code>` | Expected http response code |
1669 | `<service-id>` | Id of the service |
1670 | `<version>` | Version of the service |
1671 | `<display-name>` | Dislay name of the service |
1672 | `<description>` | Description of the service |
1674 ## Function: rapp_cat_api_delete_service() ##
1675 Check a registered service.
1679 | `<response-code> <service-id>` |
1681 | parameter | description |
1682 | --------- | ----------- |
1683 | `<response-code>` | Expected http response code |
1684 | `<service-id>` | Id of the service |
1687 # Description of functions in ricsimulator_api_functions.sh #
1688 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
1691 ## Function: use_simulator_http ##
1692 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.
1697 ## Function: use_simulator_https ##
1698 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.
1703 ## Function: start_ric_simulators ##
1704 Start a group of simulator where a group may contain 1 more simulators. Started in docker or kube depending on start mode
1707 | `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
1709 | parameter | description |
1710 | --------- | ----------- |
1711 | `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 |
1712 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
1713 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
1715 ## Function: get_kube_sim_host ##
1716 Translate ric name to kube host name.
1721 | parameter | description |
1722 | --------- | ----------- |
1723 | `<ric-name>` | The name of the ric to translate into a host name (ip) |
1725 ## Function: generate_policy_uuid ##
1726 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
1727 UUID is then automatically added to the policy id in GET/PUT/DELETE.
1732 ## Function: sim_equal ##
1733 Tests if a variable value in the RIC simulator is equal to a target value.
1734 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1735 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.
1736 See the 'a1-interface' repo for more details.
1740 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1742 | parameter | description |
1743 | --------- | ----------- |
1744 | `<variable-name>` | Variable name in the ric simulator |
1745 | `<target-value>` | Target value for the variable |
1746 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1748 ## Function: sim_print ##
1749 Prints the value of a variable in the RIC simulator.
1750 See the 'a1-interface' repo for more details.
1754 | `<variable-name>` |
1756 | parameter | description |
1757 | --------- | ----------- |
1758 | `<variable-name>` | Variable name in the RIC simulator |
1761 ## Function: sim_contains_str ##
1762 Tests if a variable value in the RIC simulator contains a target string.
1763 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
1764 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.
1765 See the 'a1-interface' repo for more details.
1769 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1771 | parameter | description |
1772 | --------- | ----------- |
1773 | `<variable-name>` | Variable name in the ric simulator |
1774 | `<target-value>` | Target substring for the variable |
1775 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1777 ## Function: sim_put_policy_type ##
1778 Loads a policy type to the simulator
1782 | `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
1784 | parameter | description |
1785 | --------- | ----------- |
1786 | `<response-code>` | Expected http response code |
1787 | `<ric-id>` | Id of the ric |
1788 | `<policy-type-id>` | Id of the policy type |
1789 | `<policy-type-file>` | Path to the schema file of the policy type |
1791 ## Function: sim_delete_policy_type ##
1792 Deletes a policy type from the simulator
1796 | `<response-code> <ric-id> <policy_type_id>` |
1798 | parameter | description |
1799 | --------- | ----------- |
1800 | `<response-code>` | Expected http response code |
1801 | `<ric-id>` | Id of the ric |
1802 | `<policy-type-id>` | Id of the policy type |
1804 ## Function: sim_post_delete_instances ##
1805 Deletes all instances (and status), for one ric
1809 | `<response-code> <ric-id>` |
1811 | parameter | description |
1812 | --------- | ----------- |
1813 | `<response-code>` | Expected http response code |
1814 | `<ric-id>` | Id of the ric |
1817 ## Function: sim_post_delete_all ##
1818 Deletes all types, instances (and status), for one ric
1822 | `<response-code> <ric-id>` |
1824 | parameter | description |
1825 | --------- | ----------- |
1826 | `<response-code>` | Expected http response code |
1827 | `<ric-id>` | Id of the ric |
1829 ## Function: sim_post_forcedresponse ##
1830 Sets (or resets) response code for next (one) A1 message, for one ric.
1831 The intention is to simulate error response on the A1 interface.
1835 | `<response-code> <ric-id> [<forced_response_code>]`|
1837 | parameter | description |
1838 | --------- | ----------- |
1839 | `<response-code>` | Expected http response code |
1840 | `<ric-id>` | Id of the ric |
1841 | `<forced_response_code>` | Http response code to send |
1843 ## Function: sim_post_forcedelay ##
1844 Sets (or resets) A1 response delay, for one ric
1845 The intention is to delay responses on the A1 interface. Setting remains until removed.
1849 | `<response-code> <ric-id> [<delay-in-seconds>]`|
1851 | parameter | description |
1852 | --------- | ----------- |
1853 | `<response-code>` | Expected http response code |
1854 | `<ric-id>` | Id of the ric |
1855 | `<delay-in-seconds>` | Delay in seconds. If omitted, the delay is removed |
1860 Copyright (C) 2020 Nordix Foundation. All rights reserved.
1861 Licensed under the Apache License, Version 2.0 (the "License");
1862 you may not use this file except in compliance with the License.
1863 You may obtain a copy of the License at
1865 http://www.apache.org/licenses/LICENSE-2.0
1867 Unless required by applicable law or agreed to in writing, software
1868 distributed under the License is distributed on an "AS IS" BASIS,
1869 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1870 See the License for the specific language governing permissions and
1871 limitations under the License.