SEBA-432
SEBA-565
SEBA-654 (alarms)

implemented

fix Jenkins make errors
fix merge conflicts
address review comments

Change-Id: Ia2e95afb33ce55054afa1fcbd9beb6ada62dd764
diff --git a/Makefile b/Makefile
index d73ab70..e2c0242 100644
--- a/Makefile
+++ b/Makefile
@@ -19,16 +19,17 @@
 .PHONY: dep test clean docker
 
 prereq:
-	go get -u google.golang.org/grpc
+	go get -v google.golang.org/grpc
 	go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
 	go get -v github.com/golang/protobuf/protoc-gen-go
+	go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
 	go get -v github.com/google/gopacket
 	go get -v github.com/opencord/omci-sim
 
-bbsim: prereq protos/openolt.pb.go dep
+bbsim: prereq protos/openolt.pb.go bbsimapi dep
 	go build -i -v -o $@
 
-dep: protos/openolt.pb.go
+dep: protos/openolt.pb.go bbsimapi
 	go get -v -d ./...
 
 protos/openolt.pb.go: openolt.proto
@@ -38,6 +39,23 @@
 	--go_out=plugins=grpc:protos/ \
 	$<
 
+bbsimapi: api/bbsim.proto
+	@protoc -I ./api \
+	-I${GOPATH}/src \
+	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
+	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway \
+	--go_out=plugins=grpc:api/ \
+	--grpc-gateway_out=logtostderr=true,allow_delete_body=true:api/ \
+	bbsim.proto
+
+swagger:						 ## Generate swagger documentation for BBsim API
+	@protoc -I ./api \
+	-I${GOPATH}/src \
+	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
+	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway \
+	--swagger_out=logtostderr=true,allow_delete_body=true:api/swagger/ \
+	bbsim.proto
+
 test:
 	go test -v ./...
 	go test -v ./... -cover
@@ -52,7 +70,12 @@
 	gometalinter --vendor --exclude ../../golang.org --skip protos --sort path --sort line ./...
 
 clean:
-	rm -f bbsim openolt/openolt.pb.go
+	@rm -vf bbsim \
+			protos/openolt.pb.go \
+			api/bbsim.pb.go \
+	        api/bbsim.pb.gw.go \
+	        api/swagger/*.json
 
 docker:
 	docker build -t ${REGISTRY}voltha/voltha-bbsim:${DOCKERTAG} .
+	docker save voltha/voltha-bbsim:${DOCKERTAG} -o voltha-bbsim_${DOCKERTAG}.tgz