[VOL-5567] Upgrade protos and remove deprecated dependencies
Change-Id: I699f46a8f3f6140431d7e813b6ae48f3db55f45c
Signed-off-by: bseeniva <balaji.seenivasan@radisys.com>
diff --git a/internal/pkg/application/application_test.go b/internal/pkg/application/application_test.go
index d8a0366..077f2ac 100644
--- a/internal/pkg/application/application_test.go
+++ b/internal/pkg/application/application_test.go
@@ -29,7 +29,7 @@
"voltha-go-controller/internal/pkg/util"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
"github.com/stretchr/testify/assert"
"go.uber.org/atomic"
diff --git a/internal/pkg/application/dhcprelay_test.go b/internal/pkg/application/dhcprelay_test.go
index 0b3989f..b62c00d 100644
--- a/internal/pkg/application/dhcprelay_test.go
+++ b/internal/pkg/application/dhcprelay_test.go
@@ -25,7 +25,7 @@
"voltha-go-controller/internal/pkg/of"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/stretchr/testify/assert"
diff --git a/internal/pkg/application/flowevent_test.go b/internal/pkg/application/flowevent_test.go
index 04bed12..e7a3bd6 100644
--- a/internal/pkg/application/flowevent_test.go
+++ b/internal/pkg/application/flowevent_test.go
@@ -23,7 +23,7 @@
"voltha-go-controller/internal/pkg/util"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
)
var voltPortVnet = &VoltPortVnet{
diff --git a/internal/pkg/application/igmp_test.go b/internal/pkg/application/igmp_test.go
index 1c346aa..9eed96f 100644
--- a/internal/pkg/application/igmp_test.go
+++ b/internal/pkg/application/igmp_test.go
@@ -26,7 +26,7 @@
common "voltha-go-controller/internal/pkg/types"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/google/gopacket/layers"
"github.com/stretchr/testify/assert"
)
diff --git a/internal/pkg/application/igmpgroup_test.go b/internal/pkg/application/igmpgroup_test.go
index aec7f45..1f4f4f1 100644
--- a/internal/pkg/application/igmpgroup_test.go
+++ b/internal/pkg/application/igmpgroup_test.go
@@ -24,7 +24,7 @@
"voltha-go-controller/internal/pkg/of"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/stretchr/testify/assert"
)
diff --git a/internal/pkg/application/igmpprofiles_test.go b/internal/pkg/application/igmpprofiles_test.go
index 411426f..b7d67db 100644
--- a/internal/pkg/application/igmpprofiles_test.go
+++ b/internal/pkg/application/igmpprofiles_test.go
@@ -27,7 +27,7 @@
"voltha-go-controller/internal/pkg/util"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/stretchr/testify/assert"
)
diff --git a/internal/pkg/application/major_upgrade_test.go b/internal/pkg/application/major_upgrade_test.go
index c0bb684..0076798 100644
--- a/internal/pkg/application/major_upgrade_test.go
+++ b/internal/pkg/application/major_upgrade_test.go
@@ -23,7 +23,7 @@
"testing"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
)
diff --git a/internal/pkg/application/meters_test.go b/internal/pkg/application/meters_test.go
index 325dd9c..0a0c51b 100644
--- a/internal/pkg/application/meters_test.go
+++ b/internal/pkg/application/meters_test.go
@@ -23,7 +23,7 @@
cntlr "voltha-go-controller/internal/pkg/controller"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
"github.com/stretchr/testify/assert"
)
diff --git a/internal/pkg/application/minor_upgrade_test.go b/internal/pkg/application/minor_upgrade_test.go
index 503fb00..3d07985 100644
--- a/internal/pkg/application/minor_upgrade_test.go
+++ b/internal/pkg/application/minor_upgrade_test.go
@@ -22,7 +22,7 @@
"testing"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
)
diff --git a/internal/pkg/application/pppoeia_test.go b/internal/pkg/application/pppoeia_test.go
index 3fcb8f5..ac9b771 100644
--- a/internal/pkg/application/pppoeia_test.go
+++ b/internal/pkg/application/pppoeia_test.go
@@ -24,7 +24,7 @@
"voltha-go-controller/internal/pkg/of"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/stretchr/testify/assert"
diff --git a/internal/pkg/application/service_test.go b/internal/pkg/application/service_test.go
index f54feff..ff3cbc8 100644
--- a/internal/pkg/application/service_test.go
+++ b/internal/pkg/application/service_test.go
@@ -29,7 +29,7 @@
"voltha-go-controller/internal/pkg/util"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/google/gopacket/layers"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
"github.com/stretchr/testify/assert"
diff --git a/internal/pkg/application/vnets_test.go b/internal/pkg/application/vnets_test.go
index a2e5b0a..371462b 100644
--- a/internal/pkg/application/vnets_test.go
+++ b/internal/pkg/application/vnets_test.go
@@ -28,7 +28,7 @@
"voltha-go-controller/internal/pkg/util"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/google/gopacket/layers"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
"github.com/stretchr/testify/assert"
diff --git a/internal/pkg/controller/addflows_test.go b/internal/pkg/controller/addflows_test.go
index aee998f..d544413 100644
--- a/internal/pkg/controller/addflows_test.go
+++ b/internal/pkg/controller/addflows_test.go
@@ -22,7 +22,7 @@
"voltha-go-controller/internal/pkg/of"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
)
func Test_isFlowOperSuccess(t *testing.T) {
diff --git a/internal/pkg/controller/auditdevice_test.go b/internal/pkg/controller/auditdevice_test.go
index a6477e3..52d0a17 100644
--- a/internal/pkg/controller/auditdevice_test.go
+++ b/internal/pkg/controller/auditdevice_test.go
@@ -22,7 +22,7 @@
"voltha-go-controller/internal/pkg/of"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
)
diff --git a/internal/pkg/controller/controller_test.go b/internal/pkg/controller/controller_test.go
index e47f727..3608b52 100644
--- a/internal/pkg/controller/controller_test.go
+++ b/internal/pkg/controller/controller_test.go
@@ -27,7 +27,7 @@
"voltha-go-controller/internal/pkg/vpagent"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/stretchr/testify/assert"
)
diff --git a/internal/pkg/controller/device_test.go b/internal/pkg/controller/device_test.go
index ab832b7..6751416 100644
--- a/internal/pkg/controller/device_test.go
+++ b/internal/pkg/controller/device_test.go
@@ -23,9 +23,9 @@
"voltha-go-controller/internal/pkg/of"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/stretchr/testify/assert"
+ "go.uber.org/mock/gomock"
)
func TestNewDevicePort(t *testing.T) {
@@ -168,6 +168,9 @@
_ = NewController(context.Background(), appMock)
dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
db = dbintf
+ // Background goroutines can update groups; allow such calls
+ // to prevent gomock from failing after the test completes.
+ dbintf.EXPECT().PutGroup(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
appMock.EXPECT().ProcessFlowModResultIndication(gomock.Any(), gomock.Any()).Times(1)
d.triggerFlowResultNotification(tt.args.cntx, tt.args.cookie, tt.args.flow, tt.args.oper, tt.args.bwDetails, tt.args.err)
})
@@ -273,7 +276,12 @@
d := &Device{}
dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
db = dbintf
+ // Expect flow-hash to be written once for this test.
dbintf.EXPECT().PutFlowHash(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+ // Background goroutines from other tests may update groups;
+ // allow such calls to be no-ops to prevent gomock from failing
+ // after this test completes.
+ dbintf.EXPECT().PutGroup(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
d.SetFlowHash(tt.args.cntx, tt.args.hash)
})
}
diff --git a/internal/pkg/controller/modmeter_test.go b/internal/pkg/controller/modmeter_test.go
index fb7df0f..23eb9aa 100644
--- a/internal/pkg/controller/modmeter_test.go
+++ b/internal/pkg/controller/modmeter_test.go
@@ -23,7 +23,8 @@
"voltha-go-controller/internal/pkg/of"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
+
"github.com/stretchr/testify/assert"
)
@@ -66,9 +67,10 @@
},
}
mmt.meter.ID = uint32(2)
- dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
- db = dbintf
- dbintf.EXPECT().DelDeviceMeter(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+ // Avoid assigning a package-level mock DB here; it can be
+ // invoked by background goroutines from other tests after this
+ // test completes and cause a panic. The ModMeterTask path under
+ // test does not require DB interactions.
volthaClientMock.EXPECT().UpdateLogicalDeviceMeterTable(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
err := mmt.Start(tt.args.ctx, tt.args.taskID)
assert.Nil(t, err)
diff --git a/internal/pkg/controller/pendingprofiles_test.go b/internal/pkg/controller/pendingprofiles_test.go
index dfb17f6..08df6ab 100644
--- a/internal/pkg/controller/pendingprofiles_test.go
+++ b/internal/pkg/controller/pendingprofiles_test.go
@@ -20,7 +20,7 @@
"testing"
"voltha-go-controller/internal/test/mocks"
- "github.com/golang/mock/gomock"
+ "go.uber.org/mock/gomock"
"github.com/stretchr/testify/assert"
)
diff --git a/internal/pkg/vpagent/changeEvent.go b/internal/pkg/vpagent/changeEvent.go
index e975396..df509ce 100644
--- a/internal/pkg/vpagent/changeEvent.go
+++ b/internal/pkg/vpagent/changeEvent.go
@@ -21,8 +21,8 @@
"voltha-go-controller/log"
- "github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc"
+ "google.golang.org/protobuf/types/known/emptypb"
)
func (vpa *VPAgent) receiveChangeEvents(ctx context.Context) {
@@ -45,7 +45,7 @@
return
}
- stream, err := vServiceClient.ReceiveChangeEvents(streamCtx, &empty.Empty{}, opt)
+ stream, err := vServiceClient.ReceiveChangeEvents(streamCtx, &emptypb.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive Change Event Stream",
log.Fields{"error": err})
@@ -61,7 +61,7 @@
default:
ce, err := stream.Recv()
if err == io.EOF {
- stream, err = vServiceClient.ReceiveChangeEvents(streamCtx, &empty.Empty{}, opt)
+ stream, err = vServiceClient.ReceiveChangeEvents(streamCtx, &emptypb.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive Change Event Stream",
log.Fields{"error": err})
diff --git a/internal/pkg/vpagent/connection.go b/internal/pkg/vpagent/connection.go
index c384cb2..3bead9a 100644
--- a/internal/pkg/vpagent/connection.go
+++ b/internal/pkg/vpagent/connection.go
@@ -22,10 +22,10 @@
"voltha-go-controller/log"
- "github.com/golang/protobuf/ptypes/empty"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/opencord/voltha-protos/v5/go/voltha"
+ "google.golang.org/protobuf/types/known/emptypb"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -57,7 +57,7 @@
if err == nil {
svc := voltha.NewVolthaServiceClient(conn)
if svc != nil {
- if _, err = svc.GetVoltha(context.Background(), &empty.Empty{}); err == nil {
+ if _, err = svc.GetVoltha(context.Background(), &emptypb.Empty{}); err == nil {
logger.Debugw(ctx, "Established connection to Voltha",
log.Fields{
"VolthaApiEndPoint": vpa.VolthaAPIEndPoint,
diff --git a/internal/pkg/vpagent/packetIn.go b/internal/pkg/vpagent/packetIn.go
index f7483a6..345caf4 100644
--- a/internal/pkg/vpagent/packetIn.go
+++ b/internal/pkg/vpagent/packetIn.go
@@ -21,8 +21,8 @@
"voltha-go-controller/log"
- "github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc"
+ "google.golang.org/protobuf/types/known/emptypb"
)
func (vpa *VPAgent) receivePacketsIn(ctx context.Context) {
@@ -39,7 +39,7 @@
opt := grpc.EmptyCallOption{}
streamCtx, streamDone := context.WithCancel(context.Background())
defer streamDone()
- stream, err := vpa.volthaClient.Get().ReceivePacketsIn(streamCtx, &empty.Empty{}, opt)
+ stream, err := vpa.volthaClient.Get().ReceivePacketsIn(streamCtx, &emptypb.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive PacketIn Stream",
log.Fields{"error": err})
@@ -56,7 +56,7 @@
default:
pkt, err := stream.Recv()
if err == io.EOF {
- stream, err = vpa.volthaClient.Get().ReceivePacketsIn(streamCtx, &empty.Empty{}, opt)
+ stream, err = vpa.volthaClient.Get().ReceivePacketsIn(streamCtx, &emptypb.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive PacketIn Stream",
log.Fields{"error": err})
diff --git a/internal/pkg/vpagent/refresh.go b/internal/pkg/vpagent/refresh.go
index a0514cf..2eeced2 100644
--- a/internal/pkg/vpagent/refresh.go
+++ b/internal/pkg/vpagent/refresh.go
@@ -23,8 +23,8 @@
"voltha-go-controller/log"
- "github.com/golang/protobuf/ptypes/empty"
"github.com/opencord/voltha-protos/v5/go/voltha"
+ "google.golang.org/protobuf/types/known/emptypb"
)
func (vpa *VPAgent) synchronizeDeviceList(ctx context.Context) {
@@ -57,7 +57,7 @@
vpa.events <- vpaEventVolthaDisconnected
return
}
- deviceList, err := vpa.volthaClient.Get().ListLogicalDevices(context.Background(), &empty.Empty{})
+ deviceList, err := vpa.volthaClient.Get().ListLogicalDevices(context.Background(), &emptypb.Empty{})
if err != nil {
logger.Errorw(ctx, "vpagent failed to query device list from voltha",
log.Fields{"error": err})