VOL-3344 - Enabled default linters and fixed found issues.
Also disabled govet's variable shadowing check, since this is very useful for isolating multiple "err"ors in a row.
Change-Id: Icd70c723c406c5986b8cfe4535ad7daa0752e48c
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index f2fec23..6ad1b60 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -264,22 +264,7 @@
return &flowMgr
}
-func (f *OpenOltFlowMgr) generateStoredFlowID(ctx context.Context, flowID uint32, direction string) (uint64, error) {
- if direction == Upstream {
- logger.Debugw(ctx, "upstream-flow-shifting-id", log.Fields{"device-id": f.deviceHandler.device.Id})
- return 0x1<<15 | uint64(flowID), nil
- } else if direction == Downstream {
- logger.Debugw(ctx, "downstream-flow-not-shifting-id", log.Fields{"device-id": f.deviceHandler.device.Id})
- return uint64(flowID), nil
- } else if direction == Multicast {
- logger.Debugw(ctx, "multicast-flow-shifting-id", log.Fields{"device-id": f.deviceHandler.device.Id})
- return 0x2<<15 | uint64(flowID), nil
- } else {
- return 0, olterrors.NewErrInvalidValue(log.Fields{"direction": direction}, nil).Log()
- }
-}
-
-func (f *OpenOltFlowMgr) registerFlow(ctx context.Context, flowFromCore *ofp.OfpFlowStats, deviceFlow *openoltpb2.Flow) {
+func (f *OpenOltFlowMgr) registerFlow(ctx context.Context, flowFromCore *ofp.OfpFlowStats, deviceFlow *openoltpb2.Flow) error {
logger.Debugw(ctx, "registering-flow-for-device ",
log.Fields{
"flow": flowFromCore,
@@ -292,7 +277,7 @@
flowIDList = appendUnique(flowIDList, deviceFlow.FlowId)
f.flowsUsedByGemPort[gemPK] = flowIDList
// update the flowids for a gem to the KVstore
- f.resourceMgr.UpdateFlowIDsForGem(ctx, uint32(deviceFlow.AccessIntfId), uint32(deviceFlow.GemportId), flowIDList)
+ return f.resourceMgr.UpdateFlowIDsForGem(ctx, uint32(deviceFlow.AccessIntfId), uint32(deviceFlow.GemportId), flowIDList)
}
func (f *OpenOltFlowMgr) divideAndAddFlow(ctx context.Context, intfID uint32, onuID uint32, uniID uint32, portNo uint32,
@@ -316,7 +301,7 @@
// only create tcont/gemports if there is actually an onu id. otherwise BAL throws an error. Usually this
// is because the flow is an NNI flow and there would be no onu resources associated with it
// TODO: properly deal with NNI flows
- if onuID <= 0 {
+ if onuID == 0 {
logger.Errorw(ctx, "no-onu-id-for-flow",
log.Fields{
"port-no": portNo,
@@ -566,9 +551,10 @@
servicePriority: multicastQueuePerPonPort.Priority,
}
//also store the queue info in kv store
- f.resourceMgr.AddMcastQueueForIntf(ctx, sq.intfID,
- multicastQueuePerPonPort.GemportId,
- multicastQueuePerPonPort.Priority)
+ if err := f.resourceMgr.AddMcastQueueForIntf(ctx, sq.intfID, multicastQueuePerPonPort.GemportId, multicastQueuePerPonPort.Priority); err != nil {
+ logger.Errorw(ctx, "failed-to-add-mcast-queue", log.Fields{"error": err})
+ return err
+ }
logger.Infow(ctx, "multicast-queues-successfully-updated", log.Fields{"device-id": f.deviceHandler.device.Id})
}
@@ -725,7 +711,9 @@
"device-id": f.deviceHandler.device.Id})
return 0, nil, nil
}
- f.resourceMgr.UpdateTechProfileIDForOnu(ctx, intfID, onuID, uniID, TpID)
+ if err := f.resourceMgr.UpdateTechProfileIDForOnu(ctx, intfID, onuID, uniID, TpID); err != nil {
+ logger.Warnw(ctx, "failed-to-update-tech-profile-id", log.Fields{"error": err})
+ }
} else {
logger.Debugw(ctx, "tech-profile-instance-already-exist-for-given port-name",
log.Fields{
@@ -1469,7 +1457,7 @@
for _, tpID := range tpIDList {
if err := f.DeleteTechProfileInstance(ctx, intfID, onuID, uniID, uniPortName, tpID); err != nil {
- olterrors.NewErrAdapter("delete-tech-profile-failed", log.Fields{"device-id": f.deviceHandler.device.Id}, err).Log()
+ _ = olterrors.NewErrAdapter("delete-tech-profile-failed", log.Fields{"device-id": f.deviceHandler.device.Id}, err).Log()
// return err
// We should continue to delete tech-profile instances for other TP IDs
}
@@ -1619,7 +1607,10 @@
}
if deviceFlow.GemportId != -1 {
// No need to register the flow if it is a trap on nni flow.
- f.registerFlow(ctx, logicalFlow, deviceFlow)
+ if err := f.registerFlow(ctx, logicalFlow, deviceFlow); err != nil {
+ logger.Errorw(ctx, "failed-to-register-flow", log.Fields{"err": err})
+ return err
+ }
}
logger.Infow(ctx, "flow-added-to-device-successfully ",
log.Fields{
@@ -1823,22 +1814,6 @@
return onuDevice, nil
}
-func findNextFlow(ctx context.Context, flow *ofp.OfpFlowStats) *ofp.OfpFlowStats {
- logger.Info(ctx, "unimplemented-flow %v", flow)
- return nil
-}
-
-func (f *OpenOltFlowMgr) clearFlowsAndSchedulerForLogicalPort(ctx context.Context, childDevice *voltha.Device, logicalPort *voltha.LogicalPort) {
- logger.Info(ctx, "unimplemented-device %v, logicalport %v", childDevice, logicalPort)
-}
-
-func (f *OpenOltFlowMgr) decodeStoredID(id uint64) (uint64, string) {
- if id>>15 == 0x1 {
- return id & 0x7fff, Upstream
- }
- return id, Downstream
-}
-
func (f *OpenOltFlowMgr) sendDeleteGemPortToChild(ctx context.Context, intfID uint32, onuID uint32, uniID uint32, gemPortID uint32, tpPath string) error {
onuDev, err := f.getOnuDevice(ctx, intfID, onuID)
if err != nil {
@@ -2017,7 +1992,7 @@
// For ex: Case of HSIA where same flow is shared
// between DS and US.
if err := f.updateFlowInfoToKVStore(ctx, int32(Intf), int32(onuID), int32(uniID), flowID, &updatedFlows); err != nil {
- olterrors.NewErrPersistence("update", "flow", flowID,
+ _ = olterrors.NewErrPersistence("update", "flow", flowID,
log.Fields{
"flow": updatedFlows,
"device-id": f.deviceHandler.device.Id}, err).Log()
@@ -2083,7 +2058,9 @@
// everytime flowsUsedByGemPort cache is updated the same should be updated
// in kv store by calling UpdateFlowIDsForGem
f.flowsUsedByGemPort[gemPK] = flowIDs
- f.resourceMgr.UpdateFlowIDsForGem(ctx, Intf, uint32(gemPortID), flowIDs)
+ if err := f.resourceMgr.UpdateFlowIDsForGem(ctx, Intf, uint32(gemPortID), flowIDs); err != nil {
+ return err
+ }
break
}
}
@@ -2122,10 +2099,18 @@
case *tp.TechProfile:
ok, _ := f.isTechProfileUsedByAnotherGem(ctx, Intf, uint32(onuID), uint32(uniID), tpID, techprofileInst, uint32(gemPortID))
if !ok {
- f.resourceMgr.RemoveTechProfileIDForOnu(ctx, Intf, uint32(onuID), uint32(uniID), tpID)
- f.DeleteTechProfileInstance(ctx, Intf, uint32(onuID), uint32(uniID), "", tpID)
- f.RemoveSchedulerQueues(ctx, schedQueue{direction: tp_pb.Direction_UPSTREAM, intfID: Intf, onuID: uint32(onuID), uniID: uint32(uniID), tpID: tpID, uniPort: portNum, tpInst: techprofileInst})
- f.RemoveSchedulerQueues(ctx, schedQueue{direction: tp_pb.Direction_DOWNSTREAM, intfID: Intf, onuID: uint32(onuID), uniID: uint32(uniID), tpID: tpID, uniPort: portNum, tpInst: techprofileInst})
+ if err := f.resourceMgr.RemoveTechProfileIDForOnu(ctx, Intf, uint32(onuID), uint32(uniID), tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
+ if err := f.DeleteTechProfileInstance(ctx, Intf, uint32(onuID), uint32(uniID), "", tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
+ if err := f.RemoveSchedulerQueues(ctx, schedQueue{direction: tp_pb.Direction_UPSTREAM, intfID: Intf, onuID: uint32(onuID), uniID: uint32(uniID), tpID: tpID, uniPort: portNum, tpInst: techprofileInst}); err != nil {
+ logger.Warn(ctx, err)
+ }
+ if err := f.RemoveSchedulerQueues(ctx, schedQueue{direction: tp_pb.Direction_DOWNSTREAM, intfID: Intf, onuID: uint32(onuID), uniID: uint32(uniID), tpID: tpID, uniPort: portNum, tpInst: techprofileInst}); err != nil {
+ logger.Warn(ctx, err)
+ }
f.resourceMgr.FreeAllocID(ctx, Intf, uint32(onuID), uint32(uniID), techprofileInst.UsScheduler.AllocID)
// Delete the TCONT on the ONU.
if err := f.sendDeleteTcontToChild(ctx, Intf, uint32(onuID), uint32(uniID), uint32(techprofileInst.UsScheduler.AllocID), tpPath); err != nil {
@@ -2139,8 +2124,12 @@
}
}
case *tp.EponProfile:
- f.resourceMgr.RemoveTechProfileIDForOnu(ctx, Intf, uint32(onuID), uint32(uniID), tpID)
- f.DeleteTechProfileInstance(ctx, Intf, uint32(onuID), uint32(uniID), "", tpID)
+ if err := f.resourceMgr.RemoveTechProfileIDForOnu(ctx, Intf, uint32(onuID), uint32(uniID), tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
+ if err := f.DeleteTechProfileInstance(ctx, Intf, uint32(onuID), uint32(uniID), "", tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
f.resourceMgr.FreeAllocID(ctx, Intf, uint32(onuID), uint32(uniID), techprofileInst.AllocID)
// Delete the TCONT on the ONU.
if err := f.sendDeleteTcontToChild(ctx, Intf, uint32(onuID), uint32(uniID), uint32(techprofileInst.AllocID), tpPath); err != nil {
@@ -2176,7 +2165,6 @@
return
}
- var updatedFlows []rsrcMgr.FlowInfo
classifierInfo := make(map[string]interface{})
portNum, Intf, onu, uni, inPort, ethType, err := FlowExtractInfo(ctx, flow, flowDirection)
@@ -2226,11 +2214,8 @@
"flow-id": flowID})
return
}
- updatedFlows = nil
- for _, flow := range *flowInfo {
- updatedFlows = append(updatedFlows, flow)
- }
+ updatedFlows := *flowInfo
for i, storedFlow := range updatedFlows {
if flow.Id == storedFlow.LogicalFlowID {
removeFlowMessage := openoltpb2.Flow{FlowId: storedFlow.Flow.FlowId, FlowType: storedFlow.Flow.FlowType}
@@ -2282,7 +2267,6 @@
var onuID = int32(NoneOnuID)
var uniID = int32(NoneUniID)
var flowID uint32
- var updatedFlows []rsrcMgr.FlowInfo
flowIds := f.resourceMgr.GetCurrentFlowIDsForOnu(ctx, networkInterfaceID, onuID, uniID)
@@ -2297,10 +2281,7 @@
"flow-id": flowID})
continue
}
- updatedFlows = nil
- for _, flow := range *flowInfo {
- updatedFlows = append(updatedFlows, flow)
- }
+ updatedFlows := *flowInfo
for i, storedFlow := range updatedFlows {
if flow.Id == storedFlow.LogicalFlowID {
removeFlowMessage := openoltpb2.Flow{FlowId: storedFlow.Flow.FlowId, FlowType: storedFlow.Flow.FlowType}
@@ -2603,20 +2584,20 @@
Priority: int32(flow.Priority),
Cookie: flow.Cookie}
- if err = f.addFlowToDevice(ctx, flow, &multicastFlow); err != nil {
+ if err := f.addFlowToDevice(ctx, flow, &multicastFlow); err != nil {
return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": multicastFlow}, err)
}
logger.Info(ctx, "multicast-flow-added-to-device-successfully")
//get cached group
- group, _, err := f.GetFlowGroupFromKVStore(ctx, groupID, true)
- if err == nil {
+ if group, _, err := f.GetFlowGroupFromKVStore(ctx, groupID, true); err == nil {
//calling groupAdd to set group members after multicast flow creation
- if err = f.ModifyGroup(ctx, group); err == nil {
- //cached group can be removed now
- f.resourceMgr.RemoveFlowGroupFromKVStore(ctx, groupID, true)
- } else {
+ if err := f.ModifyGroup(ctx, group); err != nil {
return olterrors.NewErrGroupOp("modify", groupID, log.Fields{"group": group}, err)
}
+ //cached group can be removed now
+ if err := f.resourceMgr.RemoveFlowGroupFromKVStore(ctx, groupID, true); err != nil {
+ logger.Warnw(ctx, "failed-to-remove-flow-group", log.Fields{"group-id": groupID, "error": err})
+ }
}
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &multicastFlow, flowStoreCookie, MulticastFlow, flowID, flow.Id)
@@ -2753,13 +2734,13 @@
GroupId: group.Desc.GroupId,
}
var errAdd, errRemoved error
- if membersToBeAdded != nil && len(membersToBeAdded) > 0 {
+ if len(membersToBeAdded) > 0 {
groupToOlt.Command = openoltpb2.Group_ADD_MEMBERS
groupToOlt.Members = membersToBeAdded
//execute addMembers
errAdd = f.callGroupAddRemove(ctx, &groupToOlt)
}
- if membersToBeRemoved != nil && len(membersToBeRemoved) > 0 {
+ if len(membersToBeRemoved) > 0 {
groupToOlt.Command = openoltpb2.Group_REMOVE_MEMBERS
groupToOlt.Members = membersToBeRemoved
//execute removeMembers
@@ -2838,12 +2819,10 @@
group := openoltpb2.Group{
GroupId: groupID}
// create members of the group
- if buckets != nil {
- for _, ofBucket := range buckets {
- member := f.buildMember(ctx, ofBucket)
- if member != nil && !f.contains(group.Members, member) {
- group.Members = append(group.Members, member)
- }
+ for _, ofBucket := range buckets {
+ member := f.buildMember(ctx, ofBucket)
+ if member != nil && !f.contains(group.Members, member) {
+ group.Members = append(group.Members, member)
}
}
return &group
@@ -3018,7 +2997,7 @@
logger.Errorw(ctx, "onu-id-from-gem-port-not-found", log.Fields{
"gem-port-id": gemPortID,
"interface-id": intfID,
- "all-gems-on-port": onu,
+ "all-gems-on-port": onugem,
})
return uint32(0), olterrors.NewErrNotFound("onu-id", log.Fields{
"interface-id": intfID,
@@ -3147,18 +3126,26 @@
if allPbitsMarked(gemPortAttribute.PbitMap) {
classifier[VlanPcp] = uint32(VlanPCPMask)
if FlowType == DhcpFlow || FlowType == IgmpFlow || FlowType == HsiaFlow {
- f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID)
+ if err := f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else if FlowType == EapolFlow {
- f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID)
+ if err := f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
}
} else {
for pos, pbitSet := range strings.TrimPrefix(gemPortAttribute.PbitMap, BinaryStringPrefix) {
if pbitSet == BinaryBit1 {
classifier[VlanPcp] = uint32(len(strings.TrimPrefix(gemPortAttribute.PbitMap, BinaryStringPrefix))) - 1 - uint32(pos)
if FlowType == DhcpFlow || FlowType == IgmpFlow || FlowType == HsiaFlow {
- f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID)
+ if err := f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else if FlowType == EapolFlow {
- f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID)
+ if err := f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
}
}
}
@@ -3172,18 +3159,26 @@
if allPbitsMarked(queueAttribute.PbitMap) {
classifier[VlanPcp] = uint32(VlanPCPMask)
if FlowType == DhcpFlow || FlowType == IgmpFlow || FlowType == HsiaFlow {
- f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID)
+ if err := f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else if FlowType == EapolFlow {
- f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID)
+ if err := f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
}
} else {
for pos, pbitSet := range strings.TrimPrefix(queueAttribute.PbitMap, BinaryStringPrefix) {
if pbitSet == BinaryBit1 {
classifier[VlanPcp] = uint32(len(strings.TrimPrefix(queueAttribute.PbitMap, BinaryStringPrefix))) - 1 - uint32(pos)
if FlowType == DhcpFlow || FlowType == IgmpFlow || FlowType == HsiaFlow {
- f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID)
+ if err := f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else if FlowType == EapolFlow {
- f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID)
+ if err := f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
}
}
}
@@ -3196,18 +3191,26 @@
if allPbitsMarked(queueAttribute.PbitMap) {
classifier[VlanPcp] = uint32(VlanPCPMask)
if FlowType == DhcpFlow || FlowType == IgmpFlow || FlowType == HsiaFlow {
- f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID)
+ if err := f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else if FlowType == EapolFlow {
- f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID)
+ if err := f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
}
} else {
for pos, pbitSet := range strings.TrimPrefix(queueAttribute.PbitMap, BinaryStringPrefix) {
if pbitSet == BinaryBit1 {
classifier[VlanPcp] = uint32(len(strings.TrimPrefix(queueAttribute.PbitMap, BinaryStringPrefix))) - 1 - uint32(pos)
if FlowType == DhcpFlow || FlowType == IgmpFlow || FlowType == HsiaFlow {
- f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID)
+ if err := f1(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else if FlowType == EapolFlow {
- f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID)
+ if err := f2(ctx, args["intfId"], args["onuId"], args["uniId"], args["portNo"], classifier, action, logicalFlow, args["allocId"], gemPortID, vlanID[0], tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
}
}
}
@@ -3429,6 +3432,7 @@
return "", nil
}
+// nolint: gocyclo
func (f *OpenOltFlowMgr) checkAndAddFlow(ctx context.Context, args map[string]uint32, classifierInfo map[string]interface{},
actionInfo map[string]interface{}, flow *ofp.OfpFlowStats, TpInst interface{}, gemPorts []uint32,
tpID uint32, uni string) {
@@ -3453,7 +3457,9 @@
pcp.(uint32))
//Adding DHCP upstream flow
- f.addDHCPTrapFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID)
+ if err := f.addDHCPTrapFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else {
//Adding DHCP upstream flow to all gemports
installFlowOnAllGemports(ctx, f.addDHCPTrapFlow, nil, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, DhcpFlow, Upstream, tpID)
@@ -3470,7 +3476,9 @@
gemPort = f.techprofile[intfID].GetGemportIDForPbit(ctx, TpInst,
tp_pb.Direction_UPSTREAM,
pcp.(uint32))
- f.addIGMPTrapFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID)
+ if err := f.addIGMPTrapFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else {
//Adding IGMP upstream flow to all gem ports
installFlowOnAllGemports(ctx, f.addIGMPTrapFlow, nil, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, IgmpFlow, Upstream, tpID)
@@ -3497,7 +3505,9 @@
tp_pb.Direction_UPSTREAM,
pcp.(uint32))
- f.addEAPOLFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, vlanID, tpID)
+ if err := f.addEAPOLFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, vlanID, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else {
installFlowOnAllGemports(ctx, nil, f.addEAPOLFlow, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, EapolFlow, Upstream, tpID, vlanID)
}
@@ -3513,7 +3523,9 @@
tp_pb.Direction_UPSTREAM,
pcp.(uint32))
//Adding HSIA upstream flow
- f.addUpstreamDataFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID)
+ if err := f.addUpstreamDataFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else {
//Adding HSIA upstream flow to all gemports
installFlowOnAllGemports(ctx, f.addUpstreamDataFlow, nil, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, HsiaFlow, Upstream, tpID)
@@ -3529,7 +3541,9 @@
tp_pb.Direction_DOWNSTREAM,
pcp.(uint32))
//Adding HSIA downstream flow
- f.addDownstreamDataFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID)
+ if err := f.addDownstreamDataFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, allocID, gemPort, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
} else {
//Adding HSIA downstream flow to all gemports
installFlowOnAllGemports(ctx, f.addDownstreamDataFlow, nil, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, HsiaFlow, Downstream, tpID)
@@ -3546,15 +3560,16 @@
return
}
// Send Techprofile download event to child device in go routine as it takes time
- go f.sendTPDownloadMsgToChild(ctx, intfID, onuID, uniID, uni, tpID)
+ go func() {
+ if err := f.sendTPDownloadMsgToChild(ctx, intfID, onuID, uniID, uni, tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
+ }()
}
func (f *OpenOltFlowMgr) isGemPortUsedByAnotherFlow(gemPK gemPortKey) bool {
flowIDList := f.flowsUsedByGemPort[gemPK]
- if len(flowIDList) > 1 {
- return true
- }
- return false
+ return len(flowIDList) > 1
}
func (f *OpenOltFlowMgr) isTechProfileUsedByAnotherGem(ctx context.Context, ponIntf uint32, onuID uint32, uniID uint32, tpID uint32, tpInst *tp.TechProfile, gemPortID uint32) (bool, uint32) {
@@ -3569,8 +3584,12 @@
}
if tpInst.InstanceCtrl.Onu == "single-instance" {
// The TP information for the given TP ID, PON ID, ONU ID, UNI ID should be removed.
- f.resourceMgr.RemoveTechProfileIDForOnu(ctx, ponIntf, uint32(onuID), uint32(uniID), tpID)
- f.DeleteTechProfileInstance(ctx, ponIntf, uint32(onuID), uint32(uniID), "", tpID)
+ if err := f.resourceMgr.RemoveTechProfileIDForOnu(ctx, ponIntf, uint32(onuID), uint32(uniID), tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
+ if err := f.DeleteTechProfileInstance(ctx, ponIntf, uint32(onuID), uint32(uniID), "", tpID); err != nil {
+ logger.Warn(ctx, err)
+ }
// Although we cleaned up TP Instance for the given (PON ID, ONU ID, UNI ID), the TP might
// still be used on other uni ports.
@@ -3851,8 +3870,6 @@
log.Fields{
"pktinkey": pktInkey,
"gem": gemPort})
- return
-
}
//getCTagFromPacket retrieves and returns c-tag and priority value from a packet.
@@ -3915,7 +3932,6 @@
gemPK := gemPortKey{intf, uint32(gem)}
f.flowsUsedByGemPort[gemPK] = FlowIDs
}
- return
}
//loadInterfaceToMulticastQueueMap reads multicast queues per interface from the KV store