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