[VOL-4371] Voltha protos cleanup
Change-Id: Ia83c7656c102da5edf6d413c37d1f6eedbfdf204
diff --git a/pkg/grpc/client.go b/pkg/grpc/client.go
index a3dec75..bbec5a3 100644
--- a/pkg/grpc/client.go
+++ b/pkg/grpc/client.go
@@ -27,8 +27,9 @@
grpc_opentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
"github.com/opencord/voltha-lib-go/v7/pkg/probe"
- "github.com/opencord/voltha-protos/v5/go/adapter_services"
- "github.com/opencord/voltha-protos/v5/go/core"
+ "github.com/opencord/voltha-protos/v5/go/core_service"
+ "github.com/opencord/voltha-protos/v5/go/olt_inter_adapter_service"
+ "github.com/opencord/voltha-protos/v5/go/onu_inter_adapter_service"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
)
@@ -162,13 +163,13 @@
// GetCoreServiceClient is a helper function that returns a concrete service instead of the GetClient() API
// which returns an interface
-func (c *Client) GetCoreServiceClient() (core.CoreServiceClient, error) {
+func (c *Client) GetCoreServiceClient() (core_service.CoreServiceClient, error) {
c.connectionLock.RLock()
defer c.connectionLock.RUnlock()
if c.service == nil {
return nil, fmt.Errorf("no core connection to %s", c.apiEndPoint)
}
- client, ok := c.service.(core.CoreServiceClient)
+ client, ok := c.service.(core_service.CoreServiceClient)
if ok {
return client, nil
}
@@ -177,13 +178,13 @@
// GetOnuAdapterServiceClient is a helper function that returns a concrete service instead of the GetClient() API
// which returns an interface
-func (c *Client) GetOnuInterAdapterServiceClient() (adapter_services.OnuInterAdapterServiceClient, error) {
+func (c *Client) GetOnuInterAdapterServiceClient() (onu_inter_adapter_service.OnuInterAdapterServiceClient, error) {
c.connectionLock.RLock()
defer c.connectionLock.RUnlock()
if c.service == nil {
return nil, fmt.Errorf("no child adapter connection to %s", c.apiEndPoint)
}
- client, ok := c.service.(adapter_services.OnuInterAdapterServiceClient)
+ client, ok := c.service.(onu_inter_adapter_service.OnuInterAdapterServiceClient)
if ok {
return client, nil
}
@@ -192,13 +193,13 @@
// GetOltAdapterServiceClient is a helper function that returns a concrete service instead of the GetClient() API
// which returns an interface
-func (c *Client) GetOltInterAdapterServiceClient() (adapter_services.OltInterAdapterServiceClient, error) {
+func (c *Client) GetOltInterAdapterServiceClient() (olt_inter_adapter_service.OltInterAdapterServiceClient, error) {
c.connectionLock.RLock()
defer c.connectionLock.RUnlock()
if c.service == nil {
return nil, fmt.Errorf("no parent adapter connection to %s", c.apiEndPoint)
}
- client, ok := c.service.(adapter_services.OltInterAdapterServiceClient)
+ client, ok := c.service.(olt_inter_adapter_service.OltInterAdapterServiceClient)
if ok {
return client, nil
}
diff --git a/pkg/grpc/client_test.go b/pkg/grpc/client_test.go
index d8ea31d..e06ad7b 100644
--- a/pkg/grpc/client_test.go
+++ b/pkg/grpc/client_test.go
@@ -28,7 +28,8 @@
"github.com/opencord/voltha-lib-go/v7/pkg/log"
"github.com/opencord/voltha-lib-go/v7/pkg/probe"
"github.com/opencord/voltha-protos/v5/go/common"
- "github.com/opencord/voltha-protos/v5/go/core"
+ "github.com/opencord/voltha-protos/v5/go/core_service"
+ "github.com/opencord/voltha-protos/v5/go/health"
"github.com/opencord/voltha-protos/v5/go/voltha"
"github.com/phayes/freeport"
"github.com/stretchr/testify/assert"
@@ -71,7 +72,7 @@
s.server = NewGrpcServer(s.apiEndPoint, nil, false, s.probe)
s.server.AddService(func(server *grpc.Server) {
- core.RegisterCoreServiceServer(server, &MockCoreServiceHandler{})
+ core_service.RegisterCoreServiceServer(server, &MockCoreServiceHandler{})
})
}
@@ -143,8 +144,8 @@
if conn == nil {
return nil
}
- svc := core.NewCoreServiceClient(conn)
- if h, err := svc.GetHealthStatus(ctx, &empty.Empty{}); err != nil || h.State != voltha.HealthStatus_HEALTHY {
+ svc := core_service.NewCoreServiceClient(conn)
+ if h, err := svc.GetHealthStatus(ctx, &empty.Empty{}); err != nil || h.State != health.HealthStatus_HEALTHY {
return nil
}
return svc
@@ -154,8 +155,8 @@
if conn == nil {
return nil
}
- svc := core.NewCoreServiceClient(conn)
- if h, err := svc.GetHealthStatus(ctx, &empty.Empty{}); err != nil || h.State != voltha.HealthStatus_HEALTHY {
+ svc := core_service.NewCoreServiceClient(conn)
+ if h, err := svc.GetHealthStatus(ctx, &empty.Empty{}); err != nil || h.State != health.HealthStatus_HEALTHY {
return nil
}
testForNoActivityCh <- time.Now()
@@ -174,10 +175,10 @@
c.client.Start(probeCtx, handler)
}
-func (c *testClient) getClient(t *testing.T) core.CoreServiceClient {
+func (c *testClient) getClient(t *testing.T) core_service.CoreServiceClient {
gc, err := c.client.GetClient()
assert.Nil(t, err)
- coreClient, ok := gc.(core.CoreServiceClient)
+ coreClient, ok := gc.(core_service.CoreServiceClient)
assert.True(t, ok)
return coreClient
}
diff --git a/pkg/grpc/mock_core_service.go b/pkg/grpc/mock_core_service.go
index 745753c..015f667 100644
--- a/pkg/grpc/mock_core_service.go
+++ b/pkg/grpc/mock_core_service.go
@@ -22,14 +22,15 @@
"github.com/golang/protobuf/ptypes/empty"
"github.com/opencord/voltha-protos/v5/go/common"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
+ "github.com/opencord/voltha-protos/v5/go/health"
"github.com/opencord/voltha-protos/v5/go/voltha"
)
//MockCoreServiceHandler implements the methods in the core service
type MockCoreServiceHandler struct{}
-func (handler *MockCoreServiceHandler) RegisterAdapter(ctx context.Context, reg *ic.AdapterRegistration) (*empty.Empty, error) {
+func (handler *MockCoreServiceHandler) RegisterAdapter(ctx context.Context, reg *ca.AdapterRegistration) (*empty.Empty, error) {
//logger.Debugw(ctx, "registration-received", log.Fields{"input": reg})
return &empty.Empty{}, nil
}
@@ -42,7 +43,7 @@
return &empty.Empty{}, nil
}
-func (handler *MockCoreServiceHandler) PortsStateUpdate(context.Context, *ic.PortStateFilter) (*empty.Empty, error) {
+func (handler *MockCoreServiceHandler) PortsStateUpdate(context.Context, *ca.PortStateFilter) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
@@ -50,7 +51,7 @@
return &empty.Empty{}, nil
}
-func (handler *MockCoreServiceHandler) GetDevicePort(context.Context, *ic.PortFilter) (*voltha.Port, error) {
+func (handler *MockCoreServiceHandler) GetDevicePort(context.Context, *ca.PortFilter) (*voltha.Port, error) {
return &voltha.Port{}, nil
}
@@ -58,7 +59,7 @@
return &voltha.Ports{}, nil
}
-func (handler *MockCoreServiceHandler) DeviceStateUpdate(context.Context, *ic.DeviceStateFilter) (*empty.Empty, error) {
+func (handler *MockCoreServiceHandler) DeviceStateUpdate(context.Context, *ca.DeviceStateFilter) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
@@ -66,7 +67,7 @@
return &empty.Empty{}, nil
}
-func (handler *MockCoreServiceHandler) ChildDeviceDetected(context.Context, *ic.DeviceDiscovery) (*voltha.Device, error) {
+func (handler *MockCoreServiceHandler) ChildDeviceDetected(context.Context, *ca.DeviceDiscovery) (*voltha.Device, error) {
return &voltha.Device{}, nil
}
@@ -89,7 +90,7 @@
}, nil
}
-func (handler *MockCoreServiceHandler) GetChildDevice(context.Context, *ic.ChildDeviceFilter) (*voltha.Device, error) {
+func (handler *MockCoreServiceHandler) GetChildDevice(context.Context, *ca.ChildDeviceFilter) (*voltha.Device, error) {
return nil, nil
}
@@ -97,15 +98,15 @@
return &voltha.Devices{}, nil
}
-func (handler *MockCoreServiceHandler) SendPacketIn(context.Context, *ic.PacketIn) (*empty.Empty, error) {
+func (handler *MockCoreServiceHandler) SendPacketIn(context.Context, *ca.PacketIn) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
-func (handler *MockCoreServiceHandler) DeviceReasonUpdate(context.Context, *ic.DeviceReason) (*empty.Empty, error) {
+func (handler *MockCoreServiceHandler) DeviceReasonUpdate(context.Context, *ca.DeviceReason) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
-func (handler *MockCoreServiceHandler) PortStateUpdate(context.Context, *ic.PortState) (*empty.Empty, error) {
+func (handler *MockCoreServiceHandler) PortStateUpdate(context.Context, *ca.PortState) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
@@ -118,11 +119,11 @@
return &voltha.Device{}, nil
}
-func (handler *MockCoreServiceHandler) GetPorts(context.Context, *ic.PortFilter) (*voltha.Ports, error) {
+func (handler *MockCoreServiceHandler) GetPorts(context.Context, *ca.PortFilter) (*voltha.Ports, error) {
return &voltha.Ports{}, nil
}
-func (handler *MockCoreServiceHandler) ChildrenStateUpdate(context.Context, *ic.DeviceStateFilter) (*empty.Empty, error) {
+func (handler *MockCoreServiceHandler) ChildrenStateUpdate(context.Context, *ca.DeviceStateFilter) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
@@ -130,6 +131,6 @@
return &empty.Empty{}, nil
}
-func (handler *MockCoreServiceHandler) GetHealthStatus(ctx context.Context, empty *empty.Empty) (*voltha.HealthStatus, error) {
- return &voltha.HealthStatus{State: voltha.HealthStatus_HEALTHY}, nil
+func (handler *MockCoreServiceHandler) GetHealthStatus(ctx context.Context, empty *empty.Empty) (*health.HealthStatus, error) {
+ return &health.HealthStatus{State: health.HealthStatus_HEALTHY}, nil
}