While running bbsim having the number of pon-interface greater than 16 with voltha openolt go adapter, a segment violation error was seen.
Provided a check before accessing resource-managers map in openolt-adapter, to see whether the given interface-id is present as a key.
Replaced verbose error message with crisp one
Change-Id: Ifefc45ce7ed3cdd30fbc2b1bd09b4e6b584e184c
diff --git a/adaptercore/resourcemanager/resourcemanager.go b/adaptercore/resourcemanager/resourcemanager.go
index 799a733..b7d7737 100755
--- a/adaptercore/resourcemanager/resourcemanager.go
+++ b/adaptercore/resourcemanager/resourcemanager.go
@@ -354,9 +354,12 @@
// GetONUID returns the available OnuID for the given pon-port
func (RsrcMgr *OpenOltResourceMgr) GetONUID(ponIntfID uint32) (uint32, error) {
-
+ // Check if Pon Interface ID is present in Resource-manager-map
+ if _, ok := RsrcMgr.ResourceMgrs[ponIntfID]; !ok {
+ err := errors.New("invalid-pon-interface-" + strconv.Itoa(int(ponIntfID)))
+ return 0, err
+ }
// Get ONU id for a provided pon interface ID.
-
ONUID, err := RsrcMgr.ResourceMgrs[ponIntfID].GetResourceID(ponIntfID,
ponrmgr.ONU_ID, 1)
if err != nil {