blob: 08808f232ecf9ba8cbcd754202d37425a6311998 [file] [log] [blame]
Matteo Scandolo4747d292019-08-05 11:50:18 -07001# Copyright 2019-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Matteo Scandolo0b603aa2020-08-21 14:40:48 -070015SHELL = bash -e -o pipefail
Matteo Scandolo4747d292019-08-05 11:50:18 -070016VERSION ?= $(shell cat ./VERSION)
Matteo Scandolo84f7d482019-08-08 19:00:47 -070017DIFF ?= $(git diff --shortstat 2> /dev/null | tail -n1)
Zdravko Bozakov2da76342019-10-21 09:47:35 +020018GIT_STATUS ?= $(shell [ -z "$DIFF" ] && echo "Dirty" || echo "Clean")
Matteo Scandolo4747d292019-08-05 11:50:18 -070019
20## Docker related
21DOCKER_TAG ?= ${VERSION}
Matteo Scandolo5daa2ab2019-10-08 08:27:18 -070022DOCKER_REPOSITORY ?= ""
Matteo Scandolo4747d292019-08-05 11:50:18 -070023DOCKER_REGISTRY ?= ""
Matteo Scandolo4b3fc7e2019-09-17 16:49:54 -070024DOCKER_RUN_ARGS ?= ""
Andrea Campanellad683d162020-10-13 16:40:27 +020025DOCKER_PORTS ?= -p 50070:50070 -p 50060:50060 -p 50071:50071 -p 50072:50072 -p 50073:50073 -p 50074:50074 -p 50075:50075
Andrea Campanella64dffd52019-12-17 17:29:57 -080026TYPE ?= minimal
Zdravko Bozakov2da76342019-10-21 09:47:35 +020027
Kent Hagerman60d62302020-03-10 17:02:36 -040028# tool containers
Matteo Scandolo34a9ea32020-11-19 17:40:49 -080029VOLTHA_TOOLS_VERSION ?= 2.3.1
Zdravko Bozakov2da76342019-10-21 09:47:35 +020030
Kent Hagerman60d62302020-03-10 17:02:36 -040031GO = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golang go
32GO_SH = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golang sh -c '
Kent Hagerman60d62302020-03-10 17:02:36 -040033GO_JUNIT_REPORT = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app -i voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-go-junit-report go-junit-report
Matteo Scandolo34a9ea32020-11-19 17:40:49 -080034GOCOVER_COBERTURA = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app/src/github.com/opencord/bbsim -i voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-gocover-cobertura gocover-cobertura
Matteo Scandolo90d08f62020-10-29 12:06:55 -070035GOLANGCI_LINT = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golangci-lint golangci-lint
Kent Hagerman60d62302020-03-10 17:02:36 -040036HADOLINT = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-hadolint hadolint
37PROTOC = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-protoc protoc
38
Matteo Scandolo4747d292019-08-05 11:50:18 -070039# Public targets
Matteo Scandolo4747d292019-08-05 11:50:18 -070040all: help
41
hkouser24361d42020-12-14 19:21:47 +053042protos: api/bbsim/bbsim.pb.go api/bbsim/bbsim.pb.gw.go api/legacy/bbsim.pb.go api/legacy/bbsim.pb.gw.go api/bbsim/bbsim_dmi.pb.go # @HELP Build proto files
Matteo Scandolo01d41ce2019-10-28 15:42:47 -070043
Matteo Scandolo6866b8c2019-10-28 16:15:24 -070044.PHONY: build
Kent Hagerman60d62302020-03-10 17:02:36 -040045build: protos build-bbsim build-bbsimctl build-bbr
46
47## lint and unit tests
48
49lint-dockerfile:
50 @echo "Running Dockerfile lint check..."
51 @${HADOLINT} $$(find ./build -name "Dockerfile*")
52 @echo "Dockerfile lint check OK"
53
54lint-mod:
55 @echo "Running dependency check..."
56 @${GO} mod verify
57 @echo "Dependency check OK. Running vendor check..."
58 @git status > /dev/null
59 @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Staged or modified files must be committed before running this test" && git status -- go.mod go.sum vendor && exit 1)
60 @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files must be cleaned up before running this test" && git status -- go.mod go.sum vendor && exit 1)
61 ${GO} mod tidy
62 ${GO} mod vendor
63 @git status > /dev/null
64 @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Modified files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1)
65 @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1)
66 @echo "Vendor check OK."
67
68lint: lint-mod lint-dockerfile
69
Matteo Scandolo90d08f62020-10-29 12:06:55 -070070sca:
Kent Hagerman60d62302020-03-10 17:02:36 -040071 @rm -rf ./sca-report
72 @mkdir -p ./sca-report
73 @echo "Running static code analysis..."
Matteo Scandolo96f89192021-03-12 13:17:26 -080074 @${GOLANGCI_LINT} run -vv --deadline=6m --out-format junit-xml ./... | tee ./sca-report/sca-report.xml
Kent Hagerman60d62302020-03-10 17:02:36 -040075 @echo ""
76 @echo "Static code analysis OK"
Matteo Scandolo4747d292019-08-05 11:50:18 -070077
Matteo Scandolo0e9fabf2020-09-30 17:19:27 -070078test: docs-lint test-unit test-bbr
Matteo Scandolo569e7172019-12-20 11:51:51 -080079
Matteo Scandolocedde462021-03-09 17:37:16 -080080test-unit: clean local-omci-lib-go # @HELP Execute unit tests
Matteo Scandolo90d08f62020-10-29 12:06:55 -070081 @echo "Running unit tests..."
Kent Hagerman60d62302020-03-10 17:02:36 -040082 @mkdir -p ./tests/results
Matteo Scandolo4b077aa2021-02-16 17:33:37 -080083 @${GO} test -mod=vendor -bench=. -v -coverprofile ./tests/results/go-test-coverage.out -covermode count ./... 2>&1 | tee ./tests/results/go-test-results.out ;\
Kent Hagerman60d62302020-03-10 17:02:36 -040084 RETURN=$$? ;\
85 ${GO_JUNIT_REPORT} < ./tests/results/go-test-results.out > ./tests/results/go-test-results.xml ;\
86 ${GOCOVER_COBERTURA} < ./tests/results/go-test-coverage.out > ./tests/results/go-test-coverage.xml ;\
87 exit $$RETURN
Matteo Scandolo4747d292019-08-05 11:50:18 -070088
Kent Hagerman60d62302020-03-10 17:02:36 -040089test-bbr: release-bbr docker-build # @HELP Validate that BBSim and BBR are working together
Matteo Scandolo4a036262020-08-17 15:56:13 -070090 DOCKER_RUN_ARGS="-pon 2 -onu 2" make docker-run
Matteo Scandolo569e7172019-12-20 11:51:51 -080091 sleep 5
Matteo Scandoloc11074d2020-09-14 14:59:24 -070092 ./$(RELEASE_DIR)/$(RELEASE_BBR_NAME)-linux-amd64 -pon 2 -onu 2 -logfile tmp.logs
Matteo Scandolo569e7172019-12-20 11:51:51 -080093 docker rm -f bbsim
94
Kent Hagerman60d62302020-03-10 17:02:36 -040095mod-update: # @HELP Download the dependencies to the vendor folder
96 ${GO} mod tidy
97 ${GO} mod vendor
Matteo Scandolo38305492019-10-11 11:36:00 -070098
Matteo Scandolocedde462021-03-09 17:37:16 -080099docker-build: local-omci-lib-go local-protos# @HELP Build the BBSim docker container (contains BBSimCtl too)
Kent Hagerman60d62302020-03-10 17:02:36 -0400100 docker build \
101 -t ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}bbsim:${DOCKER_TAG} \
102 -f build/package/Dockerfile .
Matteo Scandolo4747d292019-08-05 11:50:18 -0700103
Matteo Scandolo01d41ce2019-10-28 15:42:47 -0700104docker-push: # @HELP Push the docker container to a registry
Matteo Scandolo4747d292019-08-05 11:50:18 -0700105 docker push ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}bbsim:${DOCKER_TAG}
Andrea Campanella64dffd52019-12-17 17:29:57 -0800106docker-kind-load:
107 @if [ "`kind get clusters | grep voltha-$(TYPE)`" = '' ]; then echo "no voltha-$(TYPE) cluster found" && exit 1; fi
108 kind load docker-image ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}bbsim:${DOCKER_TAG} --name=voltha-$(TYPE) --nodes $(shell kubectl get nodes --template='{{range .items}}{{.metadata.name}},{{end}}' | sed 's/,$$//')
109
Matteo Scandoloe383d5d2019-10-25 14:47:27 -0700110docker-run: # @HELP Runs the container locally (available options: DOCKER_RUN_ARGS="-pon 2 -onu 2" make docker-run)
Zdravko Bozakov2da76342019-10-21 09:47:35 +0200111 docker run -d ${DOCKER_PORTS} --privileged --rm --name bbsim ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}bbsim:${DOCKER_TAG} /app/bbsim ${DOCKER_RUN_ARGS}
Matteo Scandolo4b3fc7e2019-09-17 16:49:54 -0700112
Matteo Scandoloe383d5d2019-10-25 14:47:27 -0700113docker-run-dev: # @HELP Runs the container locally (intended for development purposes, not in detached mode)
Zdravko Bozakov2da76342019-10-21 09:47:35 +0200114 docker run ${DOCKER_PORTS} --privileged --rm --name bbsim ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}bbsim:${DOCKER_TAG} /app/bbsim ${DOCKER_RUN_ARGS}
Matteo Scandoloe383d5d2019-10-25 14:47:27 -0700115
Zack Williams4b0ef4d2019-12-18 14:25:20 -0700116.PHONY: docs docs-lint
Zdravko Bozakov2da76342019-10-21 09:47:35 +0200117docs: swagger # @HELP Generate docs and opens them in the browser
Zack Williams4b0ef4d2019-12-18 14:25:20 -0700118 make -C docs html
Zdravko Bozakov2da76342019-10-21 09:47:35 +0200119 @echo -e "\nBBSim documentation generated in file://${PWD}/docs/build/html/index.html"
Matteo Scandolo40e067f2019-10-16 16:59:41 -0700120
Zack Williams4b0ef4d2019-12-18 14:25:20 -0700121docs-lint:
122 make -C docs lint
123
Matteo Scandolo8dea3992019-10-22 10:54:25 -0700124# Release related items
125# Generates binaries in $RELEASE_DIR with name $RELEASE_NAME-$RELEASE_OS_ARCH
126# Inspired by: https://github.com/kubernetes/minikube/releases
127RELEASE_DIR ?= release
128RELEASE_OS_ARCH ?= linux-amd64 linux-arm64 windows-amd64 darwin-amd64
129
Kent Hagerman60d62302020-03-10 17:02:36 -0400130RELEASE_BBR_NAME ?= bbr
131RELEASE_BBSIM_NAME ?= bbsim
132RELEASE_BBSIMCTL_NAME ?= bbsimctl
Matteo Scandolo8dea3992019-10-22 10:54:25 -0700133
Matteo Scandolo90d08f62020-10-29 12:06:55 -0700134release-bbr:
Kent Hagerman60d62302020-03-10 17:02:36 -0400135 @echo "$(RELEASE_BBR_NAME)-linux-amd64"
Matteo Scandolo90d08f62020-10-29 12:06:55 -0700136 @${GO} build -mod vendor \
Kent Hagerman60d62302020-03-10 17:02:36 -0400137 -ldflags "-w -X main.buildTime=$(shell date +%Y/%m/%d-%H:%M:%S) \
138 -X main.commitHash=$(shell git log --pretty=format:%H -n 1) \
139 -X main.gitStatus=${GIT_STATUS} \
140 -X main.version=${VERSION}" \
141 -o "$(RELEASE_DIR)/$(RELEASE_BBR_NAME)-linux-amd64" ./cmd/bbr
Matteo Scandolo8dea3992019-10-22 10:54:25 -0700142
Matteo Scandolo90d08f62020-10-29 12:06:55 -0700143release-bbsim:
Kent Hagerman60d62302020-03-10 17:02:36 -0400144 @echo "$(RELEASE_BBSIM_NAME)-linux-amd64"
Matteo Scandolo90d08f62020-10-29 12:06:55 -0700145 @${GO} build -mod vendor \
Kent Hagerman60d62302020-03-10 17:02:36 -0400146 -ldflags "-w -X main.buildTime=$(shell date +%Y/%m/%d-%H:%M:%S) \
147 -X main.commitHash=$(shell git log --pretty=format:%H -n 1) \
148 -X main.gitStatus=${GIT_STATUS} \
149 -X main.version=${VERSION}" \
150 -o "$(RELEASE_DIR)/$(RELEASE_BBSIM_NAME)-linux-amd64" ./cmd/bbsim
Matteo Scandolo8dea3992019-10-22 10:54:25 -0700151
Kent Hagerman60d62302020-03-10 17:02:36 -0400152release-bbsimctl:
153 @${GO_SH} set -eo pipefail; \
154 for os_arch in ${RELEASE_OS_ARCH}; do \
155 echo "$(RELEASE_BBSIMCTL_NAME)-$$os_arch"; \
156 GOOS="$${os_arch%-*}" GOARCH="$${os_arch#*-}" go build -mod vendor \
157 -ldflags "-w -X github.com/opencord/bbsim/internal/bbsimctl/config.BuildTime=$(shell date +%Y/%m/%d-%H:%M:%S) \
158 -X github.com/opencord/bbsim/internal/bbsimctl/config.CommitHash=$(shell git log --pretty=format:%H -n 1) \
159 -X github.com/opencord/bbsim/internal/bbsimctl/config.GitStatus=${GIT_STATUS} \
160 -X github.com/opencord/bbsim/internal/bbsimctl/config.Version=${VERSION}" \
161 -o "$(RELEASE_DIR)/$(RELEASE_BBSIMCTL_NAME)-$$os_arch" ./cmd/bbsimctl; \
162 done'
163
164.PHONY: release release-bbr release-bbsim release-bbsimctl
165release: release-bbr release-bbsim release-bbsimctl # @HELP Creates release ready bynaries for BBSimctl and BBR artifacts
Zdravko Bozakov2da76342019-10-21 09:47:35 +0200166swagger: docs/swagger/bbsim/bbsim.swagger.json docs/swagger/leagacy/bbsim.swagger.json # @HELP Generate swagger documentation for BBSim API
Matteo Scandolo8dea3992019-10-22 10:54:25 -0700167
Matteo Scandolo4747d292019-08-05 11:50:18 -0700168help: # @HELP Print the command options
169 @echo
170 @echo "\033[0;31m BroadBand Simulator (BBSim) \033[0m"
171 @echo
172 @echo Emulates the control plane of an openolt compatible device
173 @echo Useful for development and scale testing
174 @echo
175 @grep -E '^.*: .* *# *@HELP' $(MAKEFILE_LIST) \
176 | sort \
177 | awk ' \
178 BEGIN {FS = ": .* *# *@HELP"}; \
179 {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}; \
180 '
181
Matteo Scandoloca08fc72019-12-04 14:17:39 -0800182## Local Development Helpers
Matteo Scandolocedde462021-03-09 17:37:16 -0800183local-omci-lib-go:
184ifdef LOCAL_OMCI_LIB_GO
185 mkdir -p vendor/github.com/opencord/omci-lib-go
186 cp -r ${LOCAL_OMCI_LIB_GO}/* vendor/github.com/opencord/omci-lib-go
Matteo Scandoloca08fc72019-12-04 14:17:39 -0800187endif
Matteo Scandolo4747d292019-08-05 11:50:18 -0700188
Matteo Scandolo4f4ac792020-10-01 16:33:21 -0700189local-protos: ## Copies a local version of the voltha-protos dependency into the vendor directory
190ifdef LOCAL_PROTOS
David K. Bainbridgec415efe2021-08-19 13:05:21 +0000191 rm -rf vendor/github.com/opencord/voltha-protos/v5/go
192 mkdir -p vendor/github.com/opencord/voltha-protos/v5/go
193 cp -r ${LOCAL_PROTOS}/go/* vendor/github.com/opencord/voltha-protos/v5/go
194 rm -rf vendor/github.com/opencord/voltha-protos/v5/go/vendor
Matteo Scandolo4f4ac792020-10-01 16:33:21 -0700195endif
196
Matteo Scandolo4747d292019-08-05 11:50:18 -0700197# Internals
Matteo Scandolo8dea3992019-10-22 10:54:25 -0700198
Matteo Scandolo3de9de02019-11-14 13:40:03 -0800199clean:
Kent Hagerman60d62302020-03-10 17:02:36 -0400200 @rm -f bbsim
201 @rm -f bbsimctl
202 @rm -f bbr
203 @rm -rf tools/bin
204 @rm -rf release/*
Matteo Scandolo3de9de02019-11-14 13:40:03 -0800205
Matteo Scandolocedde462021-03-09 17:37:16 -0800206build-bbr: local-omci-lib-go local-protos
Kent Hagerman60d62302020-03-10 17:02:36 -0400207 @go build -mod vendor \
208 -ldflags "-w -X main.buildTime=$(shell date +%Y/%m/%d-%H:%M:%S) \
209 -X main.commitHash=$(shell git log --pretty=format:%H -n 1) \
210 -X main.gitStatus=${GIT_STATUS} \
211 -X main.version=${VERSION}" \
212 ./cmd/bbr
Matteo Scandolo40e067f2019-10-16 16:59:41 -0700213
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700214build-bbsim:
Kent Hagerman60d62302020-03-10 17:02:36 -0400215 @go build -mod vendor \
216 -ldflags "-w -X main.buildTime=$(shell date +%Y/%m/%d-%H:%M:%S) \
217 -X main.commitHash=$(shell git log --pretty=format:%H -n 1) \
218 -X main.gitStatus=${GIT_STATUS} \
219 -X main.version=${VERSION}" \
220 ./cmd/bbsim
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700221
222build-bbsimctl:
Kent Hagerman60d62302020-03-10 17:02:36 -0400223 @go build -mod vendor \
224 -ldflags "-w -X github.com/opencord/bbsim/internal/bbsimctl/config.BuildTime=$(shell date +%Y/%m/%d-%H:%M:%S) \
225 -X github.com/opencord/bbsim/internal/bbsimctl/config.CommitHash=$(shell git log --pretty=format:%H -n 1) \
226 -X github.com/opencord/bbsim/internal/bbsimctl/config.GitStatus=${GIT_STATUS} \
227 -X github.com/opencord/bbsim/internal/bbsimctl/config.Version=${VERSION}" \
228 ./cmd/bbsimctl
Matteo Scandolo4747d292019-08-05 11:50:18 -0700229
Kent Hagerman60d62302020-03-10 17:02:36 -0400230setup_tools:
231 @echo "Downloading dependencies..."
David K. Bainbridgec415efe2021-08-19 13:05:21 +0000232 @${GO} mod download github.com/grpc-ecosystem/grpc-gateway github.com/opencord/voltha-protos/v5
Kent Hagerman60d62302020-03-10 17:02:36 -0400233 @echo "Dependencies downloaded OK"
Matteo Scandolo84f7d482019-08-08 19:00:47 -0700234
David K. Bainbridgec415efe2021-08-19 13:05:21 +0000235VOLTHA_PROTOS ?= $(shell ${GO} list -f '{{ .Dir }}' -m github.com/opencord/voltha-protos/v5)
Kent Hagerman60d62302020-03-10 17:02:36 -0400236GOOGLEAPI ?= $(shell ${GO} list -f '{{ .Dir }}' -m github.com/grpc-ecosystem/grpc-gateway)
Matteo Scandolo4747d292019-08-05 11:50:18 -0700237
Kent Hagerman60d62302020-03-10 17:02:36 -0400238.PHONY: api/openolt/openolt.pb.go api/bbsim/bbsim.pb.go api/bbsim/bbsim.pb.gw.go api/legacy/bbsim.pb.go api/legacy/bbsim.pb.gw.go docs/swagger/bbsim/bbsim.swagger.json docs/swagger/leagacy/bbsim.swagger.json
239api/openolt/openolt.pb.go: api/openolt/openolt.proto setup_tools
240 @echo $@
241 @${PROTOC} -I. \
242 -I${GOOGLEAPI}/third_party/googleapis \
amit.ghoshee17c002021-06-10 12:14:38 +0200243 --go_out=plugins=grpc:./ --go_opt=paths=source_relative \
Kent Hagerman60d62302020-03-10 17:02:36 -0400244 $<
Zdravko Bozakov2da76342019-10-21 09:47:35 +0200245
hkouser24361d42020-12-14 19:21:47 +0530246api/bbsim/bbsim_dmi.pb.go: api/bbsim/bbsim_dmi.proto setup_tools
247 @echo $@
248 @${PROTOC} -I. \
249 -I${GOOGLEAPI}/third_party/googleapis \
amit.ghoshee17c002021-06-10 12:14:38 +0200250 --go_out=plugins=grpc:./ --go_opt=paths=source_relative \
hkouser24361d42020-12-14 19:21:47 +0530251 $<
252
Kent Hagerman60d62302020-03-10 17:02:36 -0400253api/bbsim/bbsim.pb.go api/bbsim/bbsim.pb.gw.go: api/bbsim/bbsim.proto api/bbsim/bbsim.yaml setup_tools
254 @echo $@
255 @${PROTOC} -I. \
256 -I${GOOGLEAPI}/third_party/googleapis \
257 -I${VOLTHA_PROTOS}/protos/ \
amit.ghoshee17c002021-06-10 12:14:38 +0200258 --go_out=plugins=grpc:./ --go_opt=paths=source_relative \
259 --grpc-gateway_out=logtostderr=true,paths=source_relative,grpc_api_configuration=api/bbsim/bbsim.yaml,allow_delete_body=true:./ \
Kent Hagerman60d62302020-03-10 17:02:36 -0400260 $<
Zdravko Bozakov2da76342019-10-21 09:47:35 +0200261
Kent Hagerman60d62302020-03-10 17:02:36 -0400262api/legacy/bbsim.pb.go api/legacy/bbsim.pb.gw.go: api/legacy/bbsim.proto setup_tools
263 @echo $@
264 @${PROTOC} -I. \
265 -I${GOOGLEAPI}/third_party/googleapis/ \
266 -I${GOOGLEAPI}/ \
267 -I${VOLTHA_PROTOS}/protos/ \
268 --go_out=plugins=grpc:./ \
amit.ghoshee17c002021-06-10 12:14:38 +0200269 --grpc-gateway_out=logtostderr=true,paths=source_relative,allow_delete_body=true:./ \
Kent Hagerman60d62302020-03-10 17:02:36 -0400270 $<
271
272docs/swagger/bbsim/bbsim.swagger.json: api/bbsim/bbsim.yaml setup_tools
273 @echo $@
274 @${PROTOC} -I ./api \
275 -I${GOOGLEAPI}/ \
276 -I${VOLTHA_PROTOS}/protos/ \
Zack Williamsd2907e62020-04-03 10:23:02 -0700277 --swagger_out=logtostderr=true,allow_delete_body=true,disable_default_errors=true,grpc_api_configuration=$<:docs/swagger/ \
Kent Hagerman60d62302020-03-10 17:02:36 -0400278 api/bbsim/bbsim.proto
279
280docs/swagger/leagacy/bbsim.swagger.json: api/legacy/bbsim.proto setup_tools
281 @echo $@
282 @${PROTOC} -I ./api \
283 -I${GOOGLEAPI}/ \
284 -I${VOLTHA_PROTOS}/protos/ \
Zack Williamsd2907e62020-04-03 10:23:02 -0700285 --swagger_out=logtostderr=true,allow_delete_body=true,disable_default_errors=true:docs/swagger/ \
Kent Hagerman60d62302020-03-10 17:02:36 -0400286 $<