[VOL-5374] - Upgrade go version to v1.23
Change-Id: I86c21c482e61b358023119620b87032f2ea04c6d
Signed-off-by: Akash Reddy Kankanala <akash.kankanala@radisys.com>
[VOL-5374] - Upgrade go version to v1.23
Change-Id: Ie653d5c992aa3ff6624916d65009e2efbe0ed3f5
Signed-off-by: Akash Reddy Kankanala <akash.kankanala@radisys.com>
diff --git a/rw_core/test/utils.go b/rw_core/test/utils.go
index dfd28da..db1b28b 100644
--- a/rw_core/test/utils.go
+++ b/rw_core/test/utils.go
@@ -20,18 +20,17 @@
import (
"bufio"
"context"
+ "crypto/rand"
"encoding/json"
"fmt"
+ "io"
"os"
"path/filepath"
"strings"
"testing"
- "time"
ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
- "math/rand"
-
"github.com/opencord/voltha-go/rw_core/config"
cm "github.com/opencord/voltha-go/rw_core/mocks"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
@@ -51,11 +50,11 @@
)
type AdapterInfo struct {
- TotalReplica int32
Vendor string
DeviceType string
ChildDeviceType string
ChildVendor string
+ TotalReplica int32
}
// prettyPrintDeviceUpdateLog is used just for debugging and exploring the Core logs
@@ -100,16 +99,14 @@
if err := json.Unmarshal([]byte(input), &logEntry); err != nil {
logger.Fatal(context.Background(), err)
}
- fmt.Println(
- fmt.Sprintf(
- "%s\t%s\t%s\t%-30.30q\t%-16.16s\t%-25.25s\t%s",
- logEntry.Ts,
- logEntry.DeviceID,
- logEntry.Status,
- logEntry.RPC,
- logEntry.RequestedBy,
- logEntry.StateChange,
- logEntry.Description))
+ fmt.Printf("%s\t%s\t%s\t%-30.30q\t%-16.16s\t%-25.25s\t%s",
+ logEntry.Ts,
+ logEntry.DeviceID,
+ logEntry.Status,
+ logEntry.RPC,
+ logEntry.RequestedBy,
+ logEntry.StateChange,
+ logEntry.Description)
}
}
@@ -317,13 +314,14 @@
// getRandomMacAddress returns a random mac address
func getRandomMacAddress() string {
- rand.Seed(time.Now().UnixNano() / int64(rand.Intn(255)+1))
+ mac := make([]byte, 6)
+ if _, err := io.ReadFull(rand.Reader, mac); err != nil {
+ fmt.Println("Error", err)
+ }
+
+ // Ensure the locally administered bit is set and the unicast bit is cleared
+ mac[0] = (mac[0] & 0xfe) | 0x02
+
return fmt.Sprintf("%02x:%02x:%02x:%02x:%02x:%02x",
- rand.Intn(255),
- rand.Intn(255),
- rand.Intn(255),
- rand.Intn(255),
- rand.Intn(255),
- rand.Intn(255),
- )
+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5])
}