Copyright 2020 Telefónica Investigación y Desarrollo S.A.U. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
openstack image create ...).cd images ./download_images.sh
osm vim-create ...).packages/ folder. Hint:cd packages ./download_packages.sh
localconfig/envconfig.rc (and localconfig/envprovisioning.sh if needed).localconfig/TEMPLATE-envconfig.rc and (if needed) localconfig/TEMPLATE-envprovisioning.sh as templates.baseconfig/patchconfig.rc.vagrant up.vagrant ssh to enter in the VM.cd robot robot -d /vagrant/results testsuite/hackfest_basic.robot
This Vagrant sandbox provides a simple self-contained environment suitable for running consistently E2E tests with OSM.
Using this sandbox for local E2E testing has a number of advantages:
provisioner.sh) can be used as-is for provisioning other types of environments, such as a Docker containers.Here is the sandbox what Vagrant creates for you:
As it can be seen, the provisioning of the sandbox installs several pieces of software:
In addition, the provision of the sandbox requires a number of inputs:
authorized_keys at ~/.ssh with proper permissions.id_rsa, id_rsa.pub at ~/.ssh with proper permissions..gitconfig file at ~ with proper permissions.${BASE_CONFIG_FOLDER} (for Vagrant, ~/baseconfig):seedconfig.rc, where most basic configuration is made.patchconfig.rc, where a Gerrit patch-set for Devops is selected. This file is optional.${LOCAL_CONFIG_FOLDER} (for Vagrant, ~/localconfig)envprovisioning.sh, where local provisioning tasks are scripted. This file is optional.envconfig.rc, where the DUT (VIM and OSM) are defined with environment variables.${PACKAGES_FOLDER}./vagrant/packages.${IMAGES_FOLDER}./vagrant/images.Users should edit the information about the DUT (local VIM and available OSM) before provisioning the sandbox.
In the case of Vagrant, the localconfig sub-folder of the Vagrant sandbox definition (i.e. at the host) contains the relevant files to be edited:
envprovisioning.sh is used as "provisioner" to retrieve some the local environment data, i.e. it is a script intended to retrieve information from some well-known locations, such as local Git repos, that will be referred lated by envconfig.rc.envconfig.rc contains the minimal set of environment variables required to run successfully the suite of Robot tests.Once the vagrant sandbox is created, these files will be automatically copied into the VM to ${LOCAL_CONFIG_FOLDER}) so that they can complete the configuration of the test environment.
Setup of testing conditions, independent from the local environment. This configuration is defined in two configuration files, stored at ${BASE_CONFIG_FOLDER} (for Vagrant, ~/baseconfig).
seedconfig.rcThis file contains common base configuration for the test suite, independent of the environment.
This repo provides a configuration customized for Vagrant sandboxes. If that is your case, please do not edit. However, the existing file can be used as template for creating a seedconfig.rc for other types of environments (e.g. Docker).
Hare is the sample of seedconfig.rc for Vagrant with the environment variables commented:
# Base folder for all operations export BASE_FOLDER=/home/vagrant # EOL account for SSH operations. Required for password-less operations with Git. # Comment to undefine and it will use HTTP instead export ETSIUSERNAME=$(git config user.name) # Folder where Robot tests are stored export ROBOT_DEVOPS_FOLDER="${HOME}/devops/robot-systest" # Folder to save alternative DUT environments (optional) export ENVIRONMENTS_FOLDER=environments # Folder where all required packages are stored export PACKAGES_FOLDER="/vagrant/packages" # Folder where all required images are stored (intended for future use) #export IMAGES_FOLDER="/vagrant/images" # Folder where test results should be exported export ROBOT_REPORT_FOLDER="/vagrant/results"
patchconfig.rcThis file, when exists, defines an optional Gerrit patch-set to be applied over the current Devops master.
This configuration is optional and mostly intended for OSM developers. Do not use if you plan to run community-approved test suites.
Here is the sample of patchconfig.rc with the environment variable commented:
# URL to be used in a subsequent `pull` command to apply the patchset export DEVOPS_PATCH=refs/changes/51/8751/1
Setup of the local environment for the tests. This configuration is defined in configuration files stored at ${LOCAL_CONFIG_FOLDER} (for Vagrant, ~/localconfig).
envprovisioning.shThis file, which is optional, is intended to be used as a script to retrieve information about the local environment, which might include cloning repositories, downloading credential files, etc. Typically, this is used to fetch sensitive information. There are two typical cases:
openstack.rc${LOCAL_CONFIG_FOLDER}/envconfig.rc.clouds.yaml${BASE_FOLDER}.Here is an example of envprovisioning.sh with relevant operations commented:
ssh-keyscan mygit.com >> ~/.ssh/known_hosts # Often needed for non public repos git clone git@mygit.com:local-environment-data/vim-and-infra.git cp vim-and-infra/openstack/clouds.yaml "${BASE_FOLDER}"/ # Copy of credentials to base folder
envconfig.rcThis file, which is mandatory, is where the local DUT is completely defined with environment variables.
# VIM setup export OS_USERNAME=username export OS_PASSWORD=password export OS_TENANT_NAME=projectName export OS_AUTH_URL=https://identityHost:portNumber/v2.0 export OS_TENANT_ID=tenantIDString export OS_REGION_NAME=regionName export OS_CACERT=/path/to/cacertFile # OSM location export OSM_HOSTNAME="192.168.1.22" # Details of the VIM target for OSM export VIM_TARGET="vim002-fortville-physnet" export VIM_MGMT_NET="management" # Optional: location of alternative `envconfig.rc`-like files export ENVIRONMENTS_FOLDER=environments
Alternatively, here is another example envconfig.rc where the VIM is defined with a credentials file, clouds.yaml:
# VIM setup export CLOUDS_PATH=${BASE_FOLDER} # Location of `clouds.yaml` export OS_CLOUD=vim-002 # OSM location export OSM_HOSTNAME="192.168.1.22" # Details of the VIM target for OSM export VIM_TARGET="vim002-fortville-physnet" export VIM_MGMT_NET="management" # Optional: location of alternative `envconfig.rc`-like files export ENVIRONMENTS_FOLDER=environments