Merge "Change to use checked exceptions in rAPP Catalogue"
[nonrtric.git] / test / common / README.md
index 75b16b5..b4754cd 100644 (file)
@@ -16,7 +16,7 @@ The included functions are described in detail further below.
 Common functions for running two or more auto test scripts as a suite.
 
 `api_curl.sh` \
-A common curl based function for the agent and ecs apis.
+A common curl based function for the agent and ecs apis. Also partly used for the Callback receiver and RAPP Catalogue apis.
 
 `agent_api_functions.sh` \
 Contains functions for adapting towards the Policy Agent API, also via dmaap (using a message-router stub interface)
@@ -33,6 +33,9 @@ Contains functions for adapting towards the RIC (A1) simulator admin API.
 `prodstub_api_functions.sh` \
 Contains functions for adapting towards the Producer stub interface - simulates a producer.
 
+`rapp_catalogue_api_functions.sh` \
+Contains functions for adapting towards the RAPP Catalogue.
+
 `compare_json.py` \
 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'.
 
@@ -54,6 +57,8 @@ A python script to extract the information from an sdnc (A1 Controller) reply js
 `do_curl_function.sh`
 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)
 
+`cr_api_functions.sh` \
+Contains functions for adapting towards the Callback receiver for checking received callback event.
 
 
 # Description of functions in testcase_common.sh #
@@ -63,18 +68,22 @@ The script can be started with these arguments
 
 | arg list |
 |--|
-| `local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ]  [--use-local-image <app-nam> [<app-name>]*]` |
+| `remote|remote-remove --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>+]` |
 
 | parameter | description |
 |-|-|
-| `local` | only locally built images (in local docker respository) will be used for the Non-RT RIC components. CBS, Consul, DB will still use remote nexus images |
-| `remote` | only remote images from nexus will be used. Images pulled if not present in local docker repository |
-| `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
-| `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
-| `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
-| `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
-| `--env-file` | point to a file with environment variables (the previous default, test_env.sh, replaced with one env file for each branch in test/common) |
-| `--use-local-image <app-nam> [<app-name>]*` | nnly applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC for Policy Agent, Control Panel, A1-controller and the Ric simulator |
+| `remote` | Use images from remote repositories. Can be overridden for individual images using the '--use_xxx' flags |
+| `remote-remove` | Same as 'remote' but will also try to pull fresh images from remote repositories |
+| `--env-file` | The script will use the supplied file to read environment variables from |
+| `release` | If this flag is given the script will use release version of the images |
+| `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 |
+| `--stop-at-error` | The script will stop when the first failed test or configuration |
+| `--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). |
+| `--use-local-image` | The script will use local images for the supplied apps, space separated list of app short names |
+| `--use-snapshot-image` | The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names |
+| `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names |
+| `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names |
+| `help` | Print this info along with the test script description and the list of app short names supported |
 
 
 ## Function: print_result ##
@@ -344,6 +353,12 @@ Start the ECS container.
 |--|
 | None |
 
+## Function: restart_ecs ##
+Restart the ECS container.
+| arg list |
+|--|
+| None |
+
 ## Function: use_ecs_rest_http ##
 Use http for all API calls to the ECS. This is the default protocol.
 | arg list |
@@ -415,21 +430,6 @@ Take a snap-shot of all logs for all running containers and stores them in `./lo
 | `<logfile-prefix>` | Log file prefix  |
 
 
-## Function: cr_equal ##
-Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
-Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
-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.
-See the 'cr' dir for more details.
-| arg list |
-|--|
-| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
-
-| parameter | description |
-| --------- | ----------- |
-| `<variable-name>` | Variable name in the CR  |
-| `<target-value>` | Target value for the variable  |
-| `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
-
 ## Function: mr_equal ##
 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
@@ -531,7 +531,7 @@ See the 'cr' dir for more details.
 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value  |
 
 ## Function: api_get_policies() ##
-Test of GET '/policies' or V2 GET '/v2/policy_instances' and optional check of the array of returned policies.
+Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
 To test the response code only, provide the response code parameter as well as the following three parameters.
 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.
 
@@ -749,15 +749,17 @@ Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
 
 | arg list |
 |--|
-| `<response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)` |
+| `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
 
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 | `<policy-id>` |  Id of the policy |
 | `STD` |  Indicator of status of Standarized A1 |
+| `STD2` |  Indicator of status of Standarized A1 version 2 |
 | `<enforce-status>` |  Enforcement status |
 | `<reason>` |  Optional reason |
+| `EMPTY` |  Indicator of empty string status or reason |
 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
 | `<instance-status>` |  Instance status |
 | `<has-been-deleted>` |  Deleted status, true or false |
@@ -897,6 +899,30 @@ Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive
 | `<response-code>` | Expected http response code |
 | `<service-name>` |  Service name |
 
+## Function: api_put_configuration() ##
+Test of PUT '/v2/configuration'
+
+| arg list |
+|--|
+| <response-code> <config-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<config-file>` |  Path json config file |
+
+## Function: api_get_configuration() ##
+Test of GET '/v2/configuration'
+
+| arg list |
+|--|
+| <response-code> [<config-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<config-file>` |  Path json config file to compare the retrieved config with |
+
 # Description of functions in ricsimulator_api_functions.sh #
 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
 
@@ -1122,6 +1148,22 @@ Checks the status of a policy
 
 # Description of functions in ecs_api_function.sh #
 
+## Function: ecs_equal ##
+Tests if a variable value in the ECS is equal to a target value.
+Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
+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.
+See the 'a1-interface' repo for more details.
+
+| arg list |
+|--|
+| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<variable-name>` | Variable name in ecs  |
+| `<target-value>` | Target value for the variable  |
+| `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
+
 ## Function: ecs_api_a1_get_job_ids() ##
 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
 To test the response code only, provide the response code parameter as well as a type id and an owner id.
@@ -1336,14 +1378,13 @@ To test, provide all parameters. The list of type/schema pair may be empty.
 
 | arg list |
 |--|
-| `<response-code> <producer-id> <create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
+| `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
 
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 | `<producer-id>` | Id of the producer  |
-| `<create-callback>` | Callback for create job  |
-| `<delete-callback>` | Callback for delete job  |
+| `<job-callback>` | Callback for create/delete job  |
 | `<supervision-callback>` | Callback for producer supervision  |
 | `<type-id>` | Id of the EI type  |
 | `<schema-file>` | Path to a schema file  |
@@ -1356,7 +1397,7 @@ To also test the response payload add the remaining parameters.
 
 | arg list |
 |--|
-| `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)` |
+| `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
 
 | parameter | description |
 | --------- | ----------- |
@@ -1365,6 +1406,7 @@ To also test the response payload add the remaining parameters.
 | `<job-id>` | Id of the job  |
 | `<type-id>` | Id of the EI type  |
 | `<target-url>` | Target url for data delivery  |
+| `<job-owner>` | Id of the job owner  |
 | `<template-job-file>` | Path to a job template file  |
 | `EMPTY` | The list of job/type/target/job-file tuples is empty  |
 
@@ -1452,7 +1494,7 @@ Check a job in the prodstub towards the list of provided parameters.
 
 | arg list |
 |--|
-| `<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>` |
+| `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
 
 | parameter | description |
 | --------- | ----------- |
@@ -1461,8 +1503,23 @@ Check a job in the prodstub towards the list of provided parameters.
 | `<job-id>` | Id of the job  |
 | `<type-id>` | Id of the type  |
 | `<target-url>` | Target url for data delivery  |
+| `<job-owner>` | Id of the job owner  |
 | `<template-job-file>` | Path to a job template file  |
 
+## Function: prodstub_delete_jobdata() ##
+Delete the job parameters, job data, for a job.
+
+| arg list |
+|--|
+| `<response-code> <producer-id> <job-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<job-id>` | Id of the job  |
+
+
 ## Function: prodstub_equal ##
 Tests if a variable value in the prodstub is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
@@ -1478,6 +1535,112 @@ With the timeout, the test waits up to the timeout seconds before setting pass o
 | `<target-value>` | Target value for the variable  |
 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
 
+# Description of functions in cr_api_function.sh #
+
+## Function: cr_equal ##
+Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
+Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
+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.
+See the 'cr' dir for more details.
+| arg list |
+|--|
+| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<variable-name>` | Variable name in the CR  |
+| `<target-value>` | Target value for the variable  |
+| `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
+
+## Function: cr_api_check_all_sync_events() ##
+Check the contents of all ric events received for a callback id.
+
+| arg list |
+|--|
+| `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<id>` | Id of the callback destination  |
+| `EMPTY` | Indicator for an empty list  |
+| `<ric-id>` | Id of the ric  |
+
+# Description of functions in rapp_catalogue_api_function.sh #
+
+## Function: rc_equal ##
+Tests if a variable value in the RAPP Catalogue is equal to a target value.
+Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
+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.
+See the 'cr' dir for more details.
+| arg list |
+|--|
+| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<variable-name>` | Variable name in the RC  |
+| `<target-value>` | Target value for the variable  |
+| `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
+
+## Function: rapp_cat_api_get_services() ##
+Check all registered services.
+
+| arg list |
+|--|
+| `<response-code> [(<service-id> <version> <display-name> <description>)+ | EMPTY ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<service-id>` | Id of the service  |
+| `<version>` | Version of the service  |
+| `<display-name>` | Dislay name of the service  |
+| `<description>` | Description of the service  |
+| `EMPTY` | Indicator for an empty list  |
+
+## Function: rapp_cat_api_put_service() ##
+Register a services.
+
+| arg list |
+|--|
+| `<response-code> <service-id> <version> <display-name> <description>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<service-id>` | Id of the service  |
+| `<version>` | Version of the service  |
+| `<display-name>` | Dislay name of the service  |
+| `<description>` | Description of the service  |
+
+## Function: rapp_cat_api_get_service() ##
+Check a registered service.
+
+| arg list |
+|--|
+| `<response-code> <service-id> <version> <display-name> <description>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<service-id>` | Id of the service  |
+| `<version>` | Version of the service  |
+| `<display-name>` | Dislay name of the service  |
+| `<description>` | Description of the service  |
+
+## Function: rapp_cat_api_delete_service() ##
+Check a registered service.
+
+| arg list |
+|--|
+| `<response-code> <service-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<service-id>` | Id of the service  |
+
 
 ## License