Revert "[VOL-3069]Pass Context in methods which are performing logging and need the context"
This reverts commit 3c425fbeabed17ec8dad437678b4d105deaf2fbe.
Reason for revert: Merging higher-priority patches first.
Change-Id: Iaa03a5977357dcd86de358d76e90cc54cd6b1fa5
diff --git a/pkg/flows/flow_utils.go b/pkg/flows/flow_utils.go
index 66e719c..3139144 100644
--- a/pkg/flows/flow_utils.go
+++ b/pkg/flows/flow_utils.go
@@ -17,7 +17,6 @@
import (
"bytes"
- "context"
"crypto/md5"
"encoding/binary"
"fmt"
@@ -504,7 +503,7 @@
}
//GetMetaData - legacy get method (only want lower 32 bits)
-func GetMetaData(ctx context.Context, flow *ofp.OfpFlowStats) uint32 {
+func GetMetaData(flow *ofp.OfpFlowStats) uint32 {
if flow == nil {
return 0
}
@@ -513,11 +512,11 @@
return uint32(field.GetTableMetadata() & 0xFFFFFFFF)
}
}
- logger.Debug(ctx, "No-metadata-present")
+ logger.Debug("No-metadata-present")
return 0
}
-func GetMetaData64Bit(ctx context.Context, flow *ofp.OfpFlowStats) uint64 {
+func GetMetaData64Bit(flow *ofp.OfpFlowStats) uint64 {
if flow == nil {
return 0
}
@@ -526,12 +525,12 @@
return field.GetTableMetadata()
}
}
- logger.Debug(ctx, "No-metadata-present")
+ logger.Debug("No-metadata-present")
return 0
}
// function returns write metadata value from write_metadata action field
-func GetMetadataFromWriteMetadataAction(ctx context.Context, flow *ofp.OfpFlowStats) uint64 {
+func GetMetadataFromWriteMetadataAction(flow *ofp.OfpFlowStats) uint64 {
if flow != nil {
for _, instruction := range flow.Instructions {
if instruction.Type == uint32(WRITE_METADATA) {
@@ -541,11 +540,11 @@
}
}
}
- logger.Debugw(ctx, "No-write-metadata-present", log.Fields{"flow": flow})
+ logger.Debugw("No-write-metadata-present", log.Fields{"flow": flow})
return 0
}
-func GetTechProfileIDFromWriteMetaData(ctx context.Context, metadata uint64) uint16 {
+func GetTechProfileIDFromWriteMetaData(metadata uint64) uint16 {
/*
Write metadata instruction value (metadata) is 8 bytes:
MS 2 bytes: C Tag
@@ -555,15 +554,15 @@
This is set in the ONOS OltPipeline as a write metadata instruction
*/
var tpId uint16 = 0
- logger.Debugw(ctx, "Write metadata value for Techprofile ID", log.Fields{"metadata": metadata})
+ logger.Debugw("Write metadata value for Techprofile ID", log.Fields{"metadata": metadata})
if metadata != 0 {
tpId = uint16((metadata >> 32) & 0xFFFF)
- logger.Debugw(ctx, "Found techprofile ID from write metadata action", log.Fields{"tpid": tpId})
+ logger.Debugw("Found techprofile ID from write metadata action", log.Fields{"tpid": tpId})
}
return tpId
}
-func GetEgressPortNumberFromWriteMetadata(ctx context.Context, flow *ofp.OfpFlowStats) uint32 {
+func GetEgressPortNumberFromWriteMetadata(flow *ofp.OfpFlowStats) uint32 {
/*
Write metadata instruction value (metadata) is 8 bytes:
MS 2 bytes: C Tag
@@ -572,17 +571,17 @@
This is set in the ONOS OltPipeline as a write metadata instruction
*/
var uniPort uint32 = 0
- md := GetMetadataFromWriteMetadataAction(ctx, flow)
- logger.Debugw(ctx, "Metadata found for egress/uni port ", log.Fields{"metadata": md})
+ md := GetMetadataFromWriteMetadataAction(flow)
+ logger.Debugw("Metadata found for egress/uni port ", log.Fields{"metadata": md})
if md != 0 {
uniPort = uint32(md & 0xFFFFFFFF)
- logger.Debugw(ctx, "Found EgressPort from write metadata action", log.Fields{"egress_port": uniPort})
+ logger.Debugw("Found EgressPort from write metadata action", log.Fields{"egress_port": uniPort})
}
return uniPort
}
-func GetInnerTagFromMetaData(ctx context.Context, flow *ofp.OfpFlowStats) uint16 {
+func GetInnerTagFromMetaData(flow *ofp.OfpFlowStats) uint16 {
/*
Write metadata instruction value (metadata) is 8 bytes:
MS 2 bytes: C Tag
@@ -591,10 +590,10 @@
This is set in the ONOS OltPipeline as a write metadata instruction
*/
var innerTag uint16 = 0
- md := GetMetadataFromWriteMetadataAction(ctx, flow)
+ md := GetMetadataFromWriteMetadataAction(flow)
if md != 0 {
innerTag = uint16((md >> 48) & 0xFFFF)
- logger.Debugw(ctx, "Found CVLAN from write metadate action", log.Fields{"c_vlan": innerTag})
+ logger.Debugw("Found CVLAN from write metadate action", log.Fields{"c_vlan": innerTag})
}
return innerTag
}
@@ -608,7 +607,7 @@
return 0
}
if md <= 0xffffffff {
- logger.Debugw(ctx, "onos-upgrade-suggested", logger.Fields{"Metadata_ofp": md, "message": "Legacy MetaData detected form OltPipeline"})
+ logger.Debugw("onos-upgrade-suggested", logger.Fields{"Metadata_ofp": md, "message": "Legacy MetaData detected form OltPipeline"})
return md
}
return (md >> 32) & 0xffffffff
@@ -938,12 +937,12 @@
}
// flowStatsEntryFromFlowModMessage maps an ofp_flow_mod message to an ofp_flow_stats message
-func MeterEntryFromMeterMod(ctx context.Context, meterMod *ofp.OfpMeterMod) *ofp.OfpMeterEntry {
+func MeterEntryFromMeterMod(meterMod *ofp.OfpMeterMod) *ofp.OfpMeterEntry {
bandStats := make([]*ofp.OfpMeterBandStats, 0)
meter := &ofp.OfpMeterEntry{Config: &ofp.OfpMeterConfig{},
Stats: &ofp.OfpMeterStats{BandStats: bandStats}}
if meterMod == nil {
- logger.Error(ctx, "Invalid meter mod command")
+ logger.Error("Invalid meter mod command")
return meter
}
// config init
@@ -965,7 +964,7 @@
bandStats = append(bandStats, band)
}
meter.Stats.BandStats = bandStats
- logger.Debugw(ctx, "Allocated meter entry", log.Fields{"meter": *meter})
+ logger.Debugw("Allocated meter entry", log.Fields{"meter": *meter})
return meter
}