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 `consult_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 `http_proxy_api_functions.sh` \
53 Contains functions for managing the Http Proxy
55 `mr_api_functions.sh` \
56 Contains functions for managing the MR Stub and the Dmaap Message Router
58 `prodstub_api_functions.sh` \
59 Contains functions for adapting towards the Producer stub interface - simulates a producer.
61 `rapp_catalogue_api_functions.sh` \
62 Contains functions for adapting towards the RAPP Catalogue.
64 `ricsimulator_api_functions.sh` \
65 Contains functions for adapting towards the RIC (A1) simulator admin API.
68 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.
69 Used by the auto test scripts/suites but could be used for other test script as well. The test cases shall be started with the file for the intended target using command line argument '--env-file'. There are preconfigured env files, pattern 'test_env*.sh', in ../common.
71 `testcase_common.sh` \
72 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.
73 The included functions are described in detail further below.
75 `testsuite_common.sh` \
76 Common functions for running two or more auto test scripts as a suite.
78 # Description of functions in testcase_common.sh #
81 The script can be started with these arguments
85 | `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>+]` |
87 | parameter | description |
89 | `remote` | Use images from remote repositories. Can be overridden for individual images using the '--use_xxx' flags |
90 | `remote-remove` | Same as 'remote' but will also try to pull fresh images from remote repositories |
91 | `docker` | Use docker environment for test |
92 | `kuber` | Use kubernetes environment for test. Requires a kubernetes minikube installation |
93 | `--env-file` | The script will use the supplied file to read environment variables from |
94 | `release` | If this flag is given the script will use release version of the images |
95 | `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 |
96 | `--stop-at-error` | The script will stop when the first failed test or configuration |
97 | `--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). |
98 | `--use-local-image` | The script will use local images for the supplied apps, space separated list of app short names |
99 | `--use-snapshot-image` | The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names |
100 | `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names |
101 | `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names |
102 | `help` | Print this info along with the test script description and the list of app short names supported |
104 ## Function: indent1 ##
105 Indent every line of a command output with one space char.
110 ## Function: indent2 ##
111 Indent every line of a command output with two space chars.
116 ## Function: print_result ##
117 Print a test report of an auto-test script.
122 ## Function: start_timer ##
123 Start a timer for time measurement. Only one timer can be running.
126 | None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
128 ## Function: print_timer ##
129 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.
132 | `<timer-message-to-print>` |
134 | parameter | description |
135 | --------- | ----------- |
136 | `<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`) |
138 ## Function: print_and_reset_timer ##
139 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.
142 | `<timer-message-to-print>` |
144 | parameter | description |
145 | --------- | ----------- |
146 | `<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`) |
148 ## Function: deviation ##
149 Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
152 | `<deviation-message-to-print>` |
154 | parameter | description |
155 | --------- | ----------- |
156 | `<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 |
158 ## Function: get_kube_sim_host ##
159 Translate ric name to kube host name.
164 | parameter | description |
165 | --------- | ----------- |
166 | `<ric-name>` | The name of the ric to translate into a host name (ip) |
168 ## Function: clean_environment ##
169 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).
174 ## Function: auto_clean_containers ##
175 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.
180 ## Function: sleep_wait ##
181 Make the script sleep for a number of seconds.
184 | `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
186 | parameter | description |
187 | --------- | ----------- |
188 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
189 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
191 ## Function: generate_uuid ##
192 Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
193 UUID is then automatically added to the policy id in GET/PUT/DELETE.
198 ## Function: check_policy_agent_logs ##
199 Check the Policy Agent log for any warnings and errors and print the count of each.
204 ## Function: check_ecs_logs ##
205 Check the ECS log for any warnings and errors and print the count of each.
210 ## Function: check_control_panel_logs ##
211 Check the Control Panel log for any warnings and errors and print the count of each.
216 ## Function: check_sdnc_logs ##
217 Check the SDNC log for any warnings and errors and print the count of each.
222 ## Function: store_logs ##
223 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.
226 | `<logfile-prefix>` |
228 | parameter | description |
229 | --------- | ----------- |
230 | `<logfile-prefix>` | Log file prefix |
233 # Description of functions in testsuite_common.sh #
235 ## Function: suite_setup ##
236 Sets up the test suite and prints out a heading.
242 Print out the overall result of the executed test cases.
247 # Description of functions in agent_api_functions.sh #
250 Both PMS version 1 and 2 are supported. The version is controlled by the env variable `$PMS_VERSION` set in the test env file.
251 For api function in version 2, an url prefix is added if configured.
253 ## Function: use_agent_rest_http ##
254 Use http for all API calls to the Policy Agent. This is the default.
259 ## Function: use_agent_rest_https ##
260 Use https for all API calls to the Policy Agent.
265 ## Function: use_agent_dmaap_http ##
266 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
271 ## Function: use_agent_dmaap_https ##
272 Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
277 ## Function: start_policy_agent ##
278 Start the Policy Agent container or corresponding kube resources depending on docker/kube mode.
280 | `<logfile-prefix>` |
281 | (docker) `PROXY|NOPROXY <config-file>` |
282 | (kube) `PROXY|NOPROXY <config-file> [ <data-file> ]` |
283 | parameter | description |
284 | --------- | ----------- |
285 | `PROXY` | Configure with http proxy, if proxy is started |
286 | `NOPROXY` | Configure without http proxy |
287 | <config-file>` | Path to application.yaml |
288 | <data-file>` | Optional path to application_configuration.json |
290 ## Function: agent_load_config ##
291 Load the config into a config map (kubernetes only).
294 | parameter | description |
295 | --------- | ----------- |
296 | <data-file>` | Path to application_configuration.json |
298 ## Function: set_agent_debug ##
299 Configure the Policy Agent log on debug level. The Policy Agent must be running.
304 ## Function: set_agent_trace ##
305 Configure the Policy Agent log on trace level. The Policy Agent must be running.
310 ## Function: use_agent_retries ##
311 Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
314 | `[<response-code>]*` |
316 ## Function: api_equal() ##
318 Tests if the array length of a json array in the Policy Agent simulator is equal to a target value.
319 Without the timeout, the test sets pass or fail immediately depending on if the array length is equal to the target or not.
320 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.
321 See the 'cr' dir for more details.
325 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
327 | parameter | description |
328 | --------- | ----------- |
329 | `<variable-name>` | Relative url. Example 'json:policy_types' - checks the json array length of the url /policy_types |
330 | `<target-value>` | Target value for the length |
331 | `<timeout-in-sec>` | Max time to wait for the length to reach the target value |
333 ## Function: api_get_policies() ##
334 Test of GET '/policies' or V2 GET '/v2/policy-instances' and optional check of the array of returned policies.
335 To test the response code only, provide the response code parameter as well as the following three parameters.
336 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.
340 | `<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>]*]` |
344 | `<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>]*]` |
346 | parameter | description |
347 | --------- | ----------- |
348 | `<response-code>` | Expected http response code |
349 | `<ric-id>` | Id of the ric |
350 | `NORIC` | Indicator that no ric is provided |
351 | `<service-id>` | Id of the service |
352 | `NOSERVICE` | Indicator that no service id is provided |
353 | `<policy-type-id>` | Id of the policy type |
354 | `NOTYPE` | Indicator that no type id is provided |
355 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
356 | `<policy-id>` | Id of the policy |
357 | `EMPTY` | Indicate for the special empty policy type |
358 | `transient` | Transient, true or false |
359 | `notification-url` | Url for notifications |
360 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
363 ## Function: api_get_policy() ##
364 Test of GET '/policy' or V2 GET '/v2/policies/{policy_id}' and optional check of the returned json payload.
365 To test the the response code only, provide the expected response code and policy id.
366 To test the contents of the returned json payload, add a path to the template file used when creating the policy.
370 | `<response-code> <policy-id> [<template-file>]` |
374 | `<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]` |
376 | parameter | description |
377 | --------- | ----------- |
378 | `<response-code>` | Expected http response code |
379 | `<policy-id>` | Id of the policy |
380 | `<template-file>` | Path to the template file for the policy (same template used when creating the policy) |
381 | `<service-id>` | Id of the service |
382 | `<ric-id>` | Id of the ric |
383 | `<policy-type-id>` | Id of the policy type |
384 | `NOTYPE` | Indicator that no type id is provided |
385 | `transient` | Transient, true or false |
386 | `notification-url` | Url for notifications |
388 ## Function: api_put_policy() ##
389 Test of PUT '/policy' or V2 PUT '/policies'.
390 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).
394 | `<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]` |
398 | `<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]` |
400 | parameter | description |
401 | --------- | ----------- |
402 | `<response-code>` | Expected http response code |
403 | `<service-id>` | Id of the service |
404 | `<ric-id>` | Id of the ric |
405 | `<policy-type-id>` | Id of the policy type |
406 | `<policy-id>` | Id of the policy. This value shall be a numeric value if more than one policy shall be created |
407 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provided) |
408 | `notification-url` | Url for notifications |
409 |`NOURL`| Indicator for no url |
410 | `<template-file>` | Path to the template file for the policy |
411 | `<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 |
413 ## Function: api_put_policy_batch() ##
414 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.
415 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.
416 For arg list and parameters, see 'api_put_policy'.
418 ## Function: api_put_policy_parallel() ##
419 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.
423 | `<response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>`
427 | `<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>`
429 | parameter | description |
430 | --------- | ----------- |
431 | `<response-code>` | Expected http response code |
432 | `<service-id>` | Id of the service |
433 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
434 | `<number-of-rics>` | The number of rics, assuming the first index is '1'. The index is added to the 'ric-id-base' id |
435 | `<policy-type-id>` | Id of the policy type |
436 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
437 | `transient>` | Transient 'true' or 'false'. 'NOTRANSIENT' can be used to indicate using the default value (no transient value provide) |
438 | `notification-url` | Url for notifications |
439 | `<template-file>` | Path to the template file for the policy |
440 | `<count-per-ric>` | Number of policies per ric |
441 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
443 ## Function: api_delete_policy() ##
444 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.
448 | `<response-code> <policy-id> [<count>]`
450 | parameter | description |
451 | --------- | ----------- |
452 | `<response-code>` | Expected http response code |
453 | `<policy-id>` | Id of the policy |
454 | `<count>` | An optional count of policies to delete. The 'policy-id' will be the first id to be deleted. |
456 ## Function: api_delete_policy_batch() ##
457 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.
458 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.
459 For arg list and parameters, see 'api_delete_policy'.
461 ## Function: api_delete_policy_parallel() ##
462 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.
466 | `<response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>`
468 | parameter | description |
469 | --------- | ----------- |
470 | `<response-code>` | Expected http response code |
471 | `<ric-id-base>` | The base id of the rics, ie ric id without the sequence number. The sequence number is added during processing |
472 | `<number-of-rics>` | The number of rics, assuming the first index is '1' |
473 | `<policy-start-id>` | Id of the policy. This value shall be a numeric value and will be the id of the first policy |
474 | `<count-per-ric>` | Number of policies per ric |
475 | `<number-of-threads>` | Number of threads (processes) to run in parallel |
478 ## Function: api_get_policy_ids() ##
480 Test of GET '/policy_ids' or V2 GET '/v2/policies'.
481 To test response code only, provide the response code parameter as well as the following three parameters.
482 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.
486 | `<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)` |
488 | parameter | description |
489 | --------- | ----------- |
490 | `<response-code>` | Expected http response code |
491 | `<ric-id>` | Id of the ric |
492 | `NORIC` | Indicator that no ric is provided |
493 | `<service-id>` | Id of the service |
494 | `NOSERVICE` | Indicator that no service id is provided |
495 | `type-id>` | Id of the policy type |
496 | `NOTYPE` | Indicator that no type id is provided |
497 | `NOID` | Indicator that no policy id is provided - indicate empty list of policies|
498 | `<policy-instance-id>` | Id of the policy |
500 ## Function: api_get_policy_schema() ##
501 Test of V2 GET '/v2/policy-types/{policyTypeId}' and optional check of the returned json schema.
502 To test the response code only, provide the expected response code and policy type id.
503 To test the contents of the returned json schema, add a path to a schema file to compare with.
507 | `<response-code> <policy-type-id> [<schema-file>]` |
509 | parameter | description |
510 | --------- | ----------- |
511 | `<response-code>` | Expected http response code |
512 | `<policy-type-id>` | Id of the policy type |
513 | `<schema-file>` | Path to the schema file for the policy type |
515 ## Function: api_get_policy_schema() ##
516 Test of GET '/policy_schema' and optional check of the returned json schema.
517 To test the response code only, provide the expected response code and policy type id.
518 To test the contents of the returned json schema, add a path to a schema file to compare with.
522 | `<response-code> <policy-type-id> [<schema-file>]` |
524 | parameter | description |
525 | --------- | ----------- |
526 | `<response-code>` | Expected http response code |
527 | `<policy-type-id>` | Id of the policy type |
528 | `<schema-file>` | Path to the schema file for the policy type |
530 ## Function: api_get_policy_schemas() ##
531 Test of GET '/policy_schemas' and optional check of the returned json schemas.
532 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
533 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)
537 | `<response-code> <ric-id>|NORIC [<schema-file>|NOFILE]*` |
539 | parameter | description |
540 | --------- | ----------- |
541 | `<response-code>` | Expected http response code |
542 | `<ric-id>` | Id of the ric |
543 | `NORIC` | No ric id given |
544 | `<schema-file>` | Path to the schema file for the policy type |
545 | `NOFILE` | Indicate the template for an empty type |
547 ## Function: api_get_policy_status() ##
548 Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
552 | `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
554 | parameter | description |
555 | --------- | ----------- |
556 | `<response-code>` | Expected http response code |
557 | `<policy-id>` | Id of the policy |
558 | `STD` | Indicator of status of Standarized A1 |
559 | `STD2` | Indicator of status of Standarized A1 version 2 |
560 | `<enforce-status>` | Enforcement status |
561 | `<reason>` | Optional reason |
562 | `EMPTY` | Indicator of empty string status or reason |
563 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
564 | `<instance-status>` | Instance status |
565 | `<has-been-deleted>` | Deleted status, true or false |
567 ## Function: api_get_policy_types() ##
568 Test of GET '/policy_types' or V2 GET '/v2/policy-types' and optional check of the returned ids.
569 To test the response code only, provide the expected response code and ric id (or NORIC if no ric is given).
570 To test the contents of the returned json payload, add the list of expected policy type id (or 'EMPTY' for the '{}' type)
574 | `<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]` |
576 | parameter | description |
577 | --------- | ----------- |
578 | `<response-code>` | Expected http response code |
579 | `<ric-id>` | Id of the ric |
580 | `NORIC` | No ric id given |
581 | `<policy-type-id>` | Id of the policy type |
582 | `EMPTY` | Indicate the empty type |
584 ## Function: api_get_status() ##
585 Test of GET /status or V2 GET /status
589 | `<response-code>` |
591 | parameter | description |
592 | --------- | ----------- |
593 | `<response-code>` | Expected http response code |
595 ## Function: api_get_ric() ##
596 Test of GET '/ric' or V2 GET '/v2/rics/ric'
597 To test the response code only, provide the expected response code and managed element id.
598 To test the returned ric id, provide the expected ric id.
602 | `<reponse-code> <managed-element-id> [<ric-id>]` |
606 | `<reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]` |
608 | parameter | description |
609 | --------- | ----------- |
610 | `<response-code>` | Expected http response code |
611 | `<managed-element-id>` | Id of the managed element |
612 | `NOME` | Indicator for no ME |
613 | `ric-id` | Id of the ric |
614 | `NORIC` | Indicator no RIC |
615 | `string-of-ricinfo` | String of ric info |
617 ## Function: api_get_rics() ##
618 Test of GET '/rics' or V2 GET '/v2/rics' and optional check of the returned json payload (ricinfo).
619 To test the response code only, provide the expected response code and policy type id (or NOTYPE if no type is given).
620 To test also the returned payload, add the formatted string of info in the returned payload.
621 Format of ricinfo: '<ric-id>:<list-of-mes>:<list-of-policy-type-ids>'
622 Example `<space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."`
626 | `<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]` |
628 | parameter | description |
629 | --------- | ----------- |
630 | `<response-code>` | Expected http response code |
631 | `<policy-type-id>` | Policy type id of the ric |
632 | `NOTYPE>` | No type given |
633 | `<space-separate-string-of-ricinfo>` | A space separated string of ric info - needs to be quoted |
635 ## Function: api_put_service() ##
636 Test of PUT '/service' or V2 PUT '/service'.
639 | `<response-code> <service-name> <keepalive-timeout> <callbackurl>` |
641 | parameter | description |
642 | --------- | ----------- |
643 | `<response-code>` | Expected http response code |
644 | `<service-name>` | Service name |
645 | `<keepalive-timeout>` | Timeout value |
646 | `<callbackurl>` | Callback url |
648 ## Function: api_get_services() ##
649 Test of GET '/service' or V2 GET '/v2/services' and optional check of the returned json payload.
650 To test only the response code, omit all parameters except the expected response code.
651 To test the returned json, provide the parameters after the response code.
655 | `<response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]` |
657 | parameter | description |
658 | --------- | ----------- |
659 | `<response-code>` | Expected http response code |
660 | <query-service-name>` | Service name for the query |
661 | <target-service-name>` | Target service name|
662 | `<keepalive-timeout>` | Timeout value |
663 | `<callbackurl>` | Callback url |
664 | `NOSERVICE` | Indicator of no target service name |
666 ## Function: api_get_service_ids() ##
667 Test of GET '/services' or V2 GET /'v2/services'. Only check of service ids.
671 | `<response-code> [<service-name>]*` |
673 | parameter | description |
674 | --------- | ----------- |
675 | `<response-code>` | Expected http response code |
676 | `<service-name>` | Service name |
678 ## Function: api_delete_services() ##
679 Test of DELETE '/services' or V2 DELETE '/v2/services/{serviceId}'
683 | `<response-code> [<service-name>]*` |
685 | parameter | description |
686 | --------- | ----------- |
687 | `<response-code>` | Expected http response code |
688 | `<service-name>` | Service name |
690 ## Function: api_put_services_keepalive() ##
691 Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive'
695 | <response-code> <service-name>` |
697 | parameter | description |
698 | --------- | ----------- |
699 | `<response-code>` | Expected http response code |
700 | `<service-name>` | Service name |
702 ## Function: api_put_configuration() ##
703 Test of PUT '/v2/configuration'
707 | <response-code> <config-file>` |
709 | parameter | description |
710 | --------- | ----------- |
711 | `<response-code>` | Expected http response code |
712 | `<config-file>` | Path json config file |
714 ## Function: api_get_configuration() ##
715 Test of GET '/v2/configuration'
719 | <response-code> [<config-file>]` |
721 | parameter | description |
722 | --------- | ----------- |
723 | `<response-code>` | Expected http response code |
724 | `<config-file>` | Path json config file to compare the retrieved config with |
725 | parameter | description |
726 | --------- | ----------- |
727 | `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'. |
730 # Description of functions in consult_cbs_function.sh #
733 ## Function: consul_config_app ##
734 Function to load a json config from a file into consul for the Policy Agent
738 | `<json-config-file>` |
740 | parameter | description |
741 | --------- | ----------- |
742 | `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
744 ## Function: prepare_consul_config ##
745 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')
748 | `<deviation-message-to-print>` |
750 | parameter | description |
751 | --------- | ----------- |
752 | `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
753 | `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app' |
755 ## Function: start_consul_cbs ##
756 Start the Consul and CBS containers
761 # Description of functions in control_panel_api_function.sh #
763 ## Function: use_control_panel_http ##
764 Set http as the protocol to use for all communication to the Control Panel
769 ## Function: use_control_panel_https ##
770 Set https as the protocol to use for all communication to the Control Panel
775 ## Function: start_control_panel ##
776 Start the Control Panel container
781 # Description of functions in controller_api_functions.sh #
782 The file contains a selection of the possible API tests towards the a1-controller
784 ## Function: use_sdnc_http ##
785 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.
790 ## Function: use_sdnc_http ##
791 Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
796 ## Function: start_sdnc ##
797 Start the SDNC A1 Controller container and its database container
802 ## Function: controller_api_get_A1_policy_ids ##
803 Test of GET policy ids towards OSC or STD type simulator.
804 To test response code only, provide the response code, 'OSC' + policy type or 'STD'
805 To test the response payload, include the ids of the expexted response.
809 | `<response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ]` |
811 | parameter | description |
812 | --------- | ----------- |
813 | `<response-code>` | Expected http response code |
814 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
815 | `<ric-id>` | Id of the ric |
816 | `policy-type-id>` | Id of the policy type |
817 | `<policy-id>` | Id of the policy |
818 | `STD` | Indicator of status of Standarized A1 |
821 ## Function: controller_api_get_A1_policy_type ##
822 Test of GET a policy type (OSC only)
826 | `<response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]` |
828 | parameter | description |
829 | --------- | ----------- |
830 | `<response-code>` | Expected http response code |
831 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
832 | `<ric-id>` | Id of the ric |
833 | `policy-type-id>` | Id of the policy type |
834 | `policy-type-file>` | Optional schema file to compare the returned type with |
836 ## Function: controller_api_delete_A1_policy ##
837 Deletes a policy instance
841 | `(STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)` |
843 | parameter | description |
844 | --------- | ----------- |
845 | `<response-code>` | Expected http response code |
846 | `STD` | Indicator of status of Standarized A1 |
847 | `<ric-id>` | Id of the ric |
848 | `<policy-id>` | Id of the policy |
849 | `policy-type-id>` | Id of the policy type |
850 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
851 | `policy-type-file>` | Optional schema file to compare the returned type with |
853 ## Function: controller_api_put_A1_policy ##
854 Creates a policy instance
858 | `<response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)` |
860 | parameter | description |
861 | --------- | ----------- |
862 | `<response-code>` | Expected http response code |
863 | `STD` | Indicator of status of Standarized A1 |
864 | `<ric-id>` | Id of the ric |
865 | `<policy-id>` | Id of the policy |
866 | `<template-file>` | Path to the template file of the policy|
867 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
868 | `<policy-type-id>` | Id of the policy type |
870 ## Function: controller_api_get_A1_policy_status ##
871 Checks the status of a policy
875 | `<response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)` |
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 | `<enforce-status>` | Enforcement status |
884 | `<reason>` | Optional reason |
885 | `OSC` | Indicator of status of Non-Standarized OSC A1 |
886 | `<policy-type-id>` | Id of the policy type |
887 | `<instance-status>` | Instance status |
888 | `<has-been-deleted>` | Deleted status, true or false |
891 # Description of functions in cr_api_functions.sh #
893 ## Function: use_cr_http ##
894 Use http for getting event from CR. The admin API is not affected. This is the default.
899 ## Function: use_cr_https ##
900 Use https for getting event from CR. The admin API is not affected.
901 Note: Not yet used as callback event is not fully implemented/deciced.
906 ## Function: start_cr ##
907 Start the Callback Receiver container in docker or kube depending on start mode.
912 ## Function: cr_equal ##
913 Tests if a variable value in the Callback Receiver (CR) simulator is equal to a target value.
914 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
915 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.
916 See the 'cr' dir for more details.
919 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
921 | parameter | description |
922 | --------- | ----------- |
923 | `<variable-name>` | Variable name in the CR |
924 | `<target-value>` | Target value for the variable |
925 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
927 ## Function: cr_api_check_all_sync_events() ##
928 Check the contents of all ric events received for a callback id.
932 | `<response-code> <id> [ EMPTY | ( <ric-id> )+ ]` |
934 | parameter | description |
935 | --------- | ----------- |
936 | `<response-code>` | Expected http response code |
937 | `<id>` | Id of the callback destination |
938 | `EMPTY` | Indicator for an empty list |
939 | `<ric-id>` | Id of the ric |
941 # Description of functions in ecs_api_functions.sh #
943 ## Function: use_ecs_rest_http ##
944 Use http for all API calls to the ECS. This is the default protocol.
949 ## Function: use_ecs_rest_https ##
950 Use https for all API calls to the ECS.
955 ## Function: use_ecs_dmaap_http ##
956 Send and recieve all API calls to the ECS over Dmaap via the MR using http.
961 ## Function: use_ecs_dmaap_https ##
962 Send and recieve all API calls to the ECS over Dmaap via the MR using https.
967 ## Function: start_ecs ##
968 Start the ECS container in docker or kube depending on running mode.
973 ## Function: restart_ecs ##
974 Restart the ECS container.
979 ## Function: set_ecs_debug ##
980 Configure the ECS log on debug level. The ECS must be running.
985 ## Function: set_ecs_trace ##
986 Configure the ECS log on trace level. The ECS must be running.
991 # Description of functions in ecs_api_function.sh #
993 ## Function: ecs_equal ##
994 Tests if a variable value in the ECS is equal to a target value.
995 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
996 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.
997 See the 'a1-interface' repo for more details.
1001 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1003 | parameter | description |
1004 | --------- | ----------- |
1005 | `<variable-name>` | Variable name in ecs |
1006 | `<target-value>` | Target value for the variable |
1007 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1009 ## Function: ecs_api_a1_get_job_ids() ##
1010 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
1011 To test the response code only, provide the response code parameter as well as a type id and an owner id.
1012 To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id.
1016 | `<response-code> <type-id> <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]` |
1018 | parameter | description |
1019 | --------- | ----------- |
1020 | `<response-code>` | Expected http response code |
1021 | `<type-id>` | Id of the EI type |
1022 | `<owner-id>` | Id of the job owner |
1023 | `NOOWNER` | No owner is given |
1024 | `<job-id>` | Id of the expected job |
1025 | `EMPTY` | The expected list of job id shall be empty |
1027 ## Function: ecs_api_a1_get_type() ##
1028 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}' and optional check of the returned schema.
1029 To test the response code only, provide the response code parameter as well as the type-id.
1030 To also test the response payload add a path to the expected schema file.
1034 | `<response-code> <type-id> [<schema-file>]` |
1036 | parameter | description |
1037 | --------- | ----------- |
1038 | `<response-code>` | Expected http response code |
1039 | `<type-id>` | Id of the EI type |
1040 | `<schema-file>` | Path to a schema file to compare with the returned schema |
1042 ## Function: ecs_api_a1_get_type_ids() ##
1043 Test of GET '/A1-EI​/v1​/eitypes' and optional check of returned list of type ids.
1044 To test the response code only, provide the response only.
1045 To also test the response payload add the list of expected type ids (or EMPTY if the list is expected to be empty).
1049 | `<response-code> [ (EMPTY | [<type-id>]+) ]` |
1051 | parameter | description |
1052 | --------- | ----------- |
1053 | `<response-code>` | Expected http response code |
1054 | `EMPTY` | The expected list of type ids shall be empty |
1055 | `<type-id>` | Id of the EI type |
1057 ## Function: ecs_api_a1_get_job_status() ##
1058 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status' and optional check of the returned status.
1059 To test the response code only, provide the response code, type id and job id.
1060 To also test the response payload add the expected status.
1064 | `<response-code> <type-id> <job-id> [<status>]` |
1066 | parameter | description |
1067 | --------- | ----------- |
1068 | `<response-code>` | Expected http response code |
1069 | `<type-id>` | Id of the EI type |
1070 | `<job-id>` | Id of the job |
1071 | `<status>` | Expected status |
1073 ## Function: ecs_api_a1_get_job() ##
1074 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}' and optional check of the returned job.
1075 To test the response code only, provide the response code, type id and job id.
1076 To also test the response payload add the remaining parameters.
1080 | `<response-code> <type-id> <job-id> [<target-url> <owner-id> <template-job-file>]` |
1082 | parameter | description |
1083 | --------- | ----------- |
1084 | `<response-code>` | Expected http response code |
1085 | `<type-id>` | Id of the EI type |
1086 | `<job-id>` | Id of the job |
1087 | `<target-url>` | Expected target url for the job |
1088 | `<owner-id>` | Expected owner for the job |
1089 | `<template-job-file>` | Path to a job template for job parameters of the job |
1091 ## Function: ecs_api_a1_delete_job() ##
1092 Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1093 To test, provide all the specified parameters.
1097 | `<response-code> <type-id> <job-id> |
1099 | parameter | description |
1100 | --------- | ----------- |
1101 | `<response-code>` | Expected http response code |
1102 | `<type-id>` | Id of the EI type |
1103 | `<job-id>` | Id of the job |
1105 ## Function: ecs_api_a1_put_job() ##
1106 Test of PUT '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'.
1107 To test, provide all the specified parameters.
1111 | `<response-code> <type-id> <job-id> <target-url> <owner-id> <template-job-file>` |
1113 | parameter | description |
1114 | --------- | ----------- |
1115 | `<response-code>` | Expected http response code |
1116 | `<type-id>` | Id of the EI type |
1117 | `<job-id>` | Id of the job |
1118 | `<target-url>` | Target url for the job |
1119 | `<owner-id>` | Owner of the job |
1120 | `<template-job-file>` | Path to a job template for job parameters of the job |
1122 ## Function: ecs_api_edp_get_type_ids() ##
1123 Test of GET '/ei-producer/v1/eitypes' and an optional check of the returned list of type ids.
1124 To test the response code only, provide the response code.
1125 To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty).
1129 | `<response-code> [ EMPTY | <type-id>+]` |
1131 | parameter | description |
1132 | --------- | ----------- |
1133 | `<response-code>` | Expected http response code |
1134 | `<type-id>` | Id of the EI type |
1135 | `EMPTY` | The expected list of type ids shall be empty |
1137 ## Function: ecs_api_edp_get_producer_status() ##
1138 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/status' and optional check of the returned status.
1139 To test the response code only, provide the response code and producer id.
1140 To also test the response payload add the expected status.
1144 | `<response-code> <producer-id> [<status>]` |
1146 | parameter | description |
1147 | --------- | ----------- |
1148 | `<response-code>` | Expected http response code |
1149 | `<producer-id>` | Id of the producer |
1150 | `<status>` | The expected status string |
1152 ## Function: ecs_api_edp_get_producer_ids() ##
1153 Test of GET '/ei-producer/v1/eiproducers' and optional check of the returned producer ids.
1154 To test the response code only, provide the response.
1155 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).
1159 | `<response-code> [ EMPTY | <producer-id>+]` |
1161 | parameter | description |
1162 | --------- | ----------- |
1163 | `<response-code>` | Expected http response code |
1164 | `<producer-id>` | Id of the producer |
1165 | `EMPTY` | The expected list of type ids shall be empty |
1167 ## Function: ecs_api_edp_get_type() ##
1168 Test of GET '/ei-producer/v1/eitypes/{eiTypeId}' and optional check of the returned type.
1169 To test the response code only, provide the response and the type-id.
1170 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).
1174 | `<response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]` |
1176 | parameter | description |
1177 | --------- | ----------- |
1178 | `<response-code>` | Expected http response code |
1179 | `<type-id>` | Id of the EI type |
1180 | `<job-schema-file>` | Path to a job schema file |
1181 | `<producer-id>` | Id of the producer |
1182 | `EMPTY` | The expected list of type ids shall be empty |
1184 ## Function: ecs_api_edp_get_producer() ##
1185 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}' and optional check of the returned producer.
1186 To test the response code only, provide the response and the producer-id.
1187 To also test the response payload add the remaining parameters defining thee producer.
1191 | `<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]` |
1193 | parameter | description |
1194 | --------- | ----------- |
1195 | `<response-code>` | Expected http response code |
1196 | `<producer-id>` | Id of the producer |
1197 | `<create-callback>` | Callback for create job |
1198 | `<delete-callback>` | Callback for delete job |
1199 | `<supervision-callback>` | Callback for producer supervision |
1200 | `<type-id>` | Id of the EI type |
1201 | `<schema-file>` | Path to a schema file |
1202 | `EMPTY` | The expected list of type schema pairs shall be empty |
1204 ## Function: ecs_api_edp_delete_producer() ##
1205 Test of DELETE '/ei-producer/v1/eiproducers/{eiProducerId}'.
1206 To test, provide all parameters.
1210 | `<response-code> <producer-id>` |
1212 | parameter | description |
1213 | --------- | ----------- |
1214 | `<response-code>` | Expected http response code |
1215 | `<producer-id>` | Id of the producer |
1217 ## Function: ecs_api_edp_put_producer() ##
1218 Test of PUT '/ei-producer/v1/eiproducers/{eiProducerId}'.
1219 To test, provide all parameters. The list of type/schema pair may be empty.
1223 | `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
1225 | parameter | description |
1226 | --------- | ----------- |
1227 | `<response-code>` | Expected http response code |
1228 | `<producer-id>` | Id of the producer |
1229 | `<job-callback>` | Callback for create/delete job |
1230 | `<supervision-callback>` | Callback for producer supervision |
1231 | `<type-id>` | Id of the EI type |
1232 | `<schema-file>` | Path to a schema file |
1233 | `EMPTY` | The list of type/schema pairs is empty |
1235 ## Function: ecs_api_edp_get_producer_jobs() ##
1236 Test of GET '/ei-producer/v1/eiproducers/{eiProducerId}/eijobs' and optional check of the returned producer job.
1237 To test the response code only, provide the response and the producer-id.
1238 To also test the response payload add the remaining parameters.
1242 | `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
1244 | parameter | description |
1245 | --------- | ----------- |
1246 | `<response-code>` | Expected http response code |
1247 | `<producer-id>` | Id of the producer |
1248 | `<job-id>` | Id of the job |
1249 | `<type-id>` | Id of the EI type |
1250 | `<target-url>` | Target url for data delivery |
1251 | `<job-owner>` | Id of the job owner |
1252 | `<template-job-file>` | Path to a job template file |
1253 | `EMPTY` | The list of job/type/target/job-file tuples is empty |
1255 ## Function: ecs_api_service_status() ##
1256 Test of GET '/status'.
1260 | `<response-code>` |
1262 | parameter | description |
1263 | --------- | ----------- |
1264 | `<response-code>` | Expected http response code |
1266 ## Function: ecs_api_admin_reset() ##
1267 Test of GET '/status'.
1271 | `<response-code> [ <type> ]` |
1273 | parameter | description |
1274 | --------- | ----------- |
1275 | `<response-code>` | Expected http response code |
1276 | `<type>` | Type id, if the interface supports type in url |
1279 # Description of functions in http_proxy_api_functions.sh #
1281 ## Function: start_http_proxy ##
1282 Start the http proxy container in docker or kube depending on running mode.
1287 # Description of functions in mr_api_functions.sh #
1289 ## Function: use_mr_http ##
1290 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.
1295 ## Function: use_mr_https ##
1296 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.
1301 ## Function: start_mr ##
1302 Start the Message Router stub interface container in docker or kube depending on start mode
1308 ## Function: mr_equal ##
1309 Tests if a variable value in the Message Router (MR) simulator is equal to a target value.
1310 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1311 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.
1312 See the 'mrstub' dir for more details.
1315 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1317 | parameter | description |
1318 | --------- | ----------- |
1319 | `<variable-name>` | Variable name in the MR |
1320 | `<target-value>` | Target value for the variable |
1321 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1323 ## Function: mr_greater ##
1324 Tests if a variable value in the Message Router (MR) simulator is greater than a target value.
1325 Without the timeout, the test sets pass or fail immediately depending on if the variable is greater than the target or not.
1326 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.
1327 See the 'mrstub' dir for more details.
1330 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1332 | parameter | description |
1333 | --------- | ----------- |
1334 | `<variable-name>` | Variable name in the MR |
1335 | `<target-value>` | Target value for the variable |
1336 | `<timeout-in-sec>` | Max time to wait for the variable to become grater than the target value |
1338 ## Function: mr_read ##
1339 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.
1340 See the 'mrstub' dir for more details.
1343 | `<variable-name>` |
1345 | parameter | description |
1346 | --------- | ----------- |
1347 | `<variable-name>` | Variable name in the MR |
1349 ## Function: mr_print ##
1350 Prints the value of a variable in the Message Router (MR) simulator.
1351 See the 'mrstub' dir for more details.
1354 | `<variable-name>` |
1356 | parameter | description |
1357 | --------- | ----------- |
1358 | `<variable-name>` | Variable name in the MR |
1361 # Description of functions in prodstub_api_functions.sh #
1363 ## Function: use_prod_stub_http ##
1364 Use http for the API. The admin API is not affected. This is the default protocol.
1369 ## Function: use_prod_stub_https ##
1370 Use https for the API. The admin API is not affected.
1375 ## Function: start_prod_stub ##
1376 Start the Producer stub container in docker or kube depending on start mode
1381 ## Function: prodstub_arm_producer() ##
1382 Preconfigure the prodstub with a producer. The producer supervision response code is optional, if not given the response code will be set to 200.
1386 | `<response-code> <producer-id> [<forced_response_code>]` |
1388 | parameter | description |
1389 | --------- | ----------- |
1390 | `<response-code>` | Expected http response code |
1391 | `<producer-id>` | Id of the producer |
1392 | `<forced_response_code>` | Forced response code for the producer callback url |
1394 ## Function: prodstub_arm_job_create() ##
1395 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.
1399 | `<response-code> <job-id> [<forced_response_code>]` |
1401 | parameter | description |
1402 | --------- | ----------- |
1403 | `<response-code>` | Expected http response code |
1404 | `<job-id>` | Id of the job |
1405 | `<forced_response_code>` | Forced response code for the create callback url |
1407 ## Function: prodstub_arm_job_delete() ##
1408 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.
1412 | `<response-code> <job-id> [<forced_response_code>]` |
1414 | parameter | description |
1415 | --------- | ----------- |
1416 | `<response-code>` | Expected http response code |
1417 | `<job-id>` | Id of the job |
1418 | `<forced_response_code>` | Forced response code for the delete callback url |
1420 ## Function: prodstub_arm_type() ##
1421 Preconfigure the prodstub with a type for a producer. Can be called multiple times to add more types.
1425 | `<response-code> <producer-id> <type-id>` |
1427 | parameter | description |
1428 | --------- | ----------- |
1429 | `<response-code>` | Expected http response code |
1430 | `<producer-id>` | Id of the producer |
1431 | `<type-id>` | Id of the type |
1433 ## Function: prodstub_disarm_type() ##
1434 Remove a type for the producer in the rodstub. Can be called multiple times to remove more types.
1438 | `<response-code> <producer-id> <type-id>` |
1440 | parameter | description |
1441 | --------- | ----------- |
1442 | `<response-code>` | Expected http response code |
1443 | `<producer-id>` | Id of the producer |
1444 | `<type-id>` | Id of the type |
1446 ## Function: prodstub_check_jobdata() ##
1447 Check a job in the prodstub towards the list of provided parameters.
1451 | `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
1453 | parameter | description |
1454 | --------- | ----------- |
1455 | `<response-code>` | Expected http response code |
1456 | `<producer-id>` | Id of the producer |
1457 | `<job-id>` | Id of the job |
1458 | `<type-id>` | Id of the type |
1459 | `<target-url>` | Target url for data delivery |
1460 | `<job-owner>` | Id of the job owner |
1461 | `<template-job-file>` | Path to a job template file |
1463 ## Function: prodstub_delete_jobdata() ##
1464 Delete the job parameters, job data, for a job.
1468 | `<response-code> <producer-id> <job-id>` |
1470 | parameter | description |
1471 | --------- | ----------- |
1472 | `<response-code>` | Expected http response code |
1473 | `<producer-id>` | Id of the producer |
1474 | `<job-id>` | Id of the job |
1477 ## Function: prodstub_equal ##
1478 Tests if a variable value in the prodstub is equal to a target value.
1479 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1480 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.
1484 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1486 | parameter | description |
1487 | --------- | ----------- |
1488 | `<variable-name>` | Variable name in the prostub |
1489 | `<target-value>` | Target value for the variable |
1490 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1493 # Description of functions in rapp_catalogue_api_function.sh #
1495 ## Function: use_rapp_catalogue_http ##
1496 Use http for the API. This is the default protocol.
1501 ## Function: use_rapp_catalogue_https ##
1502 Use https for the API.
1507 ## Function: start_rapp_catalogue ##
1508 Start the rapp catalogue container in docker or kube depending on start mode
1513 ## Function: rc_equal ##
1514 Tests if a variable value in the RAPP Catalogue is equal to a target value.
1515 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1516 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.
1517 See the 'cr' dir for more details.
1520 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1522 | parameter | description |
1523 | --------- | ----------- |
1524 | `<variable-name>` | Variable name in the RC |
1525 | `<target-value>` | Target value for the variable |
1526 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1528 ## Function: rapp_cat_api_get_services() ##
1529 Check all registered services.
1533 | `<response-code> [(<service-id> <version> <display-name> <description>)+ | EMPTY ]` |
1535 | parameter | description |
1536 | --------- | ----------- |
1537 | `<response-code>` | Expected http response code |
1538 | `<service-id>` | Id of the service |
1539 | `<version>` | Version of the service |
1540 | `<display-name>` | Dislay name of the service |
1541 | `<description>` | Description of the service |
1542 | `EMPTY` | Indicator for an empty list |
1544 ## Function: rapp_cat_api_put_service() ##
1545 Register a services.
1549 | `<response-code> <service-id> <version> <display-name> <description>` |
1551 | parameter | description |
1552 | --------- | ----------- |
1553 | `<response-code>` | Expected http response code |
1554 | `<service-id>` | Id of the service |
1555 | `<version>` | Version of the service |
1556 | `<display-name>` | Dislay name of the service |
1557 | `<description>` | Description of the service |
1559 ## Function: rapp_cat_api_get_service() ##
1560 Check a registered service.
1564 | `<response-code> <service-id> <version> <display-name> <description>` |
1566 | parameter | description |
1567 | --------- | ----------- |
1568 | `<response-code>` | Expected http response code |
1569 | `<service-id>` | Id of the service |
1570 | `<version>` | Version of the service |
1571 | `<display-name>` | Dislay name of the service |
1572 | `<description>` | Description of the service |
1574 ## Function: rapp_cat_api_delete_service() ##
1575 Check a registered service.
1579 | `<response-code> <service-id>` |
1581 | parameter | description |
1582 | --------- | ----------- |
1583 | `<response-code>` | Expected http response code |
1584 | `<service-id>` | Id of the service |
1587 # Description of functions in ricsimulator_api_functions.sh #
1588 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
1591 ## Function: use_simulator_http ##
1592 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.
1597 ## Function: use_simulator_https ##
1598 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.
1603 ## Function: start_ric_simulators ##
1604 Start a group of simulator where a group may contain 1 more simulators. Started in docker or kube depending on start mode
1607 | `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
1609 | parameter | description |
1610 | --------- | ----------- |
1611 | `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 |
1612 |`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
1613 |`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
1615 ## Function: sim_equal ##
1616 Tests if a variable value in the RIC simulator is equal to a target value.
1617 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
1618 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.
1619 See the 'a1-interface' repo for more details.
1623 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1625 | parameter | description |
1626 | --------- | ----------- |
1627 | `<variable-name>` | Variable name in the ric simulator |
1628 | `<target-value>` | Target value for the variable |
1629 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1631 ## Function: sim_print ##
1632 Prints the value of a variable in the RIC simulator.
1633 See the 'a1-interface' repo for more details.
1637 | `<variable-name>` |
1639 | parameter | description |
1640 | --------- | ----------- |
1641 | `<variable-name>` | Variable name in the RIC simulator |
1644 ## Function: sim_contains_str ##
1645 Tests if a variable value in the RIC simulator contains a target string.
1646 Without the timeout, the test sets pass or fail immediately depending on if the variable contains the target string or not.
1647 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.
1648 See the 'a1-interface' repo for more details.
1652 | `<variable-name> <target-value> [ <timeout-in-sec> ]` |
1654 | parameter | description |
1655 | --------- | ----------- |
1656 | `<variable-name>` | Variable name in the ric simulator |
1657 | `<target-value>` | Target substring for the variable |
1658 | `<timeout-in-sec>` | Max time to wait for the variable to reach the target value |
1660 ## Function: sim_put_policy_type ##
1661 Loads a policy type to the simulator
1665 | `<response-code> <ric-id> <policy-type-id> <policy-type-file>` |
1667 | parameter | description |
1668 | --------- | ----------- |
1669 | `<response-code>` | Expected http response code |
1670 | `<ric-id>` | Id of the ric |
1671 | `<policy-type-id>` | Id of the policy type |
1672 | `<policy-type-file>` | Path to the schema file of the policy type |
1674 ## Function: sim_delete_policy_type ##
1675 Deletes a policy type from the simulator
1679 | `<response-code> <ric-id> <policy_type_id>` |
1681 | parameter | description |
1682 | --------- | ----------- |
1683 | `<response-code>` | Expected http response code |
1684 | `<ric-id>` | Id of the ric |
1685 | `<policy-type-id>` | Id of the policy type |
1687 ## Function: sim_post_delete_instances ##
1688 Deletes all instances (and status), for one ric
1692 | `<response-code> <ric-id>` |
1694 | parameter | description |
1695 | --------- | ----------- |
1696 | `<response-code>` | Expected http response code |
1697 | `<ric-id>` | Id of the ric |
1700 ## Function: sim_post_delete_all ##
1701 Deletes all types, instances (and status), for one ric
1705 | `<response-code> <ric-id>` |
1707 | parameter | description |
1708 | --------- | ----------- |
1709 | `<response-code>` | Expected http response code |
1710 | `<ric-id>` | Id of the ric |
1712 ## Function: sim_post_forcedresponse ##
1713 Sets (or resets) response code for next (one) A1 message, for one ric.
1714 The intention is to simulate error response on the A1 interface.
1718 | `<response-code> <ric-id> [<forced_response_code>]`|
1720 | parameter | description |
1721 | --------- | ----------- |
1722 | `<response-code>` | Expected http response code |
1723 | `<ric-id>` | Id of the ric |
1724 | `<forced_response_code>` | Http response code to send |
1726 ## Function: sim_post_forcedelay ##
1727 Sets (or resets) A1 response delay, for one ric
1728 The intention is to delay responses on the A1 interface. Setting remains until removed.
1732 | `<response-code> <ric-id> [<delay-in-seconds>]`|
1734 | parameter | description |
1735 | --------- | ----------- |
1736 | `<response-code>` | Expected http response code |
1737 | `<ric-id>` | Id of the ric |
1738 | `<delay-in-seconds>` | Delay in seconds. If omitted, the delay is removed |
1743 Copyright (C) 2020 Nordix Foundation. All rights reserved.
1744 Licensed under the Apache License, Version 2.0 (the "License");
1745 you may not use this file except in compliance with the License.
1746 You may obtain a copy of the License at
1748 http://www.apache.org/licenses/LICENSE-2.0
1750 Unless required by applicable law or agreed to in writing, software
1751 distributed under the License is distributed on an "AS IS" BASIS,
1752 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1753 See the License for the specific language governing permissions and
1754 limitations under the License.