+++ /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
+_OPTIONAL_ALSO = False
+
+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)
+ "&& python bluval/bluval.py -l {0} {1} {2}'"
+ .format(layer, ("-o" if _OPTIONAL_ALSO else ""), 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))
@click.command()
@click.argument('blueprint')
@click.option('--layer', '-l')
-def main(blueprint, layer):
+@click.option('--optional_also', '-o', is_flag=True)
+def main(blueprint, layer, optional_also):
"""Takes blueprint name and optional layer. Validates inputs and derives
yaml location from blueprint name. Invokes validate on blue print.
"""
+ global _OPTIONAL_ALSO # pylint: disable=global-statement
mypath = Path(__file__).absolute()
yaml_loc = mypath.parents[0].joinpath('bluval-{}.yaml'.format(blueprint))
if layer is not None:
layer = layer.lower()
+ if optional_also:
+ _OPTIONAL_ALSO = True
+ print("_OPTIONAL_ALSO {}".format(_OPTIONAL_ALSO))
try:
invoke_dockers(yaml_loc, layer, blueprint)
except ShowStopperError as err:
validate_layer(blueprint, layer)
+def write_test_info(layer):
+ """writes testing info to test_info.yaml
+ """
+ data = dict(
+ test_info=dict(
+ layer=layer,
+ optional=_OPTIONAL_ALSO,
+ )
+ )
+
+ with open('/opt/akraino/results/test_info.yaml', 'w') as outfile:
+ yaml.dump(data, outfile, default_flow_style=False)
+
+
@click.command()
@click.argument('blueprint')
@click.option('--layer', '-l')
print("_OPTIONAL_ALSO {}".format(_OPTIONAL_ALSO))
try:
+ write_test_info(layer)
validate_blueprint(yaml_loc, layer)
except ShowStopperError as err:
print('ShowStopperError:', err)
--- /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:
Normally, this conainer is not used directly, but instead leveraged via
sonobuoy.
+
+The helm container
+==================
+
+Building and pushing the container
+----------------------------------
+
+To build just the helm container, use the command:
+
+.. code-block:: console
+
+ make helm-build [ REGISTRY=<dockerhub_registry> NAME=<image_name>]
+
+To both build and push the container, use the command:
+
+.. code-block:: console
+
+ make helm [ REGISTRY=<dockerhub_registry> NAME=<image_name>]
+
+Using the container
+-------------------
+
+Container needs to be started with the SSH key file mounted. Users
+credentials can be provided via a mounted variables.yaml file.
+
+The results folder can be mounted as well; this way the logs are
+stored on the local server.
+
+.. code-block:: console
+
+ docker run -ti -v /home/jenkins/openrc:/root/openrc \
+ -v /home/foobar/.ssh/id_rsa:/root/.ssh/id_rsa \
+ -v /home/foobar/variables.yaml:/opt/akraino/validation/tests/variables.yaml \
+ -v /home/foobar/helm_results:/opt/akraino/results/ \
+ akraino/validation:helm-latest
--- /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. #
+##############################################################################
+
+# ref: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds
+FROM python:3.6-alpine3.9 as build
+
+# Install dependencies
+COPY pip-requirements.txt /wheels/requirements/pip-requirements.txt
+RUN apk --no-cache add --update \
+ gcc \
+ git \
+ libc-dev \
+ libffi \
+ libffi-dev \
+ make \
+ openssl-dev
+
+# Build binaries
+WORKDIR /wheels
+RUN pip3 install wheel
+RUN pip3 wheel -r /wheels/requirements/pip-requirements.txt
+RUN git clone https://gerrit.akraino.org/r/validation /opt/akraino/validation
+
+# Copy binaries in the final container and install requirements
+FROM python:3.6-alpine3.9
+COPY --from=build /wheels /wheels
+COPY --from=build /opt/akraino/validation /opt/akraino/validation
+
+RUN pip3 install -r /wheels/requirements/pip-requirements.txt \
+ -f /wheels && \
+ rm -rf /wheels && \
+ rm -rf /root/.cache/pip/*
+
+# Install blueval dependencies
+RUN pip install -r /opt/akraino/validation/bluval/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. #
+##############################################################################
+
+.PHONY: all
+all: .push_image .push_manifest
+
+.PHONY: build
+build: .build
+
+include ../build.mk
--- /dev/null
+robotframework
+robotframework-sshlibrary
--- /dev/null
+##############################################################################
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# Copyright (c) 2019 Nokia. #
+# #
+# 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. #
+##############################################################################
+
+
+*** Settings ***
+Library SSHLibrary
+Library String
+
+
+*** Variables ***
+${REPORTDIR} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}
+${CHARTDIR} /tmp/helm-chart
+${SERVECMD} helm serve --repo-path /home/${USERNAME}/.helm/repository/local
+
+
+*** Keywords ***
+Open Connection And Log In
+ Open Connection ${HOST}
+ Login With Public Key ${USERNAME} ${SSH_KEYFILE}
+
+Start Local Chart Repository Server
+ Stop Local Chart Repository Server
+ Start Command ${SERVECMD}
+ ${rc}= Execute Command pgrep -xf "${SERVECMD}"
+ ... return_stdout=False
+ ... return_rc=True
+ Should Be Equal As Integers ${rc} 0
+
+Stop Local Chart Repository Server
+ Execute Command pkill -xf "${SERVECMD}"
+
+List Charts In Repositories
+ ${stdout}= Execute Command helm search --regexp . | tail -n +2 | cut -f1
+ @{CHARTS}= Split String ${stdout}
+ Set Suite Variable @{CHARTS}
+
+Fetch Charts
+ Execute Command rm -r ${CHARTDIR}
+ Execute Command mkdir -p ${CHARTDIR}
+ :FOR ${chart} IN @{CHARTS}
+ \ ${rc}= Execute Command helm fetch ${chart} -d ${CHARTDIR}
+ ... return_stdout=False
+ ... return_rc=True
+ \ Should Be Equal As Integers ${rc} 0
+
+Lint Charts
+ @{files}= List Files In Directory ${CHARTDIR}
+ :FOR ${file} IN @{files}
+ \ ${stdout}= Execute Command helm lint ${CHARTDIR}/${file}
+ \ Should Contain ${stdout} 1 chart(s) linted, no failures
+
+Simulate Install
+ :FOR ${chart} IN @{CHARTS}
+ \ ${rc}= Execute Command helm install --dry-run ${chart}
+ ... return_stdout=False
+ ... return_rc=True
+ \ Should Be Equal As Integers ${rc} 0
--- /dev/null
+##############################################################################
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# Copyright (c) 2019 Nokia. #
+# #
+# 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. #
+##############################################################################
+
+
+*** Settings ***
+Documentation Tests to validate Helm charts available in chart
+... repositories.
+Resource helm_chart.resource
+Suite Setup Run Keywords Open Connection And Log In
+ ... List Charts In Repositories
+ ... Start Local Chart Repository Server
+Suite Teardown Run Keywords Stop Local Chart Repository Server
+ ... Close All Connections
+
+
+*** Test Cases ***
+Validate Formatting
+ Fetch Charts
+ Lint Charts
+
+Validate Rendering
+ Simulate Install
--- /dev/null
+##############################################################################
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# Copyright (c) 2019 Nokia. #
+# #
+# 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. #
+##############################################################################
+
+*** Settings ***
+Documentation Validation, robustness and stability of Linux
+Library SSHLibrary
+Library OperatingSystem
+Library BuiltIn
+Library Process
+Resource variables.resource
+Suite Setup Open Connection And Log In
+Suite Teardown Close All Connections
+
+*** Variables ***
+${LOG} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}.log
+
+
+*** Test Cases ***
+#Run whole ltp test suite
+# [Documentation] Wait ~5hrs to complete 2536 tests
+# ${result}= Run Process ./runltp shell=yes cwd=/opt/ltp stdout=${LOG}
+# Append To File ${LOG} ${result}${\n}
+# Sleep 2s
+# Should Contain ${result.stdout} failed 0
+
+#Run ltp syscalls test suite
+# [Documentation] Wait ~45m for syscalls to complete
+# ${result}= Run Process ./runltp -f syscalls shell=yes cwd=/opt/ltp stdout=${LOG}
+# Append To File ${LOG} ${result}${\n}
+# Sleep 2s
+# Should Contain ${result.stdout} failed 0
+
+Run ltp syscalls madvise
+ [Documentation] Wait ~1m for madvise01-10 to complete
+ ${result}= Run Process ./runltp -f syscalls -s madvise shell=yes cwd=/opt/ltp stdout=${LOG}
+ Append To File ${LOG} ${result}${\n}
+ Sleep 2s
+ Should Contain ${result.stdout} failed 0
+
+*** Keywords ***
+Open Connection And Log In
+ Open Connection ${HOST}
+ Login ${ROOTUSER} ${ROOTPSWD}
+
--- /dev/null
+##############################################################################
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# Copyright (c) 2019 Nokia. #
+# #
+# 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. #
+##############################################################################
+
+*** Variables ***
+# Manual test: robot ltp.robot
+
+${HOST} aknode109 # cluster's master node address
+${ROOTUSER} root # Required root user to log in to the host
+${ROOTPSWD} root_passwd # Required root password to log in to the host
### Removed
- Deletion of submissions
+
+## [0.1.0-SNAPSHOT] - 23 August 2019
+### Added
+
+### Changed
+
+### Removed
+- Unused credentials in music.properties file
cassandra.user=cassandra
cassandra.password=cassandra
-#Music API
-#music.endpoint = http://vm-ep-dev4.research.att.com/MUSIC/rest/
-#music.version = v2
-#music.keyspace = keyspaces
-#music.x.minor.version = 3
-#music.x.patch.version = 0
-#music.ns = com.att.ecomp.portal.demeter
-#music.user.id = m00468@portal.ecomp.att.com
-#music.password = friedG33nS-
-#music.consistency.info = type
-#music.consistency.info.value = eventual
\ No newline at end of file