diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | conductor/docker/api/Dockerfile | 22 | ||||
-rwxr-xr-x | conductor/docker/api/api_paste.ini | 26 | ||||
-rwxr-xr-x | conductor/docker/build-dockers.sh | 9 | ||||
-rwxr-xr-x | conductor/docker/controller/Dockerfile | 6 | ||||
-rwxr-xr-x | conductor/docker/data/Dockerfile | 6 | ||||
-rwxr-xr-x | conductor/docker/push-dockers.sh | 43 | ||||
-rwxr-xr-x | conductor/docker/reservation/Dockerfile | 5 | ||||
-rwxr-xr-x | conductor/docker/run-dockers.sh | 6 | ||||
-rwxr-xr-x | conductor/docker/solver/Dockerfile | 6 | ||||
-rwxr-xr-x | conductor/docker/stop-dockers.sh | 5 | ||||
-rw-r--r-- | conductor/pom.xml | 18 | ||||
-rw-r--r-- | conductor/test-requirements.txt | 3 | ||||
-rwxr-xr-x | conductor/tools/pretty_tox.sh | 4 | ||||
-rw-r--r-- | pom.xml | 1 | ||||
-rwxr-xr-x | sonar.sh | 41 |
16 files changed, 170 insertions, 32 deletions
@@ -58,6 +58,7 @@ conductor/conductor/common/music/voting.py .cache nosetests.xml coverage.xml +xunit*.xml # Translations *.mo diff --git a/conductor/docker/api/Dockerfile b/conductor/docker/api/Dockerfile index bc0b07d..9280c6c 100755 --- a/conductor/docker/api/Dockerfile +++ b/conductor/docker/api/Dockerfile @@ -16,11 +16,23 @@ # ------------------------------------------------------------------------- FROM python:2.7 +ENV CON_ADDR "127.0.0.1" +ENV CON_PORT "8091" + +EXPOSE 8091 + RUN apt-get update RUN apt-get --assume-yes install python-setuptools +RUN apt-get install -y unzip +RUN apt-get install -y curl +RUN apt-get install -y wget +RUN rm -rf ./has RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -COPY ./conductor.conf conductor.conf -RUN ls -ltr /usr/local/bin/conductor-api -CMD ["sh","-c", "python /usr/local/bin/conductor-api --port=8091 -- --config-file=conductor.conf"] +WORKDIR ./has/conductor/ +#RUN ls +RUN pip install -e . +#COPY ./conductor.conf conductor.conf +WORKDIR ./has/conductor/docker/api +COPY api_paste.ini /usr/local/bin/api_paste.ini +RUN ls +CMD ["sh","-c", "python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/api/api_paste.ini b/conductor/docker/api/api_paste.ini new file mode 100755 index 0000000..4299f46 --- /dev/null +++ b/conductor/docker/api/api_paste.ini @@ -0,0 +1,26 @@ +# Conductor API WSGI Pipeline +# Define the filters that make up the pipeline for processing WSGI requests +# Note: This pipeline is PasteDeploy's term rather than Conductor's pipeline +# used for processing samples + +# Remove authtoken from the pipeline if you don't want to use keystone authentication +[pipeline:main] +pipeline = cors http_proxy_to_wsgi api-server +#pipeline = cors http_proxy_to_wsgi request_id authtoken api-server + +[app:api-server] +paste.app_factory = conductor.api.app:app_factory + +#[filter:authtoken] +#paste.filter_factory = keystonemiddleware.auth_token:filter_factory + +#[filter:request_id] +#paste.filter_factory = oslo_middleware:RequestId.factory + +[filter:cors] +paste.filter_factory = oslo_middleware.cors:filter_factory +oslo_config_project = conductor + +[filter:http_proxy_to_wsgi] +paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory +oslo_config_project = conductor diff --git a/conductor/docker/build-dockers.sh b/conductor/docker/build-dockers.sh index 3d860f8..f62a6fd 100755 --- a/conductor/docker/build-dockers.sh +++ b/conductor/docker/build-dockers.sh @@ -1,9 +1,6 @@ -#codecloud.web.att.com -#vi /etc/resolve.conf -#nameserver 135.207.142.20 -#nameserver 135.207.142.21 -#nameserver 135.207.255.13 - +#!/bin/bash +# TODO (IKRAM): need to test api only first to test the docker upload chain. +# Will enable the others once api is tested docker build -t api api/ docker build -t controller controller/ docker build -t data data/ diff --git a/conductor/docker/controller/Dockerfile b/conductor/docker/controller/Dockerfile index 427cc9b..4f9bfdd 100755 --- a/conductor/docker/controller/Dockerfile +++ b/conductor/docker/controller/Dockerfile @@ -18,10 +18,8 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -RUN pwd +WORKDIR ./has/conductor/ +RUN pip install -e . RUN echo "Starting conductor-controller" CMD ["python","/usr/local/bin/conductor-controller", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/data/Dockerfile b/conductor/docker/data/Dockerfile index d3836d9..9485644 100755 --- a/conductor/docker/data/Dockerfile +++ b/conductor/docker/data/Dockerfile @@ -18,10 +18,8 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -RUN pwd +WORKDIR ./has/conductor +RUN pip install -e . RUN echo "Starting conductor-data" CMD ["python","/usr/local/bin/conductor-data", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/push-dockers.sh b/conductor/docker/push-dockers.sh new file mode 100755 index 0000000..59cb7d4 --- /dev/null +++ b/conductor/docker/push-dockers.sh @@ -0,0 +1,43 @@ +#!/bin/bash
+BUILD_ARGS="--no-cache"
+ORG="onap"
+VERSION="1.1.0"
+PROJECT="optf"
+IMAGE="api"
+DOCKER_REPOSITORY="nexus3.onap.org:10003"
+IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
+TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
+
+if [ $HTTP_PROXY ]; then
+BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
+fi
+if [ $HTTPS_PROXY ]; then
+ BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
+fi
+
+function tag {
+ echo "Tagging !!!"
+ docker tag api "nexus3.onap.org:10003/onap/optf/api"
+ docker tag data "nexus3.onap.org:10003/onap/optf/data"
+ docker tag controller "nexus3.onap.org:10003/onap/optf/controller"
+ docker tag solver "nexus3.onap.org:10003/onap/optf/solver"
+ docker tag reservation "nexus3.onap.org:10003/onap/optf/reservation"
+}
+
+
+function push_image {
+ echo "Start push ${IMAGE_NAME}:latest"
+
+ tag
+ docker push "nexus3.onap.org:10003/onap/optf/api"
+ docker push "nexus3.onap.org:10003/onap/optf/data"
+ docker push "nexus3.onap.org:10003/onap/optf/controller"
+ docker push "nexus3.onap.org:10003/onap/optf/solver"
+ docker push "nexus3.onap.org:10003/onap/optf/reservation"
+
+ #docker push ${IMAGE_NAME}:latest
+ #push_image_tag ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest
+ #push_image_tag ${IMAGE_NAME}:${VERSION}-STAGING-latest
+ #push_image_tag ${IMAGE_NAME}:${VERSION}-STAGING-${TIMESTAMP}
+ }
+push_image
diff --git a/conductor/docker/reservation/Dockerfile b/conductor/docker/reservation/Dockerfile index 2402f1d..323f15d 100755 --- a/conductor/docker/reservation/Dockerfile +++ b/conductor/docker/reservation/Dockerfile @@ -18,10 +18,9 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . +WORKDIR ./has/conductor/ +RUN pip install -e . RUN pwd RUN echo "Starting conductor-reservation" CMD ["python","/usr/local/bin/conductor-reservation", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/run-dockers.sh b/conductor/docker/run-dockers.sh index 555fe04..f8ae249 100755 --- a/conductor/docker/run-dockers.sh +++ b/conductor/docker/run-dockers.sh @@ -1,7 +1,7 @@ ### example run - provide the conductor configuration file as input to the run script -#./run-dockers.sh <path-to>/conductor.conf -docker run -v $1:/usr/local/bin/conductor.conf api & +# ./run-dockers.sh <path-to>/conductor.conf +docker run -v $1:/usr/local/bin/conductor.conf data & docker run -v $1:/usr/local/bin/conductor.conf controller & -docker run -v $1:/usr/local/bin/conductor.conf data & +docker run -p "8091:8091" -v $1:/usr/local/bin/conductor.conf api & docker run -v $1:/usr/local/bin/conductor.conf solver & docker run -v $1:/usr/local/bin/conductor.conf reservation & diff --git a/conductor/docker/solver/Dockerfile b/conductor/docker/solver/Dockerfile index 3aad3a9..b1a3125 100755 --- a/conductor/docker/solver/Dockerfile +++ b/conductor/docker/solver/Dockerfile @@ -18,10 +18,8 @@ FROM python:2.7 RUN apt-get update RUN apt-get --assume-yes install python-setuptools -RUN virtualenv ../venv RUN git clone https://gerrit.onap.org/r/optf/has -WORKDIR ./conductor -RUN pip install . -RUN pwd +WORKDIR ./has/conductor +RUN pip install -e . RUN echo "Starting conductor-solver" CMD ["python","/usr/local/bin/conductor-solver", "--config-file=/usr/local/bin/conductor.conf"] diff --git a/conductor/docker/stop-dockers.sh b/conductor/docker/stop-dockers.sh new file mode 100755 index 0000000..72595e8 --- /dev/null +++ b/conductor/docker/stop-dockers.sh @@ -0,0 +1,5 @@ +docker stop $(sudo docker ps -a -q --filter ancestor=api) +docker stop $(sudo docker ps -a -q --filter ancestor=solver) +docker stop $(sudo docker ps -a -q --filter ancestor=reservation) +docker stop $(sudo docker ps -a -q --filter ancestor=data) +docker stop $(sudo docker ps -a -q --filter ancestor=controller) diff --git a/conductor/pom.xml b/conductor/pom.xml index db0f047..b18ac36 100644 --- a/conductor/pom.xml +++ b/conductor/pom.xml @@ -34,6 +34,24 @@ <build> <plugins> <plugin> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <executions> + <execution> + <id>tox-test</id> + <phase>test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable> + ${session.executionRootDirectory}/sonar.sh + </executable> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> diff --git a/conductor/test-requirements.txt b/conductor/test-requirements.txt index 6bd93c6..3150f00 100644 --- a/conductor/test-requirements.txt +++ b/conductor/test-requirements.txt @@ -17,4 +17,5 @@ testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT os-testr>=1.0.0 # Apache-2.0 tempest>=11.0.0 # Apache-2.0 -pifpaf>=0.0.11
\ No newline at end of file +pifpaf>=0.0.11 +junitxml>=0.7 diff --git a/conductor/tools/pretty_tox.sh b/conductor/tools/pretty_tox.sh index 190b39d..04c806e 100755 --- a/conductor/tools/pretty_tox.sh +++ b/conductor/tools/pretty_tox.sh @@ -29,7 +29,7 @@ TESTRARGS=$1 # # this work around exists until that is addressed if [[ "$TESTARGS" =~ "until-failure" ]]; then - python setup.py testr --slowest --testr-args="$TESTRARGS" + python setup.py testr --slowest --testr-args="$TESTRARGS" | subunit2junitxml --output-to=xunit-results.xml else - python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f + python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-1to2 | subunit2junitxml --forward --output-to=xunit-results.xml fi @@ -41,6 +41,7 @@ <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding> <sonar.sources>conductor/conductor</sonar.sources> <sonar.tests>conductor/conductor/tests</sonar.tests> + <sonar.junit.reportsPath>conductor/xunit-results.xml</sonar.junit.reportsPath> <sonar.python.coverage.reportPath>conductor/cover/coverage.xml</sonar.python.coverage.reportPath> <sonar.language>py</sonar.language> <sonar.pluginname>python</sonar.pluginname> diff --git a/sonar.sh b/sonar.sh new file mode 100755 index 0000000..566ede7 --- /dev/null +++ b/sonar.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 Intel Corporation Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +run_tox_test() +{ + set -x + CURDIR=$(pwd) + TOXINIS=$(find . -name "tox.ini") + for TOXINI in "${TOXINIS[@]}"; do + DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev) + cd "${CURDIR}/${DIR}" + rm -rf ./venv-tox ./.tox + virtualenv ./venv-tox + source ./venv-tox/bin/activate + pip install --upgrade pip + pip install --upgrade tox argparse + pip freeze + tox -e cover + deactivate + rm -rf ./venv-tox ./.tox + done +} + +run_tox_test |