Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2016 the original author or authors. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 17 | ifneq ($(VOLTHA_BUILD),docker) |
Nathan Knuth | edc88da | 2016-09-17 00:28:05 -0700 | [diff] [blame] | 18 | ifeq ($(VOLTHA_BASE)_set,_set) |
| 19 | $(error To get started, please source the env.sh file) |
| 20 | endif |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 21 | endif |
Nathan Knuth | edc88da | 2016-09-17 00:28:05 -0700 | [diff] [blame] | 22 | |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 23 | ifeq ($(TAG),) |
| 24 | TAG := latest |
| 25 | endif |
| 26 | |
David K. Bainbridge | 03ad741 | 2018-01-19 16:41:38 -0800 | [diff] [blame] | 27 | ifeq ($(TARGET_TAG),) |
| 28 | TARGET_TAG := latest |
| 29 | endif |
| 30 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 31 | # If no DOCKER_HOST_IP is specified grab a v4 IP address associated with |
| 32 | # the default gateway |
| 33 | ifeq ($(DOCKER_HOST_IP),) |
| 34 | DOCKER_HOST_IP := $(shell ifconfig $$(netstat -rn | grep -E '^(default|0.0.0.0)' | head -1 | awk '{print $$NF}') | grep inet | awk '{print $$2}' | sed -e 's/addr://g') |
| 35 | endif |
| 36 | |
Nathan Knuth | 84dfd2e | 2016-09-16 15:06:34 -0700 | [diff] [blame] | 37 | include setup.mk |
| 38 | |
Gertjan Van Droogenbroeck | e0c9acb | 2017-11-16 16:54:22 +0100 | [diff] [blame] | 39 | ifneq ($(http_proxy)$(https_proxy),) |
| 40 | # Include proxies from the environment |
| 41 | DOCKER_PROXY_ARGS = \ |
| 42 | --build-arg http_proxy=$(http_proxy) \ |
| 43 | --build-arg https_proxy=$(https_proxy) \ |
| 44 | --build-arg ftp_proxy=$(ftp_proxy) \ |
| 45 | --build-arg no_proxy=$(no_proxy) \ |
| 46 | --build-arg HTTP_PROXY=$(HTTP_PROXY) \ |
| 47 | --build-arg HTTPS_PROXY=$(HTTPS_PROXY) \ |
| 48 | --build-arg FTP_PROXY=$(FTP_PROXY) \ |
| 49 | --build-arg NO_PROXY=$(NO_PROXY) |
| 50 | endif |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 51 | |
| 52 | DOCKER_BUILD_ARGS = \ |
| 53 | --build-arg TAG=$(TAG) \ |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 54 | --build-arg REGISTRY=$(REGISTRY) \ |
| 55 | --build-arg REPOSITORY=$(REPOSITORY) \ |
| 56 | $(DOCKER_PROXY_ARGS) $(DOCKER_CACHE_ARG) \ |
| 57 | --rm --force-rm \ |
| 58 | $(DOCKER_BUILD_EXTRA_ARGS) |
Gertjan Van Droogenbroeck | e0c9acb | 2017-11-16 16:54:22 +0100 | [diff] [blame] | 59 | |
Zsolt Haraszti | 4161248 | 2016-09-21 12:26:20 -0700 | [diff] [blame] | 60 | VENVDIR := venv-$(shell uname -s | tr '[:upper:]' '[:lower:]') |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 61 | |
David K. Bainbridge | 03ad741 | 2018-01-19 16:41:38 -0800 | [diff] [blame] | 62 | DOCKER_IMAGE_LIST = \ |
| 63 | base \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 64 | protoc \ |
| 65 | protos \ |
David K. Bainbridge | 03ad741 | 2018-01-19 16:41:38 -0800 | [diff] [blame] | 66 | voltha \ |
| 67 | ofagent \ |
| 68 | tools \ |
| 69 | fluentd \ |
| 70 | envoy \ |
| 71 | go-builder \ |
| 72 | netconf \ |
| 73 | shovel \ |
| 74 | dashd \ |
| 75 | cli \ |
| 76 | portainer \ |
| 77 | nginx \ |
| 78 | consul \ |
| 79 | grafana \ |
| 80 | onos \ |
| 81 | unum \ |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 82 | ponsim \ |
David K. Bainbridge | 03ad741 | 2018-01-19 16:41:38 -0800 | [diff] [blame] | 83 | tester \ |
| 84 | config-push \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 85 | j2 \ |
| 86 | test_runner |
David K. Bainbridge | 03ad741 | 2018-01-19 16:41:38 -0800 | [diff] [blame] | 87 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 88 | # The following list was scavanged from the compose / stack files as well as |
| 89 | # from the Dockerfiles. If nothing else it highlights that VOLTHA is not |
| 90 | # using consistent versions for some of the containers. |
| 91 | |
| 92 | # grep -i "^FROM" docker/Dockerfile.* | grep -v voltha- | sed -e 's/ as .*$//g' -e 's/\${REGISTRY}//g' | awk '{print $NF}' | grep -v '^scratch' | sed '/:.*$/!s/$/:latest/g' | sort -u | sed -e 's/^/ /g' -e 's/$/ \\/g' |
| 93 | FETCH_BUILD_IMAGE_LIST = \ |
| 94 | alpine:3.6 \ |
| 95 | centos:7 \ |
| 96 | centurylink/ca-certs:latest \ |
| 97 | consul:0.9.2 \ |
| 98 | debian:stretch-slim \ |
| 99 | docker.elastic.co/logstash/logstash:5.6.0 \ |
| 100 | fluent/fluentd:v0.12.42 \ |
| 101 | gliderlabs/registrator:v7 \ |
| 102 | golang:1.9.2 \ |
| 103 | grpc/python:latest \ |
| 104 | kamon/grafana_graphite:3.0 \ |
| 105 | lyft/envoy:29361deae91575a1d46c7a21e913f19e75622ebe \ |
| 106 | maven:3-jdk-8-alpine \ |
| 107 | onosproject/onos:1.10.9 \ |
| 108 | opennms/horizon-core-web:19.0.1-1 \ |
| 109 | portainer/portainer:1.15.2 \ |
| 110 | ubuntu:xenial |
| 111 | |
| 112 | # find compose -type f | xargs grep image: | awk '{print $NF}' | grep -v voltha- | sed -e 's/\"//g' -e 's/\${REGISTRY}//g' -e 's/:\${.*:-/:/g' -e 's/\}//g' -e '/:.*$/!s/$/:latest/g' | sort -u | sed -e 's/^/ /g' -e 's/$/ \\/g' |
| 113 | FETCH_COMPOSE_IMAGE_LIST = \ |
| 114 | consul:0.9.2 \ |
| 115 | docker.elastic.co/elasticsearch/elasticsearch:5.6.0 \ |
| 116 | fluent/fluentd:latest \ |
| 117 | fluent/fluentd:v0.12.42 \ |
| 118 | gliderlabs/registrator:latest \ |
| 119 | kamon/grafana_graphite:latest \ |
| 120 | marcelmaatkamp/freeradius:latest \ |
| 121 | postgres:9.6.1 \ |
| 122 | quay.io/coreos/etcd:v3.2.9 \ |
| 123 | registry:2 \ |
| 124 | tianon/true:latest \ |
| 125 | wurstmeister/kafka:latest \ |
| 126 | wurstmeister/zookeeper:latest |
| 127 | |
| 128 | # find k8s -type f | xargs grep image: | awk '{print $NF}' | sed -e 's/\"//g' | sed '/:.*$/!s/$/:latest/g' | sort -u | sed -e 's/^/ /g' -e 's/$/ \\/g' |
| 129 | # Manually remove some image from this list as they don't reflect the new |
| 130 | # naming conventions for the VOLTHA build |
| 131 | FETCH_K8S_IMAGE_LIST = \ |
Stephane Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 132 | alpine:3.6 \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 133 | consul:0.9.2 \ |
Stephane Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 134 | fluent/fluentd:v0.12.42 \ |
| 135 | gcr.io/google_containers/defaultbackend:1.4 \ |
| 136 | gcr.io/google_containers/kubernetes-dashboard-amd64:v1.8.1 \ |
| 137 | k8s.gcr.io/fluentd-gcp:1.30 \ |
| 138 | kamon/grafana_graphite:3.0 \ |
| 139 | marcelmaatkamp/freeradius:latest \ |
| 140 | quay.io/coreos/hyperkube:v1.9.2_coreos.0 \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 141 | quay.io/coreos/etcd-operator:v0.7.2 \ |
Stephane Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 142 | quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.10.2 \ |
Stephane Barbarie | 30f64b8 | 2018-03-28 16:26:12 -0400 | [diff] [blame] | 143 | wurstmeister/kafka:1.0.0 \ |
| 144 | zookeeper:3.4.11 |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 145 | |
| 146 | FETCH_IMAGE_LIST = $(shell echo $(FETCH_BUILD_IMAGE_LIST) $(FETCH_COMPOSE_IMAGE_LIST) $(FETCH_K8S_IMAGE_LIST) | tr ' ' '\n' | sort -u) |
| 147 | |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 148 | .PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) flake8 base voltha ofagent netconf shovel onos dashd cli portainer grafana nginx consul envoy go-builder envoyd tools opennms logstash unum ponsim start stop tag push pull |
Nathan Knuth | 84dfd2e | 2016-09-16 15:06:34 -0700 | [diff] [blame] | 149 | |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 150 | # This should to be the first and default target in this Makefile |
| 151 | help: |
| 152 | @echo "Usage: make [<target>]" |
| 153 | @echo "where available targets are:" |
| 154 | @echo |
| 155 | @echo "build : Build the Voltha protos and docker images.\n\ |
| 156 | If this is the first time you are building, choose \"make build\" option." |
Sergio Slobodrian | 7a7091c | 2017-06-21 23:45:45 -0400 | [diff] [blame] | 157 | @echo "production : Build voltha for production deployment" |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 158 | @echo "clean : Remove files created by the build and tests" |
| 159 | @echo "distclean : Remove venv directory" |
| 160 | @echo "fetch : Pre-fetch artifacts for subsequent local builds" |
| 161 | @echo "flake8 : Run specifically flake8 tests" |
| 162 | @echo "help : Print this help" |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 163 | @echo "protoc : Build a container with protoc installed" |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 164 | @echo "protos : Compile all grpc/protobuf files" |
| 165 | @echo "rebuild-venv : Rebuild local Python virtualenv from scratch" |
| 166 | @echo "venv : Build local Python virtualenv if did not exist yet" |
| 167 | @echo "utest : Run all unit tests" |
| 168 | @echo "itest : Run all integration tests" |
| 169 | @echo "containers : Build all the docker containers" |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 170 | @echo "base : Build the base docker container used by all other dockers" |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 171 | @echo "voltha : Build the voltha docker container" |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 172 | @echo "ofagent : Build the ofagent docker container" |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 173 | @echo "netconf : Build the netconf docker container" |
| 174 | @echo "shovel : Build the shovel docker container" |
| 175 | @echo "onos : Build the onos docker container" |
| 176 | @echo "dashd : Build the dashd docker container" |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 177 | @echo "cli : Build the cli docker container" |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 178 | @echo "portainer : Build the portainer docker container" |
| 179 | @echo "grafana : Build the grafana docker container" |
| 180 | @echo "nginx : Build the nginx docker container" |
schowdhury | 4073921 | 2017-06-12 07:40:31 -0700 | [diff] [blame] | 181 | @echo "consul : Build the consul docker container" |
David K. Bainbridge | 215e024 | 2017-09-05 23:18:24 -0700 | [diff] [blame] | 182 | @echo "unum : Build the unum docker container" |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 183 | @echo "ponsim : Build the ponsim docker container" |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 184 | @echo "j2 : Build the Jinja2 template container" |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 185 | @echo "test_runner : Build a container from which tests are run" |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 186 | @echo "start : Start VOLTHA on the current system" |
| 187 | @echo "stop : Stop VOLTHA on the current system" |
David K. Bainbridge | 03ad741 | 2018-01-19 16:41:38 -0800 | [diff] [blame] | 188 | @echo "tag : Tag a set of images" |
| 189 | @echo "push : Push the docker images to an external repository" |
| 190 | @echo "pull : Pull the docker images from a repository" |
ggowdru | 9974f21 | 2017-06-06 23:31:25 -0700 | [diff] [blame] | 191 | @echo |
Nathan Knuth | 5157de0 | 2016-09-16 15:20:37 -0700 | [diff] [blame] | 192 | |
Nathan Knuth | 84dfd2e | 2016-09-16 15:06:34 -0700 | [diff] [blame] | 193 | ## New directories can be added here |
| 194 | DIRS:=\ |
Nathan Knuth | edc88da | 2016-09-17 00:28:05 -0700 | [diff] [blame] | 195 | voltha/northbound/openflow \ |
| 196 | voltha/northbound/openflow/agent \ |
| 197 | voltha/northbound/openflow/oftest |
Nathan Knuth | 84dfd2e | 2016-09-16 15:06:34 -0700 | [diff] [blame] | 198 | |
| 199 | ## If one directory depends on another directory that |
| 200 | ## dependency can be expressed here |
| 201 | ## |
| 202 | ## For example, if the Tibit directory depended on the eoam |
| 203 | ## directory being built first, then that can be expressed here. |
| 204 | ## driver/tibit: eoam |
| 205 | |
| 206 | # Parallel Build |
| 207 | $(DIRS): |
| 208 | @echo " MK $@" |
| 209 | $(Q)$(MAKE) -C $@ |
| 210 | |
| 211 | # Parallel Clean |
| 212 | DIRS_CLEAN = $(addsuffix .clean,$(DIRS)) |
| 213 | $(DIRS_CLEAN): |
| 214 | @echo " CLEAN $(basename $@)" |
| 215 | $(Q)$(MAKE) -C $(basename $@) clean |
| 216 | |
| 217 | # Parallel Flake8 |
| 218 | DIRS_FLAKE8 = $(addsuffix .flake8,$(DIRS)) |
| 219 | $(DIRS_FLAKE8): |
| 220 | @echo " FLAKE8 $(basename $@)" |
Nathan Knuth | 950dff2 | 2016-09-17 16:12:34 -0700 | [diff] [blame] | 221 | -$(Q)$(MAKE) -C $(basename $@) flake8 |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 222 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 223 | build: protoc protos go-builder containers |
Zsolt Haraszti | 32dda55 | 2016-09-27 09:17:29 -0700 | [diff] [blame] | 224 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 225 | production: protoc protos go-builder prod-containers |
Sergio Slobodrian | 7a7091c | 2017-06-21 23:45:45 -0400 | [diff] [blame] | 226 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 227 | jenkins: build |
khenaidoo | fe874ae | 2017-07-14 18:07:27 -0400 | [diff] [blame] | 228 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 229 | jenkins-containers: base voltha ofagent netconf consul cli envoy fluentd unum j2 |
Sergio Slobodrian | 7a7091c | 2017-06-21 23:45:45 -0400 | [diff] [blame] | 230 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 231 | prod-containers: base voltha ofagent netconf shovel onos dashd cli grafana consul tools envoy fluentd unum j2 |
Sergio Slobodrian | 7a7091c | 2017-06-21 23:45:45 -0400 | [diff] [blame] | 232 | |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 233 | containers: base voltha ofagent netconf shovel onos tester config-push dashd cli portainer grafana nginx consul tools envoy fluentd unum ponsim j2 test_runner |
Khen Nursimulu | aaac7ee | 2016-12-11 22:03:52 -0500 | [diff] [blame] | 234 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 235 | base: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 236 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-base:${TAG} -f docker/Dockerfile.base . |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 237 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 238 | ifneq ($(VOLTHA_BUILD),docker) |
Shad Ansari | 83777cb | 2017-06-02 14:56:08 -0700 | [diff] [blame] | 239 | voltha: voltha-adapters |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 240 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-voltha:${TAG} -f docker/Dockerfile.voltha . |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 241 | else |
| 242 | voltha: |
| 243 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-voltha:${TAG} -f docker/Dockerfile.voltha_d . |
| 244 | endif |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 245 | |
Shad Ansari | 83777cb | 2017-06-02 14:56:08 -0700 | [diff] [blame] | 246 | voltha-adapters: |
| 247 | make -C voltha/adapters/asfvolt16_olt |
Shad Ansari | 2825d01 | 2018-02-22 23:57:46 +0000 | [diff] [blame^] | 248 | make -C voltha/adapters/openolt |
Shad Ansari | 83777cb | 2017-06-02 14:56:08 -0700 | [diff] [blame] | 249 | |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 250 | ofagent: |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 251 | ifneq ($(VOLTHA_BUILD),docker) |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 252 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-ofagent:${TAG} -f docker/Dockerfile.ofagent . |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 253 | else |
| 254 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-ofagent:${TAG} -f docker/Dockerfile.ofagent_d . |
| 255 | endif |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 256 | |
Sergio Slobodrian | cab0a39 | 2017-07-13 08:42:10 -0400 | [diff] [blame] | 257 | tools: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 258 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-tools:${TAG} -f docker/Dockerfile.tools . |
Sergio Slobodrian | cab0a39 | 2017-07-13 08:42:10 -0400 | [diff] [blame] | 259 | |
sathishg | b5d1c18 | 2017-07-13 14:20:19 +0530 | [diff] [blame] | 260 | fluentd: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 261 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-fluentd:${TAG} -f docker/Dockerfile.fluentd . |
sathishg | b5d1c18 | 2017-07-13 14:20:19 +0530 | [diff] [blame] | 262 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 263 | envoy: envoyd |
| 264 | ifneq ($(VOLTHA_BUILD),docker) |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 265 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-envoy:${TAG} -f docker/Dockerfile.envoy . |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 266 | else |
| 267 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-envoy:${TAG} -f docker/Dockerfile.envoy_d . |
| 268 | endif |
Sergio Slobodrian | cab0a39 | 2017-07-13 08:42:10 -0400 | [diff] [blame] | 269 | |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 270 | envoyd: |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 271 | ifneq ($(VOLTHA_BUILD),docker) |
Sergio Slobodrian | 6570c74 | 2017-08-07 23:11:33 -0400 | [diff] [blame] | 272 | make -C envoy |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 273 | make -C envoy/go/envoyd |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 274 | endif |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 275 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 276 | go-builder: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 277 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-go-builder:${TAG} -f envoy/go/golang-builder/Dockerfile ./envoy/go/golang-builder |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 278 | |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 279 | netconf: |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 280 | ifneq ($(VOLTHA_BUILD),docker) |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 281 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-netconf:${TAG} -f docker/Dockerfile.netconf . |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 282 | else |
| 283 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-netconf:${TAG} -f docker/Dockerfile.netconf_d . |
| 284 | endif |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 285 | |
Stephane Barbarie | 1408896 | 2017-06-01 16:56:55 -0400 | [diff] [blame] | 286 | netopeer: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 287 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-netopeer:${TAG} -f docker/Dockerfile.netopeer . |
Stephane Barbarie | 1408896 | 2017-06-01 16:56:55 -0400 | [diff] [blame] | 288 | |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 289 | shovel: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 290 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-shovel:${TAG} -f docker/Dockerfile.shovel . |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 291 | |
Sergio Slobodrian | 9358bd4 | 2017-03-10 22:52:24 -0500 | [diff] [blame] | 292 | dashd: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 293 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-dashd:${TAG} -f docker/Dockerfile.dashd . |
Sergio Slobodrian | 9358bd4 | 2017-03-10 22:52:24 -0500 | [diff] [blame] | 294 | |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 295 | cli: |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 296 | ifneq ($(VOLTHA_BUILD),docker) |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 297 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-cli:${TAG} -f docker/Dockerfile.cli . |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 298 | else |
| 299 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-cli:${TAG} -f docker/Dockerfile.cli_d . |
| 300 | endif |
Sergio Slobodrian | ab11c64 | 2017-04-24 07:16:58 -0400 | [diff] [blame] | 301 | |
David K. Bainbridge | 60fdad7 | 2018-02-20 11:17:38 -0500 | [diff] [blame] | 302 | custom_cli: cli |
| 303 | ifeq ($(CUSTOM_CLI_LABEL),) |
| 304 | docker build ${DOCKER_BUILD_ARGS} -t ${REGISTRY}${REPOSITORY}voltha-cli-custom:${TAG} -f docker/Dockerfile.cli_custom . |
| 305 | else |
| 306 | docker build ${DOCKER_BUILD_ARGS} -t ${REGISTRY}${REPOSITORY}voltha-cli${CUSTOM_CLI_LABEL}:${TAG} -f docker/Dockerfile.cli_custom . |
| 307 | endif |
| 308 | |
Sergio Slobodrian | 4d30710 | 2017-04-24 10:19:00 -0400 | [diff] [blame] | 309 | portainer: |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 310 | ifneq ($(VOLTHA_BUILD),docker) |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 311 | REGISTRY=${REGISTRY} REPOSITORY=${REPOSITORY} TAG=${TAG} portainer/buildPortainer.sh |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 312 | else |
| 313 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-portainer:${TAG} -f docker/Dockerfile.portainer_d . |
| 314 | endif |
Sergio Slobodrian | 4d30710 | 2017-04-24 10:19:00 -0400 | [diff] [blame] | 315 | |
Sergio Slobodrian | ff52e1b | 2017-04-24 12:39:08 -0400 | [diff] [blame] | 316 | nginx: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 317 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-nginx:${TAG} -f docker/Dockerfile.nginx . |
Sergio Slobodrian | ff52e1b | 2017-04-24 12:39:08 -0400 | [diff] [blame] | 318 | |
schowdhury | 4073921 | 2017-06-12 07:40:31 -0700 | [diff] [blame] | 319 | consul: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 320 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-consul:${TAG} -f docker/Dockerfile.consul . |
schowdhury | 4073921 | 2017-06-12 07:40:31 -0700 | [diff] [blame] | 321 | |
Sergio Slobodrian | ff52e1b | 2017-04-24 12:39:08 -0400 | [diff] [blame] | 322 | grafana: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 323 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-grafana:${TAG} -f docker/Dockerfile.grafana . |
Sergio Slobodrian | ff52e1b | 2017-04-24 12:39:08 -0400 | [diff] [blame] | 324 | |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 325 | onos: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 326 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-onos:${TAG} -f docker/Dockerfile.onos docker |
Zsolt Haraszti | db89233 | 2017-01-09 11:08:38 -0800 | [diff] [blame] | 327 | |
David K. Bainbridge | 215e024 | 2017-09-05 23:18:24 -0700 | [diff] [blame] | 328 | unum: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 329 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-unum:${TAG} -f unum/Dockerfile ./unum |
David K. Bainbridge | 215e024 | 2017-09-05 23:18:24 -0700 | [diff] [blame] | 330 | |
alshabib | 5e18057 | 2017-01-10 23:59:47 -0600 | [diff] [blame] | 331 | tester: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 332 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-tester:${TAG} -f docker/Dockerfile.tester docker |
alshabib | 5e18057 | 2017-01-10 23:59:47 -0600 | [diff] [blame] | 333 | |
alshabib | a551408 | 2017-03-31 11:08:27 -0500 | [diff] [blame] | 334 | config-push: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 335 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-config-push:${TAG} -f docker/Dockerfile.configpush docker |
alshabib | a551408 | 2017-03-31 11:08:27 -0500 | [diff] [blame] | 336 | |
Stephane Barbarie | 95507c4 | 2017-09-19 10:41:04 -0400 | [diff] [blame] | 337 | opennms: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 338 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-opennms:${TAG} -f docker/Dockerfile.opennms . |
Stephane Barbarie | 95507c4 | 2017-09-19 10:41:04 -0400 | [diff] [blame] | 339 | |
| 340 | logstash: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 341 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-logstash:${TAG} -f docker/Dockerfile.logstash . |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 342 | |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 343 | ponsim: |
| 344 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-ponsim:${TAG} -f docker/Dockerfile.ponsim . |
| 345 | |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 346 | j2: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 347 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-j2:${TAG} -f docker/Dockerfile.j2 docker |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 348 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 349 | test_runner: |
| 350 | ifeq ($(VOLTHA_BUILD),docker) |
| 351 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-test_runner:${TAG} -f docker/Dockerfile.test_runner . |
| 352 | endif |
| 353 | |
Jonathan Hart | 2dd29dd | 2018-02-08 17:18:28 -0800 | [diff] [blame] | 354 | @MAKE_ENV := $(shell echo '$(.VARIABLES)' | awk -v RS=' ' '/^[a-zA-Z0-9]+$$/') |
| 355 | @SHELL_EXPORT := $(foreach v,$(MAKE_ENV),$(v)='$($(v))') |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 356 | start: |
Jonathan Hart | 2dd29dd | 2018-02-08 17:18:28 -0800 | [diff] [blame] | 357 | $(SHELL_EXPORT) STACK_TEMPLATE=./compose/voltha-stack.yml.j2 ./scripts/run-voltha.sh start |
| 358 | |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 359 | stop: |
Jonathan Hart | 2dd29dd | 2018-02-08 17:18:28 -0800 | [diff] [blame] | 360 | ./scripts/run-voltha.sh stop |
Sergio Slobodrian | ff52e1b | 2017-04-24 12:39:08 -0400 | [diff] [blame] | 361 | |
David K. Bainbridge | 03ad741 | 2018-01-19 16:41:38 -0800 | [diff] [blame] | 362 | tag: $(patsubst %,%.tag,$(DOCKER_IMAGE_LIST)) |
| 363 | |
| 364 | push: tag $(patsubst %,%.push,$(DOCKER_IMAGE_LIST)) |
| 365 | |
| 366 | pull: $(patsubst %,%.pull,$(DOCKER_IMAGE_LIST)) |
| 367 | |
| 368 | %.tag: |
| 369 | docker tag ${REGISTRY}${REPOSITORY}voltha-$(subst .tag,,$@):${TAG} ${TARGET_REGISTRY}${TARGET_REPOSITORY}voltha-$(subst .tag,,$@):${TARGET_TAG} |
| 370 | |
| 371 | %.push: |
| 372 | docker push ${TARGET_REGISTRY}${TARGET_REPOSITORY}voltha-$(subst .push,,$@):${TARGET_TAG} |
| 373 | |
| 374 | %.pull: |
| 375 | docker pull ${REGISTRY}${REPOSITORY}voltha-$(subst .pull,,$@):${TAG} |
| 376 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 377 | protoc: |
| 378 | ifeq ($(VOLTHA_BUILD),docker) |
| 379 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-protoc:${TAG} -f docker/Dockerfile.protoc . |
| 380 | endif |
| 381 | |
Zsolt Haraszti | 5cd6470 | 2016-09-27 13:48:35 -0700 | [diff] [blame] | 382 | protos: |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 383 | ifneq ($(VOLTHA_BUILD),docker) |
Zsolt Haraszti | 5cd6470 | 2016-09-27 13:48:35 -0700 | [diff] [blame] | 384 | make -C voltha/protos |
Zsolt Haraszti | 023ea7c | 2016-10-16 19:30:34 -0700 | [diff] [blame] | 385 | make -C ofagent/protos |
Khen Nursimulu | aaac7ee | 2016-12-11 22:03:52 -0500 | [diff] [blame] | 386 | make -C netconf/protos |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 387 | else |
| 388 | docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-protos:${TAG} -f docker/Dockerfile.protos . |
| 389 | endif |
Zsolt Haraszti | a54f2ac | 2016-09-21 15:54:15 -0700 | [diff] [blame] | 390 | |
| 391 | install-protoc: |
Zsolt Haraszti | 5cd6470 | 2016-09-27 13:48:35 -0700 | [diff] [blame] | 392 | make -C voltha/protos install-protoc |
Zsolt Haraszti | a54f2ac | 2016-09-21 15:54:15 -0700 | [diff] [blame] | 393 | |
Zsolt Haraszti | b71c2a0 | 2016-09-12 13:12:07 -0700 | [diff] [blame] | 394 | clean: |
| 395 | find voltha -name '*.pyc' | xargs rm -f |
| 396 | |
Nathan Knuth | a6b09e3 | 2016-09-21 16:26:09 -0700 | [diff] [blame] | 397 | distclean: clean |
| 398 | rm -rf ${VENVDIR} |
| 399 | |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 400 | fetch: |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 401 | @bash -c ' \ |
| 402 | for i in $(FETCH_IMAGE_LIST); do \ |
| 403 | docker pull $$i; \ |
| 404 | done' |
| 405 | |
| 406 | fetch-jenkins: fetch |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 407 | |
| 408 | purge-venv: |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 409 | rm -fr ${VENVDIR} |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 410 | |
| 411 | rebuild-venv: purge-venv venv |
| 412 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 413 | ifneq ($(VOLTHA_BUILD),docker) |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 414 | venv: ${VENVDIR}/.built |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 415 | else |
| 416 | venv: |
| 417 | endif |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 418 | |
| 419 | ${VENVDIR}/.built: |
| 420 | @ virtualenv ${VENVDIR} |
| 421 | @ . ${VENVDIR}/bin/activate && \ |
Zsolt Haraszti | 4161248 | 2016-09-21 12:26:20 -0700 | [diff] [blame] | 422 | pip install --upgrade pip; \ |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 423 | if ! pip install -r requirements.txt; \ |
| 424 | then \ |
| 425 | echo "On MAC OS X, if the installation failed with an error \n'<openssl/opensslv.h>': file not found,"; \ |
| 426 | echo "see the BUILD.md file for a workaround"; \ |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 427 | else \ |
Zsolt Haraszti | 4161248 | 2016-09-21 12:26:20 -0700 | [diff] [blame] | 428 | uname -s > ${VENVDIR}/.built; \ |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 429 | fi |
| 430 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 431 | ifneq ($(VOLTHA_BUILD),docker) |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 432 | test: venv protos run-as-root-tests |
| 433 | @ echo "Executing all tests" |
| 434 | . ${VENVDIR}/bin/activate && \ |
| 435 | nosetests -s tests \ |
| 436 | --exclude-dir=./tests/itests/run_as_root/ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 437 | else |
| 438 | test: protos test_runner run-as-root-tests |
| 439 | docker run \ |
| 440 | -e VOLTHA_BUILD=docker \ |
| 441 | -e REGISTRY=${REGISTRY} \ |
| 442 | -e REPOSITORY=${REPOSITORY} \ |
| 443 | -e TAG=${TAG} \ |
| 444 | -e DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
| 445 | --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock \ |
| 446 | ${REGISTRY}${REPSOITORY}voltha-test_runner:${TAG} \ |
| 447 | nosetests -s tests --exclude-dir=./tests/itests/run_as_root/ |
| 448 | endif |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 449 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 450 | ifneq ($(VOLTHA_BUILD),docker) |
Zsolt Haraszti | 6618662 | 2016-11-08 14:24:00 -0800 | [diff] [blame] | 451 | utest: venv protos |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 452 | @ echo "Executing all unit tests" |
| 453 | . ${VENVDIR}/bin/activate && \ |
Kim Kempf | 8c2812c | 2017-10-23 15:07:50 -0700 | [diff] [blame] | 454 | for d in $$(find ./tests/utests -type d|sort -nr); do echo $$d:; nosetests $$d; done |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 455 | else |
| 456 | utest: protos test_runner |
| 457 | docker run \ |
| 458 | -e VOLTHA_BUILD=docker \ |
| 459 | -e REGISTRY=${REGISTRY} \ |
| 460 | -e REPOSITORY=${REPOSITORY} \ |
| 461 | -e TAG=${TAG} \ |
| 462 | -e DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
| 463 | --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock \ |
| 464 | ${REGISTRY}${REPSOITORY}voltha-test_runner:${TAG} \ |
| 465 | bash -c \ |
| 466 | 'for d in $$(find ./tests/utests -type d|sort -nr); do \ |
| 467 | echo $$d:; \ |
| 468 | nosetests $$d; \ |
| 469 | done' |
| 470 | endif |
alshabib | 29a3ed5 | 2017-01-23 14:29:21 -0800 | [diff] [blame] | 471 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 472 | ifneq ($(VOLTHA_BUILD),docker) |
alshabib | 29a3ed5 | 2017-01-23 14:29:21 -0800 | [diff] [blame] | 473 | utest-with-coverage: venv protos |
| 474 | @ echo "Executing all unit tests and producing coverage results" |
| 475 | . ${VENVDIR}/bin/activate && \ |
Kim Kempf | 8c2812c | 2017-10-23 15:07:50 -0700 | [diff] [blame] | 476 | for d in $$(find ./tests/utests -type d|sort -nr); do echo $$d:; \ |
khenaidoo | 079a776 | 2017-10-26 21:42:05 -0400 | [diff] [blame] | 477 | nosetests --with-xcoverage --with-xunit --cover-package=voltha,common,ofagent $$d; done |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 478 | else |
| 479 | utest-with-coverage: protos test_runner |
| 480 | @echo "Executing all unit tests and producing coverage results" |
| 481 | docker run \ |
| 482 | -e VOLTHA_BUILD=docker \ |
| 483 | -e REGISTRY=${REGISTRY} \ |
| 484 | -e REPOSITORY=${REPOSITORY} \ |
| 485 | -e TAG=${TAG} \ |
| 486 | -e DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
| 487 | --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock \ |
| 488 | ${REGISTRY}${REPSOITORY}voltha-test_runner:${TAG} \ |
| 489 | bash -c \ |
| 490 | 'for d in $$(find ./tests/utests -type d|sort -nr); do \ |
| 491 | echo $$d:; \ |
| 492 | nosetests --with-xcoverage --with-xunit --cover-package=voltha,common,ofagent $$d; \ |
| 493 | done' |
| 494 | endif |
Khen Nursimulu | 37a9bf8 | 2016-10-16 20:11:31 -0400 | [diff] [blame] | 495 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 496 | ifneq ($(VOLTHA_BUILD),docker) |
Zsolt Haraszti | 348d193 | 2016-12-10 01:10:07 -0800 | [diff] [blame] | 497 | itest: venv run-as-root-tests |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 498 | @ echo "Executing all integration tests" |
| 499 | . ${VENVDIR}/bin/activate && \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 500 | rm -rf /tmp/fluentd/* && \ |
| 501 | REGISTRY=${REGISTRY} \ |
| 502 | REPOSITORY=${REPOSITORY} \ |
| 503 | TAG=${TAG} \ |
| 504 | DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 505 | nosetests -s \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 506 | tests/itests/docutests/build_md_test.py \ |
| 507 | --exclude-dir=./tests/utests/ \ |
| 508 | --exclude-dir=./tests/itests/run_as_root/ |
| 509 | else |
| 510 | itest: protos test_runner |
| 511 | @ echo "Executing all integration tests" |
| 512 | docker run \ |
| 513 | -e VOLTHA_BUILD=docker \ |
| 514 | -e REGISTRY=${REGISTRY} \ |
| 515 | -e REPOSITORY=${REPOSITORY} \ |
| 516 | -e TAG=${TAG} \ |
| 517 | -e DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
| 518 | --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock \ |
| 519 | ${REGISTRY}${REPSOITORY}voltha-test_runner:${TAG} \ |
| 520 | nosetests -s \ |
| 521 | tests/itests/docutests/build_md_test.py \ |
| 522 | --exclude-dir=./tests/utests/ \ |
| 523 | --exclude-dir=./tests/itests/run_as_root/ |
| 524 | endif |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 525 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 526 | ifneq ($(VOLTHA_BUILD),docker) |
Zsolt Haraszti | 348d193 | 2016-12-10 01:10:07 -0800 | [diff] [blame] | 527 | smoke-test: venv run-as-root-tests |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 528 | @ echo "Executing smoke tests" |
Khen Nursimulu | 96bb532 | 2016-11-09 20:16:03 -0800 | [diff] [blame] | 529 | . ${VENVDIR}/bin/activate && \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 530 | rm -rf /tmp/fluentd/* && \ |
| 531 | REGISTRY=${REGISTRY} \ |
| 532 | REPOSITORY=${REPOSITORY} \ |
| 533 | TAG=${TAG} \ |
| 534 | DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
Khen Nursimulu | 96bb532 | 2016-11-09 20:16:03 -0800 | [diff] [blame] | 535 | nosetests -s \ |
| 536 | tests/itests/docutests/build_md_test.py:BuildMdTests.test_07_start_all_containers \ |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 537 | --exclude-dir=./tests/itests/run_as_root/ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 538 | else |
| 539 | smoke-test: protos test_runner run-as-root-tests |
| 540 | @ echo "Executing smoke tests" |
| 541 | docker run \ |
| 542 | -e VOLTHA_BUILD=docker \ |
| 543 | -e REGISTRY=${REGISTRY} \ |
| 544 | -e REPOSITORY=${REPOSITORY} \ |
| 545 | -e TAG=${TAG} \ |
| 546 | -e DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
| 547 | --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock \ |
| 548 | ${REGISTRY}${REPSOITORY}voltha-test_runner:${TAG} \ |
| 549 | nosetests -s \ |
| 550 | tests/itests/docutests/build_md_test.py:BuildMdTests.test_07_start_all_containers \ |
| 551 | --exclude-dir=./tests/itests/run_as_root/ |
| 552 | endif |
Khen Nursimulu | 96bb532 | 2016-11-09 20:16:03 -0800 | [diff] [blame] | 553 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 554 | ifneq ($(VOLTHA_BUILD),docker) |
khenaidoo | 1243ee9 | 2017-07-17 15:54:06 -0400 | [diff] [blame] | 555 | jenkins-test: venv |
| 556 | @ echo "Executing jenkins smoke tests" |
| 557 | . ${VENVDIR}/bin/activate && \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 558 | rm -rf /tmp/fluentd/* && \ |
| 559 | REGISTRY=${REGISTRY} \ |
| 560 | REPOSITORY=${REPOSITORY} \ |
| 561 | TAG=${TAG} \ |
| 562 | DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
khenaidoo | 1243ee9 | 2017-07-17 15:54:06 -0400 | [diff] [blame] | 563 | nosetests -s \ |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 564 | tests/itests/docutests/build_md_test.py:BuildMdTests.test_07_start_all_containers \ |
| 565 | --exclude-dir=./tests/itests/run_as_root/ |
| 566 | else |
| 567 | jenkins-test: protos test_runner |
| 568 | @ echo "Executing jenkins smoke tests" |
| 569 | @ echo "Starting VOLTHA as docker-compose services" |
| 570 | docker run \ |
| 571 | -e REGISTRY=${REGISTRY} \ |
| 572 | -e REPOSITORY=${REPOSITORY} \ |
| 573 | -e TAG=${TAG} \ |
| 574 | -e DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
| 575 | --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock \ |
| 576 | ${REGISTRY}${REPSOITORY}voltha-test_runner:${TAG} \ |
| 577 | nosetests -s \ |
| 578 | tests/itests/docutests/build_md_test.py:BuildMdTests.test_07_start_all_containers \ |
| 579 | --exclude-dir=./tests/itests/run_as_root/ |
| 580 | endif |
khenaidoo | 1243ee9 | 2017-07-17 15:54:06 -0400 | [diff] [blame] | 581 | |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 582 | ifneq ($(VOLTHA_BUILD),docker) |
Khen Nursimulu | 34e7ebb | 2016-11-10 13:38:44 -0800 | [diff] [blame] | 583 | run-as-root-tests: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 584 | docker run -i --rm -v /cord/incubator/voltha:/voltha --privileged ${REGISTRY}${REPOSITORY}voltha-base:${TAG} env PYTHONPATH=/voltha python /voltha/tests/itests/run_as_root/test_frameio.py |
David K. Bainbridge | 10a7a7e | 2018-01-29 09:54:40 -0800 | [diff] [blame] | 585 | else |
| 586 | run-as-root-tests: |
| 587 | docker run \ |
| 588 | -e VOLTHA_BUILD=docker \ |
| 589 | -e REGISTRY=${REGISTRY} \ |
| 590 | -e REPOSITORY=${REPOSITORY} \ |
| 591 | -e TAG=${TAG} \ |
| 592 | -e DOCKER_HOST_IP=${DOCKER_HOST_IP} \ |
| 593 | --rm --privileged \ |
| 594 | ${REGISTRY}${REPOSITORY}voltha-test_runner:${TAG} \ |
| 595 | env PYTHONPATH=/work python tests/itests/run_as_root/test_frameio.py |
| 596 | endif |
Nathan Knuth | 84dfd2e | 2016-09-16 15:06:34 -0700 | [diff] [blame] | 597 | |
| 598 | flake8: $(DIRS_FLAKE8) |
Nathan Knuth | 220a677 | 2016-10-11 08:10:46 -0700 | [diff] [blame] | 599 | |
| 600 | # end file |