[VOL-4371] Voltha protos cleanup
Change-Id: I9ee6ef8c48e7287c3b546c59d5190a8311f1b3ac
diff --git a/rw_core/mocks/adapter.go b/rw_core/mocks/adapter.go
index 9543a7e..5b8cc1b 100644
--- a/rw_core/mocks/adapter.go
+++ b/rw_core/mocks/adapter.go
@@ -28,13 +28,15 @@
vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc"
"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/adapter_service"
"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"
"google.golang.org/grpc"
+ ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
"github.com/opencord/voltha-protos/v5/go/extension"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ "github.com/opencord/voltha-protos/v5/go/omci"
"github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
)
@@ -129,7 +131,7 @@
return ta.serviceEndpoint
}
-func (ta *Adapter) GetCoreClient() (core.CoreServiceClient, error) {
+func (ta *Adapter) GetCoreClient() (core_service.CoreServiceClient, error) {
// Wait until the Core is up and running
for {
if ta.coreClient != nil {
@@ -139,7 +141,7 @@
time.Sleep(1 * time.Second)
continue
}
- c, ok := client.(core.CoreServiceClient)
+ c, ok := client.(core_service.CoreServiceClient)
if ok {
logger.Debug(context.Background(), "got-valid-client")
return c, nil
@@ -152,10 +154,10 @@
// Helper methods
// startGRPCService creates the grpc service handlers, registers it to the grpc server and starts the server
-func (ta *Adapter) startGRPCService(ctx context.Context, server *vgrpc.GrpcServer, handler adapter_services.AdapterServiceServer, serviceName string) {
+func (ta *Adapter) startGRPCService(ctx context.Context, server *vgrpc.GrpcServer, handler adapter_service.AdapterServiceServer, serviceName string) {
logger.Infow(ctx, "service-created", log.Fields{"service": serviceName})
- server.AddService(func(gs *grpc.Server) { adapter_services.RegisterAdapterServiceServer(gs, handler) })
+ server.AddService(func(gs *grpc.Server) { adapter_service.RegisterAdapterServiceServer(gs, handler) })
logger.Infow(ctx, "service-added", log.Fields{"service": serviceName})
ta.Probe.UpdateStatus(ctx, serviceName, probe.ServiceStatusRunning)
@@ -168,16 +170,16 @@
}
func setAndTestCoreServiceHandler(ctx context.Context, conn *grpc.ClientConn) interface{} {
- 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
}
// gRPC service
-func (ta *Adapter) GetHealthStatus(ctx context.Context, empty *empty.Empty) (*voltha.HealthStatus, error) {
- return &voltha.HealthStatus{State: voltha.HealthStatus_HEALTHY}, nil
+func (ta *Adapter) GetHealthStatus(ctx context.Context, empty *empty.Empty) (*health.HealthStatus, error) {
+ return &health.HealthStatus{State: health.HealthStatus_HEALTHY}, nil
}
// Device
@@ -225,7 +227,7 @@
return &empty.Empty{}, nil
}
-func (ta *Adapter) GetOfpDeviceInfo(ctx context.Context, device *voltha.Device) (*ic.SwitchCapability, error) {
+func (ta *Adapter) GetOfpDeviceInfo(ctx context.Context, device *voltha.Device) (*ca.SwitchCapability, error) {
return nil, nil
}
@@ -240,11 +242,11 @@
}
// Flows
-func (ta *Adapter) UpdateFlowsBulk(ctx context.Context, flows *ic.BulkFlows) (*empty.Empty, error) {
+func (ta *Adapter) UpdateFlowsBulk(ctx context.Context, flows *ca.BulkFlows) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
-func (ta *Adapter) UpdateFlowsIncrementally(ctx context.Context, incrFlows *ic.IncrementalFlows) (*empty.Empty, error) {
+func (ta *Adapter) UpdateFlowsIncrementally(ctx context.Context, incrFlows *ca.IncrementalFlows) (*empty.Empty, error) {
ta.flowLock.Lock()
defer ta.flowLock.Unlock()
@@ -278,12 +280,12 @@
}
//Packets
-func (ta *Adapter) SendPacketOut(ctx context.Context, packet *ic.PacketOut) (*empty.Empty, error) {
+func (ta *Adapter) SendPacketOut(ctx context.Context, packet *ca.PacketOut) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
// PM
-func (ta *Adapter) UpdatePmConfig(ctx context.Context, configs *ic.PmConfigsInfo) (*empty.Empty, error) {
+func (ta *Adapter) UpdatePmConfig(ctx context.Context, configs *ca.PmConfigsInfo) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
@@ -313,28 +315,28 @@
}
// Deprecated image APIs
-func (ta *Adapter) DownloadImage(ctx context.Context, in *ic.ImageDownloadMessage) (*voltha.ImageDownload, error) {
+func (ta *Adapter) DownloadImage(ctx context.Context, in *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) {
return &voltha.ImageDownload{}, nil
}
-func (ta *Adapter) GetImageDownloadStatus(ctx context.Context, in *ic.ImageDownloadMessage) (*voltha.ImageDownload, error) {
+func (ta *Adapter) GetImageDownloadStatus(ctx context.Context, in *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) {
return &voltha.ImageDownload{}, nil
}
-func (ta *Adapter) CancelImageDownload(ctx context.Context, in *ic.ImageDownloadMessage) (*voltha.ImageDownload, error) {
+func (ta *Adapter) CancelImageDownload(ctx context.Context, in *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) {
return &voltha.ImageDownload{}, nil
}
-func (ta *Adapter) ActivateImageUpdate(ctx context.Context, in *ic.ImageDownloadMessage) (*voltha.ImageDownload, error) {
+func (ta *Adapter) ActivateImageUpdate(ctx context.Context, in *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) {
return &voltha.ImageDownload{}, nil
}
-func (ta *Adapter) RevertImageUpdate(ctx context.Context, in *ic.ImageDownloadMessage) (*voltha.ImageDownload, error) {
+func (ta *Adapter) RevertImageUpdate(ctx context.Context, in *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) {
return &voltha.ImageDownload{}, nil
}
// OMCI test
-func (ta *Adapter) StartOmciTest(ctx context.Context, test *ic.OMCITest) (*voltha.TestResponse, error) {
+func (ta *Adapter) StartOmciTest(ctx context.Context, test *ca.OMCITest) (*omci.TestResponse, error) {
return nil, nil
}
@@ -347,15 +349,15 @@
return &empty.Empty{}, nil
}
-func (ta *Adapter) SimulateAlarm(context.Context, *ic.SimulateAlarmMessage) (*common.OperationResp, error) {
+func (ta *Adapter) SimulateAlarm(context.Context, *ca.SimulateAlarmMessage) (*common.OperationResp, error) {
return &common.OperationResp{}, nil
}
-func (ta *Adapter) GetExtValue(context.Context, *ic.GetExtValueMessage) (*common.ReturnValues, error) {
- return &common.ReturnValues{}, nil
+func (ta *Adapter) GetExtValue(context.Context, *ca.GetExtValueMessage) (*extension.ReturnValues, error) {
+ return &extension.ReturnValues{}, nil
}
-func (ta *Adapter) SetExtValue(context.Context, *ic.SetExtValueMessage) (*empty.Empty, error) {
+func (ta *Adapter) SetExtValue(context.Context, *ca.SetExtValueMessage) (*empty.Empty, error) {
return &empty.Empty{}, nil
}
diff --git a/rw_core/mocks/adapter_olt.go b/rw_core/mocks/adapter_olt.go
index b0ff711..9bfb2d8 100644
--- a/rw_core/mocks/adapter_olt.go
+++ b/rw_core/mocks/adapter_olt.go
@@ -27,13 +27,14 @@
"github.com/opencord/voltha-lib-go/v7/pkg/probe"
"github.com/opencord/voltha-protos/v5/go/common"
"github.com/opencord/voltha-protos/v5/go/extension"
+ "github.com/opencord/voltha-protos/v5/go/omci"
"github.com/phayes/freeport"
"github.com/gogo/protobuf/proto"
com "github.com/opencord/voltha-lib-go/v7/pkg/adapters/common"
vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
of "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
)
@@ -174,7 +175,7 @@
d.ConnectStatus = common.ConnectStatus_REACHABLE
d.OperStatus = common.OperStatus_ACTIVE
- if _, err = c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{DeviceId: d.Id, OperStatus: d.OperStatus, ConnStatus: d.ConnectStatus}); err != nil {
+ if _, err = c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{DeviceId: d.Id, OperStatus: d.OperStatus, ConnStatus: d.ConnectStatus}); err != nil {
logger.Fatalf(ctx, "PortCreated-failed-%s", err)
}
@@ -190,7 +191,7 @@
for i := 0; i < numONUPerOLT; i++ {
go func(seqNo int) {
if _, err := c.ChildDeviceDetected(context.TODO(),
- &ic.DeviceDiscovery{
+ &ca.DeviceDiscovery{
ParentId: d.Id,
ParentPortNo: 1,
ChildDeviceType: oltA.ChildDeviceType,
@@ -215,11 +216,11 @@
}
// Get_ofp_device_info returns ofp device info
-func (oltA *OLTAdapter) GetOfpDeviceInfo(ctx context.Context, device *voltha.Device) (*ic.SwitchCapability, error) { // nolint
+func (oltA *OLTAdapter) GetOfpDeviceInfo(ctx context.Context, device *voltha.Device) (*ca.SwitchCapability, error) { // nolint
if d := oltA.getDevice(device.Id); d == nil {
logger.Fatalf(ctx, "device-not-found-%s", device.Id)
}
- return &ic.SwitchCapability{
+ return &ca.SwitchCapability{
Desc: &of.OfpDesc{
HwDesc: "olt_adapter_mock",
SwDesc: "olt_adapter_mock",
@@ -251,7 +252,7 @@
}
if _, err := c.PortsStateUpdate(context.TODO(),
- &ic.PortStateFilter{
+ &ca.PortStateFilter{
DeviceId: cloned.Id,
PortTypeFilter: 0,
OperStatus: common.OperStatus_UNKNOWN,
@@ -263,7 +264,7 @@
cloned.OperStatus = common.OperStatus_UNKNOWN
// The device is still reachable after it has been disabled, so the connection status should not be changed.
- if _, err := c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{
+ if _, err := c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{
DeviceId: cloned.Id,
OperStatus: cloned.OperStatus,
ConnStatus: cloned.ConnectStatus,
@@ -300,7 +301,7 @@
// Update the all ports state on that device to enable
if _, err := c.PortsStateUpdate(context.TODO(),
- &ic.PortStateFilter{
+ &ca.PortStateFilter{
DeviceId: cloned.Id,
PortTypeFilter: 0,
OperStatus: common.OperStatus_ACTIVE,
@@ -311,7 +312,7 @@
//Update the device state
cloned.OperStatus = common.OperStatus_ACTIVE
- if _, err := c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{
+ if _, err := c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{
DeviceId: cloned.Id,
OperStatus: cloned.OperStatus,
ConnStatus: cloned.ConnectStatus,
@@ -339,7 +340,7 @@
if port.Type == voltha.Port_PON_OLT {
if _, err := c.PortStateUpdate(context.TODO(),
- &ic.PortState{
+ &ca.PortState{
DeviceId: port.DeviceId,
PortType: voltha.Port_ETHERNET_NNI,
PortNo: port.PortNo,
@@ -362,7 +363,7 @@
}
if port.Type == voltha.Port_PON_OLT {
if _, err := c.PortStateUpdate(context.TODO(),
- &ic.PortState{
+ &ca.PortState{
DeviceId: port.DeviceId,
PortType: voltha.Port_PON_OLT,
PortNo: port.PortNo,
@@ -386,7 +387,7 @@
return
}
- if _, err := c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{
+ if _, err := c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{
DeviceId: device.Id,
OperStatus: common.OperStatus_UNKNOWN,
ConnStatus: common.ConnectStatus_UNREACHABLE,
@@ -396,7 +397,7 @@
}
if _, err := c.PortsStateUpdate(context.TODO(),
- &ic.PortStateFilter{
+ &ca.PortStateFilter{
DeviceId: device.Id,
PortTypeFilter: 0,
OperStatus: common.OperStatus_UNKNOWN,
@@ -408,7 +409,7 @@
}
// TODO: REMOVE Start_omci_test begins an omci self-test
-func (oltA *OLTAdapter) StartOmciTest(ctx context.Context, test *ic.OMCITest) (*voltha.TestResponse, error) { // nolint
+func (oltA *OLTAdapter) StartOmciTest(ctx context.Context, test *ca.OMCITest) (*omci.TestResponse, error) { // nolint
return nil, errors.New("start-omci-test-not-implemented")
}
@@ -419,7 +420,7 @@
return
}
- if _, err := c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{
+ if _, err := c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{
DeviceId: deviceID,
OperStatus: common.OperStatus_ACTIVE,
ConnStatus: common.ConnectStatus_REACHABLE,
diff --git a/rw_core/mocks/adapter_onu.go b/rw_core/mocks/adapter_onu.go
index 8fb4744..7712b23 100644
--- a/rw_core/mocks/adapter_onu.go
+++ b/rw_core/mocks/adapter_onu.go
@@ -26,13 +26,14 @@
vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc"
"github.com/opencord/voltha-lib-go/v7/pkg/probe"
"github.com/opencord/voltha-protos/v5/go/common"
+ ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
"github.com/opencord/voltha-protos/v5/go/extension"
"github.com/phayes/freeport"
"github.com/gogo/protobuf/proto"
com "github.com/opencord/voltha-lib-go/v7/pkg/adapters/common"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ "github.com/opencord/voltha-protos/v5/go/omci"
of "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
)
@@ -131,7 +132,7 @@
d.ConnectStatus = common.ConnectStatus_REACHABLE
d.OperStatus = common.OperStatus_DISCOVERED
- if _, err = c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{DeviceId: d.Id, OperStatus: d.OperStatus, ConnStatus: d.ConnectStatus}); err != nil {
+ if _, err = c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{DeviceId: d.Id, OperStatus: d.OperStatus, ConnStatus: d.ConnectStatus}); err != nil {
logger.Fatalf(ctx, "PortCreated-failed-%s", err)
}
@@ -187,7 +188,7 @@
d.ConnectStatus = common.ConnectStatus_REACHABLE
d.OperStatus = common.OperStatus_ACTIVE
- if _, err = c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{DeviceId: d.Id, OperStatus: d.OperStatus, ConnStatus: d.ConnectStatus}); err != nil {
+ if _, err = c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{DeviceId: d.Id, OperStatus: d.OperStatus, ConnStatus: d.ConnectStatus}); err != nil {
logger.Fatalf(ctx, "PortCreated-failed-%s", err)
}
@@ -223,7 +224,7 @@
}
if _, err := c.PortsStateUpdate(context.TODO(),
- &ic.PortStateFilter{
+ &ca.PortStateFilter{
DeviceId: cloned.Id,
PortTypeFilter: 0,
OperStatus: common.OperStatus_UNKNOWN,
@@ -235,7 +236,7 @@
cloned.ConnectStatus = common.ConnectStatus_UNREACHABLE
cloned.OperStatus = common.OperStatus_UNKNOWN
- if _, err := c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{
+ if _, err := c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{
DeviceId: cloned.Id,
OperStatus: cloned.OperStatus,
ConnStatus: cloned.ConnectStatus,
@@ -266,7 +267,7 @@
// Update the all ports state on that device to enable
if _, err := c.PortsStateUpdate(context.TODO(),
- &ic.PortStateFilter{
+ &ca.PortStateFilter{
DeviceId: cloned.Id,
PortTypeFilter: 0,
OperStatus: common.OperStatus_ACTIVE,
@@ -278,7 +279,7 @@
cloned.ConnectStatus = common.ConnectStatus_REACHABLE
cloned.OperStatus = common.OperStatus_ACTIVE
- if _, err := c.DeviceStateUpdate(context.TODO(), &ic.DeviceStateFilter{
+ if _, err := c.DeviceStateUpdate(context.TODO(), &ca.DeviceStateFilter{
DeviceId: cloned.Id,
OperStatus: cloned.OperStatus,
ConnStatus: cloned.ConnectStatus,
@@ -292,6 +293,6 @@
return &empty.Empty{}, nil
}
-func (onuA *ONUAdapter) StartOmciTest(ctx context.Context, _ *ic.OMCITest) (*voltha.TestResponse, error) { // nolint
- return &voltha.TestResponse{Result: voltha.TestResponse_SUCCESS}, nil
+func (onuA *ONUAdapter) StartOmciTest(ctx context.Context, _ *ca.OMCITest) (*omci.TestResponse, error) { // nolint
+ return &omci.TestResponse{Result: omci.TestResponse_SUCCESS}, nil
}