+++ /dev/null
-# BluVal
-
-## Installation
-
-Minimum required python verson is python3.5
-
-```
-python3 -m pip install -r requirements.txt
-```
-
--- /dev/null
+.. ############################################################################
+.. Copyright (c) 2019 AT&T, ENEA AB, Nokia and others #
+.. #
+.. Licensed under the Apache License, Version 2.0 (the "License"); #
+.. you maynot 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. #
+.. ############################################################################
+
+
+Overview
+========
+BluVal is a diagnostic toolset framework to validate different layers in the
+Akraino infrastructure developed and used in Akraino edge stack. BluVal
+integrates different test cases, its development employs a declarative approach
+that is version controlled in LF Gerrit. They are integrated in CI/CD tool
+chain where peer Jenkins jobs can run the test cases and the results are
+reported in LF Repo (Nexus). The test cases cover all blueprint layers in the
+cluster.
+
+Installation and execution
+==========================
+Bluval tool can be ran directly from the repo, or can be called from a container.
+
+
+When ran directly, minimum requirements are python verson 3.5. To setup the
+environment follow the commands below.
+
+.. code-block:: console
+
+ ns156u@aknode82:~$ git clone https://gerrit.akraino.org/r/validation.git
+ ns156u@aknode82:~$ cd validation
+ ns156u@aknode82:~/validation$ python -m venv .py35
+ ns156u@aknode82:~/validation$ source .py35/bin/activate
+ (.py35) ns156u@aknode82:~/validation$ pip install -r bluval/requirements.txt
+
+To run the tests for a certain blueprint, follow the commands below. Optionally
+the layer of testing can be specified too.
+
+.. code-block:: console
+ (.py35) ns156u@aknode82:~/validation$ python bluval/bluval.py -l \
+ hardware dummy # this will run hardware test cases of dummy blue print
+ (.py35) ns156u@aknode82:~/validation$ deactivate
+
+
+When ran from a container, docker needs to be installed on the machine.
+To run the tests for a certain blueprint, follow the steps below. Optionally
+the layer of testing can be specified too.
+
+Note that before issuing the blucon command, you need to fill in the volumes
+that will be mounted in the container. These are locations of the config files
+or access files (ssh keys or clients configs) that will be used to connect to
+the cluster. Also custom volumes can be added here.
+
+.. code-block:: console
+
+ ns156u@aknode82:~$ git clone https://gerrit.akraino.org/r/validation.git
+ ns156u@aknode82:~$ cd validation
+ ns156u@aknode82:~$ vi bluval/volumes.yaml # fill in the volumes to be \
+ mounted in the container
+ ns156u@aknode82:~$ python3 bluval/blucon.py dummy -l hardware
from bluutil import BluvalError
from bluutil import ShowStopperError
+def get_volumes(layer):
+ """Create a list with volumes to mount in the container for given layer
+ """
+ mypath = Path(__file__).absolute()
+ volume_yaml = yaml.safe_load(mypath.parents[0].joinpath("volumes.yaml").open())
+
+ if layer not in volume_yaml['layers']:
+ return ''
+ if volume_yaml['layers'][layer] is None:
+ return ''
+
+ volume_list = ''
+ for vol in volume_yaml['layers'][layer]:
+ if volume_yaml['volumes'][vol]['local'] == '':
+ continue
+ volume_list = (volume_list + ' -v ' +
+ volume_yaml['volumes'][vol]['local'] + ':' +
+ volume_yaml['volumes'][vol]['target'])
+ return volume_list
+
+
def invoke_docker(bluprint, layer):
"""Start docker container for given layer
"""
- cmd = ("docker run"
- " -v $HOME/.ssh:/root/.ssh"
- " -v $HOME/.kube/config:/root/.kube/config"
- " -v $VALIDATION_HOME/tests/variables.yaml:"
- "/opt/akraino/validation/tests/variables.yaml"
- " -v $AKRAINO_HOME/results:/opt/akraino/results"
+
+ volume_list = get_volumes('common') + get_volumes(layer)
+ cmd = ("docker run" + volume_list +
" akraino/validation:{0}-latest"
- " bin/sh -c"
+ " /bin/sh -c"
" 'cd /opt/akraino/validation "
"&& python bluval/bluval.py -l {0} {1}'").format(layer, bluprint)
+
args = [cmd]
try:
- print('Invoking {}'.format(args))
+ print('\nInvoking {}'.format(args))
subprocess.call(args, shell=True)
except OSError:
#print('Error while executing {}'.format(args))
--- /dev/null
+##############################################################################
+# Copyright (c) 2019 AT&T, ENEA AB, Nokia and others #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); #
+# you maynot 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. #
+##############################################################################
+
+# Full list of volumes that can be mounted to the containers when running the tests.
+# When adding volumes, add file or dir at the end of the keyword to ease identifying
+# the type of the volume
+#
+# When running the tests, fill in the 'local' sections only for the volumes that are
+# applicable to your setup
+
+volumes:
+ # location of the ssh key to access the cluster
+ ssh_key_file:
+ local: ''
+ target: '/root/.ssh'
+ # location of the k8s access files (config file, certificates, keys)
+ kube_config_dir:
+ local: ''
+ target: '/root/.kube/'
+ # location of the customized variables.yaml
+ custom_variables_file:
+ local: ''
+ target: '/opt/akraino/validation/tests/variables.yaml'
+ # location of the bluval-<blueprint>.yaml file
+ blueprint_dir:
+ local: ''
+ target: '/opt/akraino/validation/bluval'
+ # location on where to store the results on the local jumpserver
+ results_dir:
+ local: ''
+ target: '/opt/akraino/results'
+
+# parameters that will be passed to the container at each layer
+layers:
+ # volumes mounted at all layers; volumes specific for a different layer are below
+ common:
+ - custom_variables_file
+ - blueprint_dir
+ - results_dir
+ hardware:
+ - ssh_key_file
+ os:
+ - ssh_key_file
+ networking:
+ - ssh_key_file
+ k8s:
+ - ssh_key_file
+ - kube_config_dir
+ k8s_networking:
+ - ssh_key_File
+ - kube_config_dir
+ sds:
+ sdn:
+ vim: