Sandbox clones & uses community packages from Git:
- Clones community packages from GitLab repo inside the VM.
- For convenience, clones the Tester Guide inside the VM.
- Adds option to use daily build of OSM client instead of latest
stable.
- Updates `README.md` accordingly.
Change-Id: I8f0940a73d895c9c452e9b831ae4cbccf28959b8
Signed-off-by: ramonsalguer <javier.ramon@telefonica.com>
diff --git a/osm-tests/.gitignore b/osm-tests/.gitignore
index 9fae18b..9a02b9f 100644
--- a/osm-tests/.gitignore
+++ b/osm-tests/.gitignore
@@ -1,7 +1,6 @@
-packages/*.gz
-packages/*.tgz
-packages/*.yaml
-packages/*.yml
+packages/*
+!packages/.void
+!packages/download_packages.sh
images/*.qcow
images/*.qcow2
images/*.img
diff --git a/osm-tests/README.md b/osm-tests/README.md
index 39ed936..0e6d95a 100644
--- a/osm-tests/README.md
+++ b/osm-tests/README.md
@@ -21,11 +21,6 @@
./download_images.sh
```
2. Add the corresponding VIM target to your OSM (`osm vim-create ...`).
- 3. Copy all packages (NF, NS, NSI) required for the tests to the `packages/` folder. Hint:
- ```bash
- cd packages
- ./download_packages.sh
- ```
2. Provide credentials for your VIM+OSM environment:
- Create/Edit `localconfig/envconfig.rc` (and `localconfig/envprovisioning.sh` if needed).
- HINT: First time, use `localconfig/TEMPLATE-envconfig.rc` and (if needed) `localconfig/TEMPLATE-envprovisioning.sh` as templates.
@@ -38,6 +33,15 @@
robot -d /vagrant/results testsuite/hackfest_basic.robot
```
+**TIP:** In case your needed to use the latest version of OSM client from master instead of the latest stable version, simply do:
+
+```bash
+export OSM_CLIENT_VERSION=master
+vagrant up
+```
+
+**Please use this option with caution, and only when absolutely required**.
+
## INTRODUCTION
This Vagrant sandbox provides a simple self-contained environment suitable for running consistently E2E tests with OSM.
@@ -88,7 +92,7 @@
- `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.
- All packages required for the tests are already placed at `${PACKAGES_FOLDER}`.
- - In Vagrant, `/vagrant/packages`.
+ - In Vagrant, they are cloned into `/home/vagrant/packages/osm-packages` in the VM.
- All images required for the tests are already placed at `${IMAGES_FOLDER}`.
- In Vagrant, `/vagrant/images`.
- This folder is intended for future use, but not relevant for the current test suite.
@@ -129,7 +133,8 @@
# Folder to save alternative DUT environments (optional)
export ENVIRONMENTS_FOLDER=environments
# Folder where all required packages are stored
-export PACKAGES_FOLDER="/vagrant/packages"
+export BASE_PACKAGES_FOLDER="${BASE_FOLDER}/packages"
+export PACKAGES_FOLDER="${BASE_PACKAGES_FOLDER}/osm-packages"
# Folder where all required images are stored (intended for future use)
#export IMAGES_FOLDER="/vagrant/images"
# Folder where test results should be exported
diff --git a/osm-tests/baseconfig/seedconfig.rc b/osm-tests/baseconfig/seedconfig.rc
index 7fcf884..bf852e8 100644
--- a/osm-tests/baseconfig/seedconfig.rc
+++ b/osm-tests/baseconfig/seedconfig.rc
@@ -33,7 +33,10 @@
export ENVIRONMENTS_FOLDER=environments
# Folder where all required packages are stored
-export PACKAGES_FOLDER="/vagrant/packages"
+export BASE_PACKAGES_FOLDER="${BASE_FOLDER}/packages"
+export PACKAGES_FOLDER="${BASE_PACKAGES_FOLDER}/osm-packages"
+#export PACKAGES_FOLDER="{BASE_FOLDER}/packages"
+#export ETSIOSM_PACKAGES_FOLDER="${PACKAGES_FOLDER}"/osm-packages
# Folder where all required images are stored (intended for future use)
export IMAGES_FOLDER="/vagrant/images"
diff --git a/osm-tests/provisioner.sh b/osm-tests/provisioner.sh
index 650d366..8167982 100644
--- a/osm-tests/provisioner.sh
+++ b/osm-tests/provisioner.sh
@@ -53,6 +53,8 @@
exit 1
fi
+mkdir -p ${BASE_PACKAGES_FOLDER} # Folder to store collections of packages, based on env varibles
+
# (OPTIONAL) Devops patch configuration
if [ -f ${BASE_CONFIG_FOLDER}/patchconfig.rc ]
then
@@ -84,6 +86,10 @@
#------------------------------------------------------------------------------------------------------
# Installs OSM client
+if [ -n "${1}" ]; then # If there is a first argument, it must be the version
+ OSM_VERSION=$1
+fi
+
sudo sed -i "/osm-download.etsi.org/d" /etc/apt/sources.list
wget -qO - https://osm-download.etsi.org/repository/osm/debian/ReleaseSEVEN/OSM%20ETSI%20Release%20Key.gpg | sudo apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] https://osm-download.etsi.org/repository/osm/debian/ReleaseSEVEN stable devops IM osmclient"
@@ -92,14 +98,40 @@
sudo -H python3 -m pip install python-magic pyangbind verboselogs
sudo apt-get install -y python3-osmclient
+# Checks if there is is a version indication and if it is for "master"
+if [[ -n "${OSM_VERSION}" && "${OSM_VERSION}" = "master" ]]
+then
+ sudo apt-get remove -y python3-osmclient
+ sudo apt-get install python3-pip libcurl4-openssl-dev libssl-dev
+
+ # Upgrade pip and install dependencies (python-magic, osm-im)
+ # Next instructions install the dependencies at system level with sudo -H
+ sudo -H python3 -m pip install -U pip
+ sudo -H python3 -m pip install python-magic
+ sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/IM --upgrade
+
+ # Clone the osmclient repo and install OSM client from the git repo.
+ git clone https://osm.etsi.org/gerrit/osm/osmclient
+ curl -Lo osmclient/.git/hooks/commit-msg http://osm.etsi.org/gerrit/tools/hooks/commit-msg
+ chmod u+x osmclient/.git/hooks/commit-msg
+ # Install osmclient using pip3 with the --user and -e options
+ python3 -m pip install --user -e osmclient
+fi
+
# Installs OpenStack client
##For Train version, uncomment the following two lines:
##sudo add-apt-repository -y cloud-archive:train
##sudo apt-get update
sudo apt-get install -y python3-openstackclient # Installs Queens by default
-# Installs Robot and all dependencies required for the tests
+# Downloads community test plan
+ssh-keyscan -p 29419 osm.etsi.org >> ~/.ssh/known_hosts
+git clone ssh://git@osm.etsi.org:29419/osm-doc/osm-tester-guide.git
+# Downloads community packages and puts them in the location determined by the corresponding env variable for Robot
+git clone ssh://git@osm.etsi.org:29419/vnf-onboarding/osm-packages.git ${PACKAGES_FOLDER}
+
+# Installs Robot and all dependencies required for the tests
sudo -H python3 -m pip install --ignore-installed haikunator requests pyvcloud progressbar pathlib robotframework robotframework-seleniumlibrary robotframework-requests robotframework-SSHLibrary
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
@@ -122,6 +154,7 @@
# Installs some additional packages to ease interactive troubleshooting
sudo apt-get install -y osm-devops
sudo snap install charm --classic
+sudo apt-get install -y jq
sudo snap install yq
# Copies VIM credentials in `clouds.yaml` (if applicable) to a proper location