[VOL-4371] Voltha protos cleanup
Change-Id: I9ee6ef8c48e7287c3b546c59d5190a8311f1b3ac
diff --git a/rw_core/core/adapter/agent.go b/rw_core/core/adapter/agent.go
index c2d45de..c164826 100644
--- a/rw_core/core/adapter/agent.go
+++ b/rw_core/core/adapter/agent.go
@@ -25,7 +25,8 @@
"github.com/golang/protobuf/ptypes/empty"
vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
- "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/health"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc"
)
@@ -42,8 +43,8 @@
}
func setAndTestAdapterServiceHandler(ctx context.Context, conn *grpc.ClientConn) interface{} {
- svc := adapter_services.NewAdapterServiceClient(conn)
- if h, err := svc.GetHealthStatus(ctx, &empty.Empty{}); err != nil || h.State != voltha.HealthStatus_HEALTHY {
+ svc := adapter_service.NewAdapterServiceClient(conn)
+ if h, err := svc.GetHealthStatus(ctx, &empty.Empty{}); err != nil || h.State != health.HealthStatus_HEALTHY {
logger.Debugw(ctx, "connection-not-ready", log.Fields{"error": err, "health": h})
return nil
}
@@ -88,12 +89,12 @@
return aa.adapter
}
-func (aa *agent) getClient() (adapter_services.AdapterServiceClient, error) {
+func (aa *agent) getClient() (adapter_service.AdapterServiceClient, error) {
client, err := aa.vClient.GetClient()
if err != nil {
return nil, err
}
- c, ok := client.(adapter_services.AdapterServiceClient)
+ c, ok := client.(adapter_service.AdapterServiceClient)
if ok {
return c, nil
}
diff --git a/rw_core/core/adapter/manager.go b/rw_core/core/adapter/manager.go
index b592842..790a670 100644
--- a/rw_core/core/adapter/manager.go
+++ b/rw_core/core/adapter/manager.go
@@ -25,9 +25,9 @@
"github.com/opencord/voltha-lib-go/v7/pkg/db"
vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc"
- "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"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ "github.com/opencord/voltha-protos/v5/go/core_adapter"
"github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
@@ -132,7 +132,7 @@
return "", errors.New("Not found")
}
-func (aMgr *Manager) GetAdapterClient(_ context.Context, endpoint string) (adapter_services.AdapterServiceClient, error) {
+func (aMgr *Manager) GetAdapterClient(_ context.Context, endpoint string) (adapter_service.AdapterServiceClient, error) {
if endpoint == "" {
return nil, errors.New("endpoint-cannot-be-empty")
}
@@ -277,7 +277,7 @@
return nil
}
-func (aMgr *Manager) RegisterAdapter(ctx context.Context, registration *ic.AdapterRegistration) (*empty.Empty, error) {
+func (aMgr *Manager) RegisterAdapter(ctx context.Context, registration *core_adapter.AdapterRegistration) (*empty.Empty, error) {
adapter := registration.Adapter
deviceTypes := registration.DTypes
logger.Infow(ctx, "RegisterAdapter", log.Fields{"adapter": adapter, "deviceTypes": deviceTypes.Items})
diff --git a/rw_core/core/api/grpc_nbi_handler.go b/rw_core/core/api/grpc_nbi_handler.go
index 6defba3..eb80522 100755
--- a/rw_core/core/api/grpc_nbi_handler.go
+++ b/rw_core/core/api/grpc_nbi_handler.go
@@ -26,6 +26,7 @@
"github.com/opencord/voltha-go/rw_core/core/device"
"github.com/opencord/voltha-lib-go/v7/pkg/version"
"github.com/opencord/voltha-protos/v5/go/common"
+ "github.com/opencord/voltha-protos/v5/go/health"
"github.com/opencord/voltha-protos/v5/go/omci"
"github.com/opencord/voltha-protos/v5/go/voltha"
)
@@ -49,8 +50,8 @@
}
}
-func (handler *APIHandler) GetHealthStatus(ctx context.Context, empty *empty.Empty) (*voltha.HealthStatus, error) {
- return &voltha.HealthStatus{State: voltha.HealthStatus_HEALTHY}, nil
+func (handler *APIHandler) GetHealthStatus(ctx context.Context, empty *empty.Empty) (*health.HealthStatus, error) {
+ return &health.HealthStatus{State: health.HealthStatus_HEALTHY}, nil
}
// GetVoltha currently just returns version information
@@ -78,12 +79,6 @@
func (handler *APIHandler) GetCoreInstance(context.Context, *voltha.ID) (*voltha.CoreInstance, error) {
return nil, errUnimplemented
}
-func (handler *APIHandler) ListDeviceGroups(context.Context, *empty.Empty) (*voltha.DeviceGroups, error) {
- return nil, errUnimplemented
-}
-func (handler *APIHandler) GetDeviceGroup(context.Context, *voltha.ID) (*voltha.DeviceGroup, error) {
- return nil, errUnimplemented
-}
func (handler *APIHandler) CreateEventFilter(context.Context, *voltha.EventFilter) (*voltha.EventFilter, error) {
return nil, errUnimplemented
}
@@ -102,18 +97,9 @@
func (handler *APIHandler) SelfTest(context.Context, *voltha.ID) (*voltha.SelfTestResponse, error) {
return nil, errUnimplemented
}
-func (handler *APIHandler) Subscribe(context.Context, *voltha.OfAgentSubscriber) (*voltha.OfAgentSubscriber, error) {
- return nil, errUnimplemented
-}
func (handler *APIHandler) GetAlarmDeviceData(context.Context, *common.ID) (*omci.AlarmDeviceData, error) {
return nil, errUnimplemented
}
func (handler *APIHandler) GetMibDeviceData(context.Context, *common.ID) (*omci.MibDeviceData, error) {
return nil, errUnimplemented
}
-func (handler *APIHandler) GetMembership(context.Context, *empty.Empty) (*voltha.Membership, error) {
- return nil, errUnimplemented
-}
-func (handler *APIHandler) UpdateMembership(context.Context, *voltha.Membership) (*empty.Empty, error) {
- return nil, errUnimplemented
-}
diff --git a/rw_core/core/core.go b/rw_core/core/core.go
index 3fa68ef..0fee3e3 100644
--- a/rw_core/core/core.go
+++ b/rw_core/core/core.go
@@ -31,7 +31,7 @@
"github.com/opencord/voltha-lib-go/v7/pkg/kafka"
"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/core"
+ "github.com/opencord/voltha-protos/v5/go/core_service"
"github.com/opencord/voltha-protos/v5/go/extension"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc"
@@ -189,10 +189,10 @@
}
// startGrpcSbiService creates the grpc core service handlers, registers it to the grpc server and starts the server
-func startGrpcSbiService(ctx context.Context, server *grpcserver.GrpcServer, serviceName string, handler core.CoreServiceServer) {
+func startGrpcSbiService(ctx context.Context, server *grpcserver.GrpcServer, serviceName string, handler core_service.CoreServiceServer) {
logger.Infow(ctx, "starting-grpc-sbi-service", log.Fields{"service": serviceName})
- server.AddService(func(server *grpc.Server) { core.RegisterCoreServiceServer(server, handler) })
+ server.AddService(func(server *grpc.Server) { core_service.RegisterCoreServiceServer(server, handler) })
logger.Infow(ctx, "grpc-sbi-service-added", log.Fields{"service": serviceName})
probe.UpdateStatusFromContext(ctx, serviceName, probe.ServiceStatusRunning)
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index a33765b..ad7b523 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -25,8 +25,9 @@
"sync"
"time"
- "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/core"
+ "github.com/opencord/voltha-protos/v5/go/omci"
"github.com/cenkalti/backoff/v3"
"github.com/gogo/protobuf/proto"
@@ -44,8 +45,8 @@
coreutils "github.com/opencord/voltha-go/rw_core/utils"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
"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"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
)
@@ -453,7 +454,7 @@
//addFlowsAndGroups adds the "newFlows" and "newGroups" from the existing flows/groups and sends the update to the
//adapters
-func (agent *Agent) addFlowsAndGroups(ctx context.Context, newFlows []*ofp.OfpFlowStats, newGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+func (agent *Agent) addFlowsAndGroups(ctx context.Context, newFlows []*ofp.OfpFlowStats, newGroups []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) error {
var flwResponse, grpResponse coreutils.Response
var err error
//if new flow list is empty then the called function returns quickly
@@ -473,7 +474,7 @@
//deleteFlowsAndGroups removes the "flowsToDel" and "groupsToDel" from the existing flows/groups and sends the update to the
//adapters
-func (agent *Agent) deleteFlowsAndGroups(ctx context.Context, flowsToDel []*ofp.OfpFlowStats, groupsToDel []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+func (agent *Agent) deleteFlowsAndGroups(ctx context.Context, flowsToDel []*ofp.OfpFlowStats, groupsToDel []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) error {
var flwResponse, grpResponse coreutils.Response
var err error
if flwResponse, err = agent.deleteFlowsFromAdapter(ctx, flowsToDel, flowMetadata); err != nil {
@@ -491,7 +492,7 @@
//updateFlowsAndGroups replaces the existing flows and groups with "updatedFlows" and "updatedGroups" respectively. It
//also sends the updates to the adapters
-func (agent *Agent) updateFlowsAndGroups(ctx context.Context, updatedFlows []*ofp.OfpFlowStats, updatedGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+func (agent *Agent) updateFlowsAndGroups(ctx context.Context, updatedFlows []*ofp.OfpFlowStats, updatedGroups []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) error {
var flwResponse, grpResponse coreutils.Response
var err error
if flwResponse, err = agent.updateFlowsToAdapter(ctx, updatedFlows, flowMetadata); err != nil {
@@ -644,7 +645,7 @@
previousAdminState := device.AdminState
if previousAdminState != common.AdminState_PREPROVISIONED {
- var client adapter_services.AdapterServiceClient
+ var client adapter_service.AdapterServiceClient
client, err = agent.adapterMgr.GetAdapterClient(ctx, agent.adapterEndpoint)
if err != nil {
logger.Errorw(ctx, "grpc-client-nil",
@@ -713,7 +714,7 @@
// If the device was in pre-prov state (only parent device are in that state) then do not send the request to the
// adapter
if previousAdminState != common.AdminState_PREPROVISIONED {
- var client adapter_services.AdapterServiceClient
+ var client adapter_service.AdapterServiceClient
client, err = agent.adapterMgr.GetAdapterClient(ctx, agent.adapterEndpoint)
if err != nil {
logger.Errorw(ctx, "grpc-client-nil",
@@ -761,7 +762,7 @@
}
// getSwitchCapability retrieves the switch capability of a parent device
-func (agent *Agent) getSwitchCapability(ctx context.Context) (*ic.SwitchCapability, error) {
+func (agent *Agent) getSwitchCapability(ctx context.Context) (*ca.SwitchCapability, error) {
logger.Debugw(ctx, "get-switch-capability", log.Fields{"device-id": agent.deviceID})
device, err := agent.getDeviceReadOnly(ctx)
@@ -807,7 +808,7 @@
subCtx, cancel := context.WithTimeout(coreutils.WithAllMetadataFromContext(ctx), agent.rpcTimeout)
go func() {
defer cancel()
- _, err := client.SendPacketOut(subCtx, &ic.PacketOut{
+ _, err := client.SendPacketOut(subCtx, &ca.PacketOut{
DeviceId: agent.deviceID,
EgressPortNo: outPort,
Packet: packet,
@@ -945,7 +946,7 @@
requestStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
go func() {
defer cancel()
- _, err := client.SimulateAlarm(subCtx, &ic.SimulateAlarmMessage{Device: device, Request: simulateReq})
+ _, err := client.SimulateAlarm(subCtx, &ca.SimulateAlarmMessage{Device: device, Request: simulateReq})
if err == nil {
agent.onSuccess(subCtx, nil, nil, false)
} else {
@@ -1120,7 +1121,7 @@
return nil
}
-func (agent *Agent) startOmciTest(ctx context.Context, omcitestrequest *voltha.OmciTestRequest) (*voltha.TestResponse, error) {
+func (agent *Agent) startOmciTest(ctx context.Context, omcitestrequest *omci.OmciTestRequest) (*omci.TestResponse, error) {
var err error
var desc string
requestStatus := &common.OperationResp{Code: common.OperationResp_OPERATION_FAILURE}
@@ -1156,7 +1157,7 @@
return nil, err
}
- res, err := client.StartOmciTest(ctx, &ic.OMCITest{
+ res, err := client.StartOmciTest(ctx, &ca.OMCITest{
Device: cloned,
Request: omcitestrequest,
})
@@ -1166,7 +1167,7 @@
return res, err
}
-func (agent *Agent) getExtValue(ctx context.Context, pdevice *voltha.Device, cdevice *voltha.Device, valueparam *voltha.ValueSpecifier) (*voltha.ReturnValues, error) {
+func (agent *Agent) getExtValue(ctx context.Context, pdevice *voltha.Device, cdevice *voltha.Device, valueparam *extension.ValueSpecifier) (*extension.ReturnValues, error) {
logger.Debugw(ctx, "get-ext-value", log.Fields{"device-id": agent.deviceID, "onu-id": valueparam.Id, "value-type": valueparam.Value})
var err error
var desc string
@@ -1194,7 +1195,7 @@
// Release lock before sending to adapter
agent.requestQueue.RequestComplete()
- retVal, err := client.GetExtValue(ctx, &ic.GetExtValueMessage{
+ retVal, err := client.GetExtValue(ctx, &ca.GetExtValueMessage{
ParentDevice: pdevice,
ChildDevice: cdevice,
ValueType: valueparam.Value,
@@ -1205,7 +1206,7 @@
return retVal, err
}
-func (agent *Agent) setExtValue(ctx context.Context, device *voltha.Device, value *voltha.ValueSet) (*empty.Empty, error) {
+func (agent *Agent) setExtValue(ctx context.Context, device *voltha.Device, value *extension.ValueSet) (*empty.Empty, error) {
logger.Debugw(ctx, "set-ext-value", log.Fields{"device-id": value.Id})
var err error
@@ -1234,7 +1235,7 @@
// Release lock before sending request to adapter
agent.requestQueue.RequestComplete()
- retVal, err := client.SetExtValue(ctx, &ic.SetExtValueMessage{
+ retVal, err := client.SetExtValue(ctx, &ca.SetExtValueMessage{
Device: device,
Value: value,
})
diff --git a/rw_core/core/device/agent_flow.go b/rw_core/core/device/agent_flow.go
index 6ad4488..f53cb7d 100644
--- a/rw_core/core/device/agent_flow.go
+++ b/rw_core/core/device/agent_flow.go
@@ -20,7 +20,7 @@
"context"
"fmt"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
"github.com/gogo/protobuf/proto"
coreutils "github.com/opencord/voltha-go/rw_core/utils"
@@ -46,7 +46,7 @@
return flows
}
-func (agent *Agent) addFlowsToAdapter(ctx context.Context, newFlows []*ofp.OfpFlowStats, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
+func (agent *Agent) addFlowsToAdapter(ctx context.Context, newFlows []*ofp.OfpFlowStats, flowMetadata *ofp.FlowMetadata) (coreutils.Response, error) {
logger.Debugw(ctx, "add-flows-to-adapters", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "flow-metadata": flowMetadata})
var err error
@@ -118,16 +118,16 @@
flowSlice[ctr] = flow
ctr++
}
- go agent.sendBulkFlows(subCtx, device, &voltha.Flows{Items: flowSlice}, nil, flowMetadata, response)
+ go agent.sendBulkFlows(subCtx, device, &ofp.Flows{Items: flowSlice}, nil, flowMetadata, response)
} else {
flowChanges := &ofp.FlowChanges{
- ToAdd: &voltha.Flows{Items: flowsToAdd},
- ToRemove: &voltha.Flows{Items: flowsToDelete},
+ ToAdd: &ofp.Flows{Items: flowsToAdd},
+ ToRemove: &ofp.Flows{Items: flowsToDelete},
}
groupChanges := &ofp.FlowGroupChanges{
- ToAdd: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToRemove: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToUpdate: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToAdd: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToRemove: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToUpdate: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
}
go agent.sendIncrementalFlows(subCtx, device, flowChanges, groupChanges, flowMetadata, response)
}
@@ -138,9 +138,9 @@
func (agent *Agent) sendBulkFlows(
ctx context.Context,
device *voltha.Device,
- flows *voltha.Flows,
- groups *voltha.FlowGroups,
- flowMetadata *voltha.FlowMetadata,
+ flows *ofp.Flows,
+ groups *ofp.FlowGroups,
+ flowMetadata *ofp.FlowMetadata,
response coreutils.Response,
) {
var err error
@@ -164,7 +164,7 @@
subCtx, cancel := context.WithTimeout(ctx, agent.rpcTimeout)
defer cancel()
- if _, err = client.UpdateFlowsBulk(subCtx, &ic.BulkFlows{
+ if _, err = client.UpdateFlowsBulk(subCtx, &ca.BulkFlows{
Device: device,
Flows: flows,
Groups: groups,
@@ -182,7 +182,7 @@
device *voltha.Device,
flowChanges *ofp.FlowChanges,
groupChanges *ofp.FlowGroupChanges,
- flowMetadata *voltha.FlowMetadata,
+ flowMetadata *ofp.FlowMetadata,
response coreutils.Response,
) {
var err error
@@ -205,7 +205,7 @@
}
subCtx, cancel := context.WithTimeout(ctx, agent.rpcTimeout)
defer cancel()
- if _, err = client.UpdateFlowsIncrementally(subCtx, &ic.IncrementalFlows{
+ if _, err = client.UpdateFlowsIncrementally(subCtx, &ca.IncrementalFlows{
Device: device,
Flows: flowChanges,
Groups: groupChanges,
@@ -218,7 +218,7 @@
}
}
-func (agent *Agent) deleteFlowsFromAdapter(ctx context.Context, flowsToDel []*ofp.OfpFlowStats, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
+func (agent *Agent) deleteFlowsFromAdapter(ctx context.Context, flowsToDel []*ofp.OfpFlowStats, flowMetadata *ofp.FlowMetadata) (coreutils.Response, error) {
logger.Debugw(ctx, "delete-flows-from-adapter", log.Fields{"device-id": agent.deviceID, "flows": flowsToDel})
var desc string
@@ -269,16 +269,16 @@
flowSlice[ctr] = flow
ctr++
}
- go agent.sendBulkFlows(subCtx, device, &voltha.Flows{Items: flowSlice}, nil, flowMetadata, response)
+ go agent.sendBulkFlows(subCtx, device, &ofp.Flows{Items: flowSlice}, nil, flowMetadata, response)
} else {
flowChanges := &ofp.FlowChanges{
- ToAdd: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
- ToRemove: &voltha.Flows{Items: flowsToDel},
+ ToAdd: &ofp.Flows{Items: []*ofp.OfpFlowStats{}},
+ ToRemove: &ofp.Flows{Items: flowsToDel},
}
groupChanges := &ofp.FlowGroupChanges{
- ToAdd: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToRemove: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToUpdate: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToAdd: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToRemove: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToUpdate: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
}
go agent.sendIncrementalFlows(subCtx, device, flowChanges, groupChanges, flowMetadata, response)
}
@@ -286,7 +286,7 @@
return response, nil
}
-func (agent *Agent) updateFlowsToAdapter(ctx context.Context, updatedFlows []*ofp.OfpFlowStats, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
+func (agent *Agent) updateFlowsToAdapter(ctx context.Context, updatedFlows []*ofp.OfpFlowStats, flowMetadata *ofp.FlowMetadata) (coreutils.Response, error) {
logger.Debugw(ctx, "update-flows-to-adapter", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows})
var err error
@@ -347,7 +347,7 @@
flowSlice[ctr] = flow
ctr++
}
- go agent.sendBulkFlows(subCtx, device, &voltha.Flows{Items: flowSlice}, nil, flowMetadata, response)
+ go agent.sendBulkFlows(subCtx, device, &ofp.Flows{Items: flowSlice}, nil, flowMetadata, response)
} else {
logger.Debugw(ctx, "updating-flows-and-groups",
log.Fields{
@@ -363,13 +363,13 @@
}
flowChanges := &ofp.FlowChanges{
- ToAdd: &voltha.Flows{Items: flowsToAdd},
- ToRemove: &voltha.Flows{Items: flowsToDelete},
+ ToAdd: &ofp.Flows{Items: flowsToAdd},
+ ToRemove: &ofp.Flows{Items: flowsToDelete},
}
groupChanges := &ofp.FlowGroupChanges{
- ToAdd: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToRemove: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToUpdate: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToAdd: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToRemove: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToUpdate: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
}
go agent.sendIncrementalFlows(subCtx, device, flowChanges, groupChanges, flowMetadata, response)
}
@@ -378,7 +378,7 @@
}
//filterOutFlows removes flows from a device using the uni-port as filter
-func (agent *Agent) filterOutFlows(ctx context.Context, uniPort uint32, flowMetadata *voltha.FlowMetadata) error {
+func (agent *Agent) filterOutFlows(ctx context.Context, uniPort uint32, flowMetadata *ofp.FlowMetadata) error {
var flowsToDelete []*ofp.OfpFlowStats
// If an existing flow has the uniPort as an InPort or OutPort or as a Tunnel ID then it needs to be removed
for flowID := range agent.flowCache.ListIDs() {
diff --git a/rw_core/core/device/agent_group.go b/rw_core/core/device/agent_group.go
index 43a8929..ad95e9c 100644
--- a/rw_core/core/device/agent_group.go
+++ b/rw_core/core/device/agent_group.go
@@ -42,7 +42,7 @@
return groups
}
-func (agent *Agent) addGroupsToAdapter(ctx context.Context, newGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
+func (agent *Agent) addGroupsToAdapter(ctx context.Context, newGroups []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) (coreutils.Response, error) {
logger.Debugw(ctx, "add-groups-to-adapters", log.Fields{"device-id": agent.deviceID, "groups": newGroups, "flow-metadata": flowMetadata})
var err error
@@ -116,16 +116,16 @@
groupSlice[ctr] = group
ctr++
}
- go agent.sendBulkFlows(subCtx, device, nil, &voltha.FlowGroups{Items: groupSlice}, flowMetadata, response)
+ go agent.sendBulkFlows(subCtx, device, nil, &ofp.FlowGroups{Items: groupSlice}, flowMetadata, response)
} else {
flowChanges := &ofp.FlowChanges{
- ToAdd: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
- ToRemove: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
+ ToAdd: &ofp.Flows{Items: []*ofp.OfpFlowStats{}},
+ ToRemove: &ofp.Flows{Items: []*ofp.OfpFlowStats{}},
}
groupChanges := &ofp.FlowGroupChanges{
- ToAdd: &voltha.FlowGroups{Items: groupsToAdd},
- ToRemove: &voltha.FlowGroups{Items: groupsToDelete},
- ToUpdate: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToAdd: &ofp.FlowGroups{Items: groupsToAdd},
+ ToRemove: &ofp.FlowGroups{Items: groupsToDelete},
+ ToUpdate: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
}
go agent.sendIncrementalFlows(subCtx, device, flowChanges, groupChanges, flowMetadata, response)
}
@@ -133,7 +133,7 @@
return response, nil
}
-func (agent *Agent) deleteGroupsFromAdapter(ctx context.Context, groupsToDel []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
+func (agent *Agent) deleteGroupsFromAdapter(ctx context.Context, groupsToDel []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) (coreutils.Response, error) {
logger.Debugw(ctx, "delete-groups-from-adapter", log.Fields{"device-id": agent.deviceID, "groups": groupsToDel})
var desc string
@@ -183,16 +183,16 @@
groupSlice[ctr] = group
ctr++
}
- go agent.sendBulkFlows(subCtx, device, nil, &voltha.FlowGroups{Items: groupSlice}, flowMetadata, response)
+ go agent.sendBulkFlows(subCtx, device, nil, &ofp.FlowGroups{Items: groupSlice}, flowMetadata, response)
} else {
flowChanges := &ofp.FlowChanges{
- ToAdd: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
- ToRemove: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
+ ToAdd: &ofp.Flows{Items: []*ofp.OfpFlowStats{}},
+ ToRemove: &ofp.Flows{Items: []*ofp.OfpFlowStats{}},
}
groupChanges := &ofp.FlowGroupChanges{
- ToAdd: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToRemove: &voltha.FlowGroups{Items: groupsToDel},
- ToUpdate: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToAdd: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToRemove: &ofp.FlowGroups{Items: groupsToDel},
+ ToUpdate: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
}
go agent.sendIncrementalFlows(subCtx, device, flowChanges, groupChanges, flowMetadata, response)
}
@@ -200,7 +200,7 @@
return response, nil
}
-func (agent *Agent) updateGroupsToAdapter(ctx context.Context, updatedGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
+func (agent *Agent) updateGroupsToAdapter(ctx context.Context, updatedGroups []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) (coreutils.Response, error) {
logger.Debugw(ctx, "update-groups-to-adapter", log.Fields{"device-id": agent.deviceID, "groups": updatedGroups})
var desc string
@@ -258,7 +258,7 @@
groupSlice[ctr] = group
ctr++
}
- go agent.sendBulkFlows(subCtx, device, nil, &voltha.FlowGroups{Items: groupSlice}, flowMetadata, response)
+ go agent.sendBulkFlows(subCtx, device, nil, &ofp.FlowGroups{Items: groupSlice}, flowMetadata, response)
} else {
logger.Debugw(ctx, "updating-groups",
log.Fields{
@@ -274,13 +274,13 @@
}
flowChanges := &ofp.FlowChanges{
- ToAdd: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
- ToRemove: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
+ ToAdd: &ofp.Flows{Items: []*ofp.OfpFlowStats{}},
+ ToRemove: &ofp.Flows{Items: []*ofp.OfpFlowStats{}},
}
groupChanges := &ofp.FlowGroupChanges{
- ToAdd: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToRemove: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
- ToUpdate: &voltha.FlowGroups{Items: groupsToUpdate},
+ ToAdd: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToRemove: &ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
+ ToUpdate: &ofp.FlowGroups{Items: groupsToUpdate},
}
go agent.sendIncrementalFlows(subCtx, device, flowChanges, groupChanges, flowMetadata, response)
}
diff --git a/rw_core/core/device/agent_image.go b/rw_core/core/device/agent_image.go
index 2fa8dac..7c86e08 100644
--- a/rw_core/core/device/agent_image.go
+++ b/rw_core/core/device/agent_image.go
@@ -21,7 +21,7 @@
"errors"
"time"
- 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/common"
@@ -100,7 +100,7 @@
operStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
go func() {
defer cancel()
- response, err := client.DownloadImage(subCtx, &ic.ImageDownloadMessage{
+ response, err := client.DownloadImage(subCtx, &ca.ImageDownloadMessage{
Device: cloned,
Image: clonedImg,
})
@@ -181,7 +181,7 @@
operStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
go func() {
defer cancel()
- response, err := client.CancelImageDownload(subCtx, &ic.ImageDownloadMessage{
+ response, err := client.CancelImageDownload(subCtx, &ca.ImageDownloadMessage{
Device: cloned,
Image: img,
})
@@ -262,7 +262,7 @@
operStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
go func() {
defer cancel()
- response, err := client.ActivateImageUpdate(subCtx, &ic.ImageDownloadMessage{
+ response, err := client.ActivateImageUpdate(subCtx, &ca.ImageDownloadMessage{
Device: cloned,
Image: img,
})
@@ -333,7 +333,7 @@
operStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
go func() {
defer cancel()
- _, err := client.RevertImageUpdate(subCtx, &ic.ImageDownloadMessage{
+ _, err := client.RevertImageUpdate(subCtx, &ca.ImageDownloadMessage{
Device: cloned,
Image: img,
})
@@ -379,7 +379,7 @@
return nil, err
}
agent.requestQueue.RequestComplete()
- return client.GetImageDownloadStatus(ctx, &ic.ImageDownloadMessage{
+ return client.GetImageDownloadStatus(ctx, &ca.ImageDownloadMessage{
Device: device,
Image: img,
})
diff --git a/rw_core/core/device/agent_pm_config.go b/rw_core/core/device/agent_pm_config.go
index ba1005a..0e5bf7c 100644
--- a/rw_core/core/device/agent_pm_config.go
+++ b/rw_core/core/device/agent_pm_config.go
@@ -22,7 +22,7 @@
"github.com/gogo/protobuf/proto"
"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"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -60,7 +60,7 @@
})
return err
}
- _, pmErr := client.UpdatePmConfig(ctx, &ic.PmConfigsInfo{
+ _, pmErr := client.UpdatePmConfig(ctx, &ca.PmConfigsInfo{
DeviceId: agent.deviceID,
PmConfigs: pmConfigs,
})
diff --git a/rw_core/core/device/agent_test.go b/rw_core/core/device/agent_test.go
index 0577c1e..35142d3 100755
--- a/rw_core/core/device/agent_test.go
+++ b/rw_core/core/device/agent_test.go
@@ -27,7 +27,7 @@
"time"
ver "github.com/opencord/voltha-lib-go/v7/pkg/version"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
"github.com/gogo/protobuf/proto"
"github.com/opencord/voltha-go/db/model"
@@ -347,7 +347,7 @@
{Id: 124, TableId: 1240, Priority: 1000, IdleTimeout: 0, Flags: 0, Cookie: 1240000, PacketCount: 0},
{Id: 125, TableId: 1250, Priority: 1000, IdleTimeout: 0, Flags: 0, Cookie: 1250000, PacketCount: 0},
}
- err := da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &voltha.FlowMetadata{})
+ err := da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &ofp.FlowMetadata{})
// Expect specific error as adapter communication, for unit tests, are not set
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "flow-failure-device-"))
@@ -368,7 +368,7 @@
{Id: 127, TableId: 1270, Priority: 1000, IdleTimeout: 0, Flags: 0, Cookie: 1270000, PacketCount: 0},
}
- err = da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &voltha.FlowMetadata{})
+ err = da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "flow-failure-device-"))
daFlows = changeToFlowList(da.listDeviceFlows())
@@ -390,7 +390,7 @@
{Id: 128, TableId: 1280, Priority: 1000, IdleTimeout: 0, Flags: 0, Cookie: 1280000, PacketCount: 0},
}
- err = da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &voltha.FlowMetadata{})
+ err = da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daFlows = changeToFlowList(da.listDeviceFlows())
@@ -412,7 +412,7 @@
{Id: 128, TableId: 1280, Priority: 1000, IdleTimeout: 0, Flags: 0, Cookie: 1280000, PacketCount: 0},
}
- err = da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &voltha.FlowMetadata{})
+ err = da.addFlowsAndGroups(context.Background(), newFlows, []*ofp.OfpGroupEntry{}, &ofp.FlowMetadata{})
assert.Nil(t, err)
daFlows = changeToFlowList(da.listDeviceFlows())
assert.True(t, isFlowSliceEqual(expectedFlows, daFlows))
@@ -430,7 +430,7 @@
{Id: 125, TableId: 1250, Priority: 1000, IdleTimeout: 0, Flags: 0, Cookie: 1250000, PacketCount: 0},
}
- err = da.deleteFlowsAndGroups(context.Background(), flowsToDelete, []*ofp.OfpGroupEntry{}, &voltha.FlowMetadata{})
+ err = da.deleteFlowsAndGroups(context.Background(), flowsToDelete, []*ofp.OfpGroupEntry{}, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daFlows = changeToFlowList(da.listDeviceFlows())
@@ -446,7 +446,7 @@
{Id: 124, TableId: 1240, Priority: 1000, IdleTimeout: 0, Flags: 0, Cookie: 1240000, PacketCount: 0},
}
- err = da.deleteFlowsAndGroups(context.Background(), flowsToDelete, []*ofp.OfpGroupEntry{}, &voltha.FlowMetadata{})
+ err = da.deleteFlowsAndGroups(context.Background(), flowsToDelete, []*ofp.OfpGroupEntry{}, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daFlows = changeToFlowList(da.listDeviceFlows())
@@ -459,7 +459,7 @@
{Desc: &ofp.OfpGroupDesc{Type: 1, GroupId: 10, Buckets: nil}},
{Desc: &ofp.OfpGroupDesc{Type: 2, GroupId: 20, Buckets: nil}},
}
- err := da.addFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, newGroups, &voltha.FlowMetadata{})
+ err := da.addFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, newGroups, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "flow-failure-device-"))
daGroups := changeToGroupList(da.listDeviceGroups())
@@ -476,7 +476,7 @@
{Desc: &ofp.OfpGroupDesc{Type: 3, GroupId: 30, Buckets: nil}},
{Desc: &ofp.OfpGroupDesc{Type: 4, GroupId: 40, Buckets: nil}},
}
- err = da.addFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, newGroups, &voltha.FlowMetadata{})
+ err = da.addFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, newGroups, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daGroups = changeToGroupList(da.listDeviceGroups())
@@ -495,7 +495,7 @@
{Desc: &ofp.OfpGroupDesc{Type: 44, GroupId: 40, Buckets: nil}},
{Desc: &ofp.OfpGroupDesc{Type: 5, GroupId: 50, Buckets: nil}},
}
- err = da.addFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, newGroups, &voltha.FlowMetadata{})
+ err = da.addFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, newGroups, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daGroups = changeToGroupList(da.listDeviceGroups())
@@ -512,7 +512,7 @@
{Desc: &ofp.OfpGroupDesc{Type: 44, GroupId: 40, Buckets: nil}},
{Desc: &ofp.OfpGroupDesc{Type: 5, GroupId: 50, Buckets: nil}},
}
- err = da.updateFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, updtGroups, &voltha.FlowMetadata{})
+ err = da.updateFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, updtGroups, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daGroups = changeToGroupList(da.listDeviceGroups())
@@ -528,7 +528,7 @@
{Desc: &ofp.OfpGroupDesc{Type: 44, GroupId: 40, Buckets: nil}},
{Desc: &ofp.OfpGroupDesc{Type: 5, GroupId: 50, Buckets: nil}},
}
- err = da.deleteFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, delGroups, &voltha.FlowMetadata{})
+ err = da.deleteFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, delGroups, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daGroups = changeToGroupList(da.listDeviceGroups())
@@ -543,7 +543,7 @@
{Desc: &ofp.OfpGroupDesc{Type: 2, GroupId: 20, Buckets: nil}},
{Desc: &ofp.OfpGroupDesc{Type: 5, GroupId: 50, Buckets: nil}},
}
- err = da.deleteFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, delGroups, &voltha.FlowMetadata{})
+ err = da.deleteFlowsAndGroups(context.Background(), []*ofp.OfpFlowStats{}, delGroups, &ofp.FlowMetadata{})
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "Aborted"))
daGroups = changeToGroupList(da.listDeviceGroups())
@@ -563,7 +563,7 @@
}
types := []*voltha.DeviceType{{Id: "olt-mock-device-type", AdapterType: "olt-mock-adapter-type", AcceptsAddRemoveFlowUpdates: true}}
deviceTypes := &voltha.DeviceTypes{Items: types}
- _, err := dat.adapterMgr.RegisterAdapter(ctx, &ic.AdapterRegistration{
+ _, err := dat.adapterMgr.RegisterAdapter(ctx, &ca.AdapterRegistration{
Adapter: oltAdapter,
DTypes: deviceTypes,
})
@@ -582,7 +582,7 @@
}
types = []*voltha.DeviceType{{Id: "onu-mock-device-type", AdapterType: "onu-mock-adapter-type", AcceptsAddRemoveFlowUpdates: true}}
deviceTypes = &voltha.DeviceTypes{Items: types}
- _, err = dat.adapterMgr.RegisterAdapter(ctx, &ic.AdapterRegistration{
+ _, err = dat.adapterMgr.RegisterAdapter(ctx, &ca.AdapterRegistration{
Adapter: onuAdapter,
DTypes: deviceTypes,
})
diff --git a/rw_core/core/device/logical_agent.go b/rw_core/core/device/logical_agent.go
index cbf2625..f175305 100644
--- a/rw_core/core/device/logical_agent.go
+++ b/rw_core/core/device/logical_agent.go
@@ -33,7 +33,7 @@
coreutils "github.com/opencord/voltha-go/rw_core/utils"
fu "github.com/opencord/voltha-lib-go/v7/pkg/flows"
"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"
ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc/codes"
@@ -106,7 +106,7 @@
var ld *voltha.LogicalDevice
if !logicalDeviceExist {
//Build the logical device based on information retrieved from the device adapter
- var switchCap *ic.SwitchCapability
+ var switchCap *ca.SwitchCapability
var err error
if switchCap, err = agent.deviceMgr.getSwitchCapability(ctx, agent.rootDeviceID); err != nil {
return err
@@ -298,7 +298,7 @@
return responses
}
-func (agent *LogicalAgent) updateFlowsAndGroupsOfDevice(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) []coreutils.Response {
+func (agent *LogicalAgent) updateFlowsAndGroupsOfDevice(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *ofp.FlowMetadata) []coreutils.Response {
logger.Debugw(ctx, "send-update-flows-to-device-manager", log.Fields{"logical-device-id": agent.logicalDeviceID})
responses := make([]coreutils.Response, 0)
@@ -341,7 +341,7 @@
continue
}
logger.Debugw(ctx, "uni-port", log.Fields{"flows": flows, "uni-port": uniPort})
- go func(uniPort uint32, metadata *voltha.FlowMetadata) {
+ go func(uniPort uint32, metadata *ofp.FlowMetadata) {
subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), agent.internalTimeout)
subCtx = coreutils.WithRPCMetadataFromContext(subCtx, ctx)
diff --git a/rw_core/core/device/logical_agent_flow.go b/rw_core/core/device/logical_agent_flow.go
index 85b78ef..fa1a19a 100644
--- a/rw_core/core/device/logical_agent_flow.go
+++ b/rw_core/core/device/logical_agent_flow.go
@@ -517,13 +517,13 @@
}
// TODO: Remove this helper, just pass the map through to functions directly
-func toMetadata(meters map[uint32]*ofp.OfpMeterConfig) *voltha.FlowMetadata {
+func toMetadata(meters map[uint32]*ofp.OfpMeterConfig) *ofp.FlowMetadata {
ctr, ret := 0, make([]*ofp.OfpMeterConfig, len(meters))
for _, meter := range meters {
ret[ctr] = meter
ctr++
}
- return &voltha.FlowMetadata{Meters: ret}
+ return &ofp.FlowMetadata{Meters: ret}
}
func (agent *LogicalAgent) deleteFlowsHavingMeter(ctx context.Context, meterID uint32) error {
diff --git a/rw_core/core/device/logical_agent_group.go b/rw_core/core/device/logical_agent_group.go
index 9a47d81..cbf296b 100644
--- a/rw_core/core/device/logical_agent_group.go
+++ b/rw_core/core/device/logical_agent_group.go
@@ -231,7 +231,7 @@
}
// Update the devices
- respChnls := agent.updateFlowsAndGroupsOfDevice(ctx, deviceRules, &voltha.FlowMetadata{})
+ respChnls := agent.updateFlowsAndGroupsOfDevice(ctx, deviceRules, &ofp.FlowMetadata{})
// Wait for completion
go func() {
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 5519cab..9f7e656 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -33,7 +33,7 @@
"github.com/opencord/voltha-go/rw_core/utils"
"github.com/opencord/voltha-lib-go/v7/pkg/events"
"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"
ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc/codes"
@@ -477,7 +477,7 @@
return nil
}
-func (dMgr *Manager) addFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+func (dMgr *Manager) addFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) error {
logger.Debugw(ctx, "add-flows-and-groups", log.Fields{"device-id": deviceID, "groups:": groups, "flow-metadata": flowMetadata})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.addFlowsAndGroups(ctx, flows, groups, flowMetadata)
@@ -486,7 +486,7 @@
}
// deleteParentFlows removes flows from the parent device based on specific attributes
-func (dMgr *Manager) deleteParentFlows(ctx context.Context, deviceID string, uniPort uint32, metadata *voltha.FlowMetadata) error {
+func (dMgr *Manager) deleteParentFlows(ctx context.Context, deviceID string, uniPort uint32, metadata *ofp.FlowMetadata) error {
logger.Debugw(ctx, "delete-parent-flows", log.Fields{"device-id": deviceID, "uni-port": uniPort, "metadata": metadata})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
if !agent.isRootDevice {
@@ -497,7 +497,7 @@
return status.Errorf(codes.NotFound, "%s", deviceID)
}
-func (dMgr *Manager) deleteFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+func (dMgr *Manager) deleteFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) error {
logger.Debugw(ctx, "delete-flows-and-groups", log.Fields{"device-id": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.deleteFlowsAndGroups(ctx, flows, groups, flowMetadata)
@@ -505,7 +505,7 @@
return status.Errorf(codes.NotFound, "%s", deviceID)
}
-func (dMgr *Manager) updateFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+func (dMgr *Manager) updateFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *ofp.FlowMetadata) error {
logger.Debugw(ctx, "update-flows-and-groups", log.Fields{"device-id": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.updateFlowsAndGroups(ctx, flows, groups, flowMetadata)
@@ -524,7 +524,7 @@
return status.Errorf(codes.NotFound, "%s", deviceID)
}
-func (dMgr *Manager) getSwitchCapability(ctx context.Context, deviceID string) (*ic.SwitchCapability, error) {
+func (dMgr *Manager) getSwitchCapability(ctx context.Context, deviceID string) (*ca.SwitchCapability, error) {
logger.Debugw(ctx, "get-switch-capability", log.Fields{"device-id": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.getSwitchCapability(ctx)
diff --git a/rw_core/core/device/manager_nbi.go b/rw_core/core/device/manager_nbi.go
index 9632eb1..3f23e2d 100644
--- a/rw_core/core/device/manager_nbi.go
+++ b/rw_core/core/device/manager_nbi.go
@@ -23,6 +23,8 @@
"github.com/opencord/voltha-go/rw_core/utils"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
"github.com/opencord/voltha-protos/v5/go/common"
+ "github.com/opencord/voltha-protos/v5/go/extension"
+ "github.com/opencord/voltha-protos/v5/go/omci"
ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc/codes"
@@ -776,7 +778,7 @@
}
// ListDeviceFlowGroups returns the flow group details for a specific device entry
-func (dMgr *Manager) ListDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*voltha.FlowGroups, error) {
+func (dMgr *Manager) ListDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*ofp.FlowGroups, error) {
ctx = utils.WithRPCMetadataContext(ctx, "ListDeviceFlowGroups")
log.EnrichSpan(ctx, log.Fields{"device-id": id.Id})
logger.Debugw(ctx, "list-device-flow-groups", log.Fields{"device-id": id.Id})
@@ -790,7 +792,7 @@
ret[ctr] = group
ctr++
}
- return &voltha.FlowGroups{Items: ret}, nil
+ return &ofp.FlowGroups{Items: ret}, nil
}
func (dMgr *Manager) EnablePort(ctx context.Context, port *voltha.Port) (*empty.Empty, error) {
@@ -817,7 +819,7 @@
return &empty.Empty{}, agent.disablePort(ctx, port.PortNo)
}
-func (dMgr *Manager) GetExtValue(ctx context.Context, value *voltha.ValueSpecifier) (*voltha.ReturnValues, error) {
+func (dMgr *Manager) GetExtValue(ctx context.Context, value *extension.ValueSpecifier) (*extension.ReturnValues, error) {
ctx = utils.WithRPCMetadataContext(ctx, "GetExtValue")
log.EnrichSpan(ctx, log.Fields{"device-id": value.Id})
@@ -843,7 +845,7 @@
}
// SetExtValue set some given configs or value
-func (dMgr *Manager) SetExtValue(ctx context.Context, value *voltha.ValueSet) (*empty.Empty, error) {
+func (dMgr *Manager) SetExtValue(ctx context.Context, value *extension.ValueSet) (*empty.Empty, error) {
ctx = utils.WithRPCMetadataContext(ctx, "SetExtValue")
logger.Debugw(ctx, "set-ext-value", log.Fields{"onu-id": value.Id})
@@ -863,7 +865,7 @@
}
-func (dMgr *Manager) StartOmciTestAction(ctx context.Context, request *voltha.OmciTestRequest) (*voltha.TestResponse, error) {
+func (dMgr *Manager) StartOmciTestAction(ctx context.Context, request *omci.OmciTestRequest) (*omci.TestResponse, error) {
ctx = utils.WithRPCMetadataContext(ctx, "StartOmciTestAction")
log.EnrichSpan(ctx, log.Fields{"device-id": request.Id})
diff --git a/rw_core/core/device/manager_sbi.go b/rw_core/core/device/manager_sbi.go
index 53d2a24..5530750 100644
--- a/rw_core/core/device/manager_sbi.go
+++ b/rw_core/core/device/manager_sbi.go
@@ -22,7 +22,7 @@
"github.com/opencord/voltha-go/rw_core/utils"
"github.com/opencord/voltha-lib-go/v7/pkg/log"
"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/voltha"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -62,7 +62,7 @@
return nil, status.Errorf(codes.NotFound, "%s", device.Id)
}
-func (dMgr *Manager) DeviceStateUpdate(ctx context.Context, ds *ic.DeviceStateFilter) (*empty.Empty, error) {
+func (dMgr *Manager) DeviceStateUpdate(ctx context.Context, ds *ca.DeviceStateFilter) (*empty.Empty, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "DeviceStateUpdate")
logger.Debugw(ctx, "device-state-update", log.Fields{"device-id": ds.DeviceId, "operStatus": ds.OperStatus, "connStatus": ds.ConnStatus})
@@ -75,7 +75,7 @@
return nil, status.Errorf(codes.NotFound, "%s", ds.DeviceId)
}
-func (dMgr *Manager) ChildDeviceDetected(ctx context.Context, dd *ic.DeviceDiscovery) (*voltha.Device, error) {
+func (dMgr *Manager) ChildDeviceDetected(ctx context.Context, dd *ca.DeviceDiscovery) (*voltha.Device, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "ChildDeviceDetected")
logger.Debugw(ctx, "child-device-detected",
log.Fields{
@@ -121,7 +121,7 @@
return nil, status.Errorf(codes.FailedPrecondition, "device Type not set %s", dd.ParentId)
}
- if device, err := dMgr.GetChildDevice(ctx, &ic.ChildDeviceFilter{
+ if device, err := dMgr.GetChildDevice(ctx, &ca.ChildDeviceFilter{
ParentId: dd.ParentId,
SerialNumber: dd.SerialNumber,
OnuId: dd.OnuId,
@@ -170,7 +170,7 @@
return insertedChildDevice, nil
}
-func (dMgr *Manager) GetChildDevice(ctx context.Context, df *ic.ChildDeviceFilter) (*voltha.Device, error) {
+func (dMgr *Manager) GetChildDevice(ctx context.Context, df *ca.ChildDeviceFilter) (*voltha.Device, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "GetChildDevice")
logger.Debugw(ctx, "get-child-device", log.Fields{"filter": df})
@@ -229,7 +229,7 @@
}
// PortsStateUpdate updates the operational status of all ports on the device
-func (dMgr *Manager) PortsStateUpdate(ctx context.Context, ps *ic.PortStateFilter) (*empty.Empty, error) {
+func (dMgr *Manager) PortsStateUpdate(ctx context.Context, ps *ca.PortStateFilter) (*empty.Empty, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "PortsStateUpdate")
logger.Debugw(ctx, "ports-state-update", log.Fields{"device-id": ps.DeviceId})
@@ -336,7 +336,7 @@
return nil, status.Errorf(codes.NotFound, "%s", proxyAddress)
}
-func (dMgr *Manager) GetPorts(ctx context.Context, pf *ic.PortFilter) (*voltha.Ports, error) {
+func (dMgr *Manager) GetPorts(ctx context.Context, pf *ca.PortFilter) (*voltha.Ports, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "GetPorts")
logger.Debugw(ctx, "get-ports", log.Fields{"device-id": pf.DeviceId, "portType": pf.PortType})
@@ -354,7 +354,7 @@
return dMgr.getAllChildDevices(ctx, parentDeviceID.Id)
}
-func (dMgr *Manager) ChildrenStateUpdate(ctx context.Context, ds *ic.DeviceStateFilter) (*empty.Empty, error) {
+func (dMgr *Manager) ChildrenStateUpdate(ctx context.Context, ds *ca.DeviceStateFilter) (*empty.Empty, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "ChildrenStateUpdate")
logger.Debugw(ctx, "children-state-update", log.Fields{"parent-device-id": ds.ParentDeviceId, "operStatus": ds.OperStatus, "connStatus": ds.ConnStatus})
@@ -372,7 +372,7 @@
return &empty.Empty{}, nil
}
-func (dMgr *Manager) PortStateUpdate(ctx context.Context, ps *ic.PortState) (*empty.Empty, error) {
+func (dMgr *Manager) PortStateUpdate(ctx context.Context, ps *ca.PortState) (*empty.Empty, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "PortStateUpdate")
logger.Debugw(ctx, "port-state-update", log.Fields{"device-id": ps.DeviceId, "portType": ps.PortType, "portNo": ps.PortNo, "operStatus": ps.OperStatus})
@@ -430,7 +430,7 @@
}
// GetDevicePort returns the port details for a specific device port entry
-func (dMgr *Manager) GetDevicePort(ctx context.Context, pf *ic.PortFilter) (*voltha.Port, error) {
+func (dMgr *Manager) GetDevicePort(ctx context.Context, pf *ca.PortFilter) (*voltha.Port, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "GetDevicePort")
logger.Debugw(ctx, "get-device-port", log.Fields{"device-id": pf.DeviceId})
@@ -459,7 +459,7 @@
}
// SendPacketIn receives packetIn request from adapter
-func (dMgr *Manager) SendPacketIn(ctx context.Context, pi *ic.PacketIn) (*empty.Empty, error) {
+func (dMgr *Manager) SendPacketIn(ctx context.Context, pi *ca.PacketIn) (*empty.Empty, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "SendPacketIn")
logger.Debugw(ctx, "packet-in", log.Fields{"device-id": pi.DeviceId, "port": pi.Port})
@@ -481,7 +481,7 @@
return &empty.Empty{}, nil
}
-func (dMgr *Manager) DeviceReasonUpdate(ctx context.Context, dr *ic.DeviceReason) (*empty.Empty, error) {
+func (dMgr *Manager) DeviceReasonUpdate(ctx context.Context, dr *ca.DeviceReason) (*empty.Empty, error) {
ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "DeviceReasonUpdate")
logger.Debugw(ctx, "update-device-reason", log.Fields{"device-id": dr.DeviceId, "reason": dr.Reason})
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
}
diff --git a/rw_core/test/core_nbi_handler_multi_test.go b/rw_core/test/core_nbi_handler_multi_test.go
index 9a76069..8dbbbfc 100755
--- a/rw_core/test/core_nbi_handler_multi_test.go
+++ b/rw_core/test/core_nbi_handler_multi_test.go
@@ -31,6 +31,7 @@
"github.com/opencord/voltha-lib-go/v7/pkg/kafka"
mock_kafka "github.com/opencord/voltha-lib-go/v7/pkg/mocks/kafka"
"github.com/opencord/voltha-lib-go/v7/pkg/probe"
+ "github.com/opencord/voltha-protos/v5/go/omci"
ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
"github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc"
@@ -1222,7 +1223,7 @@
// -----------------------------------------------------------------------
// SubTest 1: Omci test action should fail due to nonexistent device id
- request := &voltha.OmciTestRequest{Id: "123", Uuid: "456"}
+ request := &omci.OmciTestRequest{Id: "123", Uuid: "456"}
_, err := nbi.StartOmciTestAction(getContext(), request)
assert.NotNil(t, err)
assert.Equal(t, "rpc error: code = NotFound desc = 123", err.Error())
@@ -1236,7 +1237,7 @@
assert.NotNil(t, deviceNoAdapter)
// Omci test action should fail due to nonexistent adapter
- request = &voltha.OmciTestRequest{Id: deviceNoAdapter.Id, Uuid: "456"}
+ request = &omci.OmciTestRequest{Id: deviceNoAdapter.Id, Uuid: "456"}
_, err = nbi.StartOmciTestAction(getContext(), request)
assert.NotNil(t, err)
assert.True(t, strings.Contains(err.Error(), "noAdapterRegisteredOmciTest"))
@@ -1283,10 +1284,10 @@
onuDevice := onuDevices.Items[0]
// Omci test action should succeed
- request = &voltha.OmciTestRequest{Id: onuDevice.Id, Uuid: "456"}
+ request = &omci.OmciTestRequest{Id: onuDevice.Id, Uuid: "456"}
resp, err := nbi.StartOmciTestAction(getContext(), request)
assert.Nil(t, err)
- assert.Equal(t, resp.Result, voltha.TestResponse_SUCCESS)
+ assert.Equal(t, resp.Result, omci.TestResponse_SUCCESS)
//Remove the device
err = cleanUpDevices(nb.maxTimeout, nbi, oltDevice.Id, false)
diff --git a/rw_core/test/utils.go b/rw_core/test/utils.go
index 8890295..d86ecff 100644
--- a/rw_core/test/utils.go
+++ b/rw_core/test/utils.go
@@ -28,7 +28,7 @@
"testing"
"time"
- ic "github.com/opencord/voltha-protos/v5/go/inter_container"
+ ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
"math/rand"
@@ -226,7 +226,7 @@
coreClient, err := onuAdapter.GetCoreClient()
assert.Nil(t, err)
assert.NotNil(t, coreClient)
- if _, err := coreClient.RegisterAdapter(ctx, &ic.AdapterRegistration{
+ if _, err := coreClient.RegisterAdapter(ctx, &ca.AdapterRegistration{
Adapter: adapterToRegister,
DTypes: deviceTypes}); err != nil {
logger.Errorw(ctx, "failed-to-register-adapter", log.Fields{"error": err, "adapter": adapterToRegister.Id})
@@ -266,7 +266,7 @@
assert.Nil(t, err)
assert.NotNil(t, coreClient)
- if _, err := coreClient.RegisterAdapter(ctx, &ic.AdapterRegistration{
+ if _, err := coreClient.RegisterAdapter(ctx, &ca.AdapterRegistration{
Adapter: adapterToRegister,
DTypes: deviceTypes}); err != nil {
logger.Errorw(ctx, "failed-to-register-adapter", log.Fields{"error": err, "adapter": adapterToRegister.Id})