SEBA-758 send periodic port stats to voltha
SEBA-790 get flow, gemport, and tcont information through API
fix lint errors
Change-Id: I10909e1992eba71d8e54c976ccbcea8778e35539
diff --git a/device/utils.go b/device/utils.go
index 7e0eca3..2d4cc28 100644
--- a/device/utils.go
+++ b/device/utils.go
@@ -17,19 +17,17 @@
package device
import (
- "fmt"
-
"github.com/opencord/voltha-bbsim/common/logger"
log "github.com/sirupsen/logrus"
"strconv"
)
+// OnuToSn returns serial number in string format for given ONU
func OnuToSn(onu *Onu) string {
- // FIXME
- // see https://github.com/opencord/voltha/blob/master/voltha/adapters/openolt/openolt_device.py#L929-L943
- return string(onu.SerialNumber.VendorId) + "00000" + fmt.Sprint(onu.IntfID) + "0" + fmt.Sprintf("%x", onu.OnuID-1)
+ return string(onu.SerialNumber.VendorId) + ConvB2S(onu.SerialNumber.VendorSpecific)
}
+// LoggerWithOnu method logs ONU fields
func LoggerWithOnu(onu *Onu) *log.Entry {
if onu == nil {
@@ -39,12 +37,13 @@
return logger.GetLogger().WithFields(log.Fields{
"serial_number": OnuToSn(onu),
- "interfaceId": onu.IntfID,
- "onuId": onu.OnuID,
- "oltId": onu.OltID,
+ "interfaceID": onu.IntfID,
+ "onuID": onu.OnuID,
+ "oltID": onu.OltID,
})
}
+// ConvB2S converts byte array to string
func ConvB2S(b []byte) string {
s := ""
for _, i := range b {