From: garciadeblas Date: Thu, 6 Apr 2017 01:12:51 +0000 (+0200) Subject: Restructuring code in osm_ro folder, and setup based on MANIFEST X-Git-Tag: v2.0.0~22^2~8 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=commitdiff_plain;h=2c290ca4088492a3c32bb6ab218d0004da68f6ea Restructuring code in osm_ro folder, and setup based on MANIFEST Also updated Makefile and service-openmano.sh Change-Id: I60cf49013315efafd73de377452e38faf2f2f1e0 Signed-off-by: garciadeblas --- diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..154ea275 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,9 @@ +#include MANIFEST.in +#include requirements.txt +include README.rst +include openmano +include openmanod.py +include openmanod.cfg +include osm-ro.service +recursive-include osm_ro * + diff --git a/Makefile b/Makefile index b5e6960f..76a29908 100644 --- a/Makefile +++ b/Makefile @@ -2,42 +2,47 @@ SHELL := /bin/bash all: pypackage debpackage prepare: - mkdir -p build - cp *.py build/ - #cd build; mv openmanod.py openmanod - cp openmano build/ - cp openmanod.cfg build/ + mkdir -p build/ + cp MANIFEST.in build/ cp requirements.txt build/ cp README.rst build/ - cp openmano.service build/ - cp -r vnfs build/ - cp -r scenarios build/ - cp -r instance-scenarios build/ - cp -r scripts build/ - cd build/scripts; mv service-openmano.sh service-openmano; mv openmano-report.sh openmano-report - cp -r database_utils build/ + cp setup.py build/ + cp -r osm_ro build/ + cp openmano build/ + cp openmanod.py build/ + cp openmanod.cfg build/ + cp osm-ro.service 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/openmanolinkervimconn.py - cd build; for i in `ls vimconn_*.py |sed "s/\.py//"` ; do echo "import $$i" >> openmanolinkervimconn.py; done - python build/openmanolinkervimconn.py - rm -f build/openmanolinkervimconn.py + 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: prepare - python -m py_compile build/*.py +build: connectors prepare + python -m py_compile build/osm_ro/*.py -pypackage: build +pypackage: prepare cd build; ./setup.py sdist - #cp build/dist/* /root/artifacts/... + cd build; ./setup.py bdist_wheel -debpackage: build - echo "Nothing to be done yet" +debpackage: prepare + echo "Nothing to be done" + #cd build; ./setup.py --command-packages=stdeb.command bdist_deb #fpm -s python -t deb build/setup.py snappackage: echo "Nothing to be done yet" +sync: + #cp build/dist/* /root/artifacts/... + test: ./test/basictest.sh --force --insert-bashrc --install-openvim --init-openvim 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