summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvrvarma <vikas.varma@att.com>2020-03-19 20:02:54 -0400
committervrvarma <vikas.varma@att.com>2020-03-20 00:17:24 -0400
commit6f3312c6576eefdbac120214b1adc0f150b72d98 (patch)
treeccd11c7e51b6c1c61828b39c957f3bc712fbed46
parentd39860b859417c1a7773f39ad8db311848ec0676 (diff)
fix csit, cleanup dockerfile for osdf
Change-Id: Ie3d44592a382ba8e886c2a7544520cbed6971f84 Signed-off-by: vrvarma <vikas.varma@att.com> Issue-ID: OPTFRA-722
-rw-r--r--docker/opteng/Dockerfile11
-rw-r--r--docker/osdf/Dockerfile10
-rw-r--r--osdf/apps/baseapp.py9
-rwxr-xr-xosdfapp.py6
-rw-r--r--requirements.txt3
-rwxr-xr-xtest/functest/scripts/start-simulators.sh7
-rwxr-xr-xtest/functest/scripts/stop-simulators.sh7
-rwxr-xr-xtest/functest/simulators/build_sim_image.sh1
-rw-r--r--test/functest/simulators/oof_dependencies_simulators.py11
9 files changed, 44 insertions, 21 deletions
diff --git a/docker/opteng/Dockerfile b/docker/opteng/Dockerfile
index 9dca3e7..bd58f35 100644
--- a/docker/opteng/Dockerfile
+++ b/docker/opteng/Dockerfile
@@ -38,8 +38,10 @@ ENV MZN_DL_URL ${MZN_GH_BASE}/releases/download/${MZN}/${MZN_BASENAME}-x86_64.tg
RUN apk update && apk upgrade \
&& apk --no-cache --update add --virtual build-deps openssl wget \
&& apk --no-cache --update add less ca-certificates bash libxslt-dev unzip \
- freetype freetype-dev libstdc++ build-base libc6-compat \
- && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
+ freetype freetype-dev libstdc++ build-base libc6-compat lapack-dev openblas-dev \
+ && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 \
+ && pip install --no-cache-dir --upgrade pip wheel setuptools \
+ && pip install --no-cache-dir Cython numpy==1.17.3 scipy==1.3.1
# Minizinc
RUN wget -q $MZN_DL_URL -O mz.tgz \
@@ -49,7 +51,7 @@ RUN wget -q $MZN_DL_URL -O mz.tgz \
&& echo PATH=/mz-dist/bin:$PATH >> ~/.bashrc
ENV SHELL /bin/bash
-ENV PATH /mz-dist:$PATH
+ENV PATH /mz-dist/bin:$PATH
RUN addgroup -S onap && adduser -S -G onap onap
@@ -67,7 +69,8 @@ RUN mkdir -p /var/log/onap/optf/osdf/ \
&& chown onap:onap /var/log/onap -R \
&& chown onap:onap /opt/osdf -R
-RUN pip install --no-cache-dir -r requirements.txt -r requirements-opteng.txt
+RUN pip install --no-cache-dir -r requirements.txt -r requirements-opteng.txt\
+ && apk del build-deps && rm -rf /var/cache/apk/*
USER onap
diff --git a/docker/osdf/Dockerfile b/docker/osdf/Dockerfile
index 5860df2..5a14a04 100644
--- a/docker/osdf/Dockerfile
+++ b/docker/osdf/Dockerfile
@@ -36,11 +36,11 @@ ENV MZN_GH_BASE https://github.com/MiniZinc/MiniZincIDE
ENV MZN_DL_URL ${MZN_GH_BASE}/releases/download/${MZN}/${MZN_BASENAME}-x86_64.tgz
RUN apt-get update -y \
- && apt-get install -y vim unzip wget libmpfr-dev \
- && apt-get install -y git libqt5printsupport5 build-essential \
- && apt-get install -y python3 python3-setuptools python3-dev \
+ && apt-get install -y --no-install-recommends vim unzip wget libmpfr-dev ca-certificates\
+ && apt-get install -y --no-install-recommends git libqt5printsupport5 build-essential \
+ && apt-get install -y --no-install-recommends python3 python3-setuptools python3-dev \
&& easy_install3 pip \
- && pip install --upgrade virtualenv pip wheel setuptools
+ && pip install --no-cache-dir --upgrade virtualenv pip wheel setuptools && rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3.5 /usr/bin/python
@@ -52,7 +52,7 @@ RUN wget -q $MZN_DL_URL -O /tmp/mz.tgz \
&& echo PATH=/mz-dist/bin:$PATH >> ~/.bashrc
ENV SHELL /bin/bash
-ENV PATH /mz-dist:$PATH
+ENV PATH /mz-dist/bin:$PATH
# OSDF
WORKDIR /opt/osdf
diff --git a/osdf/apps/baseapp.py b/osdf/apps/baseapp.py
index fd94c11..fa301d8 100644
--- a/osdf/apps/baseapp.py
+++ b/osdf/apps/baseapp.py
@@ -27,17 +27,18 @@ import time
import traceback
from optparse import OptionParser
-import osdf.adapters.aaf.sms as sms
-import osdf.operation.responses
import pydevd
from flask import Flask, request, Response, g
+from requests import RequestException
+from schematics.exceptions import DataError
+
+import osdf.adapters.aaf.sms as sms
+import osdf.operation.responses
from osdf.config.base import osdf_config
from osdf.logging.osdf_logging import error_log, debug_log
from osdf.operation.error_handling import request_exception_to_json_body, internal_error_message
from osdf.operation.exceptions import BusinessException
from osdf.utils.mdc_utils import clear_mdc, mdc_from_json, default_mdc, get_request_id
-from requests import RequestException
-from schematics.exceptions import DataError
ERROR_TEMPLATE = osdf.ERROR_TEMPLATE
diff --git a/osdfapp.py b/osdfapp.py
index 536816d..c0a554e 100755
--- a/osdfapp.py
+++ b/osdfapp.py
@@ -21,11 +21,7 @@ OSDF Manager Main Flask Application
"""
import json
-import ssl
-import sys
-import time
-import traceback
-from optparse import OptionParser
+
from threading import Thread # for scaling up, may need celery with RabbitMQ or redis
from flask import request, g
diff --git a/requirements.txt b/requirements.txt
index c3749e8..b2bfd53 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,3 +15,6 @@ pymzn>=0.18.3
onappylog>=1.0.9
pathtools>=0.1.2
pycryptodome>=3.9.6
+numpy==1.17.3
+scipy==1.3.1
+scikit-learn>=0.22.0
diff --git a/test/functest/scripts/start-simulators.sh b/test/functest/scripts/start-simulators.sh
index a3f3db1..66507d4 100755
--- a/test/functest/scripts/start-simulators.sh
+++ b/test/functest/scripts/start-simulators.sh
@@ -20,7 +20,12 @@
# This script is in osdf/test/functest/scripts/
-SCRIPTDIR=$(dirname $(readlink -f $0))
+if [[ `uname` == "Darwin" ]]
+then
+ SCRIPTDIR=$(dirname $(greadlink -f $0))
+else
+ SCRIPTDIR=$(dirname $(readlink -f $0))
+fi
FUNC_TEST_DIR=$(dirname $SCRIPTDIR)
TEST_DIR=$(dirname $FUNC_TEST_DIR)
OSDF_DIR=$(dirname $TEST_DIR)
diff --git a/test/functest/scripts/stop-simulators.sh b/test/functest/scripts/stop-simulators.sh
index c9dd126..e80a080 100755
--- a/test/functest/scripts/stop-simulators.sh
+++ b/test/functest/scripts/stop-simulators.sh
@@ -23,7 +23,12 @@
# We don't need all the directory names here and the "cd", but it may be needed later on
# Also, it will be a guard against some bad config where the directory doesn't exist
-SCRIPTDIR=$(dirname $(readlink -f $0))
+if [[ `uname` == "Darwin" ]]
+then
+ SCRIPTDIR=$(dirname $(greadlink -f $0))
+else
+ SCRIPTDIR=$(dirname $(readlink -f $0))
+fi
FUNC_TEST_DIR=$(dirname $SCRIPTDIR)
TEST_DIR=$(dirname $FUNC_TEST_DIR)
OSDF_DIR=$(dirname $TEST_DIR)
diff --git a/test/functest/simulators/build_sim_image.sh b/test/functest/simulators/build_sim_image.sh
index 6d6cb13..c6bde2a 100755
--- a/test/functest/simulators/build_sim_image.sh
+++ b/test/functest/simulators/build_sim_image.sh
@@ -38,6 +38,7 @@ cp -r $SIMULATORS_DIR/configdb $DOCKER_DIR/sim
cp -r $SIMULATORS_DIR/has-api $DOCKER_DIR/sim
cp -r $SIMULATORS_DIR/policy $DOCKER_DIR/sim
cp $TEST_DIR/policy-local-files/*.json $DOCKER_DIR/sim/policy/response-payloads/pdp-has-vcpe-good
+cp $TEST_DIR/placement-tests/policy_response.json $DOCKER_DIR/sim/policy/response-payloads/
cp $SIMULATORS_DIR/oof_dependencies_simulators.py $DOCKER_DIR/sim/oof_dependencies_simulators.py
cp $OSDF_DIR/requirements.txt $DOCKER_DIR
cp -r $SIMULATORS_DIR/start_sim.sh $DOCKER_DIR/
diff --git a/test/functest/simulators/oof_dependencies_simulators.py b/test/functest/simulators/oof_dependencies_simulators.py
index 2995861..b0b7b32 100644
--- a/test/functest/simulators/oof_dependencies_simulators.py
+++ b/test/functest/simulators/oof_dependencies_simulators.py
@@ -22,7 +22,8 @@ Simulators for dependencies of OSDF (e.g. HAS-API, Policy, SO-callback, etc.)
import glob
import json
import os
-from flask import Flask, jsonify, request
+
+from flask import Flask, jsonify
from osdf.utils.interfaces import json_from_file
@@ -93,6 +94,14 @@ def get_policies(sub_component):
return jsonify(list_json)
+@app.route("/simulated/policy/pdpx/decision/v1", methods=["POST"])
+def get_pdx_policies():
+ """
+ get the pdpx policy
+ """
+ return jsonify(json_from_file("policy/response-payloads/policy_response.json"))
+
+
@app.route("/simulated/configdb/getCellList/<network_id>/<ts>", methods=["GET"])
def get_cell_list(network_id, ts):
data, status = get_payload_for_simulated_component('configdb',