[CORD-3206]

- enable junit-xml output from nose2 unit tests
- Delete obsolete django-based tests
- cleanup of virtualenv scripts

Change-Id: Ibc014da4319bdc00f6cf321350389ac93ac46804
diff --git a/scripts/setup_venv.sh b/scripts/setup_venv.sh
index 73effb1..99717e1 100755
--- a/scripts/setup_venv.sh
+++ b/scripts/setup_venv.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright 2017-present Open Networking Foundation
 #
@@ -14,50 +14,46 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-BASEDIR=$(pwd)
-REQUIREMENTS=$BASEDIR/containers/xos/pip_requested.txt
-VENVDIR=venv-xos
+# setup_venv_lite.sh
+# sets up a python virtualenv for testing and service development
 
-echo $BASEDIR
-echo $REQUIREMENTS
-echo $VENVDIR
+set -e -o pipefail
+
+WORKSPACE=${WORKSPACE:-.}
+XOS_DIR=${XOS_DIR:-.}
+PIP_REQS=${PIP_REQS:-${XOS_DIR}/scripts/xos_dev_reqs.txt}
+VENVDIR="${WORKSPACE}/venv-xos"
 
 # create venv if it's not yet there
-if [ ! -d "$BASEDIR/$VENVDIR" ]; then
-   echo "Setting up virtualenv for XOS"
-   virtualenv -q $BASEDIR/$VENVDIR --no-site-packages
-   pip install --upgrade pip
-   echo "Virtualenv created."
+if [ ! -x "${VENVDIR}/bin/activate" ]; then
+  echo "Setting up dev/test virtualenv in ${VENVDIR} for XOS"
+  virtualenv -q "${VENVDIR}" --no-site-packages
+  echo "Virtualenv created."
 fi
 
-# activate the virtual env
-if [ ! $VIRTUAL_ENV ]; then
-   source $BASEDIR/$VENVDIR/bin/activate
-   echo "Virtualenv activated."
-fi
+echo "Installing python requirements in virtualenv with pip"
+source "${VENVDIR}/bin/activate"
+pip install --upgrade pip
+pip install -r "$PIP_REQS"
 
-# install pip requirements
-if \
-pip install cryptography --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" && \
-pip install -r $REQUIREMENTS && \
-cd $BASEDIR/lib/xos-config; python setup.py install && \
+pushd "$XOS_DIR/lib/xos-util"
+python setup.py install
+echo "xos-util Installed"
+popd
 
-#install xos-client
-cp -R $BASEDIR/containers/xos/tmp.chameleon $BASEDIR/xos/xos_client/xosapi/chameleon && \
-cd $BASEDIR/xos/xos_client/xosapi/chameleon/protos; VOLTHA_BASE=anything make && \
-cd $BASEDIR/xos/xos_client; python setup.py install && \
-chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/gw_gen.py && \
-chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/swagger_gen.py && \
+pushd "$XOS_DIR/lib/xos-config"
+python setup.py install
+echo "xos-config Installed"
+popd
 
-#install xos-genx
-cd $BASEDIR/lib/xos-genx; python setup.py install && \
+pushd "$XOS_DIR//lib/xos-genx"
+python setup.py install
+echo "xos-genx Installed"
+popd
 
-#install xos-util
-cd $BASEDIR/lib/xos-util; python setup.py install
- then
-   echo "Requirements installed."
-   echo "Virtualenv ready"
- else
-   echo "An error occurred"
-fi
-cd $BASEDIR
+pushd "$XOS_DIR/xos/xos_client"
+make
+echo "xos-client Installed"
+popd
+
+echo "XOS dev/test virtualenv created. Run 'source ${VENVDIR}/bin/activate'."
diff --git a/scripts/setup_venv_lite.sh b/scripts/setup_venv_lite.sh
deleted file mode 100755
index 82ba642..0000000
--- a/scripts/setup_venv_lite.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright 2017-present Open Networking Foundation
-#
-# 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.
-
-# setup_venv_lite.sh
-# sets up a python virtualenv for testing and service development
-
-set -eu -o pipefail
-
-BASEDIR=$(pwd)
-REQUIREMENTS=$BASEDIR/scripts/xos_reqs_lite.txt
-VENVDIR=venv-xos-lite
-
-# create venv if it's not yet there
-if [ ! -x "$BASEDIR/$VENVDIR/bin/activate" ]; then
-  echo "Setting up virtualenv ${BASEDIR}/${VENVDIR} for XOS"
-  virtualenv -q "$BASEDIR/$VENVDIR" --no-site-packages
-  pip install --upgrade pip
-  echo "Virtualenv created."
-fi
-
-set +u
-# activate the virtual env
-if [ ! -x "$VIRTUAL_ENV" ]; then
-  source "$BASEDIR/$VENVDIR/bin/activate"
-  echo "Virtualenv activated."
-fi
-
-pip install -r "$REQUIREMENTS"
-cd "$BASEDIR/lib/xos-config"; python setup.py install
-cd "$BASEDIR/lib/xos-genx"; python setup.py install
-cd "$BASEDIR/lib/xos-util"; python setup.py install
-
diff --git a/scripts/xos_reqs_lite.txt b/scripts/xos_dev_reqs.txt
similarity index 94%
rename from scripts/xos_reqs_lite.txt
rename to scripts/xos_dev_reqs.txt
index 2d453d5..1680477 100644
--- a/scripts/xos_reqs_lite.txt
+++ b/scripts/xos_dev_reqs.txt
@@ -1,6 +1,7 @@
 Jinja2==2.10
 Pattern==2.6
 PyYAML==3.12
+Twisted==16.6.0
 astunparse==1.5.0
 colorama==0.3.9
 grpcio-tools==1.12.0