| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 1 | .PHONY: all test clean |
| 2 | |
| garciadeblas | 9453a8a | 2017-03-09 16:21:24 +0100 | [diff] [blame] | 3 | SHELL := /bin/bash |
| garciadeblas | 9453a8a | 2017-03-09 16:21:24 +0100 | [diff] [blame] | 4 | |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 5 | BRANCH ?= master |
| garciadeblas | d40e551 | 2017-04-21 15:09:26 +0200 | [diff] [blame] | 6 | |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 7 | all: lib-openvim osm-im |
| 8 | $(MAKE) clean_build build |
| 9 | $(MAKE) clean_build package |
| 10 | |
| 11 | clean: clean_build |
| 12 | rm -rf .build openvim IM |
| 13 | |
| 14 | clean_build: |
| garciadeblas | d40e551 | 2017-04-21 15:09:26 +0200 | [diff] [blame] | 15 | rm -rf build |
| 16 | find osm_ro -name '*.pyc' -delete |
| 17 | find osm_ro -name '*.pyo' -delete |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 18 | |
| garciadeblas | 9453a8a | 2017-03-09 16:21:24 +0100 | [diff] [blame] | 19 | prepare: |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 20 | # ip install --user --upgrade setuptools |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 21 | mkdir -p build/ |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 22 | # VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \ |
| 23 | # VER2=$(shell git describe | cut -d- -f2); \ |
| 24 | # VER3=$(shell git describe | cut -d- -f3); \ |
| 25 | # echo "$$VER1.dev$$VER2+$$VER3" > build/RO_VERSION |
| 26 | cp tox.ini build/ |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 27 | cp MANIFEST.in build/ |
| garciadeblas | 06e6c39 | 2017-03-28 15:42:20 +0200 | [diff] [blame] | 28 | cp requirements.txt build/ |
| 29 | cp README.rst build/ |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 30 | cp setup.py build/ |
| garciadeblas | e5ef517 | 2017-04-20 14:46:29 +0200 | [diff] [blame] | 31 | cp stdeb.cfg build/ |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 32 | cp -r osm_ro build/ |
| 33 | cp openmano build/ |
| garciadeblas | cf1826b | 2017-04-18 10:03:17 +0200 | [diff] [blame] | 34 | cp openmanod build/ |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 35 | cp -r vnfs build/osm_ro |
| 36 | cp -r scenarios build/osm_ro |
| 37 | cp -r instance-scenarios build/osm_ro |
| 38 | cp -r scripts build/osm_ro |
| 39 | cp -r database_utils build/osm_ro |
| garciadeblas | 8285539 | 2017-09-20 17:34:16 +0200 | [diff] [blame] | 40 | cp LICENSE build/osm_ro |
| garciadeblas | 9453a8a | 2017-03-09 16:21:24 +0100 | [diff] [blame] | 41 | |
| garciadeblas | 06e6c39 | 2017-03-28 15:42:20 +0200 | [diff] [blame] | 42 | connectors: prepare |
| 43 | # python-novaclient is required for that |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 44 | rm -f build/osm_ro/openmanolinkervimconn.py |
| 45 | cd build/osm_ro; for i in `ls vimconn_*.py |sed "s/\.py//"` ; do echo "import $$i" >> openmanolinkervimconn.py; done |
| tierno | 3cb8dc3 | 2017-10-24 18:13:19 +0200 | [diff] [blame] | 46 | python build/osm_ro/openmanolinkervimconn.py 2>&1 |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 47 | rm -f build/osm_ro/openmanolinkervimconn.py |
| garciadeblas | 9453a8a | 2017-03-09 16:21:24 +0100 | [diff] [blame] | 48 | |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 49 | build: connectors prepare |
| garciadeblas | 2c290ca | 2017-04-06 03:12:51 +0200 | [diff] [blame] | 50 | python -m py_compile build/osm_ro/*.py |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 51 | # cd build && tox -e flake8 |
| garciadeblas | 9453a8a | 2017-03-09 16:21:24 +0100 | [diff] [blame] | 52 | |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 53 | lib-openvim: |
| 54 | $(shell git clone https://osm.etsi.org/gerrit/osm/openvim) |
| 55 | LIB_BRANCH=$(shell git -C openvim branch -a|grep -oP 'remotes/origin/\K$(BRANCH)'); \ |
| 56 | [ -z "$$LIB_BRANCH" ] && LIB_BRANCH='master'; \ |
| 57 | echo "BRANCH: $(BRANCH)"; \ |
| 58 | echo "LIB_OPENVIM_BRANCH: $$LIB_BRANCH"; \ |
| 59 | git -C openvim checkout $$LIB_BRANCH |
| 60 | make -C openvim clean lite |
| garciadeblas | 06e6c39 | 2017-03-28 15:42:20 +0200 | [diff] [blame] | 61 | |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 62 | osm-im: |
| 63 | $(shell git clone https://osm.etsi.org/gerrit/osm/IM) |
| Mike Marchetti | 76f3ee7 | 2018-10-05 14:06:23 -0400 | [diff] [blame] | 64 | git -C IM checkout $(BRANCH) |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 65 | make -C IM clean all |
| 66 | |
| 67 | package: prepare |
| 68 | # apt-get install -y python-stdeb |
| garciadeblas | e5ef517 | 2017-04-20 14:46:29 +0200 | [diff] [blame] | 69 | cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True |
| 70 | cd build && cp osm_ro/scripts/python-osm-ro.postinst deb_dist/osm-ro*/debian/ |
| 71 | cd build/deb_dist/osm-ro* && dpkg-buildpackage -rfakeroot -uc -us |
| garciadeblas | d40e551 | 2017-04-21 15:09:26 +0200 | [diff] [blame] | 72 | mkdir -p .build |
| garciadeblas | a64b262 | 2017-04-24 11:50:03 +0200 | [diff] [blame] | 73 | cp build/deb_dist/python-*.deb .build/ |
| garciadeblas | 06e6c39 | 2017-03-28 15:42:20 +0200 | [diff] [blame] | 74 | |
| garciadeblas | cf1826b | 2017-04-18 10:03:17 +0200 | [diff] [blame] | 75 | snap: |
| garciadeblas | 06e6c39 | 2017-03-28 15:42:20 +0200 | [diff] [blame] | 76 | echo "Nothing to be done yet" |
| 77 | |
| garciadeblas | cf1826b | 2017-04-18 10:03:17 +0200 | [diff] [blame] | 78 | install: |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 79 | dpkg -i IM/deb_dist/python-osm-im*.deb |
| 80 | dpkg -i openvim/.build/python-lib-osm-openvim*.deb |
| 81 | dpkg -i .build/python-osm-ro*.deb |
| 82 | cd .. && \ |
| 83 | OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` || FATAL "lib-osm-openvim was not properly installed" && \ |
| 84 | OSMRO_PATH=`python -c 'import osm_ro; print osm_ro.__path__[0]'` || FATAL "osm-ro was not properly installed" && \ |
| 85 | USER=root DEBIAN_FRONTEND=noninteractive $$OSMRO_PATH/database_utils/install-db-server.sh --updatedb || FATAL "osm-ro db installation failed" && \ |
| 86 | 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" |
| 87 | service osm-ro restart |
| garciadeblas | cf1826b | 2017-04-18 10:03:17 +0200 | [diff] [blame] | 88 | |
| 89 | develop: prepare |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 90 | # pip install -r requirements.txt |
| garciadeblas | cf1826b | 2017-04-18 10:03:17 +0200 | [diff] [blame] | 91 | cd build && ./setup.py develop |
| 92 | |
| garciadeblas | 06e6c39 | 2017-03-28 15:42:20 +0200 | [diff] [blame] | 93 | test: |
| garciadeblas | cf92004 | 2017-09-14 16:17:39 +0200 | [diff] [blame] | 94 | . ./test/basictest.sh -f --insert-bashrc --install-openvim --init-openvim |
| 95 | . ./test/basictest.sh -f reset add-openvim |
| 96 | ./test/test_RO.py deploy -n mgmt -t osm -i cirros034 -d local-openvim --timeout=30 --failfast |
| 97 | ./test/test_RO.py vim -t osm -d local-openvim --timeout=30 --failfast |
| garciadeblas | 06e6c39 | 2017-03-28 15:42:20 +0200 | [diff] [blame] | 98 | |
| Gennadiy Dubina | 311ea74 | 2017-04-03 20:46:16 +0300 | [diff] [blame] | 99 | build-docker-from-source: |
| 100 | docker build -t osm/openmano -f docker/Dockerfile-local . |
| 101 | |
| 102 | run-docker: |
| 103 | docker-compose -f docker/openmano-compose.yml up |
| 104 | |
| 105 | stop-docker: |
| 106 | docker-compose -f docker/openmano-compose.yml down |
| 107 | |
| garciadeblas | 9453a8a | 2017-03-09 16:21:24 +0100 | [diff] [blame] | 108 | |