OSM IM consumed, changes in devops-related files: Makefile, Dockerfile, setup, new... 69/2169/8
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 14 Sep 2017 14:17:39 +0000 (16:17 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 15 Sep 2017 12:33:10 +0000 (14:33 +0200)
Change-Id: Iff96eaf1a718a205b1e53c84d3f555bef8818716
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
Dockerfile
MANIFEST.in
Makefile
devops-stages/stage-build.sh
setup.py
stdeb.cfg
tox.ini [new file with mode: 0644]

index 254027c..f901e9e 100644 (file)
@@ -1,10 +1,17 @@
 FROM ubuntu:16.04
 
 RUN  apt-get update && \
-  DEBIAN_FRONTEND=noninteractive apt-get -y install git build-essential apt-utils && \
-  DEBIAN_FRONTEND=noninteractive apt-get -y install python python-dev python-all python-stdeb fakeroot pypi2deb && \
-  DEBIAN_FRONTEND=noninteractive apt-get -y install python-pip libmysqlclient-dev libssl-dev libffi-dev && \
-  DEBIAN_FRONTEND=noninteractive pip install --upgrade pip && \
-  DEBIAN_FRONTEND=noninteractive pip install --upgrade setuptools && \
-  DEBIAN_FRONTEND=noninteractive apt-get -y install python-argcomplete python-boto python-bottle python-jsonschema python-logutils python-cinderclient python-glanceclient python-keystoneclient python-neutronclient python-novaclient python-openstackclient python-mysqldb
+  DEBIAN_FRONTEND=noninteractive apt-get -y install git make python python-pip debhelper && \
+  DEBIAN_FRONTEND=noninteractive apt-get -y install wget tox && \
+  DEBIAN_FRONTEND=noninteractive pip install -U pip && \
+  DEBIAN_FRONTEND=noninteractive pip install -U setuptools setuptools-version-command stdeb && \
+  DEBIAN_FRONTEND=noninteractive pip install -U pyang pyangbind && \
+  DEBIAN_FRONTEND=noninteractive apt-get -y install python-yaml python-netaddr python-boto && \
+  DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common && \
+  DEBIAN_FRONTEND=noninteractive add-apt-repository -y cloud-archive:ocata && \
+  DEBIAN_FRONTEND=noninteractive apt-get update && \
+  DEBIAN_FRONTEND=noninteractive apt-get -y install python-novaclient python-keystoneclient python-glanceclient python-cinderclient python-neutronclient && \
+  DEBIAN_FRONTEND=noninteractive pip install -U progressbar pyvmomi pyvcloud && \
+  DEBIAN_FRONTEND=noninteractive apt-get -y install python-argcomplete python-bottle python-cffi python-packaging python-paramiko python-pkgconfig libmysqlclient-dev libssl-dev libffi-dev python-mysqldb && \
+  DEBIAN_FRONTEND=noninteractive apt-get -y install python-logutils python-openstackclient python-openstacksdk
 
index 48790d4..483b709 100644 (file)
@@ -1,7 +1,6 @@
 #include MANIFEST.in
 #include requirements.txt
 include README.rst
-include RO_VERSION
 include openmano
 include openmanod
 recursive-include osm_ro *
index 41b265a..8330b74 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,29 @@
+.PHONY: all test clean
+
 SHELL := /bin/bash
-all: package install
 
-clean_deb:
-       rm -rf .build
+BRANCH ?= master
+
+all: lib-openvim osm-im
+       $(MAKE) clean_build build
+       $(MAKE) clean_build package
+
+clean: clean_build
+       rm -rf .build openvim IM
 
-clean:
+clean_build:
        rm -rf build
        find osm_ro -name '*.pyc' -delete
        find osm_ro -name '*.pyo' -delete
+
 prepare:
-       pip install --user --upgrade setuptools
+#      ip install --user --upgrade setuptools
        mkdir -p build/
-       VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
-       VER2=$(shell git describe | cut -d- -f2); \
-       VER3=$(shell git describe | cut -d- -f3); \
-       echo "$$VER1.dev$$VER2+$$VER3" > build/RO_VERSION
+#      VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
+#      VER2=$(shell git describe | cut -d- -f2); \
+#      VER3=$(shell git describe | cut -d- -f3); \
+#      echo "$$VER1.dev$$VER2+$$VER3" > build/RO_VERSION
+       cp tox.ini build/
        cp MANIFEST.in build/
        cp requirements.txt build/
        cp README.rst build/
@@ -36,14 +45,25 @@ connectors: prepare
        python build/osm_ro/openmanolinkervimconn.py
        rm -f build/osm_ro/openmanolinkervimconn.py
 
-build: clean connectors prepare
+build: connectors prepare
        python -m py_compile build/osm_ro/*.py
+#      cd build && tox -e flake8
+
+lib-openvim:
+       $(shell git clone https://osm.etsi.org/gerrit/osm/openvim)
+       LIB_BRANCH=$(shell git -C openvim branch -a|grep -oP 'remotes/origin/\K$(BRANCH)'); \
+       [ -z "$$LIB_BRANCH" ] && LIB_BRANCH='master'; \
+       echo "BRANCH: $(BRANCH)"; \
+       echo "LIB_OPENVIM_BRANCH: $$LIB_BRANCH"; \
+       git -C openvim checkout $$LIB_BRANCH
+       make -C openvim clean lite
 
-pip: prepare
-       cd build && ./setup.py sdist
+osm-im:
+       $(shell git clone https://osm.etsi.org/gerrit/osm/IM)
+       make -C IM clean all
 
-package: clean clean_deb prepare
-       #apt-get install -y python-stdeb
+package: prepare
+#      apt-get install -y python-stdeb
        cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True
        cd build && cp osm_ro/scripts/python-osm-ro.postinst deb_dist/osm-ro*/debian/
        cd build/deb_dist/osm-ro* && dpkg-buildpackage -rfakeroot -uc -us
@@ -54,17 +74,25 @@ snap:
        echo "Nothing to be done yet"
 
 install:
-       DEBIAN_FRONTEND=noninteractive apt-get update && \
-       DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip && \
-       pip install --upgrade pip && \
-       dpkg -i .build/*.deb
+       dpkg -i IM/deb_dist/python-osm-im*.deb
+       dpkg -i openvim/.build/python-lib-osm-openvim*.deb
+       dpkg -i .build/python-osm-ro*.deb
+       cd .. && \
+       OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` || FATAL "lib-osm-openvim was not properly installed" && \
+       OSMRO_PATH=`python -c 'import osm_ro; print osm_ro.__path__[0]'` || FATAL "osm-ro was not properly installed" && \
+       USER=root DEBIAN_FRONTEND=noninteractive $$OSMRO_PATH/database_utils/install-db-server.sh --updatedb || FATAL "osm-ro db installation failed" && \
+       USER=root DEBIAN_FRONTEND=noninteractive $$OSMLIBOVIM_PATH/database_utils/install-db-server.sh -u mano -p manopw -d mano_vim_db --updatedb || FATAL "lib-osm-openvim db installation failed"
+       service osm-ro restart
 
 develop: prepare
-       #pip install -r requirements.txt
+#      pip install -r requirements.txt
        cd build && ./setup.py develop
 
 test:
-       ./test/basictest.sh --force --insert-bashrc --install-openvim --init-openvim
+       . ./test/basictest.sh -f --insert-bashrc --install-openvim --init-openvim
+       . ./test/basictest.sh -f reset add-openvim
+       ./test/test_RO.py deploy -n mgmt -t osm -i cirros034 -d local-openvim --timeout=30 --failfast
+       ./test/test_RO.py vim  -t osm  -d local-openvim --timeout=30 --failfast
 
 build-docker-from-source:
        docker build -t osm/openmano -f docker/Dockerfile-local .
index 8505499..4c35ccd 100755 (executable)
@@ -1,2 +1,4 @@
 #!/bin/sh
-make package
+make clean all BRANCH=v2.0
+#make install && \
+#make test
index 303a652..70cefd4 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,6 @@ from os import system
 #import glob
 
 _name = 'osm_ro'
-_version = open('RO_VERSION').read().strip()
 _description = 'OSM Resource Orchestrator'
 _author = 'ETSI OSM'
 _author_email = 'alfonso.tiernosepulveda@telefonica.com'
@@ -18,7 +17,8 @@ _url = 'https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary'
 _requirements = [
     "PyYAML",
     "bottle",
-    "MySQL-python",
+    #"mysqlclient",
+    #"MySQLdb",
     "jsonschema",
     "paramiko",
     "argcomplete",
@@ -30,15 +30,17 @@ _requirements = [
     "python-glanceclient",
     "python-neutronclient",
     "python-cinderclient",
-    "pyvcloud",
-    "progressbar",
+    #"pyvcloud",
+    #"progressbar",
     "prettytable",
-    "pyvmomi",
+    #"pyvmomi",
     "boto",
+    #"lib_osm_openvim",
+    #"osm_im",
 ]
 
 setup(name=_name,
-      version = _version,
+      version_command=('git describe', 'pep440-git'),
       description = _description,
       long_description = open('README.rst').read(),
       author = _author,
@@ -60,5 +62,7 @@ setup(name=_name,
       scripts=['openmanod', 'openmano', 'osm_ro/scripts/service-openmano', 'osm_ro/scripts/openmano-report',],
       install_requires=_requirements,
       include_package_data=True,
+      setup_requires=['setuptools-version-command'],
+      #test_suite='nose.collector',
       )
 
index a0c20ec..8a4507e 100644 (file)
--- a/stdeb.cfg
+++ b/stdeb.cfg
@@ -2,5 +2,5 @@
 Suite: xenial
 XS-Python-Version: >= 2.7
 Maintainer: Gerardo Garcia <gerardo.garciadeblas@telefonica.com>
-Depends: python-pip, libmysqlclient-dev, libssl-dev, libffi-dev, python-argcomplete, python-boto, python-bottle, python-jsonschema, python-logutils, python-cinderclient, python-glanceclient, python-keystoneclient, python-neutronclient, python-novaclient, python-openstackclient, python-mysqldb
+Depends: python-pip, libmysqlclient-dev, libssl-dev, libffi-dev, python-argcomplete, python-boto, python-bottle, python-jsonschema, python-logutils, python-cinderclient, python-glanceclient, python-keystoneclient, python-neutronclient, python-novaclient, python-openstackclient, python-mysqldb, python-lib-osm-openvim
 
diff --git a/tox.ini b/tox.ini
new file mode 100644 (file)
index 0000000..025f4a0
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,22 @@
+[tox]
+#envlist = py27,py3
+envlist = py27
+toxworkdir={homedir}/.tox
+
+[testenv]
+deps=nose
+     mock
+commands=nosetests
+
+[testenv:flake8]
+basepython = python
+deps = flake8
+commands =
+    flake8 setup.py
+
+[testenv:build]
+basepython = python
+deps = stdeb
+       setuptools-version-command
+commands = python setup.py --command-packages=stdeb.command bdist_deb
+