From: tierno Date: Thu, 20 Apr 2017 16:56:07 +0000 (+0200) Subject: Merge branch 'packaging' X-Git-Tag: v2.0.0~22 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F07%2F1607%2F3;hp=ae3fa6137b603b4d6b44e8c7897427a7e535b2a7;p=osm%2FRO.git Merge branch 'packaging' Change-Id: I58a236852dab90f025d8300bbbf508d368d799c0 Signed-off-by: tierno --- diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..48790d46 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,8 @@ +#include MANIFEST.in +#include requirements.txt +include README.rst +include RO_VERSION +include openmano +include openmanod +recursive-include osm_ro * + diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..b5f6ac59 --- /dev/null +++ b/Makefile @@ -0,0 +1,73 @@ +SHELL := /bin/bash +all: package install + +prepare: + pip install 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 + cp MANIFEST.in build/ + cp requirements.txt build/ + cp README.rst build/ + cp setup.py build/ + cp stdeb.cfg build/ + cp -r osm_ro build/ + cp openmano build/ + cp openmanod build/ + cp -r vnfs build/osm_ro + cp -r scenarios build/osm_ro + cp -r instance-scenarios build/osm_ro + cp -r scripts build/osm_ro + cp -r database_utils build/osm_ro + +connectors: prepare + # python-novaclient is required for that + rm -f build/osm_ro/openmanolinkervimconn.py + cd build/osm_ro; for i in `ls vimconn_*.py |sed "s/\.py//"` ; do echo "import $$i" >> openmanolinkervimconn.py; done + python build/osm_ro/openmanolinkervimconn.py + rm -f build/osm_ro/openmanolinkervimconn.py + +build: connectors prepare + python -m py_compile build/osm_ro/*.py + +pip: prepare + cd build && ./setup.py sdist + +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 + +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_dist/*.deb + +develop: prepare + #pip install -r requirements.txt + cd build && ./setup.py develop + +test: + ./test/basictest.sh --force --insert-bashrc --install-openvim --init-openvim + +build-docker-from-source: + docker build -t osm/openmano -f docker/Dockerfile-local . + +run-docker: + docker-compose -f docker/openmano-compose.yml up + +stop-docker: + docker-compose -f docker/openmano-compose.yml down + +clean: + rm -rf build + find osm_ro -name '*.pyc' -delete + find osm_ro -name '*.pyo' -delete + diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..3a2be888 --- /dev/null +++ b/README.rst @@ -0,0 +1,8 @@ +=========== +osm-ro +=========== + +osm-ro is the Resource Orchestrator for OSM, dealing with resource operations +against different VIMs such as Openstack, VMware's vCloud Director, openvim +and AWS. + diff --git a/console_proxy_thread.py b/console_proxy_thread.py deleted file mode 100644 index 460a4aaa..00000000 --- a/console_proxy_thread.py +++ /dev/null @@ -1,188 +0,0 @@ -# -*- coding: utf-8 -*- - -## -# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U. -# This file is part of openmano -# All Rights Reserved. -# -# 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. -# -# For those usages not covered by the Apache License, Version 2.0 please -# contact with: nfvlabs@tid.es -## - -''' -Implement like a proxy for TCP/IP in a separated thread. -It creates two sockets to bypass the TCP/IP packets among the fix console -server specified at class construction (console_host, console_port) -and a client that connect against the (host, port) specified also at construction - - --------------------- ------------------------------- - | OPENMANO | | VIM | -client 1 ----> | ConsoleProxyThread | ------> | Console server | -client 2 ----> | (host, port) | ------> |(console_host, console_server)| - ... -------------------- ------------------------------ -''' -__author__="Alfonso Tierno" -__date__ ="$19-nov-2015 09:07:15$" - -import socket -import select -import threading -import logging - - -class ConsoleProxyException(Exception): - '''raise when an exception has found''' -class ConsoleProxyExceptionPortUsed(ConsoleProxyException): - '''raise when the port is used''' - -class ConsoleProxyThread(threading.Thread): - buffer_size = 4096 - check_finish = 1 #frequency to check if requested to end in seconds - - def __init__(self, host, port, console_host, console_port, log_level=None): - try: - threading.Thread.__init__(self) - self.console_host = console_host - self.console_port = console_port - self.host = host - self.port = port - self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self.server.bind((host, port)) - self.server.listen(200) - #TODO timeout in a lock section can be used to autoterminate the thread - #when inactivity and timeout