fix 1138 forcing cryptography version 2.5 or higher
[osm/RO.git] / RO / Makefile
1 # Copyright 2018 Telefonica S.A.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 .PHONY: all test clean
17
18 SHELL := /bin/bash
19
20 BRANCH ?= master
21
22 all: clean package
23
24 clean:
25 rm -rf dist deb_dist osm_ro-*.tar.gz osm_ro.egg-info .eggs
26
27 package:
28 # apt-get install -y python-stdeb
29 python3 setup.py --command-packages=stdeb.command sdist_dsc
30 cp debian/python3-osm-ro.postinst deb_dist/osm-ro*/debian/
31 # cd deb_dist/osm-nbi*/debian && echo "cryptography python3-cryptography (>= 1.9)" > py3dist-overrides
32 cd deb_dist/osm-ro*/ && dpkg-buildpackage -rfakeroot -uc -us
33 # mkdir -p .build
34 # cp build/deb_dist/python-*.deb .build/
35
36 clean_build:
37 rm -rf build
38 find osm_ro -name '*.pyc' -delete
39 find osm_ro -name '*.pyo' -delete
40
41 prepare:
42 # ip install --user --upgrade setuptools
43 mkdir -p build/
44 # VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
45 # VER2=$(shell git describe | cut -d- -f2); \
46 # VER3=$(shell git describe | cut -d- -f3); \
47 # echo "$$VER1.dev$$VER2+$$VER3" > build/RO_VERSION
48 cp tox.ini build/
49 cp MANIFEST.in build/
50 cp requirements.txt build/
51 cp README.rst build/
52 cp setup.py build/
53 cp stdeb.cfg build/
54 cp -r osm_ro build/
55 cp openmano build/
56 cp openmanod build/
57 cp -r vnfs build/osm_ro
58 cp -r scenarios build/osm_ro
59 cp -r instance-scenarios build/osm_ro
60 cp -r scripts build/osm_ro
61 cp -r database_utils build/osm_ro
62 cp LICENSE build/osm_ro
63
64 connectors: prepare
65 # python-novaclient is required for that
66 rm -f build/osm_ro/openmanolinkervimconn.py
67 cd build/osm_ro; for i in `ls vimconn_*.py |sed "s/\.py//"` ; do echo "import $$i" >> openmanolinkervimconn.py; done
68 python build/osm_ro/openmanolinkervimconn.py 2>&1
69 rm -f build/osm_ro/openmanolinkervimconn.py
70
71 build: connectors prepare
72 python -m py_compile build/osm_ro/*.py
73 # cd build && tox -e flake8
74
75 lib-openvim:
76 $(shell git clone https://osm.etsi.org/gerrit/osm/openvim)
77 LIB_BRANCH=$(shell git -C openvim branch -a|grep -oP 'remotes/origin/\K$(BRANCH)'); \
78 [ -z "$$LIB_BRANCH" ] && LIB_BRANCH='master'; \
79 echo "BRANCH: $(BRANCH)"; \
80 echo "LIB_OPENVIM_BRANCH: $$LIB_BRANCH"; \
81 git -C openvim checkout $$LIB_BRANCH
82 make -C openvim clean lite
83
84 osm-im:
85 $(shell git clone https://osm.etsi.org/gerrit/osm/IM)
86 make -C IM clean all
87
88 snap:
89 echo "Nothing to be done yet"
90
91 install: lib-openvim osm-im
92 dpkg -i IM/deb_dist/python-osm-im*.deb
93 dpkg -i openvim/.build/python-lib-osm-openvim*.deb
94 dpkg -i .build/python-osm-ro*.deb
95 cd .. && \
96 OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` || FATAL "lib-osm-openvim was not properly installed" && \
97 OSMRO_PATH=`python -c 'import osm_ro; print osm_ro.__path__[0]'` || FATAL "osm-ro was not properly installed" && \
98 USER=root DEBIAN_FRONTEND=noninteractive $$OSMRO_PATH/database_utils/install-db-server.sh --updatedb || FATAL "osm-ro db installation failed" && \
99 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"
100 service osm-ro restart
101
102 develop: prepare
103 # pip install -r requirements.txt
104 cd build && ./setup.py develop
105
106 test:
107 . ./test/basictest.sh -f --insert-bashrc --install-openvim --init-openvim
108 . ./test/basictest.sh -f reset add-openvim
109 ./test/test_RO.py deploy -n mgmt -t osm -i cirros034 -d local-openvim --timeout=30 --failfast
110 ./test/test_RO.py vim -t osm -d local-openvim --timeout=30 --failfast
111
112 build-docker-from-source:
113 docker build -t osm/openmano -f docker/Dockerfile-local .
114
115 run-docker:
116 docker-compose -f docker/openmano-compose.yml up
117
118 stop-docker:
119 docker-compose -f docker/openmano-compose.yml down
120
121