From 902968ab29b3bd97256f694b3f8c0120bfa34711 Mon Sep 17 00:00:00 2001 From: peusterm Date: Thu, 19 Dec 2019 16:02:34 +0100 Subject: [PATCH 1/2] Feature: Python3 support for vim-emu server Signed-off-by: peusterm --- Dockerfile | 2 ++ node-installers/node-vim-emu.yml | 11 ++++++++--- requirements.txt | 7 +++---- src/tngsdk/benchmark/pdriver/vimemu/server.py | 13 +++++-------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5db46c7..ae7d906 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,8 @@ FROM python:3.6-slim RUN apt-get update && apt-get install -y git build-essential RUN pip install flake8 RUN pip install tavern # fix (try to remove once the tavern installation is not broken anymore) +RUN pip install tngsdk.project +RUN pip install tngsdk.package ADD . /tng-sdk-benchmark WORKDIR /tng-sdk-benchmark RUN python setup.py install diff --git a/node-installers/node-vim-emu.yml b/node-installers/node-vim-emu.yml index 8ee2b02..e40717c 100644 --- a/node-installers/node-vim-emu.yml +++ b/node-installers/node-vim-emu.yml @@ -49,20 +49,25 @@ creates: "/usr/local/bin/vim-emu" # skip if vim-emu is there - name: "Install: vim-emu setup.py" become: yes - shell: "python setup.py install" + shell: "python3 setup.py install" args: chdir: "{{ install_base_path }}/vim-emu" creates: "/usr/local/bin/vim-emu" # skip if vim-emu is there + - name: "Install: tng-sdk-project (using pip3)" + become: yes + shell: "pip3 install tngsdk.project" + - name: "Install: tng-sdk-package (using pip3)" + become: yes + shell: "pip3 install tngsdk.package" - name: "Install: Git clone tng-sdk-benchmark (for emusrv component)" git: repo: "https://github.com/sonata-nfv/tng-sdk-benchmark.git" dest: "{{ install_base_path }}/tng-sdk-benchmark" - name: "Install: tng-sdk-benchmark setup.py" become: yes - shell: "python setup.py install" + shell: "python3 setup.py install" args: chdir: "{{ install_base_path }}/tng-sdk-benchmark" - # creates: "/usr/local/bin/tng-bench-emusrv" # deatctivated: always use latest code from master - name: "Install: Pulling example Docker images" become: yes shell: | diff --git a/requirements.txt b/requirements.txt index 54f4629..7ec565d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,15 @@ setuptools +Flask +flask-restplus pytest==4.3 pyyaml>=5.1 pyaml jsonschema coloredlogs requests -flask-restplus gevent==1.4.0 docker numpy==1.16 pandas==0.24 flatten-dict -pyangbind -tngsdk.project -tngsdk.package +pyangbind \ No newline at end of file diff --git a/src/tngsdk/benchmark/pdriver/vimemu/server.py b/src/tngsdk/benchmark/pdriver/vimemu/server.py index 3c813ab..34bbc48 100644 --- a/src/tngsdk/benchmark/pdriver/vimemu/server.py +++ b/src/tngsdk/benchmark/pdriver/vimemu/server.py @@ -42,19 +42,16 @@ import time import signal import datetime -import platform from ctypes import c_bool from flask import Flask, Blueprint from flask_restplus import Resource, Api, Namespace from werkzeug.contrib.fixers import ProxyFix from gevent.pywsgi import WSGIServer -# Hotfix: -if "2.7" in str(platform.python_version()): - # pylint: disable=E0402 - from emuvim.dcemulator.net import DCNetwork - from mininet.log import setLogLevel - from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint - from emuvim.api.tango import TangoLLCMEndpoint +# pylint: disable=E0402 +from emuvim.dcemulator.net import DCNetwork +from mininet.log import setLogLevel +from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint +from emuvim.api.tango import TangoLLCMEndpoint LOG = logging.getLogger(__name__) From a54a903b0188919717ece8459af71fc316913319 Mon Sep 17 00:00:00 2001 From: peusterm Date: Thu, 19 Dec 2019 16:14:39 +0100 Subject: [PATCH 2/2] Hotfix for __pycache__ issue. Signed-off-by: peusterm --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ae7d906..e5f7445 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ RUN pip install tngsdk.project RUN pip install tngsdk.package ADD . /tng-sdk-benchmark WORKDIR /tng-sdk-benchmark -RUN python setup.py install +RUN python setup.py develop # # Runtime