+# Copyright 2018 Telefonica S.A.
+#
+# 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.
+
# This Dockerfile is intented for devops and deb package generation
#
# Use Dockerfile.local for running osm/LCM in a docker container from source
-# Use Dockerfile.fromdeb for running osm/LCM in a docker container from last stable package
FROM ubuntu:16.04
-RUN apt-get update && apt-get -y install git make python python3 \
- libcurl4-gnutls-dev libgnutls-dev tox python-dev python3-dev \
- debhelper python-setuptools python-all python3-all apt-utils
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get --yes install git tox make debhelper wget \
+ python-all python3 python3-pip python3-all && \
+ DEBIAN_FRONTEND=noninteractive pip3 install -U setuptools setuptools-version-command stdeb
+
+# TODO delete if not needed:
+# libcurl4-gnutls-dev libgnutls-dev python-dev python3-dev python-setuptools apt-utils
+
+
+# Uncomment this block to generate automatically a debian package and show info
+# # Set the working directory to /app
+# WORKDIR /app
+# # Copy the current directory contents into the container at /app
+# ADD . /app
+#i CMD /app/devops-stages/stage-build.sh && find -name "*.deb" -exec dpkg -I {} ";"
+# Copyright 2018 Telefonica S.A.
+#
+# 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.
+
FROM ubuntu:16.04
# Set the working directory to /app
# Copy the current directory contents into the container at /app
ADD . /app
-RUN apt-get update && apt-get install -y git python3 \
- python3-pip python3-pymongo python3-yaml python3-aiohttp \
- python3-stdeb python3-setuptools python3-all python-all \
- python3-bitarray python3-regex python3-lxml debhelper dh-python tox wget \
- python3-cffi \
+RUN apt-get update && apt-get install -y git tox python3 \
+ python3-pip python3-aiohttp \
&& pip3 install pip==9.0.3 \
- && pip3 install -U aiokafka pyang lxml six enum34
+ && pip3 install -U 'PyYAML==3.*' 'aiohttp==0.20.2' flake8
RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \
- && cd N2VC \
- && git checkout BUILD_v4.0.1_1 \
- && pip3 install websockets==4.0.1 \
- && pip3 install requests \
- && cd modules/libjuju && python3 setup.py develop && cd ../.. \
- && pip3 install -U -r requirements.txt \
- && python3 setup.py develop \
- && cd ..
+ && pip3 install -e N2VC \
+ && pip3 install -e N2VC/modules/libjuju \
+ && apt-get install -y libffi-dev libssl-dev
+ # cd N2VC; python3 setup.py develop
+ # cd modules/libjuju; python3 setup.py develop
RUN git clone https://osm.etsi.org/gerrit/osm/common.git \
- && cd common && python3 setup.py develop && cd ..
-# && pip3 install -U -r requirements.txt \
-# && cd ..
+ && pip3 install -e common
+ # python3-pymongo python3-yaml pycrypto aiokafka
RUN mkdir -p /app/storage/kafka && mkdir -p /app/log
+# Copyright 2018 Telefonica S.A.
+#
+# 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.
+
include README.rst
-recursive-include osm_lcm *
+recursive-include osm_lcm *.py *.xml *.sh lcm.cfg
+recursive-include devops-stages *
+# Copyright 2018 Telefonica S.A.
+#
+# 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.
+
+all: clean package
clean:
- rm -rf dist deb_dist .build osm_lcm-*.tar.gz osm_lcm.egg-info eggs
+ rm -rf dist deb_dist osm_lcm-*.tar.gz osm_lcm.egg-info .eggs
package:
python3 setup.py --command-packages=stdeb.command sdist_dsc
- cp python3-osm-lcm.postinst deb_dist/osm-lcm*/debian
+ # cp debian/python3-osm-lcm.postinst deb_dist/osm-lcm*/debian
cd deb_dist/osm-lcm*/debian && echo "osm-common python3-osm-common" > py3dist-overrides
# cd deb_dist/osm-lcm*/debian && echo "pip3 python3-pip" >> py3dist-overrides
cd deb_dist/osm-lcm*/ && dpkg-buildpackage -rfakeroot -uc -us
- mkdir -p .build
- cp deb_dist/python3-osm-lcm*.deb .build/
-
--- /dev/null
+#!/bin/bash
+
+##
+# 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: OSM_TECH@list.etsi.org
+##
+
+echo "POST INSTALL OSM-LCM"
+
+#Creation of log folder
+mkdir -p /var/log/osm
+
+systemctl enable osm-lcm.service
+
#!/bin/sh
-rm -rf deb_dist
-tox -e build
-#make clean package
+
+# 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.
+
+# moved to a Makefile in order to add post install. Needed for "pip3 install aiokafka",
+# that is not available with a package
+
+make clean # rm -rf deb_dist
+tox -e build # make package
+
+++ /dev/null
-#!/bin/bash
-
-##
-# 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: OSM_TECH@list.etsi.org
-##
-
-echo "POST INSTALL OSM-LCM"
-
-#Creation of log folder
-mkdir -p /var/log/osm
-
-systemctl enable osm-lcm.service
-
-pymongo
-yaml
-n2vc
+# 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.
+
+pyyaml==3.*
+aiohttp==0.20.2
+git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common
+git+https://osm.etsi.org/gerrit/osm/N2VC.git#egg=n2vc
#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2018 Telefonica S.A.
+#
+# 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.
import os
from setuptools import setup
setup(
name=_name,
- description='OSM North Bound Interface',
+ description='OSM Life Cycle Management module',
long_description=README,
version_command=('git describe --match v* --tags --long --dirty', 'pep440-git-full'),
# version=VERSION,
packages=[_name],
include_package_data=True,
- data_files=[('/etc/osm/', ['osm_lcm/lcm.cfg']),
- ('/etc/systemd/system/', ['osm_lcm/osm-lcm.service']),
- ],
+ # data_files=[('/etc/osm/', ['osm_lcm/lcm.cfg']),
+ # ('/etc/systemd/system/', ['osm_lcm/osm-lcm.service']),
+ # ],
dependency_links=[
- "git+https://osm.etsi.org/gerrit/osm/common.git@master#egg=osm-common-0.1.4"
+ 'git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common',
+ 'git+https://osm.etsi.org/gerrit/osm/N2VC.git#egg=n2vc',
],
install_requires=[
- 'pymongo',
- 'PyYAML',
+ # 'pymongo',
+ 'PyYAML==3.*',
'aiohttp==0.20.2',
+ 'osm-common',
+ 'n2vc',
# TODO this is version installed by 'apt python3-aiohttp' on Ubuntu Sserver 14.04
# version installed by pip 3.3.2 is not compatible. Code should be migrated to this version and use pip3
- # 'osm-common',
],
setup_requires=['setuptools-version-command'],
- # test_suite='nose.collector',
- # entry_points='''
- # [console_scripts]
- # osm=osm_lcm.lcm:lcm
- # ''',
)
--- /dev/null
+[DEFAULT]
+X-Python3-Version : >= 3.5
+Depends3: python3-osm-common, python3-n2vc
--- /dev/null
+# Copyright 2018 Telefonica S.A.
+#
+# 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.
+
+flake8<3.0
+mock
+
+# Copyright 2018 Telefonica S.A.
+#
+# 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.
+
[tox]
-envlist = py27,py3,flake8
+envlist = py3
toxworkdir={homedir}/.tox
[testenv]
-deps=nose
- mock
-commands=nosetests
+basepython = python3
+install_command = python3 -m pip install -r requirements.txt -U {opts} {packages}
+deps = -r{toxinidir}/test-requirements.txt
+commands=python3 -m unittest discover -v
[testenv:flake8]
basepython = python3
deps = flake8
-commands =
- flake8 osm_lcm --max-line-length 120 --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp --ignore W291,W293,E226
+commands = flake8 osm_lcm --max-line-length 120 \
+ --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp --ignore W291,W293,E226,W504
[testenv:build]
basepython = python3
deps = stdeb
setuptools-version-command
commands = python3 setup.py --command-packages=stdeb.command bdist_deb
+