Add scripts & docker-compose file for oru app and related components
[nonrtric.git] / test / common / README.md
index 120a826..65f20cc 100644 (file)
@@ -81,6 +81,47 @@ The included functions are described in detail further below.
 `testsuite_common.sh` \
 Common functions for running two or more auto test scripts as a suite.
 
+## Integration of a new applicaton
+
+Integration a new application to the test environment involves the following steps.
+
+* Choose a short name for the application. Should be a uppcase name. For example, the NonRTRIC Gateway has NGW as short name.
+This short name shall be added to the testengine_config.sh. See that file for detailed instructions.
+
+* Create a file in this directory using the pattern `<application-name>_api_functions.sh`.
+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.
+
+| Function |
+|--|
+| __<app-short_name>_imagesetup |
+| __<app-short_name>_imagepull |
+| __<app-short_name>_imagebuild |
+| __<app-short_name>_image_data |
+| __<app-short_name>_kube_scale_zero |
+| __<app-short_name>_kube_scale_zero_and_wait |
+| __<app-short_name>_kube_delete_all |
+
+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.
+
+* 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.
+
+* 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.
+
+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.
+
+| Label for docker compose | Description |
+|--|--|
+| nrttest_app | shall contain the application short name |
+| nrttest_dp  | shall be set by a variable containing the display name, a short textual description of the applicaion |
+
+| Label for kubernetes resource | Description |
+|--|--|
+| autotest | shall contain the application short name |
+
+* 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>`.
+In addition, all other needed environment shall also be defined in these file.
+
+
 # Description of functions in testcase_common.sh #
 
 ## Script args ##
@@ -88,7 +129,7 @@ The script can be started with these arguments
 
 | arg list |
 |--|
-| `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>+]` |
+| `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>]` |
 
 | parameter | description |
 |-|-|
@@ -105,6 +146,9 @@ The script can be started with these arguments
 | `--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 |
+| `--image-repo` |  Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo |
+| `-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' |
+| `--cluster-timeout` |  Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds |
 | `help` | Print this info along with the test script description and the list of app short names supported |
 
 ## Function: setup_testenvironment
@@ -961,8 +1005,14 @@ Start the ECS container in docker or kube depending on running mode.
 |--|
 | None |
 
-## Function: restart_ecs ##
-Restart the ECS container.
+## Function: stop_ecs ##
+Stop the ECS container.
+| arg list |
+|--|
+| None |
+
+## Function: start_stopped_ecs ##
+Start a previously stopped ecs.
 | arg list |
 |--|
 | None |
@@ -1115,7 +1165,7 @@ To test, provide all the specified parameters.
 | `<template-job-file>` | Path to a job template for job parameters of the job  |
 
 ## Function: ecs_api_edp_get_type_ids() ##
-Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
+Test of GET '/ei-producer/v1/eitypes' or '/data-producer/v1/info-types' depending on ecs version and an optional check of the returned list of type ids.
 To test the response code only, provide the response code.
 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
 
@@ -1126,11 +1176,11 @@ To also test the response payload add list of expected type ids (or EMPTY if the
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
-| `<type-id>` | Id of the EI type  |
+| `<type-id>` | Id of the type  |
 | `EMPTY` | The expected list of type ids shall be empty  |
 
 ## Function: ecs_api_edp_get_producer_status() ##
-Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
+Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' or '/data-producer/v1/info-producers/{infoProducerId}/status' depending on ecs version and optional check of the returned status.
 To test the response code only, provide the response code and producer id.
 To also test the response payload add the expected status.
 
@@ -1159,6 +1209,23 @@ To also test the response payload add the list of expected producer-ids (or EMPT
 | `<producer-id>` | Id of the producer  |
 | `EMPTY` | The expected list of type ids shall be empty  |
 
+## Function: ecs_api_edp_get_producer_ids_2() ##
+Test of GET '/ei-producer/v1/eiproducers' or '/data-producer/v1/info-producers' depending on ecs version and optional check of the returned producer ids.
+To test the response code only, provide the response.
+To also test the response payload add the type (if any) and a list of expected producer-ids (or EMPTY if the list of ids is expected to be empty).
+
+| arg list |
+|--|
+| `<response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the type  |
+| `EMPTY` | No type given  |
+| `<producer-id>` | Id of the producer  |
+| `EMPTY` | The expected list of type ids shall be empty  |
+
 ## Function: ecs_api_edp_get_type() ##
 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
 To test the response code only, provide the response and the type-id.
@@ -1171,11 +1238,53 @@ To also test the response payload add a path to a job schema file and a list exp
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
-| `<type-id>` | Id of the EI type  |
+| `<type-id>` | Id of the type  |
 | `<job-schema-file>` | Path to a job schema file  |
 | `<producer-id>` | Id of the producer  |
 | `EMPTY` | The expected list of type ids shall be empty  |
 
+## Function: ecs_api_edp_get_type_2() ##
+Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' or '/data-producer/v1/info-types/{infoTypeId}' depending on ecs version and optional check of the returned type.
+To test the response code only, provide the response and the type-id.
+To also test the response payload add a path to a job schema file.
+
+| arg list |
+|--|
+| `<response-code> <type-id> [<job-schema-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the type  |
+| `<job-schema-file>` | Path to a job schema file  |
+| `EMPTY` | The expected list of type ids shall be empty  |
+
+## Function: ecs_api_edp_put_type_2() ##
+Test of PUT '/ei-producer/v1/eitypes/{eiTypeId}' or '/data-producer/v1/info-types/{infoTypeId}' depending on ecs version and optional check of the returned type.
+
+| arg list |
+|--|
+| `<response-code> <type-id> [<job-schema-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the type  |
+| `<job-schema-file>` | Path to a job schema file  |
+| `EMPTY` | The expected list of type ids shall be empty  |
+
+## Function: ecs_api_edp_delete_type_2() ##
+Test of DELETE '/ei-producer/v1/eitypes/{eiTypeId}' or '/data-producer/v1/info-types/{infoTypeId}' depending on ecs version and optional check of the returned type.
+
+| arg list |
+|--|
+| `<response-code> <type-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the type  |
+
 ## Function: ecs_api_edp_get_producer() ##
 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
 To test the response code only, provide the response and the producer-id.
@@ -1192,12 +1301,31 @@ To also test the response payload add the remaining parameters defining thee pro
 | `<create-callback>` | Callback for create job  |
 | `<delete-callback>` | Callback for delete job  |
 | `<supervision-callback>` | Callback for producer supervision  |
-| `<type-id>` | Id of the EI type  |
+| `<type-id>` | Id of the type  |
 | `<schema-file>` | Path to a schema file  |
 | `EMPTY` | The expected list of type schema pairs shall be empty  |
 
+
+## Function: ecs_api_edp_get_producer_2() ##
+Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' or '/data-producer/v1/info-producers/{infoProducerId}' depending on ecs version and optional check of the returned producer.
+To test the response code only, provide the response and the producer-id.
+To also test the response payload add the remaining parameters defining thee producer.
+
+| arg list |
+|--|
+| `<response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<job-callback>` | Callback for the url  |
+| `<supervision-callback>` | Callback for producer supervision  |
+| `<type-id>` | Id of the type  |
+| `EMPTY` | The expected list of types shall be empty  |
+
 ## Function: ecs_api_edp_delete_producer() ##
-Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
+Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}' or '/data-producer/v1/info-producers/{infoProducerId}' depending on ecs version.
 To test, provide all parameters.
 
 | arg list |
@@ -1223,10 +1351,27 @@ To test, provide all parameters. The list of type/schema pair may be empty.
 | `<producer-id>` | Id of the producer  |
 | `<job-callback>` | Callback for create/delete job  |
 | `<supervision-callback>` | Callback for producer supervision  |
-| `<type-id>` | Id of the EI type  |
+| `<type-id>` | Id of the type  |
 | `<schema-file>` | Path to a schema file  |
 | `EMPTY` | The list of type/schema pairs is empty  |
 
+## Function: ecs_api_edp_put_producer_2() ##
+Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}' or '/data-producer/v1/info-producers/{infoProducerId}' depending on ecs version.
+To test, provide all parameters. The list of type/schema pair may be empty.
+
+| arg list |
+|--|
+| `<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<job-callback>` | Callback for create/delete job  |
+| `<supervision-callback>` | Callback for producer supervision  |
+| `<type-id>` | Id of the type  |
+| `NOTYPE` | The list of types is empty  |
+
 ## Function: ecs_api_edp_get_producer_jobs() ##
 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
 To test the response code only, provide the response and the producer-id.
@@ -1247,6 +1392,26 @@ To also test the response payload add the remaining parameters.
 | `<template-job-file>` | Path to a job template file  |
 | `EMPTY` | The list of job/type/target/job-file tuples is empty  |
 
+## Function: ecs_api_edp_get_producer_jobs_2() ##
+Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' or '/data-producer/v1/info-producers/{infoProducerId}/info-jobs' depending on ecs version and optional check of the returned producer job.
+To test the response code only, provide the response and the producer-id.
+To also test the response payload add the remaining parameters.
+
+| arg list |
+|--|
+| `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<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  |
+| `EMPTY` | The list of job/type/target/job-file tuples is empty  |
+
 ## Function: ecs_api_service_status() ##
 Test of GET '/status'.
 
@@ -1258,6 +1423,121 @@ Test of GET '/status'.
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 
+## Function: ecs_api_idc_get_type_ids() ##
+Test of GET '/data-consumer/v1/info-types' and an optional check of the returned list of type ids.
+To test the response code only, provide the response code.
+To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
+
+| arg list |
+|--|
+| `<response-code> [ EMPTY | <type-id>+]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the Info type  |
+| `EMPTY` | The expected list of type ids shall be empty  |
+
+## Function: ecs_api_idc_get_job_ids() ##
+Test of GET '/data-consumer/v1/info-jobs' 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.
+To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
+
+| arg list |
+|--|
+| `<response-code> <type-id>  <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the Info type  |
+| `<owner-id>` | Id of the job owner  |
+| `NOOWNER` | No owner is given  |
+| `<job-id>` | Id of the expected job  |
+| `EMPTY` | The expected list of job id shall be empty  |
+
+## Function: ecs_api_idc_get_job() ##
+Test of GET '/data-consumer/v1/info-jobs/{infoJobId}' and optional check of the returned job.
+To test the response code only, provide the response code, type id and job id.
+To also test the response payload add the remaining parameters.
+
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the Info type  |
+| `<job-id>` | Id of the job  |
+| `<target-url>` | Expected target url for the job  |
+| `<owner-id>` | Expected owner for the job  |
+| `<template-job-file>` | Path to a job template for job parameters of the job  |
+
+## Function: ecs_api_idc_put_job() ##
+Test of PUT '​/data-consumer/v1/info-jobs/{infoJobId}'.
+To test, provide all the specified parameters.
+
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file> [VALIDATE]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the Info type  |
+| `<job-id>` | Id of the job  |
+| `<target-url>` | Target url for the job  |
+| `<owner-id>` | Owner of the job  |
+| `<template-job-file>` | Path to a job template for job parameters of the job  |
+| `VALIIDATE` | Indicator to preform type validation at creation  |
+
+## Function: ecs_api_idc_delete_job() ##
+Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
+To test, provide all the specified parameters.
+
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the type  |
+| `<job-id>` | Id of the job  |
+
+## Function: ecs_api_idc_get_type() ##
+Test of GET '/data-consumer/v1/info-types/{infoTypeId} and optional check of the returned schema.
+To test the response code only, provide the response code parameter as well as the type-id.
+To also test the response payload add a path to the expected schema file.
+
+| arg list |
+|--|
+| `<response-code> <type-id> [<schema-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the Info type  |
+| `<schema-file>` | Path to a schema file to compare with the returned schema  |
+
+## Function: ecs_api_idc_get_job_status() ##
+Test of GET '/data-consumer/v1/info-jobs/{infoJobId}/status' and optional check of the returned status.
+To test the response code only, provide the response code, type id and job id.
+To also test the response payload add the expected status.
+
+| arg list |
+|--|
+| `<response-code> <type-id> <job-id> [<status>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<type-id>` | Id of the Info type  |
+| `<job-id>` | Id of the job  |
+| `<status>` | Expected status  |
+
+
 ## Function: ecs_api_admin_reset() ##
 Test of GET '/status'.
 
@@ -1314,7 +1594,7 @@ Sample test of pms api (status)
 | `<response-code>` | Expected http response code |
 
 ## Function: gateway_ecs_get_types ##
-Sample test of ecs api (get ei type)
+Sample test of ecs api (get types)
 Only response code tested - not payload
 | arg list |
 |--|
@@ -1326,6 +1606,18 @@ Only response code tested - not payload
 
 # Description of functions in http_proxy_api_functions.sh #
 
+## Function: use_http_proxy_http ##
+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.
+| arg list |
+|--|
+| None |
+
+## Function: use_http_proxy_https ##
+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.
+| arg list |
+|--|
+| None |
+
 ## Function: start_http_proxy ##
 Start the http proxy container in docker or kube depending on running mode.
 | arg list |
@@ -1334,6 +1626,18 @@ Start the http proxy container in docker or kube depending on running mode.
 
 # Description of functions in kube_proxy_api_functions.sh #
 
+## Function: use_kube_proxy_http ##
+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.
+| arg list |
+|--|
+| None |
+
+## Function: use_kube_proxy_https ##
+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.
+| arg list |
+|--|
+| None |
+
 ## Function: start_kube_proxy ##
 Start the kube proxy container in kube. This proxy enabled the test env to access all services and pods in a kube cluster.
 No proxy is started if the function is called in docker mode.
@@ -1517,6 +1821,40 @@ Check a job in the prodstub towards the list of provided parameters.
 | `<job-owner>` | Id of the job owner  |
 | `<template-job-file>` | Path to a job template file  |
 
+## Function: prodstub_check_jobdata_2() ##
+Check a job in the prodstub towards the list of provided parameters.
+
+| arg list |
+|--|
+| `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<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_check_jobdata_3() ##
+Check a job in the prodstub towards the list of provided parameters.
+
+| arg list |
+|--|
+| `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<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.