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

Fix build and add gNOI versions. #16

Merged
merged 5 commits into from
Jan 3, 2019
Merged

Fix build and add gNOI versions. #16

merged 5 commits into from
Jan 3, 2019

Conversation

robshakir
Copy link
Contributor

Clean up gNOI repository for clarity and standard Go build.

  • Remove all BUILD.bazel files from the repository, since there are no users currently.
  • Move types and common protos to separate directories to work with the standard Go build system.
  • Add a gnoi_version proto FileOption such that we can mark the version of all files, and assign 0.1.0 as the first version at this point.

 * Remove all BUILD.bazel files from the repository, since there are
   no users currently.
 * Move types and common protos to separate directories to work with
   the standard Go build system.
 * Add a gnoi_version proto FileOption such that we can mark the
   version of all files, and assign 0.1.0 as the first version at
   this point.
@robshakir
Copy link
Contributor Author

@ejbrever @samribeiro @aashaikh -- PTAL, this PR makes some cleanups to the gNOI repository. One backwards incompatible change is moving types.proto -- please review the impact of this in your projects.

@@ -18,7 +18,7 @@ syntax = "proto3";

package gnoi;
Copy link

Choose a reason for hiding this comment

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

Would you consider changing package gnoi to package gnoi.common?
Also suggest to change types/types.proto package to gnoi.types.

Otherwise, one must use import identifier when importing both gnoi/types and gnoi/common in one module to avoid getting the following error: gnoi redeclared as imported package name" error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done -- renamed to types and common such that we don't have a gnoi package at all.

Origin: "oc",
Elem: []*gpb.PathElem{{Name: "interfaces", Key: map[string]string{"name": "Ethernet1/1/0"}}},
Elem: []*tpb.PathElem{{Name: "interfaces", Key: map[string]string{"name": "Ethernet1/1/0"}}},
},
want: "origin: \"oc\"\nelem: <\n name: \"interfaces\"\n key: <\n key: \"name\"\n value: \"Ethernet1/1/0\"\n >\n>\n",
}, {
Copy link

Choose a reason for hiding this comment

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

Would you consider adding the test for system.SetPackage(RemoteDownload with Credentials)? This test requires simple_test.go to import both "gnoi/common" and "gnoi/types".

The code diff is listed below:

diff --git a/test/simple_test.go b/test/simple_test.go
index ecc708c..1b8405c 100644
--- a/test/simple_test.go
+++ b/test/simple_test.go
@@ -18,8 +18,10 @@ import (
 	"testing"
 
 	"github.com/golang/protobuf/proto"
-	gpb "github.com/openconfig/gnoi"
 	bgppb "github.com/openconfig/gnoi/bgp"
+	"github.com/openconfig/gnoi/common"
+	gSystem "github.com/openconfig/gnoi/system"
+	gpb "github.com/openconfig/gnoi/types"
 )
 
 func TestGNOI(t *testing.T) {
@@ -34,6 +36,19 @@ func TestGNOI(t *testing.T) {
 			Elem:   []*gpb.PathElem{{Name: "interfaces", Key: map[string]string{"name": "Ethernet1/1/0"}}},
 		},
 		want: "origin: \"oc\"\nelem: <\n  name: \"interfaces\"\n  key: <\n    key: \"name\"\n    value: \"Ethernet1/1/0\"\n  >\n>\n",
+	}, {
+		desc: "system.SetPackage",
+		in: &gSystem.Package{
+			Filename: "filename",
+			RemoteDownload: &gnoi.RemoteDownload{
+				Path:     "foo",
+				Protocol: gnoi.RemoteDownload_SCP,
+				Credentials: &gpb.Credentials{
+					Username: "bar",
+				},
+			},
+		},
+		want: "filename: \"filename\"\nremote_download: <\n  path: \"foo\"\n  protocol: SCP\n  credentials: <\n    username: \"bar\"\n  >\n>\n",
 	}, {
 		desc: "gpb.HashType",
 		in: &gpb.HashType{

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this test case, thanks!

Copy link

Choose a reason for hiding this comment

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

LGTM. Thanks!

Copy link
Member

@samribeiro samribeiro left a comment

Choose a reason for hiding this comment

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

Thanks, updated my projects. I will let other reviewers approve.

Copy link
Contributor

@ejbrever ejbrever left a comment

Choose a reason for hiding this comment

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

LGTM

@robshakir
Copy link
Contributor Author

Thanks for the reviews here folks. Comments addressed, so I'll merge after the newly-setup travis run completes.

@robshakir robshakir merged commit d703187 into master Jan 3, 2019
@robshakir robshakir deleted the proto-cleanup branch January 3, 2019 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants