From 559771fe0fd39ef11b6fdd3c18af6a25f899ada0 Mon Sep 17 00:00:00 2001 From: mrichomme Date: Thu, 29 Oct 2020 15:36:09 +0100 Subject: Update xtesting READMEs They can be used to run the xtesting dockers on any ONAP deployment Note a section in the official doc shall also be created Issue-ID: TEST-274 Signed-off-by: mrichomme Change-Id: If1d98e51c1dd476f5b1da81e51e4b4d99f513aa5 Signed-off-by: mrichomme --- smoke-usecases-pythonsdk/README.md | 238 ++++++++++++++++++++++++++++++++++--- 1 file changed, 220 insertions(+), 18 deletions(-) (limited to 'smoke-usecases-pythonsdk') diff --git a/smoke-usecases-pythonsdk/README.md b/smoke-usecases-pythonsdk/README.md index a840ef1..d21f5d2 100644 --- a/smoke-usecases-pythonsdk/README.md +++ b/smoke-usecases-pythonsdk/README.md @@ -11,17 +11,17 @@ but the Dockerfile must be adapted accordingly. The tests are: -- basic_vm: it onboard/distribute/deploy a single Ubuntu VM in ONAP using - VNF-API. The components used are SDC, SO, AA&I, SDNC. -- freeradius_nbi: based on basic_vm, the instantiation part is done through the - ONAP external API (NBI) module. -- clearwater_ims: it consists in a full deployment of an clearwater vIMS in ONAP. +- basic_vm: onboarding/distribution/deployment of a single Ubuntu VM in ONAP using + GR-API (A la Carte SO BPMN). The components used are SDC, SO, AAI, SDNC. +- basic_cnf: onboarding/distribution/deployment of a single nginx pod in ONAP using + GR-API (A la Carte SO BPMN) and K8s module. The components used are SDC, SO, + AAI, SDNC, MultiCloud. +- basic_network: onboarding/distribution/deployment of a Neutron network ## Usage -Note this docker will be deprecated in Guilin. The existing 3 test cases and -additional ones will be performed through test cases [2] consuming the Python -ONAP SDK [1] +Tests are performed through test cases [2] consuming the Python +ONAP SDK [1]. ### Configuration @@ -29,35 +29,237 @@ Mandatory: Assuming that these use cases were based on onap-tests, the service descriptions must be overwritten with the right cloud informations as well as the onap-tests -configuration. That is why 2 volumes are needed: +configuration. -- : The last section of the default configuration must - be adapted to your environement [3] -- : the customized service descriptions including the - parameters to be overwritten (SDNC preload) [4] +pythonsdk-tests configuration is given by a file whose path is specified in env +variables. It is therefore needed to setup env files and precise the +test configuration. + +There are optional and mandatory env variables + +Mandatory: + +- OS_TEST_CLOUD: it specifies the Openstack cloud you + are using (declared in the clouds.yaml) +- ONAP_PYTHON_SDK_SETTINGS: the configuration to be considered for the tests. + See pythonsdk-tests README for details Optional: +- INSTALLER_TYPE: the name of the installer (used for results) +- TEST_DB_URL: the url of the DB you want to push the results +- NODE_NAME: the name of the lab or CI chain (used for results) +- BUILD_TAG: an id used for CI to group tests in a CI run +- DEBUG: by default xtesting logs are not enables + +An example of env file is given herefater: + +``` +INSTALLER_TYPE=oom +TEST_DB_URL=http://testresults.opnfv.org/onap/api/v1/results +NODE_NAME=onap_daily_pod4_master-ONAP-oom +BUILD_TAG=gitlab_ci-functest-kubespray-baremetal-daily-master-209039216-onap +DEBUG=True +OS_TEST_CLOUD=onap-master-daily-vnfs-ci +ONAP_PYTHON_SDK_SETTINGS=onaptests.configuration.ubuntu16_nomulticloud_settings +``` + +The generic configuration file settings.py can be also specified to overwritte +default values. + +``` +"""Specific settings module.""" # pylint: disable=bad-whitespace + +###################### +# # +# ONAP INPUTS DATAS # +# # +###################### + + +# Variables to set logger information +# Possible values for logging levels in onapsdk: INFO, DEBUG , WARNING, ERROR +LOG_CONFIG = { + "version": 1, + "disable_existing_loggers": False, + "formatters": { + "default": { + "class": "logging.Formatter", + "format": "%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s" + } + }, + "handlers": { + "console": { + "level": "INFO", + "class": "logging.StreamHandler", + "formatter": "default" + }, + "file": { + "level": "DEBUG", + "class": "logging.FileHandler", + "formatter": "default", + "filename": "/var/lib/xtesting/results/pythonsdk.debug.log", + "mode": "w" + } + }, + "root": { + "level": "DEBUG", + "handlers": ["console", "file"] + } +} + +# SOCK_HTTP = "socks5h://127.0.0.1:8080" +REPORTING_FILE_PATH = "/var/lib/xtesting/results/reporting.html" +K8S_REGION_TYPE = "k8s" +``` + +You can specify the log level, the log file, and the path for the reporting page. + +You may then indicate several volumes when launching the xtesting docker. +Please note it can be run from anyplace assuming that the configuration and the +connectivity are properly set. You then need to hav access to ONAP endpoints, you +can either copy a /etc/hosts in the docker or add the hosts in the docker command. + +The different needed volumes are: + - The local result directory path: to store the results in your local environement. It shall corresponds to the internal result docker path /var/lib/xtesting/results -- The cloud.yaml if you enable the Openstack verification option (Openstack - client call to check that the stack is created in Openstack) +- The kubernetes .kube/config configuration for use cases interacting with kubernetes + (basic_cnf) +- The openstack cloud.yaml for use cases interacting with Openstack + infrastructures (basic_vm, basic_network) +- The customization of your service. You can overwrite the model datas by the + values matching your environement. In this case you need to replace the default + service configuration file + +An example of clouds.yaml + +``` +clouds: + onap-master-daily-vnfs-ci: + auth: + auth_url: https://vim.pod4.opnfv.fr:5000 + password: yGiJDEh82K9x0T69iIJJRPeUqVRPFnIR + project_id: 978ec1ae58ac492a936e0bcec22dfee9 + project_name: onap-master-daily-vnfs + user_domain_name: Default + username: onap-master-daily-vnfs-ci + compute_api_version: '2.15' + identity_api_version: '3' + interface: public + project_domain_name: Default + region_name: RegionOne +``` + +A example of basic_vm customization is provided hereafter. You can customize +this file according to your cloud environment (key, flavor name,..). +The data will be preloaded to overwrite the default model values. + +``` +--- +ubuntu16test: + tosca_file_from_SDC: service-Ubuntu16tha-template + version: "1.0" + vnfs: + - vnf_name: ubuntu16test + heat_files_to_upload: onaptests/templates/heat-files/ubuntu16/ubuntu16.zip + vnf_parameters: [ + {"name": "ubuntu16_image_name", + "value": "ubuntu-16.04-daily" + }, + {"name": "ubuntu16_key_name", + "value": "cleouverte" + }, + {"name": "ubuntu16_pub_key", + "value": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA\ +BAQDY15cdBmIs2XOpe4EiFCsaY6bmUmK/GysMoLl4UG51JCfJwvwoWCoA+6mDIbymZxhxq9IGx\ +ilp/yTA6WQ9s/5pBag1cUMJmFuda9PjOkXl04jgqh5tR6I+GZ97AvCg93KAECis5ubSqw1xOCj4\ +utfEUtPoF1OuzqM/lE5mY4N6VKXn+fT7pCD6cifBEs6JHhVNvs5OLLp/tO8Pa3kKYQOdyS0xc3r\ +h+t2lrzvKUSWGZbX+dLiFiEpjsUL3tDqzkEMNUn4pdv69OJuzWHCxRWPfdrY9Wg0j3mJesP29EBh\ +t+w+EC9/kBKq+1VKdmsXUXAcjEvjovVL8l1BrX3BY0R8D imported-openssh-key" + }, + {"name": "ubuntu16_flavor_name", + "value": "m1.small" + }, + {"name": "VM_name", + "value": "ubuntu16test-VM-01" + }, + {"name": "vnf_id", + "value": "ubuntu16test-VNF-instance" + }, + {"name": "vf_module_id", + "value": "ubuntu16test-vfmodule-instance" + }, + {"name": "vnf_name", + "value": "ubuntu16test-VNF" + }, + {"name": "admin_plane_net_name", + "value": "admin" + } + ] +``` ### Command +If you specify all the hosts + ``` docker run -v :/var/lib/xtesting/conf/env_file --v :/usr/lib/python3.8/site-packages/onap_tests/onap-conf/onap-testing.yaml --v :/usr/lib/python3.8/site-packages/onap_tests/templates/vnf-services -v /root/.config/openstack.yaml +-v /root/.kube/config +-v :/usr/lib/python3.8/site-packages/onaptests/templates/vnf-services/ubuntu16test-service.yaml -v :/var/lib/xtesting/results -nexus3.onap.org:10001/onap/xtesting-infra-healthcheck:latest +--add-host="portal.api.simpledemo.onap.org:" +--add-host="vid.api.simpledemo.onap.org:" +--add-host="sdc.api.fe.simpledemo.onap.org:" +--add-host="sdc.api.be.simpledemo.onap.org:" +--add-host="aai.api.sparky.simpledemo.onap.org:" +--add-host="so.api.simpledemo.onap.org:" +--add-host="sdnc.api.simpledemo.onap.org:" +--add-host="sdc.workflow.plugin.simpledemo.onap.org:" +--add-host="sdc.dcae.plugin.simpledemo.onap.org:" +--add-host="msb.api.simpledemo.onap.org:" +nexus3.onap.org:10003/onap/xtesting-smoke-usecases-pythonsdk:latest /bin/sh -c "run_tests -t basic_vm" ``` +Unkike the other xtesting docker, 1 docker = 1 use case, the target -t all is +not usable. + +Note you can run also the docker interactivly + +``` +docker run -it +-v :/var/lib/xtesting/conf/env_file +-v /root/.config/openstack.yaml +-v /root/.kube/config +-v :/usr/lib/python3.8/site-packages/onaptests/templates/vnf-services/ubuntu16test-service.yaml +-v :/var/lib/xtesting/results +nexus3.onap.org:10003/onap/xtesting-smoke-usecases-pythonsdk:latest sh +``` + +Inside the docker you can edit the /etc/hosts and indicate the different hosts). +Then you can run the test with the following command: + +``` +run_tests -t basic_vm +``` + +you can modify the env variable to run any of the use cases. + ### Output +``` ++-------------------+---------------------+------------------+----------------+ +| TEST CASE | PROJECT | DURATION | RESULT | ++-------------------+---------------------+------------------+----------------+ +| basic_vm | integration | 09:52 | PASS | ++-------------------+---------------------+------------------+----------------+ +``` + +### references + [1]: https://gitlab.com/Orange-OpenSource/lfn/onap/python-onapsdk "Python ONAP SDK repository" [2]: https://git.onap.org/testsuite/pythonsdk-tests/tree/ "Scenario consuming Python SDK" -- cgit 1.2.3-korg