diff --git a/api/apiIntegration_test.go b/api/apiIntegration_test.go index bfc67ae99751d91b17a2e0d3c2151f175f11d22b..a76273fd9600958bcbcb1eb188d4d37c26f6643a 100644 --- a/api/apiIntegration_test.go +++ b/api/apiIntegration_test.go @@ -97,7 +97,7 @@ func TestApiIntegration(t *testing.T) { cliPnd, testPath, hostname, - pnd.ApiOperation_UPDATE, + pnd.ApiOperation_API_OPERATION_UPDATE, ) if (err != nil) != tt.wantErr { t.Errorf("gosdn cli set error = %v, wantErr %v", err, tt.wantErr) diff --git a/api/api_test.go b/api/api_test.go index a3f722da0509f09585d713520a0274ec5a39c5ce..7612068f866ae3b92c5824f293b4408e7e26b9e5 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -28,7 +28,7 @@ func Test_GetIds(t *testing.T) { } func Test_AddPnd(t *testing.T) { - sbi := nucleus.NewSBI(spb.Type_OPENCONFIG) + sbi := nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG) resp, err := AddPnd(bufnet, "test", "test pnd", sbi.ID().String()) if err != nil { t.Error(err) @@ -104,7 +104,7 @@ func Test_GetDevice(t *testing.T) { } func Test_Update(t *testing.T) { - resp, err := changeRequest(bufnet, ondID, pndID, "", "", ppb.ApiOperation_UPDATE) + resp, err := changeRequest(bufnet, ondID, pndID, "", "", ppb.ApiOperation_API_OPERATION_UPDATE) if err != nil { t.Error(err) return @@ -113,7 +113,7 @@ func Test_Update(t *testing.T) { } func Test_Replace(t *testing.T) { - resp, err := changeRequest(bufnet, ondID, pndID, "", "", ppb.ApiOperation_REPLACE) + resp, err := changeRequest(bufnet, ondID, pndID, "", "", ppb.ApiOperation_API_OPERATION_REPLACE) if err != nil { t.Error(err) return @@ -122,7 +122,7 @@ func Test_Replace(t *testing.T) { } func Test_Delete(t *testing.T) { - resp, err := changeRequest(bufnet, ondID, pndID, "", "", ppb.ApiOperation_DELETE) + resp, err := changeRequest(bufnet, ondID, pndID, "", "", ppb.ApiOperation_API_OPERATION_DELETE) if err != nil { t.Error(err) return diff --git a/api/grpc.go b/api/grpc.go index 0ebdabb68a8eb9612494cc44f0f290080d153afb..b237669d856798a5853bb2ef7201fbde11db5c15 100644 --- a/api/grpc.go +++ b/api/grpc.go @@ -190,7 +190,7 @@ func addDevice(addr, deviceName string, opt *tpb.TransportOption, sid, pid uuid. Pid: pid.String(), } switch t := opt.Type; t { - case spb.Type_CONTAINERISED, spb.Type_PLUGIN: + case spb.Type_TYPE_CONTAINERISED, spb.Type_TYPE_PLUGIN: req.Ond[0].Sbi.Id = uuid.Nil.String() req.Ond[0].Sbi.Type = t req.Ond[0].TransportOption.Type = t diff --git a/api/initialise_test.go b/api/initialise_test.go index 347a20a806d1fd027468bbf25f9481048590f8fe..83cb64e9581b9ef0fab2f6a542ced6360e4f39bd 100644 --- a/api/initialise_test.go +++ b/api/initialise_test.go @@ -77,7 +77,7 @@ func bootstrapUnitTest() { mockChange := &mocks.Change{} mockChange.On("Age").Return(time.Hour) - mockChange.On("State").Return(ppb.Change_INCONSISTENT) + mockChange.On("State").Return(ppb.ChangeState_CHANGE_STATE_INCONSISTENT) mockPnd := mocks.NetworkDomain{} mockPnd.On("ID").Return(pndUUID) diff --git a/api/pnd.go b/api/pnd.go index 573869c22a47b134b2c80cb19d0170b1f9508634..e53200fe51634d57fe5bada1a9900ba7234cb1b1 100644 --- a/api/pnd.go +++ b/api/pnd.go @@ -167,7 +167,7 @@ func (p *PrincipalNetworkDomainAdapter) PendingChanges() []uuid.UUID { log.Error(err) return nil } - return filterChanges(ppb.Change_PENDING, resp) + return filterChanges(ppb.ChangeState_CHANGE_STATE_PENDING, resp) } // CommittedChanges sends an API call to the controller requesting @@ -178,7 +178,7 @@ func (p *PrincipalNetworkDomainAdapter) CommittedChanges() []uuid.UUID { log.Error(err) return nil } - return filterChanges(ppb.Change_COMMITTED, resp) + return filterChanges(ppb.ChangeState_CHANGE_STATE_COMMITTED, resp) } // GetChange sends an API call to the controller requesting the specified change @@ -206,7 +206,7 @@ func (p *PrincipalNetworkDomainAdapter) Confirm(cuid uuid.UUID) error { return nil } -func filterChanges(state ppb.Change_State, resp *ppb.GetResponse) []uuid.UUID { +func filterChanges(state ppb.ChangeState, resp *ppb.GetResponse) []uuid.UUID { changes := make([]uuid.UUID, 0) for _, ch := range resp.Change { if ch.State == state { diff --git a/api/pnd_test.go b/api/pnd_test.go index 62beb9281875b6ef5a3d3c68eb8e2dbc3ec2005c..2b9f44fa3132b6bc057b0da17f4a5279e3a3a589 100644 --- a/api/pnd_test.go +++ b/api/pnd_test.go @@ -646,7 +646,7 @@ func TestPrincipalNetworkDomainAdapter_Confirm(t *testing.T) { func Test_filterChanges(t *testing.T) { type args struct { - state ppb.Change_State + state ppb.ChangeState resp *ppb.GetResponse } tests := []struct { diff --git a/go.mod b/go.mod index 094fad6678d5b4f509352d45e740fb669f42bba8..67eb76db4dd1ffe73e9c85c0c1b8a1e2f516fd91 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module code.fbi.h-da.de/danet/gosdn go 1.17 require ( - code.fbi.h-da.de/danet/api v0.2.5-0.20210722102157-e7e463162450 + code.fbi.h-da.de/danet/api v0.2.5-0.20220208132534-98ec7f81567f code.fbi.h-da.de/danet/forks/goarista v0.0.0-20210709163519-47ee8958ef40 code.fbi.h-da.de/danet/forks/google v0.0.0-20210709163519-47ee8958ef40 code.fbi.h-da.de/danet/yang-models v0.1.0 @@ -19,7 +19,7 @@ require ( github.com/spf13/viper v1.9.0 github.com/stretchr/objx v0.2.0 // indirect github.com/stretchr/testify v1.7.0 - google.golang.org/grpc v1.40.0 + google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 ) @@ -30,6 +30,7 @@ require ( github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/golang/glog v1.0.0 // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect @@ -50,7 +51,7 @@ require ( golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/ini.v1 v1.64.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect diff --git a/go.sum b/go.sum index 427cfd8f8a6f4ec2f16ff2a17b223137b7ebfbdb..b51351f2e34627514dbe670e358bd275589a1e22 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -code.fbi.h-da.de/danet/api v0.2.5-0.20210722102157-e7e463162450 h1:gImcnMybH6KceaLQzbD2FDjV0kRL88WobBDQVH92d9o= -code.fbi.h-da.de/danet/api v0.2.5-0.20210722102157-e7e463162450/go.mod h1:kjazkgCFLje+z4BBNBLlyozhQUnkJd0sqlZz1Axe0wM= +code.fbi.h-da.de/danet/api v0.2.5-0.20220208132534-98ec7f81567f h1:+/JvX942Za21HLwG0E26bSct7EFpSBW0t+XYlDFUw+k= +code.fbi.h-da.de/danet/api v0.2.5-0.20220208132534-98ec7f81567f/go.mod h1:J1wwKAHhP3HprrzoNs6f5C56znzvns69FU56oItc3kc= code.fbi.h-da.de/danet/forks/goarista v0.0.0-20210709163519-47ee8958ef40 h1:x7rVYGqfJSMWuYBp+JE6JVMcFP03Gx0mnR2ftsgqjVI= code.fbi.h-da.de/danet/forks/goarista v0.0.0-20210709163519-47ee8958ef40/go.mod h1:uVe3gCeF2DcIho8K9CIO46uAkHW/lUF+fAaUX1vHrF0= code.fbi.h-da.de/danet/forks/google v0.0.0-20210709163519-47ee8958ef40 h1:B45k5tGEdjjdsKK4f+0dQoyReFmsWdwYEzHofA7DPM8= @@ -112,7 +112,11 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -156,6 +160,7 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -287,7 +292,10 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.2 h1:I/pwhnUln5wbMnTyRbzswA0/JxpK8sZj0aUfI3TV1So= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.2/go.mod h1:lsuH8kb4GlMdSlI4alNIBBSAt5CHJtg3i+0WuN9J5YM= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= @@ -755,6 +763,7 @@ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1014,8 +1023,8 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1045,8 +1054,9 @@ google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1110,4 +1120,5 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/interfaces/change/change.go b/interfaces/change/change.go index 460a1af047a5eb56534fc3cffcc901aaddbe44ec..cd4b78ccbfecea14e2ab7f1cf77687acbfa0ae35 100644 --- a/interfaces/change/change.go +++ b/interfaces/change/change.go @@ -16,7 +16,7 @@ type Change interface { ID() uuid.UUID Commit() error Confirm() error - State() ppb.Change_State + State() ppb.ChangeState Age() time.Duration } diff --git a/northbound/server/core.go b/northbound/server/core.go index d32628cef77fc0c12fcf6a25928952b4b3ced1ed..af76ff407173f1526fe0f61700c55c605446757e 100644 --- a/northbound/server/core.go +++ b/northbound/server/core.go @@ -69,7 +69,7 @@ func (s core) Set(ctx context.Context, request *pb.SetRequest) (*pb.SetResponse, start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) for _, r := range request.Pnd { - sbi := nucleus.NewSBI(spb.Type_OPENCONFIG) + sbi := nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG) pnd, err := nucleus.NewPND(r.Name, r.Description, uuid.New(), sbi, nil, nil) if err != nil { diff --git a/northbound/server/pnd_test.go b/northbound/server/pnd_test.go index 19e765819e84894daf50714d2856a5ecf7b78757..e55f3d7958162eb41b1bded4ef3a523a362f489e 100644 --- a/northbound/server/pnd_test.go +++ b/northbound/server/pnd_test.go @@ -77,7 +77,7 @@ func getMockPND() networkdomain.NetworkDomain { TransportOption: &transport.TransportOption_GnmiTransportOption{ GnmiTransportOption: &transport.GnmiTransportOption{}, }, - Type: spb.Type_OPENCONFIG, + Type: spb.Type_TYPE_OPENCONFIG, }, sbiUUID) return newPnd @@ -124,7 +124,7 @@ func TestMain(m *testing.M) { UUID: deviceUUID, } - mockDevice.(*nucleus.CommonDevice).SetSBI(nucleus.NewSBI(spb.Type_OPENCONFIG)) + mockDevice.(*nucleus.CommonDevice).SetSBI(nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG)) mockDevice.(*nucleus.CommonDevice).SetTransport(&mocks.Transport{}) mockDevice.(*nucleus.CommonDevice).SetName(hostname) sbiStore = store.NewSbiStore() @@ -134,7 +134,7 @@ func TestMain(m *testing.M) { mockChange := &mocks.Change{} mockChange.On("Age").Return(time.Hour) - mockChange.On("State").Return(ppb.Change_INCONSISTENT) + mockChange.On("State").Return(ppb.ChangeState_CHANGE_STATE_INCONSISTENT) mockPnd = &mocks.NetworkDomain{} mockPnd.On("ID").Return(pndUUID) @@ -244,7 +244,7 @@ func Test_pnd_Set(t *testing.T) { { Sbi: &spb.SouthboundInterface{ Id: sbiID, - Type: spb.Type_OPENCONFIG, + Type: spb.Type_TYPE_OPENCONFIG, }, DeviceName: hostname, TransportOption: &transport.TransportOption{ diff --git a/nucleus/change.go b/nucleus/change.go index ca4a6bd4bfcf43993995bc41139a1ff83ee0a09b..824ed850af4f60f660253974e8604d2902cbab54 100644 --- a/nucleus/change.go +++ b/nucleus/change.go @@ -38,7 +38,7 @@ func NewChange(device uuid.UUID, currentState ygot.GoStruct, change ygot.GoStruc c := &Change{ cuid: uuid.New(), duid: device, - state: ppb.Change_PENDING, + state: ppb.ChangeState_CHANGE_STATE_PENDING, timestamp: time.Now(), previousState: currentState, intendedState: change, @@ -60,15 +60,15 @@ func NewChange(device uuid.UUID, currentState ygot.GoStruct, change ygot.GoStruc type Change struct { cuid uuid.UUID duid uuid.UUID - state ppb.Change_State + state ppb.ChangeState timestamp time.Time previousState ygot.GoStruct intendedState ygot.GoStruct callback func(ygot.GoStruct, ygot.GoStruct) error stateMu sync.RWMutex errChan <-chan error - stateIn chan<- ppb.Change_State - stateOut <-chan ppb.Change_State + stateIn chan<- ppb.ChangeState + stateOut <-chan ppb.ChangeState stateManagerCancel context.CancelFunc } @@ -82,7 +82,7 @@ func (c *Change) ID() uuid.UUID { // the change is rolled back. func (c *Change) Commit() error { //TODO: check if already commited - c.stateIn <- ppb.Change_COMMITTED + c.stateIn <- ppb.ChangeState_CHANGE_STATE_COMMITTED select { case err := <-c.errChan: return err @@ -94,7 +94,7 @@ func (c *Change) Commit() error { // Confirm confirms a committed Change and stops the rollback timer. func (c *Change) Confirm() error { //TODO: check if already confirmed - c.stateIn <- ppb.Change_CONFIRMED + c.stateIn <- ppb.ChangeState_CHANGE_STATE_CONFIRMED select { case err := <-c.errChan: return err @@ -109,16 +109,16 @@ func (c *Change) Age() time.Duration { } // State returns the changes's state. -func (c *Change) State() ppb.Change_State { +func (c *Change) State() ppb.ChangeState { c.stateMu.RLock() state := c.state c.stateMu.RUnlock() return state } -func stateManager(ctx context.Context, ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <-chan ppb.Change_State, <-chan error) { - stateIn := make(chan ppb.Change_State) - stateOut := make(chan ppb.Change_State) +func stateManager(ctx context.Context, ch *Change, timeout time.Duration) (chan<- ppb.ChangeState, <-chan ppb.ChangeState, <-chan error) { + stateIn := make(chan ppb.ChangeState) + stateOut := make(chan ppb.ChangeState) // A Goroutine, which is created while a new Change is initialized acts as // the reciever for errorChan errChan := make(chan error) @@ -134,13 +134,13 @@ func stateManager(ctx context.Context, ch *Change, timeout time.Duration) (chan< select { case <-ticker.C: state := ch.State() - if state == ppb.Change_CONFIRMED { + if state == ppb.ChangeState_CHANGE_STATE_CONFIRMED { continue } err := ch.callback(ch.intendedState, ch.previousState) if err != nil { ch.stateMu.Lock() - ch.state = ppb.Change_INCONSISTENT + ch.state = ppb.ChangeState_CHANGE_STATE_INCONSISTENT ch.stateMu.Unlock() log.Errorf("change %v timed out", ch.cuid) log.Error(err) @@ -150,14 +150,14 @@ func stateManager(ctx context.Context, ch *Change, timeout time.Duration) (chan< ticker.Stop() // TODO: keep the Change as pending, or remove it? ch.stateMu.Lock() - ch.state = ppb.Change_PENDING + ch.state = ppb.ChangeState_CHANGE_STATE_PENDING ch.stateMu.Unlock() log.Errorf("change %v timed out", ch.cuid) case s := <-stateIn: switch s { - case ppb.Change_COMMITTED: + case ppb.ChangeState_CHANGE_STATE_COMMITTED: state := ch.State() - if state == ppb.Change_COMMITTED || state == ppb.Change_CONFIRMED { + if state == ppb.ChangeState_CHANGE_STATE_COMMITTED || state == ppb.ChangeState_CHANGE_STATE_CONFIRMED { errChan <- fmt.Errorf("change %v already %s", ch.cuid, state.String()) continue } @@ -166,25 +166,25 @@ func stateManager(ctx context.Context, ch *Change, timeout time.Duration) (chan< err := ch.callback(ch.previousState, ch.intendedState) if err != nil { ch.stateMu.Lock() - ch.state = ppb.Change_INCONSISTENT + ch.state = ppb.ChangeState_CHANGE_STATE_INCONSISTENT ch.stateMu.Unlock() errChan <- err continue } ch.stateMu.Lock() - ch.state = ppb.Change_COMMITTED + ch.state = ppb.ChangeState_CHANGE_STATE_COMMITTED ch.stateMu.Unlock() stateOut <- state - case ppb.Change_CONFIRMED: + case ppb.ChangeState_CHANGE_STATE_CONFIRMED: state := ch.State() - if state != ppb.Change_COMMITTED { + if state != ppb.ChangeState_CHANGE_STATE_COMMITTED { errChan <- fmt.Errorf("cannot confirm uncommitted change %v", ch.cuid) continue } // The change has been confirmed and the timer is stopped, // since a rollback is not necessary anymore. ch.stateMu.Lock() - ch.state = ppb.Change_CONFIRMED + ch.state = ppb.ChangeState_CHANGE_STATE_CONFIRMED ch.stateMu.Unlock() stateOut <- state ch.stateManagerCancel() diff --git a/nucleus/change_test.go b/nucleus/change_test.go index bb59c2f97706ad7522c40e51e601c0fed576c6fd..9bff07b4056c3d7cd907c6b37d0b38f07de41d44 100644 --- a/nucleus/change_test.go +++ b/nucleus/change_test.go @@ -120,7 +120,7 @@ func TestChange_CommitRollbackError(t *testing.T) { } func TestChange_CommitError(t *testing.T) { - want := ppb.Change_INCONSISTENT + want := ppb.ChangeState_CHANGE_STATE_INCONSISTENT c := &Change{ cuid: cuid, duid: did, @@ -150,7 +150,7 @@ func TestChange_CommitError(t *testing.T) { } func TestChange_Commit(t *testing.T) { - want := ppb.Change_COMMITTED + want := ppb.ChangeState_CHANGE_STATE_COMMITTED c := &Change{ cuid: cuid, duid: did, @@ -263,19 +263,19 @@ func TestChange_ID(t *testing.T) { func TestChange_State(t *testing.T) { tests := []struct { name string - want ppb.Change_State + want ppb.ChangeState }{ { name: "pending", - want: ppb.Change_PENDING, + want: ppb.ChangeState_CHANGE_STATE_PENDING, }, { name: "committed", - want: ppb.Change_COMMITTED, + want: ppb.ChangeState_CHANGE_STATE_COMMITTED, }, { name: "confirmed", - want: ppb.Change_CONFIRMED, + want: ppb.ChangeState_CHANGE_STATE_CONFIRMED, }, } for _, tt := range tests { diff --git a/nucleus/device.go b/nucleus/device.go index 80034d540f187469b60347967f10de3fead546d4..8ded445919e525849b7280431555cf23a852ae79 100644 --- a/nucleus/device.go +++ b/nucleus/device.go @@ -34,7 +34,7 @@ func NewDevice(name string, uuidInput uuid.UUID, opt *tpb.TransportOption, sbi s if err != nil { return nil, err } - if opt.Type == spb.Type_CONTAINERISED { + if opt.Type == spb.Type_TYPE_CONTAINERISED { return &CsbiDevice{ CommonDevice: CommonDevice{ UUID: uuidInput, @@ -174,7 +174,7 @@ func (d *CommonDevice) MarshalJSON() ([]byte, error) { transportAddress = "testing" transportUsername = "testing" transportPassword = "testing" - transportOptionType = spb.Type_OPENCONFIG + transportOptionType = spb.Type_TYPE_OPENCONFIG } else { transportType = d.transport.Type() transportAddress = d.transportOptions.Address diff --git a/nucleus/gnmi_transport.go b/nucleus/gnmi_transport.go index 37f6f772680f4de808f51b75c663fc14040e99b0..d02d0aa9c30a439e724a7f95afd874883a8564c7 100644 --- a/nucleus/gnmi_transport.go +++ b/nucleus/gnmi_transport.go @@ -102,9 +102,9 @@ func (g *Gnmi) applyDiff(ctx context.Context, payload change.Payload) error { req := &gpb.SetRequest{} if diff.Update != nil { switch op { - case ppb.ApiOperation_UPDATE: + case ppb.ApiOperation_API_OPERATION_UPDATE: req.Update = diff.Update - case ppb.ApiOperation_REPLACE: + case ppb.ApiOperation_API_OPERATION_REPLACE: req.Replace = diff.Update default: return &errors.ErrOperationNotSupported{Op: op} diff --git a/nucleus/gnmi_transport_test.go b/nucleus/gnmi_transport_test.go index 376f0363209eb0b9856b67511cefc0bf7e5ad18a..9f893695277106eaf44fffb0e6c97f66104d12ea 100644 --- a/nucleus/gnmi_transport_test.go +++ b/nucleus/gnmi_transport_test.go @@ -460,7 +460,7 @@ func TestNewGnmiTransport(t *testing.T) { startGnmiTarget <- gnmiConfig.Addr } - got, err := newGnmiTransport(tt.args.opts, NewSBI(spb.Type_OPENCONFIG)) + got, err := newGnmiTransport(tt.args.opts, NewSBI(spb.Type_TYPE_OPENCONFIG)) if (err != nil) != tt.wantErr { t.Errorf("NewGnmiTransport() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/nucleus/principalNetworkDomain.go b/nucleus/principalNetworkDomain.go index 2c7d845514419c74322e3381b71e4855a72f4ac6..8b1d8d63a0e8493884161d6b3189acb4ddcfdf77 100644 --- a/nucleus/principalNetworkDomain.go +++ b/nucleus/principalNetworkDomain.go @@ -164,9 +164,9 @@ func (pnd *pndImplementation) AddDevice(name string, opt *tpb.TransportOption, s defer metrics.FinishHook(labels, start, deviceCreationDurationSecondsTotal, deviceCreationDurationSeconds) var sbi southbound.SouthboundInterface switch t := opt.Type; t { - case spb.Type_CONTAINERISED: + case spb.Type_TYPE_CONTAINERISED: return pnd.handleCsbiEnrolment(name, opt) - case spb.Type_PLUGIN: + case spb.Type_TYPE_PLUGIN: var err error sbi, err = pnd.requestPlugin(name, opt) if err != nil { @@ -189,7 +189,7 @@ func (pnd *pndImplementation) AddDevice(name string, opt *tpb.TransportOption, s //AddDeviceFromStore adds a new device to the PND func (pnd *pndImplementation) AddDeviceFromStore(name string, deviceUUID uuid.UUID, opt *tpb.TransportOption, sid uuid.UUID) error { - if opt.Type == spb.Type_CONTAINERISED { + if opt.Type == spb.Type_TYPE_CONTAINERISED { return pnd.handleCsbiEnrolment(name, opt) } @@ -342,19 +342,19 @@ func (pnd *pndImplementation) ChangeOND(duid uuid.UUID, operation ppb.ApiOperati return uuid.Nil, err } - if operation != ppb.ApiOperation_DELETE && len(value) != 1 { + if operation != ppb.ApiOperation_API_OPERATION_DELETE && len(value) != 1 { return uuid.Nil, &errors.ErrInvalidParameters{ Func: pnd.ChangeOND, Param: value, } } switch operation { - case ppb.ApiOperation_UPDATE, ppb.ApiOperation_REPLACE: + case ppb.ApiOperation_API_OPERATION_UPDATE, ppb.ApiOperation_API_OPERATION_REPLACE: typedValue := gnmi.TypedValue(value[0]) if err := ytypes.SetNode(d.SBI().Schema().RootSchema(), cpy, p, typedValue); err != nil { return uuid.Nil, err } - case ppb.ApiOperation_DELETE: + case ppb.ApiOperation_API_OPERATION_DELETE: if err := ytypes.DeleteNode(d.SBI().Schema().RootSchema(), cpy, p); err != nil { return uuid.Nil, err } @@ -555,7 +555,7 @@ func (pnd *pndImplementation) loadStoredDevices() error { TransportOption: &tpb.TransportOption_GnmiTransportOption{ GnmiTransportOption: &tpb.GnmiTransportOption{}, }, - Type: spb.Type_OPENCONFIG, + Type: spb.Type_TYPE_OPENCONFIG, }, device.SBI) if err != nil { return err diff --git a/nucleus/principalNetworkDomain_test.go b/nucleus/principalNetworkDomain_test.go index 2aabcd29814271b38539dfbef5def11827ff348e..58bd97e34275c419faa2ee278110771494c6628b 100644 --- a/nucleus/principalNetworkDomain_test.go +++ b/nucleus/principalNetworkDomain_test.go @@ -392,7 +392,7 @@ func Test_pndImplementation_RemoveDevice(t *testing.T) { if tt.name != "fails empty" { d := &CommonDevice{ UUID: did, - sbi: NewSBI(spb.Type_OPENCONFIG), + sbi: NewSBI(spb.Type_TYPE_OPENCONFIG), } if err := pnd.addDevice(d); err != nil { t.Error(err) @@ -599,7 +599,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "update", args: args{ - operation: ppb.ApiOperation_UPDATE, + operation: ppb.ApiOperation_API_OPERATION_UPDATE, path: "/system/config/hostname", value: []string{"ceos3000"}, }, @@ -608,7 +608,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "replace", args: args{ - operation: ppb.ApiOperation_REPLACE, + operation: ppb.ApiOperation_API_OPERATION_REPLACE, path: "/system/config/hostname", value: []string{"ceos3000"}, }, @@ -617,7 +617,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "delete", args: args{ - operation: ppb.ApiOperation_DELETE, + operation: ppb.ApiOperation_API_OPERATION_DELETE, path: "/system/config/hostname", }, wantErr: false, @@ -625,7 +625,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "delete w/args", args: args{ - operation: ppb.ApiOperation_DELETE, + operation: ppb.ApiOperation_API_OPERATION_DELETE, path: "/system/config/hostname", value: []string{"ceos3000"}, }, @@ -643,7 +643,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "invalid arg count", args: args{ - operation: ppb.ApiOperation_UPDATE, + operation: ppb.ApiOperation_API_OPERATION_UPDATE, path: "/system/config/hostname", value: []string{"ceos3000", "ceos3001"}, }, @@ -652,7 +652,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "invalid arg count - update, no args", args: args{ - operation: ppb.ApiOperation_UPDATE, + operation: ppb.ApiOperation_API_OPERATION_UPDATE, path: "/system/config/hostname", }, wantErr: true, @@ -660,7 +660,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "invalid arg count - replace, no args", args: args{ - operation: ppb.ApiOperation_UPDATE, + operation: ppb.ApiOperation_API_OPERATION_UPDATE, path: "/system/config/hostname", }, wantErr: true, @@ -668,7 +668,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { { name: "device not found", args: args{ - operation: ppb.ApiOperation_UPDATE, + operation: ppb.ApiOperation_API_OPERATION_UPDATE, }, wantErr: true, }, @@ -707,7 +707,7 @@ func Test_pndImplementation_ChangeOND(t *testing.T) { func Test_pndImplementation_GetDevice(t *testing.T) { pnd := newPnd() - sbi := NewSBI(spb.Type_OPENCONFIG) + sbi := NewSBI(spb.Type_TYPE_OPENCONFIG) d, err := NewDevice("", uuid.Nil, newGnmiTransportOptions(), sbi) if err != nil { t.Error(err) @@ -757,7 +757,7 @@ func Test_pndImplementation_GetDevice(t *testing.T) { func Test_pndImplementation_GetDeviceByName(t *testing.T) { p := newPnd() - sbi := NewSBI(spb.Type_OPENCONFIG) + sbi := NewSBI(spb.Type_TYPE_OPENCONFIG) d, err := NewDevice("my-device", uuid.Nil, newGnmiTransportOptions(), sbi) if err != nil { t.Error(err) @@ -832,7 +832,7 @@ func Test_pndImplementation_Confirm(t *testing.T) { t.Error(err) return } - _, err := pnd.ChangeOND(d.ID(), ppb.ApiOperation_UPDATE, "system/config/hostname", "ceos3000") + _, err := pnd.ChangeOND(d.ID(), ppb.ApiOperation_API_OPERATION_UPDATE, "system/config/hostname", "ceos3000") if err != nil { t.Error(err) return diff --git a/nucleus/southbound.go b/nucleus/southbound.go index d62411738bac97389cbf9173755c35e53a686b80..3c4f98b2ab51e4436e8fd2cff0bd23bb0619c7a5 100644 --- a/nucleus/southbound.go +++ b/nucleus/southbound.go @@ -32,7 +32,7 @@ func NewSBI(southbound spb.Type, sbUUID ...uuid.UUID) southbound.SouthboundInter } switch southbound { - case spb.Type_OPENCONFIG: + case spb.Type_TYPE_OPENCONFIG: return &OpenConfig{id: id} default: return nil @@ -125,7 +125,7 @@ func (oc *OpenConfig) ID() uuid.UUID { } // Type returns the Southbound's type -func (oc *OpenConfig) Type() spb.Type { return spb.Type_OPENCONFIG } +func (oc *OpenConfig) Type() spb.Type { return spb.Type_TYPE_OPENCONFIG } // Csbi is a stub for the containerised SBI functionality. // It holds the standard goSDN OPENCONFIG schema for minimum @@ -171,5 +171,5 @@ func (csbi *Csbi) ID() uuid.UUID { // Type returns the Southbound's type func (csbi *Csbi) Type() spb.Type { - return spb.Type_CONTAINERISED + return spb.Type_TYPE_CONTAINERISED } diff --git a/nucleus/southbound_test.go b/nucleus/southbound_test.go index b13f3bb30e1cf672a95f01ceac177978c12d01b1..1fc2d76505bd8240d07cb3e686658c917670af61 100644 --- a/nucleus/southbound_test.go +++ b/nucleus/southbound_test.go @@ -165,7 +165,7 @@ func Test_unmarshal(t *testing.T) { t.Error(err) } bytes := resp.Notification[0].Update[0].Val.GetJsonIetfVal() - oc := NewSBI(spb.Type_OPENCONFIG) + oc := NewSBI(spb.Type_TYPE_OPENCONFIG) if err := unmarshal(oc.Schema(), bytes, resp.Notification[0].Update[0].Path, tt.args.goStruct, tt.args.opt...); err != nil { if !tt.wantErr { t.Errorf("unmarshal() error = %v, wantErr %v", err, tt.wantErr) @@ -180,7 +180,7 @@ func Test_unmarshal(t *testing.T) { } func Test_CreateNewUUID(t *testing.T) { - sbi := NewSBI(spb.Type_OPENCONFIG) + sbi := NewSBI(spb.Type_TYPE_OPENCONFIG) if sbi.ID().String() == "" { t.Errorf("sbi.ID().String() is not set.") @@ -189,7 +189,7 @@ func Test_CreateNewUUID(t *testing.T) { func Test_UseProvidedUUID(t *testing.T) { providedSBIId := uuid.New() - sbi := NewSBI(spb.Type_OPENCONFIG, providedSBIId) + sbi := NewSBI(spb.Type_TYPE_OPENCONFIG, providedSBIId) if sbi.ID() != providedSBIId { t.Errorf("sbi.ID() is not %s. got=%s", providedSBIId.String(), sbi.ID().String()) diff --git a/store/changeStores.go b/store/changeStores.go index ef2d5a75002d14399c3e00c5acca0912798dc88f..f9cd3a9bea1e694bd71e8a96d90b543be0b39903 100644 --- a/store/changeStores.go +++ b/store/changeStores.go @@ -41,20 +41,20 @@ func (s *ChangeStore) GetChange(id uuid.UUID) (change.Change, error) { // Pending returns the UUIDs of all pending changes func (s *ChangeStore) Pending() []uuid.UUID { - return filterChanges(s, ppb.Change_PENDING) + return filterChanges(s, ppb.ChangeState_CHANGE_STATE_PENDING) } // Committed returns the UUIDs of all pending changes func (s *ChangeStore) Committed() []uuid.UUID { - return filterChanges(s, ppb.Change_COMMITTED) + return filterChanges(s, ppb.ChangeState_CHANGE_STATE_COMMITTED) } // Confirmed returns the UUIDs of all pending changes func (s *ChangeStore) Confirmed() []uuid.UUID { - return filterChanges(s, ppb.Change_CONFIRMED) + return filterChanges(s, ppb.ChangeState_CHANGE_STATE_CONFIRMED) } -func filterChanges(store *ChangeStore, state ppb.Change_State) []uuid.UUID { +func filterChanges(store *ChangeStore, state ppb.ChangeState) []uuid.UUID { changes := make([]uuid.UUID, 0) for _, ch := range store.Store { switch c := ch.(type) { diff --git a/store/change_store_test.go b/store/change_store_test.go index fee6c99bd07c75114c41eac9648ef77396dc6256..e1e4cc9b75d9c5bab809b506042fff7d00a1cf4f 100644 --- a/store/change_store_test.go +++ b/store/change_store_test.go @@ -14,7 +14,7 @@ import ( func TestChangeStore_Pending(t *testing.T) { changeMock := &mocks.Change{} changeMock.On("ID").Return(cuid) - changeMock.On("State").Return(pnd.Change_PENDING) + changeMock.On("State").Return(pnd.ChangeState_CHANGE_STATE_PENDING) store := NewChangeStore() pending := changeMock @@ -44,7 +44,7 @@ func TestChangeStore_Pending(t *testing.T) { func TestChangeStore_Committed(t *testing.T) { changeMock := &mocks.Change{} changeMock.On("ID").Return(cuid) - changeMock.On("State").Return(pnd.Change_COMMITTED) + changeMock.On("State").Return(pnd.ChangeState_CHANGE_STATE_COMMITTED) changeMock.On("Commit").Return(nil) store := NewChangeStore() @@ -79,7 +79,7 @@ func TestChangeStore_Committed(t *testing.T) { func TestChangeStore_Confirmed(t *testing.T) { changeMock := &mocks.Change{} changeMock.On("ID").Return(cuid) - changeMock.On("State").Return(pnd.Change_CONFIRMED) + changeMock.On("State").Return(pnd.ChangeState_CHANGE_STATE_CONFIRMED) changeMock.On("Commit").Return(nil) changeMock.On("Confirm").Return(nil) @@ -138,19 +138,19 @@ func Test_filterChanges(t *testing.T) { changeMockPending := &mocks.Change{} changeMockPending.On("ID").Return(pendingCUID) - changeMockPending.On("State").Return(pnd.Change_PENDING) + changeMockPending.On("State").Return(pnd.ChangeState_CHANGE_STATE_PENDING) changeMockPending.On("Commit").Return(nil) changeMockPending.On("Confirm").Return(nil) changeMockCommited := &mocks.Change{} changeMockCommited.On("ID").Return(committedCUID) - changeMockCommited.On("State").Return(pnd.Change_COMMITTED) + changeMockCommited.On("State").Return(pnd.ChangeState_CHANGE_STATE_COMMITTED) changeMockCommited.On("Commit").Return(nil) changeMockCommited.On("Confirm").Return(nil) changeMockConfirmed := &mocks.Change{} changeMockConfirmed.On("ID").Return(confirmedCUID) - changeMockConfirmed.On("State").Return(pnd.Change_CONFIRMED) + changeMockConfirmed.On("State").Return(pnd.ChangeState_CHANGE_STATE_CONFIRMED) changeMockConfirmed.On("Commit").Return(nil) changeMockConfirmed.On("Confirm").Return(nil) @@ -184,7 +184,7 @@ func Test_filterChanges(t *testing.T) { } type args struct { store *ChangeStore - state ppb.Change_State + state ppb.ChangeState } tests := []struct { name string @@ -195,7 +195,7 @@ func Test_filterChanges(t *testing.T) { name: "pending", args: args{ store: store, - state: ppb.Change_PENDING, + state: ppb.ChangeState_CHANGE_STATE_PENDING, }, want: []uuid.UUID{pendingCUID}, }, @@ -203,7 +203,7 @@ func Test_filterChanges(t *testing.T) { name: "committed", args: args{ store: store, - state: ppb.Change_COMMITTED, + state: ppb.ChangeState_CHANGE_STATE_COMMITTED, }, want: []uuid.UUID{committedCUID}, }, @@ -211,7 +211,7 @@ func Test_filterChanges(t *testing.T) { name: "confirmed", args: args{ store: store, - state: ppb.Change_CONFIRMED, + state: ppb.ChangeState_CHANGE_STATE_CONFIRMED, }, want: []uuid.UUID{confirmedCUID}, }, diff --git a/test/integration/nucleusIntegration_test.go b/test/integration/nucleusIntegration_test.go index 68ac907101bd4fb1dd82c2289821e820c9411030..80d0cb3798dd7fb6e1f284873342fb482445b218 100644 --- a/test/integration/nucleusIntegration_test.go +++ b/test/integration/nucleusIntegration_test.go @@ -135,7 +135,7 @@ func TestGnmi_SetInvalidIntegration(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - g, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_OPENCONFIG)) + g, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG)) if err != nil { t.Errorf("NewGnmiTransport() error = %v, wantErr %v", err, tt.wantErr) return @@ -154,7 +154,7 @@ func TestGnmi_SetValidIntegration(t *testing.T) { t.Skip("skipping integration test") } - sbi := nucleus.NewSBI(spb.Type_OPENCONFIG) + sbi := nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG) opt := &tpb.TransportOption{ Address: testAddress, Username: testUsername, @@ -187,21 +187,21 @@ func TestGnmi_SetValidIntegration(t *testing.T) { }{ { name: "update", - apiOp: ppb.ApiOperation_UPDATE, + apiOp: ppb.ApiOperation_API_OPERATION_UPDATE, path: testPath, value: modifiedHostname, want: modifiedHostname, }, { name: "replace", - apiOp: ppb.ApiOperation_REPLACE, + apiOp: ppb.ApiOperation_API_OPERATION_REPLACE, path: "/system/config/domain-name", value: modifiedHostname, want: modifiedHostname, }, { name: "delete", - apiOp: ppb.ApiOperation_DELETE, + apiOp: ppb.ApiOperation_API_OPERATION_DELETE, path: testPath, }, } @@ -295,7 +295,7 @@ func TestGnmi_GetIntegration(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - g, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_OPENCONFIG)) + g, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG)) if err != nil { t.Error(err) return @@ -404,7 +404,7 @@ func TestGnmi_SubscribeIntegration(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var wantErr = tt.wantErr - g, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_OPENCONFIG)) + g, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG)) if err != nil { t.Error(err) return @@ -481,7 +481,7 @@ func TestGnmi_CapabilitiesIntegration(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - tr, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_OPENCONFIG)) + tr, err := nucleus.NewTransport(tt.fields.opt, nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG)) if err != nil { t.Error(err) return