From: xinhuili Date: Wed, 13 Sep 2017 00:35:08 +0000 (+0000) Subject: Merge "Add setup.py for multivimbroker" X-Git-Tag: v1.0.0~22 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=multicloud%2Fframework.git;a=commitdiff_plain;h=2e18b448e0f99ba90d22be929c6bfa2cd4e8adb1;hp=52b18d9e11cb9bc4055b73f6845b933a6f1ba690 Merge "Add setup.py for multivimbroker" --- diff --git a/.gitignore b/.gitignore index 56ab27e..495cfc8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,9 @@ target/ logs/*.log *.pyc + +# Test related files +multivimbroker/.coverage +multivimbroker/.tox/ +multivimbroker/logs/*.log +multivimbroker/test-reports/ diff --git a/doc/user/keystoneproxy/multivimproxy.txt b/doc/user/keystoneproxy/multivimproxy.txt new file mode 100644 index 0000000..ecfabb9 --- /dev/null +++ b/doc/user/keystoneproxy/multivimproxy.txt @@ -0,0 +1,184 @@ +prepare environment: +system: centos7-64bit, 8GB RAM, 4 CPU + +docker images: +docker pull onapmulticloud/common-services-msb +docker pull onapmulticloud/common-services-extsys +docker pull onapmulticloud/common-services-drivermanager +docker pull onapmulticloud/gso-service-gateway +docker pull onapmulticloud/gso-service-manager +docker pull onapmulticloud/gso-gui-portal + +# login onap and pull those two images +docker login -u docker -p docker nexus3.onap.org:10001 +docker pull nexus3.onap.org:10001/onapmulticloud/multivim-broker:r1 +docker pull nexus3.onap.org:10001/onapmulticloud/multivim-vio-driver:r1 + + +run msb docker server + +docker run -t --name i-msb -p 80:80 onapmulticloud/common-services-msb + +Run other docker server: + Assign the host ip to MSB_ADDR. If server cannot connect to msb server, please check iptables rule on host may block this connection. + +docker run -t -e MSB_ADDR=$HOST_IP:80 onapmulticloud/gso-service-gateway +docker run -t -e MSB_ADDR=$HOST_IP:80 onapmulticloud/common-services-extsys +docker run -t -e MSB_ADDR=$HOST_IP:80 onapmulticloud/common-services-drivermanager +docker run -t -e MSB_ADDR=$HOST_IP:80 onapmulticloud/gso-gui-portal +docker run -t -e MSB_ADDR=$HOST_IP:80 onapmulticloud/gso-service-manage +docker run -t --name multivim-driver-vio-test -e MSB_ADDR=$HOST_IP:80 nexus3.onap.org:10001/onapmulticloud/multivim-vio-driver:r1 +docker run -t --name multivim-broker-test -e MSB_ADDR= $HOST_IP:80 nexus3.onap.org:10001/onapmulticloud/multivim-broker:r1 + + +Login Dashboard + +Access: http://$HOST_IP/openoui/microservices/index.html + +Register your openstack enviroment in extsys server +Choose 'extsys' —> 'vim Managent' —> 'post vim' + + +Request body Example: +{ + "id": "", + "name": "vmware-vio", + "vendor": "vmware", + "version": "4.0", + "description": "test", + "type": "vmware", # It must be ‘vmware’ so will use multvim-proxy service to execute requests + "createTime": "", + "category": "", + "url": "https://10.154.2.225:5000/v3", # keystone auth_url + "userName": "admin", + "password": "vmware", + "domain": "default", + "tenant": "admin" +} + +response example: + +Response: +{ + "name": "vmware-vio", + "vendor": "vmware", + "version": "4.0", + "description": "test", + "type": "vmware", + "createTime": "2017-08-14 21:28:05", + "vimId": "a5b17aaa-a142-4a50-b425-f1e6eab7136d", # vimid + "userName": "admin", + "password": "vmware", + "domain": "default", + "tenant": "admin" +} + + + +2 Testing Examples + +2.1 Get auth token + +you need to input in url path. + +curl -X POST -d @test.json -H 'Content-Type:application/json' http://$HOST_IP/api/multivim/v1//identity/auth/tokens + +test.json content example: + +{ + "auth": + { + "scope": {"project": {"id": “”}}, + "identity": + { + "password": {"user": {"domain": {"name": “”}, "password": “”, "name": “”}}, "methods": ["password"] + } + } +} + + +Response: +There are a large amounts of data including service endpoint, user information, etc. For our testing We take nova and identity service endpoint address and auth token which is in response header named “X-Subject-Token”. + +Identity endpoint: + http://$HOST_IP/api/multivim-vio/v1//identity + +Nova endpoint: + http://$HOST_IP/api/multivim-vio/v1//compute/ + + +2.2 List projects + +Use identity’s endpoint: http://$HOST_IP/api/multivim-vio/v1//identity/ + +curl -X GET -H 'X-Auth-Token:' http://$HOST_IP/api/multivim-vio/v1//identity/projects + + +2.3 Get os Hypervisor + +Use nova’s endpoint: http://$HOST_IP/api/multivim-vio/v1//nova/ + + +curl -X GET -H 'X-Auth-Token:' http://$HOST_IP/api/multivim-vio/v1//nova//os-hypervisors/detail + + +2.4 List instance of user’s project + +curl -X GET -H 'X-Auth-Token:' http://$HOST_IP/api/multivim-vio/v1//nova//servers + + +2.5 Show instance detail + +you need to input in url path. + +curl -X GET -H 'X-Auth-Token:' http://$HOST_IP/api/multivim-vio/v1/vimid/nova/tenantid/servers/ + + +2.6 Shutdown instance + +you need to input in url path + +curl -X POST -d '{"os-stop":null}' -H 'X-Auth-Token:' -H 'Content-Type:application/json' http://$HOST_IP/api/multivim-vio/v1//nova//servers//action + + +2.7 Start instance + +you need to input in url path + +curl -X POST -d '{"os-start":null}' -H 'X-Auth-Token:' -H 'Content-Type:application/json' http://$HOST_IP/api/multivim-vio/v1//nova//servers//action + + +2.8 Suspend instance + +you need to input in url path + +curl -X POST -d '{"suspend":null}' -H 'X-Auth-Token:' -H 'Content-Type:application/json' http://$HOST_IP/api/multivim-vio/v1//nova//servers//action + + +2.9 Resume instance + +you need to input in url path + +curl -X POST -d '{"resume":null}' -H 'X-Auth-Token:' -H 'Content-Type:application/json' http://$HOST_IP/api/multivim-vio/v1//nova//servers//action + + +2.10 Pause instance + +you need to input in url path + +curl -X POST -d '{"pause":null}' -H 'X-Auth-Token:' -H 'Content-Type:application/json' http://$HOST_IP/api/multivim-vio/v1//nova//servers//action + + + +2.11 Unpasue instance + +you need to input in url path + +curl -X POST -d '{"unpause":null}' -H 'X-Auth-Token: -H 'Content-Type:application/json' http://$HOST_IP/api/multivim-vio/v1//nova//servers//action + + +2.12 Reboot instance + +you need to input in url path + +curl -X POST -d '{"reboot":{"type":"HARD"}}' -H 'X-Auth-Token: -H 'Content-Type:application/json' http://$HOST_IP/api/multivim-vio/v1//nova//servers//action diff --git a/doc/user/keystoneproxy/test.json b/doc/user/keystoneproxy/test.json new file mode 100644 index 0000000..cd19378 --- /dev/null +++ b/doc/user/keystoneproxy/test.json @@ -0,0 +1,10 @@ +{ + "auth": + { + "scope": {"project": {"id": "622b0f38ec9e4ce1ab5c3aad7765d045"}}, + "identity": + { + "password": {"user": {"domain": {"name": "Default"}, "password": "vmware", "name": "admin"}}, "methods": ["password"] + } + } +} diff --git a/multivimbroker/assembly.xml b/multivimbroker/assembly.xml index 58117d8..2fa7ebd 100644 --- a/multivimbroker/assembly.xml +++ b/multivimbroker/assembly.xml @@ -37,6 +37,14 @@ *.txt + + docker + /docker + + *.sh + Dockerfile + + . / diff --git a/multivimbroker/docker/Dockerfile b/multivimbroker/docker/Dockerfile new file mode 100644 index 0000000..4cd71c0 --- /dev/null +++ b/multivimbroker/docker/Dockerfile @@ -0,0 +1,23 @@ +FROM python:2 + +ENV MSB_ADDR "127.0.0.1" +ENV MSB_PORT "80" +ENV AAI_ADDR "aai.api.simpledemo.openecomp.org" +ENV AAI_PORT "8443" +ENV AAI_SCHEMA_VERSION "v11" +ENV AAI_USERNAME "AAI" +ENV AAI_PASSWORD "AAI" + +EXPOSE 9001 + +# COPY ./ /opt/multivimbroker/ +RUN apt-get update && \ + apt-get install -y unzip && \ + cd /opt/ && \ + wget -O multicloud-framework.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.framework&a=multicloud-framework&e=zip&v=LATEST" && \ + unzip -q -o -B multicloud-framework.zip && \ + rm -f multicloud-framework.zip && \ + pip install -r /opt/multivimbroker/requirements.txt + +WORKDIR /opt/multivimbroker +CMD /bin/sh -c /opt/multivimbroker/run.sh \ No newline at end of file diff --git a/multivimbroker/docker/build_image.sh b/multivimbroker/docker/build_image.sh new file mode 100644 index 0000000..73a8db6 --- /dev/null +++ b/multivimbroker/docker/build_image.sh @@ -0,0 +1,32 @@ +#!/bin/bash +DIRNAME=`dirname $0` +DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd` +echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +cd ${DOCKER_BUILD_DIR} + +BUILD_ARGS="--no-cache" +ORG="onap" +VERSION="1.0.0-SNAPSHOT" +PROJECT="multicloud" +IMAGE="framework" +DOCKER_REPOSITORY="nexus3.onap.org:10003" +IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}" + +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 build_image { + docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest . +} + +function push_image { + docker push ${IMAGE_NAME}:${VERSION} + docker push ${IMAGE_NAME}:latest +} + +build_image +push_image \ No newline at end of file diff --git a/multivimbroker/multivimbroker/forwarder/base.py b/multivimbroker/multivimbroker/forwarder/base.py index c96461a..7477842 100644 --- a/multivimbroker/multivimbroker/forwarder/base.py +++ b/multivimbroker/multivimbroker/forwarder/base.py @@ -53,7 +53,6 @@ class BaseHandler(object): try: url = getMultivimDriver(vimid, full_path=full_path) - except exceptions.VimBrokerException as e: logging.exception("vimbroker exception: %s" % e) return HttpResponse(e.content, status=e.status_code) diff --git a/multivimbroker/multivimbroker/forwarder/urls.py b/multivimbroker/multivimbroker/forwarder/urls.py index 2caa219..5b3fc41 100644 --- a/multivimbroker/multivimbroker/forwarder/urls.py +++ b/multivimbroker/multivimbroker/forwarder/urls.py @@ -15,15 +15,26 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns +from multivimbroker.forwarder.views import Extension from multivimbroker.forwarder.views import Forward from multivimbroker.forwarder.views import Identity +from multivimbroker.forwarder.views import Registry +from multivimbroker.forwarder.views import VIMTypes urlpatterns = [ + url(r'^api/multicloud/v0/vim_types$', + VIMTypes.as_view()), url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)/identity/v3$', Identity.as_view()), - url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)/\ - identity/v3/auth/tokens$', Identity.as_view()), + url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)/identity/v3' + r'/auth/tokens$', Identity.as_view()), + url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)/registry$', + Registry.as_view()), + url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)$', + Registry.as_view()), + url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)/extensions$', + Extension.as_view()), url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)', Forward.as_view()), ] diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py index ed67977..623aaa8 100644 --- a/multivimbroker/multivimbroker/forwarder/views.py +++ b/multivimbroker/multivimbroker/forwarder/views.py @@ -13,6 +13,8 @@ # limitations under the License. from rest_framework.views import APIView +from rest_framework.views import Response +from rest_framework.views import status from multivimbroker.forwarder.base import BaseHandler # @@ -39,7 +41,7 @@ class BaseServer(BaseHandler, APIView): raise NotImplementedError() -# vio proxy handler +# proxy handler class Identity(BaseServer): def get(self, request, vimid): @@ -51,6 +53,59 @@ class Identity(BaseServer): return self.send(vimid, request.get_full_path(), request.body, "POST") +class Registry(BaseServer): + + def post(self, request, vimid): + + return self.send(vimid, request.get_full_path(), request.body, "POST") + + def delete(self, request, vimid): + + return self.send(vimid, request.get_full_path(), request.body, + "DELETE") + + +class Extension(BaseServer): + + def get(self, request, vimid): + + return self.send(vimid, request.get_full_path(), request.body, "GET") + + +class VIMTypes(BaseServer): + + def get(self, request): + # Fix here unless we have plugin registry + data = { + "vim_types": [ + { + "vim_type": "openstack", + "versions": [ + { + "version": "mitaka", + "extra_info_hint": "" + }, + { + "version": "ocata", + "extra_info_hint": "" + } + ] + }, + { + "vim_type": "vmware", + "versions": [ + { + "version": "4.0", + "extra_info_hint": "" + } + ] + } + ] + } + + return Response(data=data, status=status.HTTP_200_OK) + + # forward handler class Forward(BaseServer): diff --git a/multivimbroker/multivimbroker/pub/config/config.py b/multivimbroker/multivimbroker/pub/config/config.py index 71b4d2a..72932dd 100644 --- a/multivimbroker/multivimbroker/pub/config/config.py +++ b/multivimbroker/multivimbroker/pub/config/config.py @@ -40,8 +40,8 @@ REDIS_PASSWD = '' REG_TO_MSB_WHEN_START = False REG_TO_MSB_REG_URL = "/api/microservices/v1/services" REG_TO_MSB_REG_PARAM = { - "serviceName": "multivim", - "version": "v1", + "serviceName": "multicloud", + "version": "v0", "url": "/api/multicloud/v0", "protocol": "REST", "visualRange": "1", diff --git a/multivimbroker/multivimbroker/pub/utils/syscomm.py b/multivimbroker/multivimbroker/pub/utils/syscomm.py index 0d0419a..cdc6480 100644 --- a/multivimbroker/multivimbroker/pub/utils/syscomm.py +++ b/multivimbroker/multivimbroker/pub/utils/syscomm.py @@ -37,25 +37,21 @@ def findMultivimDriver(vim=None): if vim and vim["type"] == "openstack": if vim["version"] == "kilo": - multivimdriver = "multivim-kilo" + multivimdriver = "multicloud-kilo" elif vim["version"] == "newton": - multivimdriver = "multivim-newton" + multivimdriver = "multicloud-newton" else: # if vim type is openstack, use latest "newton" version as default - multivimdriver = "multivim-newton" + multivimdriver = "multicloud-newton" elif vim and vim["type"] == "vmware": - multivimdriver = "multivim-vio" + multivimdriver = "multicloud-vio" else: raise exceptions.NotFound("Not support VIM type") return multivimdriver def getMultivimDriver(vimid, full_path=""): - - multivim = "multivim" + multcloud = "multicloud" vim = get_vim_by_id(vimid) - if vim["type"] and vim["version"]: - pass - - multivimdriver = findMultivimDriver(vim=vim) - return re.sub(multivim, multivimdriver, full_path) + multclouddriver = findMultivimDriver(vim=vim) + return re.sub(multcloud, multclouddriver, full_path) diff --git a/multivimbroker/multivimbroker/settings-cover.py b/multivimbroker/multivimbroker/settings-cover.py new file mode 100644 index 0000000..51b73e8 --- /dev/null +++ b/multivimbroker/multivimbroker/settings-cover.py @@ -0,0 +1,20 @@ +# 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. + +from multivimbroker.settings import * # noqa +from multivimbroker.settings import INSTALLED_APPS + +INSTALLED_APPS.append('django_nose') + +TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' + +NOSE_ARGS = [ + '--with-coverage', + '--cover-package=multivimbroker', +] diff --git a/multivimbroker/multivimbroker/swagger/multivim.identity.swagger.json b/multivimbroker/multivimbroker/swagger/multivim.identity.swagger.json index 923924e..a81b431 100644 --- a/multivimbroker/multivimbroker/swagger/multivim.identity.swagger.json +++ b/multivimbroker/multivimbroker/swagger/multivim.identity.swagger.json @@ -4,7 +4,7 @@ "version": "1.0.0", "title": "MultiVIM Service rest API" }, - "basePath": "/openoapi/multivim/v1/", + "basePath": "/api/multicloud/v0/", "tags": [ { "name": "MultiVIM services" diff --git a/multivimbroker/multivimbroker/tests/__init__.py b/multivimbroker/multivimbroker/tests/__init__.py new file mode 100644 index 0000000..802f3fb --- /dev/null +++ b/multivimbroker/multivimbroker/tests/__init__.py @@ -0,0 +1,10 @@ +# Copyright (c) 2017 Wind River Systems, Inc. +# +# 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. diff --git a/multivimbroker/multivimbroker/tests/test_urls.py b/multivimbroker/multivimbroker/tests/test_urls.py new file mode 100644 index 0000000..71241f8 --- /dev/null +++ b/multivimbroker/multivimbroker/tests/test_urls.py @@ -0,0 +1,26 @@ +# 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. + +import json +import mock +import unittest + +from multivimbroker.pub.config import config +from multivimbroker import urls + + +class TestUrls(unittest.TestCase): + + def test_request_msb(self): + with mock.patch("multivimbroker.pub.utils.restcall." + "req_by_msb") as req_by_msb: + urls.req_msb(True) + req_by_msb.assert_called_once_with( + config.REG_TO_MSB_REG_URL, "POST", + json.JSONEncoder().encode(config.REG_TO_MSB_REG_PARAM)) diff --git a/multivimbroker/multivimbroker/urls.py b/multivimbroker/multivimbroker/urls.py index c8e0f42..7619e5a 100644 --- a/multivimbroker/multivimbroker/urls.py +++ b/multivimbroker/multivimbroker/urls.py @@ -10,8 +10,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. from django.conf.urls import include, url -from multivimbroker.pub.config.config \ - import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM +import json + +from multivimbroker.pub.config import config + urlpatterns = [ url(r'^', include('multivimbroker.swagger.urls')), @@ -19,9 +21,13 @@ urlpatterns = [ url(r'^', include('multivimbroker.forwarder.urls')), ] -# regist to MSB when startup -if REG_TO_MSB_WHEN_START: - import json - from multivimbroker.pub.utils.restcall import req_by_msb - req_by_msb(REG_TO_MSB_REG_URL, "POST", - json.JSONEncoder().encode(REG_TO_MSB_REG_PARAM)) + +def req_msb(request_when_start): + # regist to MSB when startup + if request_when_start: + from multivimbroker.pub.utils.restcall import req_by_msb + req_by_msb(config.REG_TO_MSB_REG_URL, "POST", + json.JSONEncoder().encode(config.REG_TO_MSB_REG_PARAM)) + + +req_msb(config.REG_TO_MSB_WHEN_START) diff --git a/multivimbroker/pom.xml b/multivimbroker/pom.xml index 57a49fc..cd80d6c 100644 --- a/multivimbroker/pom.xml +++ b/multivimbroker/pom.xml @@ -11,7 +11,9 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> - + org.onap.oparent oparent @@ -23,28 +25,28 @@ multicloud-framework 1.0.0-SNAPSHOT pom - multicloud/framework + multicloud-framework multivim broker - - - maven-assembly-plugin - - false - - assembly.xml - - - - - make-assembly - package - - single - - - - - + + + maven-assembly-plugin + + false + + assembly.xml + + + + + make-assembly + package + + single + + + + + - + \ No newline at end of file diff --git a/multivimbroker/requirements.txt b/multivimbroker/requirements.txt index 6d58957..caf8687 100644 --- a/multivimbroker/requirements.txt +++ b/multivimbroker/requirements.txt @@ -18,6 +18,7 @@ python-glanceclient==2.5.0 python-neutronclient==6.0.0 # for unit test +django-nose>=1.4.0 coverage==4.2 mock==2.0.0 unittest_xml_reporting==1.12.0 diff --git a/multivimbroker/run.sh b/multivimbroker/run.sh index 3fb6e80..48b8476 100755 --- a/multivimbroker/run.sh +++ b/multivimbroker/run.sh @@ -1,13 +1,17 @@ #!/bin/bash -# Copyright (c) 2017 Wind River Systems, Inc. -# -# 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. - -nohup python manage.py runserver 127.0.0.1:9001 > /dev/null & + +sed -i "s/MSB_SERVICE_IP =.*/MSB_SERVICE_IP = \"${MSB_ADDR}\"/g" multivimbroker/pub/config/config.py +sed -i "s/MSB_SERVICE_PORT =.*/MSB_SERVICE_PORT = \"${MSB_PORT}\"/g" multivimbroker/pub/config/config.py +sed -i "s/AAI_ADDR =.*/AAI_ADDR = \"${AAI_ADDR}\"/g" multivimbroker/pub/config/config.py +sed -i "s/AAI_PORT =.*/AAI_PORT = \"${AAI_PORT}\"/g" multivimbroker/pub/config/config.py +sed -i "s/AAI_SCHEMA_VERSION =.*/AAI_SCHEMA_VERSION = \"${AAI_SCHEMA_VERSION}\"/g" multivimbroker/pub/config/config.py +sed -i "s/AAI_USERNAME =.*/AAI_USERNAME = \"${AAI_USERNAME}\"/g" multivimbroker/pub/config/config.py +sed -i "s/AAI_PASSWORD =.*/AAI_PASSWORD = \"${AAI_PASSWORD}\"/g" multivimbroker/pub/config/config.py + +nohup python manage.py runserver 0.0.0.0:9001 2>&1 & + +while [ ! -f logs/runtime_multivimbroker.log ]; do + sleep 1 +done + +tail -F logs/runtime_multivimbroker.log diff --git a/multivimbroker/tox.ini b/multivimbroker/tox.ini index 88d43d9..4db044a 100644 --- a/multivimbroker/tox.ini +++ b/multivimbroker/tox.ini @@ -7,8 +7,21 @@ downloadcache = ~/cache/pip [testenv] deps = -r{toxinidir}/requirements.txt -commands = coverage run --branch manage.py test multivimbroker +commands = + /usr/bin/find . -type f -name "*.py[c|o]" -delete + python manage.py test multivimbroker [testenv:pep8] deps=flake8 commands=flake8 + +[testenv:py27] +commands = + {[testenv]commands} + +[testenv:cover] +setenv= + DJANGO_SETTINGS_MODULE = multivimbroker.settings-cover +commands = + coverage erase + {[testenv]commands} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c88ba53 --- /dev/null +++ b/pom.xml @@ -0,0 +1,30 @@ + + + + + org.onap.oparent + oparent + 1.0.0-SNAPSHOT + + 4.0.0 + org.onap.multicloud.framework + multicloud-framework + 1.0.0-SNAPSHOT + pom + multicloud-framework + multivim broker + diff --git a/version.properties b/version.properties new file mode 100644 index 0000000..639c1f7 --- /dev/null +++ b/version.properties @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright (c) 2017 VMware, Inc. +# +# 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. + +# Versioning variables +# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... ) +# because they are used in Jenkins, whose plug-in doesn't support + +major=1 +minor=1 +patch=0 + +base_version=${major}.${minor}.${patch} + +# Release must be completed with git revision # in Jenkins +release_version=${base_version} +snapshot_version=${base_version}-SNAPSHOT