[VOL-4371] Voltha protos cleanup
Change-Id: I9ee6ef8c48e7287c3b546c59d5190a8311f1b3ac
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() {