Feature 7318 check vim-create connectivity and credentials
[osm/RO.git] / 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: # lib-openvim # osm-im
23 $(MAKE) clean_build build
24 $(MAKE) clean_build package
25
26 clean: clean_build
27 rm -rf .build openvim IM
28
29 clean_build:
30 rm -rf build
31 find osm_ro -name '*.pyc' -delete
32 find osm_ro -name '*.pyo' -delete
33
34 prepare:
35 # ip install --user --upgrade setuptools
36 mkdir -p build/
37 # VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
38 # VER2=$(shell git describe | cut -d- -f2); \
39 # VER3=$(shell git describe | cut -d- -f3); \
40 # echo "$$VER1.dev$$VER2+$$VER3" > build/RO_VERSION
41 cp tox.ini build/
42 cp MANIFEST.in build/
43 cp requirements.txt build/
44 cp README.rst build/
45 cp setup.py build/
46 cp stdeb.cfg build/
47 cp -r osm_ro build/
48 cp openmano build/
49 cp openmanod build/
50 cp -r vnfs build/osm_ro
51 cp -r scenarios build/osm_ro
52 cp -r instance-scenarios build/osm_ro
53 cp -r scripts build/osm_ro
54 cp -r database_utils build/osm_ro
55 cp LICENSE build/osm_ro
56
57 connectors: prepare
58 # python-novaclient is required for that
59 rm -f build/osm_ro/openmanolinkervimconn.py
60 cd build/osm_ro; for i in `ls vimconn_*.py |sed "s/\.py//"` ; do echo "import $$i" >> openmanolinkervimconn.py; done
61 python build/osm_ro/openmanolinkervimconn.py 2>&1
62 rm -f build/osm_ro/openmanolinkervimconn.py
63
64 build: connectors prepare
65 python -m py_compile build/osm_ro/*.py
66 # cd build && tox -e flake8
67
68 lib-openvim:
69 $(shell git clone https://osm.etsi.org/gerrit/osm/openvim)
70 LIB_BRANCH=$(shell git -C openvim branch -a|grep -oP 'remotes/origin/\K$(BRANCH)'); \
71 [ -z "$$LIB_BRANCH" ] && LIB_BRANCH='master'; \
72 echo "BRANCH: $(BRANCH)"; \
73 echo "LIB_OPENVIM_BRANCH: $$LIB_BRANCH"; \
74 git -C openvim checkout $$LIB_BRANCH
75 make -C openvim clean lite
76
77 osm-im:
78 $(shell git clone https://osm.etsi.org/gerrit/osm/IM)
79 make -C IM clean all
80
81 package: prepare
82 # apt-get install -y python-stdeb
83 cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True
84 cd build && cp osm_ro/scripts/python-osm-ro.postinst deb_dist/osm-ro*/debian/
85 cd build/deb_dist/osm-ro* && dpkg-buildpackage -rfakeroot -uc -us
86 mkdir -p .build
87 cp build/deb_dist/python-*.deb .build/
88
89 snap:
90 echo "Nothing to be done yet"
91
92 install: lib-openvim osm-im
93 dpkg -i IM/deb_dist/python-osm-im*.deb
94 dpkg -i openvim/.build/python-lib-osm-openvim*.deb
95 dpkg -i .build/python-osm-ro*.deb
96 cd .. && \
97 OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` || FATAL "lib-osm-openvim was not properly installed" && \
98 OSMRO_PATH=`python -c 'import osm_ro; print osm_ro.__path__[0]'` || FATAL "osm-ro was not properly installed" && \
99 USER=root DEBIAN_FRONTEND=noninteractive $$OSMRO_PATH/database_utils/install-db-server.sh --updatedb || FATAL "osm-ro db installation failed" && \
100 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"
101 service osm-ro restart
102
103 develop: prepare
104 # pip install -r requirements.txt
105 cd build && ./setup.py develop
106
107 test:
108 . ./test/basictest.sh -f --insert-bashrc --install-openvim --init-openvim
109 . ./test/basictest.sh -f reset add-openvim
110 ./test/test_RO.py deploy -n mgmt -t osm -i cirros034 -d local-openvim --timeout=30 --failfast
111 ./test/test_RO.py vim -t osm -d local-openvim --timeout=30 --failfast
112
113 build-docker-from-source:
114 docker build -t osm/openmano -f docker/Dockerfile-local .
115
116 run-docker:
117 docker-compose -f docker/openmano-compose.yml up
118
119 stop-docker:
120 docker-compose -f docker/openmano-compose.yml down
121
122