VOL-4217: Update to latest version of protos and voltha-lib-go for
voltha-2.9 release. Tested with BAL3.10
Change-Id: Ibdc5978a1f2df713965a27ce26d0e22c1ffa366a
diff --git a/core/utils.go b/core/utils.go
index 1bcdedd..eca4f20 100644
--- a/core/utils.go
+++ b/core/utils.go
@@ -18,9 +18,10 @@
import (
"fmt"
+ "sync"
- "github.com/opencord/voltha-lib-go/v4/pkg/log"
- "github.com/opencord/voltha-protos/v4/go/openolt"
+ "github.com/opencord/voltha-lib-go/v7/pkg/log"
+ "github.com/opencord/voltha-protos/v5/go/openolt"
)
type DtStagKey struct {
@@ -32,6 +33,7 @@
var DtCtag map[uint32]uint32
var AttCtag map[uint32]uint32
var TtCtag map[uint32]uint32
+var mutex sync.RWMutex
func init() {
AttCtag = make(map[uint32]uint32)
@@ -77,6 +79,8 @@
func GetAttCtag(ponIntf uint32) uint32 {
var currCtag uint32
var ok bool
+ mutex.Lock()
+ defer mutex.Unlock()
if currCtag, ok = AttCtag[ponIntf]; !ok {
// Start with ctag 2
AttCtag[ponIntf] = 2
@@ -89,6 +93,8 @@
func GetDtCtag(ponIntf uint32) uint32 {
var currCtag uint32
var ok bool
+ mutex.Lock()
+ defer mutex.Unlock()
if currCtag, ok = DtCtag[ponIntf]; !ok {
// Start with ctag 1
DtCtag[ponIntf] = 1
@@ -101,6 +107,8 @@
func GetTtCtag(ponIntf uint32) uint32 {
var currCtag uint32
var ok bool
+ mutex.Lock()
+ defer mutex.Unlock()
if currCtag, ok = TtCtag[ponIntf]; !ok {
// Start with ctag 1
TtCtag[ponIntf] = 1
@@ -118,7 +126,8 @@
func GetDtStag(ponIntf uint32, onuID uint32, uniID uint32) uint32 {
// Dt workflow requires unique stag for each subscriber
key := DtStagKey{ponIntf: ponIntf, onuID: onuID, uniID: uniID}
-
+ mutex.Lock()
+ defer mutex.Unlock()
if value, ok := DtStag[key]; ok {
return value
} else {