diff --git a/Makefile b/Makefile index fa35b3180..3c2476a13 100644 --- a/Makefile +++ b/Makefile @@ -5,64 +5,46 @@ export PATH := $(PATH):$(GOPATH)/bin INSTALL := /usr/bin/install DBDIR := /var/run/redis/sonic-db/ -GO := /usr/local/go/bin/go +GO ?= /usr/local/go/bin/go TOP_DIR := $(abspath ..) -GO_MGMT_PATH=$(TOP_DIR)/sonic-mgmt-framework -BUILD_DIR := $(GOPATH)/bin -export CVL_SCHEMA_PATH := $(GO_MGMT_PATH)/src/cvl/schema +MGMT_COMMON_DIR := $(TOP_DIR)/sonic-mgmt-common +BUILD_DIR := build/bin +export CVL_SCHEMA_PATH := $(MGMT_COMMON_DIR)/build/cvl/schema +export GOBIN := $(abspath $(BUILD_DIR)) SRC_FILES=$(shell find . -name '*.go' | grep -v '_test.go' | grep -v '/tests/') TEST_FILES=$(wildcard *_test.go) -TELEMETRY_TEST_DIR = $(GO_MGMT_PATH)/build/tests/gnmi_server +TELEMETRY_TEST_DIR = build/tests/gnmi_server TELEMETRY_TEST_BIN = $(TELEMETRY_TEST_DIR)/server.test ifeq ($(SONIC_TELEMETRY_READWRITE),y) BLD_FLAGS := -tags readwrite endif -.phony: mgmt-deps +GO_DEPS := vendor/.done +PATCHES := $(wildcard patches/*.patch) +PATCHES += $(shell find $(MGMT_COMMON_DIR)/patches -type f) all: sonic-telemetry $(TELEMETRY_TEST_BIN) go.mod: - /usr/local/go/bin/go mod init github.com/Azure/sonic-telemetry -mgmt-deps: - rm -rf cvl - rm -rf translib - cp -r ../sonic-mgmt-framework/src/cvl ./ - cp -r ../sonic-mgmt-framework/src/translib ./ - find cvl -name \*\.go -exec sed -i -e 's/\"translib/\"github.com\/Azure\/sonic-telemetry\/translib/g' {} \; - find translib -name \*\.go -exec sed -i -e 's/\"translib/\"github.com\/Azure\/sonic-telemetry\/translib/g' {} \; - find cvl -name \*\.go -exec sed -i -e 's/\"cvl/\"github.com\/Azure\/sonic-telemetry\/cvl/g' {} \; - find translib -name \*\.go -exec sed -i -e 's/\"cvl/\"github.com\/Azure\/sonic-telemetry\/cvl/g' {} \; - sed -i -e 's/\.\.\/\.\.\/\.\.\/models\/yang/\.\.\/\.\.\/\.\.\/sonic-mgmt-framework\/models\/yang/' translib/ocbinds/oc.go - sed -i -e 's/\$$GO run \$$BUILD_GOPATH\/src\/github.com\/openconfig\/ygot\/generator\/generator.go/generator/' translib/ocbinds/oc.go - $(GO) get github.com/openconfig/gnmi@89b2bf29312cda887da916d0f3a32c1624b7935f - $(GO) get github.com/openconfig/ygot@724a6b18a9224343ef04fe49199dfb6020ce132a - $(GO) get github.com/openconfig/goyang@064f9690516f4f72db189f4690b84622c13b7296 - $(GO) get github.com/openconfig/goyang@064f9690516f4f72db189f4690b84622c13b7296 + $(GO) mod init github.com/Azure/sonic-telemetry + +$(GO_DEPS): go.mod $(PATCHES) + # FIXME temporary workaround for crypto not downloading.. $(GO) get golang.org/x/crypto/ssh/terminal@e9b2fee46413 - $(GO) get github.com/jipanyang/gnxi@f0a90cca6fd0041625bcce561b71f849c9b65a8d - $(GO) install github.com/openconfig/ygot/generator - $(GO) get -x github.com/golang/glog@23def4e6c14b4da8ac2ed8007337bc5eb5007998 - rm -rf vendor $(GO) mod vendor - ln -s vendor src - cp -r $(GOPATH)/pkg/mod/github.com/openconfig/gnmi@v0.0.0-20190823184014-89b2bf29312c/* vendor/github.com/openconfig/gnmi/ - cp -r $(GOPATH)/pkg/mod/github.com/openconfig/goyang@v0.0.0-20190924211109-064f9690516f/* vendor/github.com/openconfig/goyang/ - cp -r $(GOPATH)/pkg/mod/github.com/openconfig/ygot@v0.6.1-0.20190723223108-724a6b18a922/* vendor/github.com/openconfig/ygot/ + $(MGMT_COMMON_DIR)/patches/apply.sh vendor cp -r $(GOPATH)/pkg/mod/golang.org/x/crypto@v0.0.0-20191206172530-e9b2fee46413 vendor/golang.org/x/crypto chmod -R u+w vendor patch -d vendor -p0 ../sonic-mgmt-framework +replace github.com/Azure/sonic-mgmt-common => ../sonic-mgmt-common diff --git a/go.sum b/go.sum index 99adbf6e7..157e6de7b 100644 --- a/go.sum +++ b/go.sum @@ -20,10 +20,11 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-redis/redis v6.15.6+incompatible h1:H9evprGPLI8+ci7fxQx6WNZHJSb7be8FqJQRhdQZ5Sg= github.com/go-redis/redis v6.15.6+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-redis/redis/v7 v7.0.0-beta.3.0.20190824101152-d19aba07b476/go.mod h1:xhhSbUMTsleRPur+Vgx9sUHtyN33bdjxY+9/0n9Ig8s= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 h1:uHTyIjqVhYRhLbJ8nIiOJHkEZZ+5YoOsAbD3sk82NiE= -github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= @@ -41,20 +42,18 @@ github.com/jipanyang/gnxi v0.0.0-20181221084354-f0a90cca6fd0/go.mod h1:vL9tMB3I6 github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c h1:a380JP+B7xlMbEQOlha1buKhzBPXFqgFXplyWCEIGEY= github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c/go.mod h1:t+O9It+LKzfOAhKTT5O0ehDix+MTqbtT0T9t+7zzOvc= -github.com/openconfig/gnmi v0.0.0-20200307010808-e7106f7f5493 h1:e/znXbq+Yiws97a4lJYlUeRw9OGxT2q27L4aMUb0GuM= github.com/openconfig/goyang v0.0.0-20190924211109-064f9690516f h1:BaekRUaWpfaRBP3mShDZaNi4+EHbdli7D6YXc/TP3lo= github.com/openconfig/goyang v0.0.0-20190924211109-064f9690516f/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU= -github.com/openconfig/ygot v0.6.0 h1:kJJFPBrczC6TDnz/HMlFTJEdW2CuyUftV13XveIukg0= github.com/openconfig/ygot v0.6.1-0.20190723223108-724a6b18a922 h1:zBLb75mrLMxabjsAhPk/2qxbht+BwHKFWBvRAB4Fd2U= github.com/openconfig/ygot v0.6.1-0.20190723223108-724a6b18a922/go.mod h1:o30svNf7O0xK+R35tlx95odkDmZWS9JyWWQSmIhqwAs= -github.com/openconfig/ygot v0.6.1-0.20191216180356-029bc88c228c h1:Ow7KYdHwjrPrRozqmYGtEEdEX5/owpE4dgRUvxmbSsI= -github.com/openconfig/ygot v0.6.1-0.20191216180356-029bc88c228c/go.mod h1:o30svNf7O0xK+R35tlx95odkDmZWS9JyWWQSmIhqwAs= github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3 h1:YtFkrqsMEj7YqpIhRteVxJxCeC3jJBieuLr0d4C4rSA= github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -109,6 +108,7 @@ gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sonic_data_client/transl_data_client.go b/sonic_data_client/transl_data_client.go index 6c89b9b78..4799cd5dd 100644 --- a/sonic_data_client/transl_data_client.go +++ b/sonic_data_client/transl_data_client.go @@ -11,7 +11,7 @@ import ( "time" "fmt" "reflect" - "github.com/Azure/sonic-telemetry/translib" + "github.com/Azure/sonic-mgmt-common/translib" "bytes" "encoding/json" ) diff --git a/transl_utils/transl_utils.go b/transl_utils/transl_utils.go index 032be9d90..606aa2352 100644 --- a/transl_utils/transl_utils.go +++ b/transl_utils/transl_utils.go @@ -7,7 +7,7 @@ import ( "fmt" log "github.com/golang/glog" gnmipb "github.com/openconfig/gnmi/proto/gnmi" - "github.com/Azure/sonic-telemetry/translib" + "github.com/Azure/sonic-mgmt-common/translib" ) func GnmiTranslFullPath(prefix, path *gnmipb.Path) *gnmipb.Path {