Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[202012] Change to sonic-gnmi #84

Open
wants to merge 5 commits into
base: 202012
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ GO_DEPS := vendor/.done
PATCHES := $(wildcard patches/*.patch)
PATCHES += $(shell find $(MGMT_COMMON_DIR)/patches -type f)

all: sonic-telemetry $(TELEMETRY_TEST_BIN)
all: sonic-gnmi $(TELEMETRY_TEST_BIN)

go.mod:
$(GO) mod init github.com/Azure/sonic-telemetry
$(GO) mod init github.com/sonic-net/sonic-gnmi

$(GO_DEPS): go.mod $(PATCHES)
$(GO) mod vendor
Expand All @@ -48,22 +48,31 @@ go-deps: $(GO_DEPS)
go-deps-clean:
$(RM) -r vendor

sonic-telemetry: $(GO_DEPS)
$(GO) install -mod=vendor $(BLD_FLAGS) github.com/Azure/sonic-telemetry/telemetry
$(GO) install -mod=vendor $(BLD_FLAGS) github.com/Azure/sonic-telemetry/dialout/dialout_client_cli
sonic-gnmi: $(GO_DEPS)
ifeq ($(CROSS_BUILD_ENVIRON),y)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR description says that it changes sonic-telemetry into sonic-gnmi, so, could you limit changes to this and create anohter PR for introduction of other changes?

$(GO) build -o ${GOBIN}/telemetry -mod=vendor $(BLD_FLAGS) github.com/sonic-net/sonic-gnmi/telemetry
$(GO) build -o ${GOBIN}/dialout_client_cli -mod=vendor $(BLD_FLAGS) github.com/sonic-net/sonic-gnmi/dialout/dialout_client_cli
$(GO) build -o ${GOBIN}/gnmi_get -mod=vendor github.com/jipanyang/gnxi/gnmi_get
$(GO) build -o ${GOBIN}/gnmi_set -mod=vendor github.com/jipanyang/gnxi/gnmi_get
$(GO) build -o ${GOBIN}/gnmi_cli -mod=vendor github.com/openconfig/gnmi/cmd/gnmi_cli
$(GO) build -o ${GOBIN}/gnoi_client -mod=vendor $(BLD_FLAGS) github.com/sonic-net/sonic-gnmi/gnoi_client
else
$(GO) install -mod=vendor $(BLD_FLAGS) github.com/sonic-net/sonic-gnmi/telemetry
$(GO) install -mod=vendor $(BLD_FLAGS) github.com/sonic-net/sonic-gnmi/dialout/dialout_client_cli
$(GO) install -mod=vendor github.com/jipanyang/gnxi/gnmi_get
$(GO) install -mod=vendor github.com/jipanyang/gnxi/gnmi_set
$(GO) install -mod=vendor github.com/openconfig/gnmi/cmd/gnmi_cli
$(GO) install -mod=vendor github.com/Azure/sonic-telemetry/gnoi_client
$(GO) install -mod=vendor github.com/sonic-net/sonic-gnmi/gnoi_client
endif

check:
sudo mkdir -p ${DBDIR}
sudo cp ./testdata/database_config.json ${DBDIR}
sudo mkdir -p /usr/models/yang || true
sudo find $(MGMT_COMMON_DIR)/models -name '*.yang' -exec cp {} /usr/models/yang/ \;
sudo $(GO) test -coverprofile=coverage-config.txt -covermode=atomic -v github.com/Azure/sonic-telemetry/sonic_db_config
sudo $(GO) test -coverprofile=coverage-gnmi.txt -covermode=atomic -mod=vendor $(BLD_FLAGS) -v github.com/Azure/sonic-telemetry/gnmi_server
sudo $(GO) test -coverprofile=coverage-dialcout.txt -covermode=atomic -mod=vendor $(BLD_FLAGS) -v github.com/Azure/sonic-telemetry/dialout/dialout_client
sudo $(GO) test -coverprofile=coverage-config.txt -covermode=atomic -v github.com/sonic-net/sonic-gnmi/sonic_db_config
sudo $(GO) test -coverprofile=coverage-gnmi.txt -covermode=atomic -mod=vendor $(BLD_FLAGS) -v github.com/sonic-net/sonic-gnmi/gnmi_server
sudo $(GO) test -coverprofile=coverage-dialcout.txt -covermode=atomic -mod=vendor $(BLD_FLAGS) -v github.com/sonic-net/sonic-gnmi/dialout/dialout_client
$(GO) get github.com/axw/gocov/...
$(GO) get github.com/AlekSi/gocov-xml
gocov convert coverage-*.txt | gocov-xml -source $(shell pwd) > coverage.xml
Expand All @@ -76,7 +85,7 @@ clean:
$(TELEMETRY_TEST_BIN): $(TEST_FILES) $(SRC_FILES)
mkdir -p $(@D)
cp -r testdata $(@D)/
$(GO) test -mod=vendor $(BLD_FLAGS) -c -cover github.com/Azure/sonic-telemetry/gnmi_server -o $@
$(GO) test -mod=vendor $(BLD_FLAGS) -c -cover github.com/sonic-net/sonic-gnmi/gnmi_server -o $@

install:
$(INSTALL) -D $(BUILD_DIR)/telemetry $(DESTDIR)/usr/sbin/telemetry
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ Install __go__ in your system https://golang.org/doc/install. Requires golang1.8

To install dial-in mode system telemetry server, run

go get -u github.com/Azure/sonic-telemetry/telemetry
go get -u github.com/sonic-net/sonic-gnmi/telemetry

To install dial-out mode system telemetry client, run

go get -u github.com/Azure/sonic-telemetry/dialout/dialout_client_cli
go get -u github.com/sonic-net/sonic-gnmi/dialout/dialout_client_cli

There is also a test program dialout_server_cli for collecting data from dial-out mode system telemetry client. _Note_: it is for testing purpose only.

go get -u github.com/Azure/sonic-telemetry/dialout/dialout_server_cli
go get -u github.com/sonic-net/sonic-gnmi/dialout/dialout_server_cli

The binaries will be installed under $GOPATH/bin/, they may be copied to any SONiC switch and run there.

You can also build a debian package and install it:

git clone https://github.com/Azure/sonic-telemetry.git
pushd sonic-telemetry
git clone https://github.com/sonic-net/sonic-gnmi.git
pushd sonic-gnmi
dpkg-buildpackage -rfakeroot -b -us -uc
popd

Expand Down
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sonic-telemetry (0.1) UNRELEASED; urgency=medium
sonic-gnmi (0.1) UNRELEASED; urgency=medium

* Initial release.

Expand Down
12 changes: 6 additions & 6 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Source: sonic-telemetry
Source: sonic-gnmi
Section: devel
Priority: optional
Maintainer: Jipan Yang <[email protected]>
Build-Depends: debhelper (>= 8.0.0),
Standards-Version: 3.9.3
Homepage: https://github.com/Azure/sonic-telemetry
XS-Go-Import-Path: github.com/Azure/sonic-telemetry
Homepage: https://github.com/sonic-net/sonic-gnmi
XS-Go-Import-Path: github.com/sonic-net/sonic-gnmi

Package: sonic-telemetry
Package: sonic-gnmi
Architecture: any
Built-Using: ${misc:Built-Using}
Depends: ${misc:Depends},
${shlibs:Depends}
Description: SONiC telemetry
sonic-telemetry
Description: SONiC gNMI
sonic-gnmi
6 changes: 3 additions & 3 deletions dialout/dialout_client/dialout_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"crypto/tls"
"errors"
"fmt"
spb "github.com/Azure/sonic-telemetry/proto"
sdc "github.com/Azure/sonic-telemetry/sonic_data_client"
sdcfg "github.com/Azure/sonic-telemetry/sonic_db_config"
spb "github.com/sonic-net/sonic-gnmi/proto"
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
sdcfg "github.com/sonic-net/sonic-gnmi/sonic_db_config"
"github.com/go-redis/redis"
log "github.com/golang/glog"
gpb "github.com/openconfig/gnmi/proto/gnmi"
Expand Down
8 changes: 4 additions & 4 deletions dialout/dialout_client/dialout_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"encoding/json"
"github.com/go-redis/redis"
//"github.com/golang/protobuf/proto"
testcert "github.com/Azure/sonic-telemetry/testdata/tls"
testcert "github.com/sonic-net/sonic-gnmi/testdata/tls"

//"github.com/kylelemons/godebug/pretty"
//"github.com/openconfig/gnmi/client"
Expand All @@ -28,9 +28,9 @@ import (
"testing"
"time"

sds "github.com/Azure/sonic-telemetry/dialout/dialout_server"
sdc "github.com/Azure/sonic-telemetry/sonic_data_client"
sdcfg "github.com/Azure/sonic-telemetry/sonic_db_config"
sds "github.com/sonic-net/sonic-gnmi/dialout/dialout_server"
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
sdcfg "github.com/sonic-net/sonic-gnmi/sonic_db_config"
gclient "github.com/openconfig/gnmi/client/gnmi"
)

Expand Down
2 changes: 1 addition & 1 deletion dialout/dialout_client_cli/dialout_client_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package main
import (
"crypto/tls"
"flag"
dc "github.com/Azure/sonic-telemetry/dialout/dialout_client"
dc "github.com/sonic-net/sonic-gnmi/dialout/dialout_client"
log "github.com/golang/glog"
gpb "github.com/openconfig/gnmi/proto/gnmi"
"golang.org/x/net/context"
Expand Down
2 changes: 1 addition & 1 deletion dialout/dialout_server/dialout_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dialout_server
import (
"errors"
"fmt"
spb "github.com/Azure/sonic-telemetry/proto"
spb "github.com/sonic-net/sonic-gnmi/proto"
log "github.com/golang/glog"
"github.com/google/gnxi/utils"
gpb "github.com/openconfig/gnmi/proto/gnmi"
Expand Down
4 changes: 2 additions & 2 deletions dialout/dialout_server_cli/dialout_server_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"

ds "github.com/Azure/sonic-telemetry/dialout/dialout_server"
testcert "github.com/Azure/sonic-telemetry/testdata/tls"
ds "github.com/sonic-net/sonic-gnmi/dialout/dialout_server"
testcert "github.com/sonic-net/sonic-gnmi/testdata/tls"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion gnmi_server/basicAuth.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gnmi

import (
"github.com/Azure/sonic-telemetry/common_utils"
"github.com/sonic-net/sonic-gnmi/common_utils"
"github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion gnmi_server/clientCertAuth.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gnmi

import (
"github.com/Azure/sonic-telemetry/common_utils"
"github.com/sonic-net/sonic-gnmi/common_utils"
"github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion gnmi_server/client_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"

sdc "github.com/Azure/sonic-telemetry/sonic_data_client"
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
gnmipb "github.com/openconfig/gnmi/proto/gnmi"
)

Expand Down
6 changes: 3 additions & 3 deletions gnmi_server/gnoi.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
gnoi_system_pb "github.com/openconfig/gnoi/system"
log "github.com/golang/glog"
"time"
spb "github.com/Azure/sonic-telemetry/proto/gnoi"
transutil "github.com/Azure/sonic-telemetry/transl_utils"
spb_jwt "github.com/Azure/sonic-telemetry/proto/gnoi/jwt"
spb "github.com/sonic-net/sonic-gnmi/proto/gnoi"
transutil "github.com/sonic-net/sonic-gnmi/transl_utils"
spb_jwt "github.com/sonic-net/sonic-gnmi/proto/gnoi/jwt"
"google.golang.org/grpc/status"
"google.golang.org/grpc/codes"
"os/user"
Expand Down
4 changes: 2 additions & 2 deletions gnmi_server/jwtAuth.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package gnmi

import (
"github.com/Azure/sonic-telemetry/common_utils"
"github.com/sonic-net/sonic-gnmi/common_utils"
"crypto/rand"
jwt "github.com/dgrijalva/jwt-go"
"github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
spb "github.com/Azure/sonic-telemetry/proto/gnoi/jwt"
spb "github.com/sonic-net/sonic-gnmi/proto/gnoi/jwt"
"time"
)

Expand Down
2 changes: 1 addition & 1 deletion gnmi_server/pamAuth.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gnmi

import (
"github.com/Azure/sonic-telemetry/common_utils"
"github.com/sonic-net/sonic-gnmi/common_utils"
"errors"
"github.com/golang/glog"
"github.com/msteinert/pam"
Expand Down
10 changes: 5 additions & 5 deletions gnmi_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net"
"strings"
"sync"
"github.com/Azure/sonic-telemetry/common_utils"
"github.com/sonic-net/sonic-gnmi/common_utils"
log "github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc"
Expand All @@ -16,13 +16,13 @@ import (
"google.golang.org/grpc/status"
"github.com/golang/protobuf/proto"
gnoi_system_pb "github.com/openconfig/gnoi/system"
sdc "github.com/Azure/sonic-telemetry/sonic_data_client"
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
gnmipb "github.com/openconfig/gnmi/proto/gnmi"
gnmi_extpb "github.com/openconfig/gnmi/proto/gnmi_ext"
spb_gnoi "github.com/Azure/sonic-telemetry/proto/gnoi"
spb "github.com/Azure/sonic-telemetry/proto"
spb_gnoi "github.com/sonic-net/sonic-gnmi/proto/gnoi"
spb "github.com/sonic-net/sonic-gnmi/proto"
"github.com/Azure/sonic-mgmt-common/translib"
spb_jwt_gnoi "github.com/Azure/sonic-telemetry/proto/gnoi/jwt"
spb_jwt_gnoi "github.com/sonic-net/sonic-gnmi/proto/gnoi/jwt"
"bytes"
)

Expand Down
10 changes: 5 additions & 5 deletions gnmi_server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"fmt"
"strings"

testcert "github.com/Azure/sonic-telemetry/testdata/tls"
testcert "github.com/sonic-net/sonic-gnmi/testdata/tls"
"github.com/go-redis/redis"
"github.com/golang/protobuf/proto"

Expand All @@ -35,10 +35,10 @@ import (
"google.golang.org/grpc/status"

// Register supported client types.
spb "github.com/Azure/sonic-telemetry/proto"
sgpb "github.com/Azure/sonic-telemetry/proto/gnoi"
sdc "github.com/Azure/sonic-telemetry/sonic_data_client"
sdcfg "github.com/Azure/sonic-telemetry/sonic_db_config"
spb "github.com/sonic-net/sonic-gnmi/proto"
sgpb "github.com/sonic-net/sonic-gnmi/proto/gnoi"
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
sdcfg "github.com/sonic-net/sonic-gnmi/sonic_db_config"
gclient "github.com/jipanyang/gnmi/client/gnmi"
"github.com/jipanyang/gnxi/utils/xpath"
gnoi_system_pb "github.com/openconfig/gnoi/system"
Expand Down
4 changes: 2 additions & 2 deletions gnoi_client/gnoi_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"google.golang.org/grpc"
gnoi_system_pb "github.com/openconfig/gnoi/system"
spb "github.com/Azure/sonic-telemetry/proto/gnoi"
spb_jwt "github.com/Azure/sonic-telemetry/proto/gnoi/jwt"
spb "github.com/sonic-net/sonic-gnmi/proto/gnoi"
spb_jwt "github.com/sonic-net/sonic-gnmi/proto/gnoi/jwt"
"context"
"os"
"os/signal"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Azure/sonic-telemetry
module github.com/sonic-net/sonic-gnmi

go 1.12

Expand Down
4 changes: 2 additions & 2 deletions sonic_data_client/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

log "github.com/golang/glog"

spb "github.com/Azure/sonic-telemetry/proto"
sdcfg "github.com/Azure/sonic-telemetry/sonic_db_config"
spb "github.com/sonic-net/sonic-gnmi/proto"
sdcfg "github.com/sonic-net/sonic-gnmi/sonic_db_config"
"github.com/Workiva/go-datastructures/queue"
"github.com/go-redis/redis"
gnmipb "github.com/openconfig/gnmi/proto/gnmi"
Expand Down
2 changes: 1 addition & 1 deletion sonic_data_client/non_db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"gopkg.in/yaml.v2"

spb "github.com/Azure/sonic-telemetry/proto"
spb "github.com/sonic-net/sonic-gnmi/proto"
"github.com/Workiva/go-datastructures/queue"
linuxproc "github.com/c9s/goprocinfo/linux"
log "github.com/golang/glog"
Expand Down
6 changes: 3 additions & 3 deletions sonic_data_client/transl_data_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
package client

import (
spb "github.com/Azure/sonic-telemetry/proto"
transutil "github.com/Azure/sonic-telemetry/transl_utils"
spb "github.com/sonic-net/sonic-gnmi/proto"
transutil "github.com/sonic-net/sonic-gnmi/transl_utils"
log "github.com/golang/glog"
"github.com/golang/protobuf/proto"
gnmipb "github.com/openconfig/gnmi/proto/gnmi"
Expand All @@ -14,7 +14,7 @@ import (
"fmt"
"reflect"
"github.com/Azure/sonic-mgmt-common/translib"
"github.com/Azure/sonic-telemetry/common_utils"
"github.com/sonic-net/sonic-gnmi/common_utils"
"bytes"
"encoding/json"
"context"
Expand Down
4 changes: 2 additions & 2 deletions telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"

gnmi "github.com/Azure/sonic-telemetry/gnmi_server"
testcert "github.com/Azure/sonic-telemetry/testdata/tls"
gnmi "github.com/sonic-net/sonic-gnmi/gnmi_server"
testcert "github.com/sonic-net/sonic-gnmi/testdata/tls"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion transl_utils/transl_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
log "github.com/golang/glog"
gnmipb "github.com/openconfig/gnmi/proto/gnmi"
"github.com/Azure/sonic-mgmt-common/translib"
"github.com/Azure/sonic-telemetry/common_utils"
"github.com/sonic-net/sonic-gnmi/common_utils"
"context"
"log/syslog"
"github.com/Azure/sonic-mgmt-common/translib/tlerr"
Expand Down