From ff3ffaf4fff2cb14831797487bcf9be361aa6424 Mon Sep 17 00:00:00 2001 From: beierlm Date: Thu, 4 Aug 2022 19:50:04 +0000 Subject: [PATCH 1/3] Using Robot for Upgrade Testing Removes the manual selection of packages and replaces it with documentation on how to set up and run the robot suite for pre and post upgrade testing --- 19-lts-upgrade.md | 228 ++++++++++++++++++++++++++++------------------ 1 file changed, 138 insertions(+), 90 deletions(-) diff --git a/19-lts-upgrade.md b/19-lts-upgrade.md index 1153235..9672240 100644 --- a/19-lts-upgrade.md +++ b/19-lts-upgrade.md @@ -473,132 +473,180 @@ osm user-create test_member_1 --projects admin --project-role-mappings 'test_pro osm user-update test_member_1 --remove-project-role 'admin,project_admin' ``` -### Selection of Packages +## Testing Upgrade + +### Changing Credentials -In order to test that the upgrade does not impact existing operations, we will deploy a series of network services and slices prior to the upgrade and then verify all functionality post upgrade. What follows is a list of packages and tests to run. All packages will come from https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages +We will change some default passwords, and create some additional users to ensure RBAC still works. ```bash -git clone -j4 --recursive https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git +osm user-update admin --password 'osm4u' +export OSM_PASSWORD=osm4u ``` -#### Basic OpenStack VNF - -##### Preparation - ```bash -osm package-build hackfest_basic_ns -osm package-build hackfest_basic_vnf -osm upload-package hackfest_basic_vnf -osm upload-package hackfest_basic_ns +osm project-create --domain-name default test_project_1 +``` -osm ns-create --ns_name hackfest_basic-ns \ - --nsd_name hackfest_basic-ns \ - --vim_account etsi-vim \ - --config \ - '{vld: [ {name: mgmtnet, vim-network-name: osm-ext} ] }' +```bash +osm user-create test_admin_1 --projects admin --project-role-mappings 'test_project_1,project_user' --password testadmin --domain-name default +osm user-update test_admin_1 --remove-project-role 'admin,project_admin' +osm user-create test_member_1 --projects admin --project-role-mappings 'test_project_1,project_user' --password testmember --domain-name default +osm user-update test_member_1 --remove-project-role 'admin,project_admin' ``` -#### Basic OpenStack VNF with Monitoring +### Running Robot Test Suite -##### Preparation +#### Install Docker (Charmed OSM Only) +Docker does not get installed with charmed OSM, so that needs to be installed first. ```bash -osm package-build hackfest_basic_metrics_vnf -osm package-build hackfest_basic_metrics_ns -osm upload-package ./hackfest_basic_metrics_vnf.tar.gz -osm upload-package ./hackfest_basic_metrics_ns.tar.gz +sudo snap install docker +sudo addgroup --system docker +sudo adduser $USER docker +newgrp docker +sudo snap disable docker +sudo snap enable docker +sudo iptables -I DOCKER-USER -j ACCEPT +``` + +#### Prepare to Run Tests + +You should already have OSM_HOSTNAME and OSM_PASSWORD environment variables set, based on the output from the installer. -osm ns-create --ns_name hackfest_basic_metrics_ns \ - --nsd_name hackfest_basic-ns-metrics \ - --vim_account etsi-vim \ - --config '{vld: [ {name: mgmtnet, vim-network-name: osm-ext} ] }' +Source your openstack.rc file to get all your Openstack environment variables set. + +##### Set Environment Variables (K8s Installation) + +``` +export OSM_HOSTNAME=127.0.0.1 +export PROMETHEUS_HOSTNAME=127.0.0.1 +export PROMETHEUS_PORT=9091 +export JUJU_PASSWORD=`juju gui 2>&1 | grep password | awk '{print $2}'` +export HOSTIP=127.0.1.1 ``` -#### Basic OpenStack VNF with Proxy Charms +##### Set Environment Variables (Charmed OSM) ```bash -osm package-build charm-packages/ha_proxy_charm_vnf -osm package-build charm-packages/ha_proxy_charm_ns -osm upload-package charm-packages/ha_proxy_charm_vnf.tar.gz -osm upload-package charm-packages/ha_proxy_charm_ns.tar.gz +export OSM_HOSTNAME=$(juju config -m osm nbi site_url | sed "s/http.*\?:\/\///"):443 +export PROMETHEUS_HOSTNAME=$(juju config -m osm prometheus site_url | sed "s/http.*\?:\/\///") +export PROMETHEUS_PORT=80 +export JUJU_PASSWORD=`juju gui 2>&1 | grep password | awk '{print $2}'` +export HOSTIP=$(echo $PROMETHEUS_HOSTNAME | sed "s/prometheus.//" | sed "s/.nip.io//") +``` -osm ns-create --ns_name ha_proxy_charm-ns \ ---nsd_name ha_proxy_charm-ns \ ---vim_account etsi-vim \ ---config '{vld: [ {name: mgmtnet, vim-network-name: osm-ext} ] }' +#### Create robot-systest.cfg +```bash +cat << EOF > robot-systest.cfg +VIM_TARGET=osm +VIM_MGMT_NET=osm-ext +ENVIRONMENTS_FOLDER=environments +PACKAGES_FOLDER=/robot-systest/osm-packages +OS_CLOUD=openstack +LC_ALL=C.UTF-8 +LANG=C.UTF-8 +EOF +for line in `env | grep "^OS_" | sort` ; do echo $line >> robot-systest.cfg ; done +``` -osm ns-action ha_proxy_charm-ns \ - --vnf_name 1 \ - --action_name touch \ - --params '{filename: file-001.dat}' +#### Create robot.etc.hosts (Charmed OSM) +```bash +cat << EOF > robot.etc.hosts +127.0.0.1 localhost +${HOSTIP} prometheus.${HOSTIP}.nip.io nbi.${HOSTIP}.nip.io +EOF ``` -#### Basic OpenStack VNF with Native Charms +#### Create clouds.yaml ```bash -osm package-build charm-packages/native_charm_vnf -osm package-build charm-packages/native_charm_ns -osm upload-package charm-packages/native_charm_vnf.tar.gz -osm upload-package charm-packages/native_charm_ns.tar.gz +cat << EOF > clouds.yaml +clouds: + openstack: + auth: + auth_url: $OS_AUTH_URL + project_name: $OS_PROJECT_NAME + username: $OS_USERNAME + password: $OS_PASSWORD + user_domain_name: $OS_USER_DOMAIN_NAME + project_domain_name: $OS_PROJECT_DOMAIN_NAME +EOF +``` + +#### Create VIM -osm ns-create --ns_name native_charm-ns \ - --nsd_name native_charm-ns \ - --vim_account etsi-vim \ - --config '{vld: [ {name: mgmtnet, vim-network-name: osm-ext} ] }' +Create a VIM called `osm`. Be sure to add your specific configurations, such as floating +ip addresses, or untrusted SSL certificates. -osm ns-action native_charm-ns \ - --vnf_name 1 \ - --vdu_id mgmtVM \ - --action_name touch \ - --params '{filename: file-001.dat}' +``` +osm vim-create --name osm --user "$OS_USERNAME" --password "$OS_PASSWORD" \ + --auth_url "$OS_AUTH_URL" --tenant "$OS_USERNAME" --account_type openstack \ + --config='{management_network_name: osm-ext}' +``` + +Provide a copy of your Kubernetes cluster configuration file to the Robot container. +``` +export KUBECONFIG=/path/to/kubeconfig.yaml ``` -#### KNF with Helm +#### Start Robot Tests Container +To keep a copy of the reports, create a directory for the container to store them. ```bash -cat << EOF > ~/openldap-params.yaml +mkdir reports +``` -vld: -- name: mgmtnet - vim-network-name: osm-ext -additionalParamsForVnf: -- member-vnf-index: openldap - additionalParamsForKdu: - - kdu_name: ldap - additionalParams: - adminPassword: osm4u - configPassword: osm4u - env: -        LDAP_ORGANISATION: "Example Inc." -        LDAP_DOMAIN: "example.org" -        LDAP_BACKEND: "hdb" -        LDAP_TLS: "true" -        LDAP_TLS_ENFORCE: "false" -        LDAP_REMOVE_CONFIG_AFTER_SETUP: "true" -EOF +```bash +docker run -ti --entrypoint /bin/bash \ + --env OSM_HOSTNAME=${OSM_HOSTNAME} \ + --env PROMETHEUS_HOSTNAME=${PROMETHEUS_HOSTNAME} \ + --env PROMETHEUS_PORT=${PROMETHEUS_PORT} \ + --env JUJU_PASSWORD=${JUJU_PASSWORD} \ + --env HOSTIP=${HOSTIP} \ + --env-file robot-systest.cfg \ + -v "$(pwd)/robot.etc.hosts":/etc/hosts \ + -v "${KUBECONFIG}":/root/.kube/config \ + -v "$(pwd)/clouds.yaml":/etc/openstack/clouds.yaml \ + -v "$(pwd)/reports":/robot-systest/reports \ + opensourcemano/tests:10 +``` + +#### Run Tests Pre-Upgrade -osm package-build openldap_knf -osm package-build openldap_ns -osm upload-package ./openldap_knf.tar.gz -osm upload-package ./openldap_ns.tar.gz +From the Robot tests container command line, execute the prepare step. -osm ns-create --ns_name openldap_ns \ - --nsd_name openldap_ns \ - --vim_account etsi-vim \ - --config_file ~/openldap-params.yaml +```bash +./run_test.sh -t prepare ``` -#### KNF with Juju +After the run has completed successfully, there should be 5 network services present +in OSM: +``` ++---------------------------------+--------------------------------------+---------------------+----------+-------------------+---------------+ +| ns instance name | id | date | ns state | current operation | error details | ++---------------------------------+--------------------------------------+---------------------+----------+-------------------+---------------+ +| basic_07_secure_key_management | 1a8621ea-d51d-434c-90e0-e153701729dd | 2022-08-03T17:51:07 | READY | IDLE (None) | N/A | +| basic_09_manual_scaling_test | 7611ce54-bff2-480e-94fb-5a8b0549a6c4 | 2022-08-03T17:54:32 | READY | IDLE (None) | N/A | +| basic_21 | 8090754c-f49c-4891-a7c0-1e5750c7980b | 2022-08-03T17:55:30 | READY | IDLE (None) | N/A | +| k8s_06-nopasswd_k8s_proxy_charm | a5eb22d7-4a4f-4615-ad44-9f8957cf243c | 2022-08-03T18:17:01 | READY | IDLE (None) | N/A | +| ldap | be0f6e33-e4d9-463d-92c6-cc27f2f1d5eb | 2022-08-03T18:51:51 | READY | IDLE (None) | N/A | ++---------------------------------+--------------------------------------+---------------------+----------+-------------------+---------------+ +``` + +Run the verify step before upgrading: ```bash -osm package-build squid_metrics_cnf -osm package-build squid_metrics_cnf_ns -osm upload-package ./squid_metrics_cnf.tar.gz -osm upload-package ./squid_metrics_cnf_ns.tar.gz +./run_test.sh -t verify +``` + +#### Run Tests Post-Upgrade -osm ns-create --ns_name squid_cnf_ns \ - --nsd_name squid_cnf_ns \ - --vim_account dimension \ - --config '{vld: [ {name: mgmtnet, vim-network-name: osm-ext} ] }' +After completing the upgrade procedure, execute the verify step again to ensure the upgrade +was successful + +```bash +./run_test.sh -t verify ``` +This will only verify services that were already deployed in the prepare step. -- GitLab From b0550123f2af18e2a3a1e8df175a06a2060d74d0 Mon Sep 17 00:00:00 2001 From: beierlm Date: Fri, 12 Aug 2022 13:05:57 +0000 Subject: [PATCH 2/3] removed duplicate sectin --- 19-lts-upgrade.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/19-lts-upgrade.md b/19-lts-upgrade.md index 9672240..6068045 100644 --- a/19-lts-upgrade.md +++ b/19-lts-upgrade.md @@ -473,28 +473,6 @@ osm user-create test_member_1 --projects admin --project-role-mappings 'test_pro osm user-update test_member_1 --remove-project-role 'admin,project_admin' ``` -## Testing Upgrade - -### Changing Credentials - -We will change some default passwords, and create some additional users to ensure RBAC still works. - -```bash -osm user-update admin --password 'osm4u' -export OSM_PASSWORD=osm4u -``` - -```bash -osm project-create --domain-name default test_project_1 -``` - -```bash -osm user-create test_admin_1 --projects admin --project-role-mappings 'test_project_1,project_user' --password testadmin --domain-name default -osm user-update test_admin_1 --remove-project-role 'admin,project_admin' -osm user-create test_member_1 --projects admin --project-role-mappings 'test_project_1,project_user' --password testmember --domain-name default -osm user-update test_member_1 --remove-project-role 'admin,project_admin' -``` - ### Running Robot Test Suite #### Install Docker (Charmed OSM Only) -- GitLab From 16febe726ed3cad0de580eef81eab920fbd0d22f Mon Sep 17 00:00:00 2001 From: beierlm Date: Tue, 16 Aug 2022 12:37:21 +0000 Subject: [PATCH 3/3] Update 19-lts-upgrade.md --- 19-lts-upgrade.md | 1 + 1 file changed, 1 insertion(+) diff --git a/19-lts-upgrade.md b/19-lts-upgrade.md index 6068045..f21e6a9 100644 --- a/19-lts-upgrade.md +++ b/19-lts-upgrade.md @@ -582,6 +582,7 @@ docker run -ti --entrypoint /bin/bash \ --env PROMETHEUS_PORT=${PROMETHEUS_PORT} \ --env JUJU_PASSWORD=${JUJU_PASSWORD} \ --env HOSTIP=${HOSTIP} \ + --env OSM_PASSWORD=osm4u --env-file robot-systest.cfg \ -v "$(pwd)/robot.etc.hosts":/etc/hosts \ -v "${KUBECONFIG}":/root/.kube/config \ -- GitLab