VOL-3433 Make timeouts of inter-adapter communication configurable
Change-Id: I3944737701546203262f95ffeb563716ff540c8a
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index ee8e1b3..2951a2f 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -318,7 +318,7 @@
// deadline context to ensure completion of background routines waited for
//20200721: 10s proved to be less in 8*8 ONU test on local vbox machine with debug, might be further adapted
- deadline := time.Now().Add(30 * time.Second) //allowed run time to finish before execution
+ deadline := time.Now().Add(dh.pOpenOnuAc.maxTimeoutInterAdapterComm) //allowed run time to finish before execution
dctx, cancel := context.WithDeadline(context.Background(), deadline)
dh.pOnuTP.resetTpProcessingErrorIndication()
@@ -374,7 +374,7 @@
if bTpModify := pDevEntry.updateOnuUniTpPath(uniID, ""); bTpModify {
// deadline context to ensure completion of background routines waited for
- deadline := time.Now().Add(10 * time.Second) //allowed run time to finish before execution
+ deadline := time.Now().Add(dh.pOpenOnuAc.maxTimeoutInterAdapterComm) //allowed run time to finish before execution
dctx, cancel := context.WithDeadline(context.Background(), deadline)
dh.pOnuTP.resetTpProcessingErrorIndication()
@@ -430,7 +430,7 @@
if bTpModify := pDevEntry.updateOnuUniTpPath(uniID, ""); bTpModify {
// deadline context to ensure completion of background routines waited for
- deadline := time.Now().Add(10 * time.Second) //allowed run time to finish before execution
+ deadline := time.Now().Add(dh.pOpenOnuAc.maxTimeoutInterAdapterComm) //allowed run time to finish before execution
dctx, cancel := context.WithDeadline(context.Background(), deadline)
dh.pOnuTP.resetTpProcessingErrorIndication()
@@ -634,7 +634,7 @@
for _, uniData := range pDevEntry.sOnuPersistentData.PersUniConfig {
// deadline context to ensure completion of background routines waited for
//20200721: 10s proved to be less in 8*8 ONU test on local vbox machine with debug, might be further adapted
- deadline := time.Now().Add(30 * time.Second) //allowed run time to finish before execution
+ deadline := time.Now().Add(dh.pOpenOnuAc.maxTimeoutInterAdapterComm) //allowed run time to finish before execution
dctx, cancel := context.WithDeadline(context.Background(), deadline)
dh.pOnuTP.resetTpProcessingErrorIndication()
@@ -703,7 +703,7 @@
// deadline context to ensure completion of background routines waited for
//20200721: 10s proved to be less in 8*8 ONU test on local vbox machine with debug, might be further adapted
- deadline := time.Now().Add(30 * time.Second) //allowed run time to finish before execution
+ deadline := time.Now().Add(dh.pOpenOnuAc.maxTimeoutInterAdapterComm) //allowed run time to finish before execution
dctx, cancel := context.WithDeadline(context.Background(), deadline)
pDevEntry.resetKvProcessingErrorIndication()
@@ -2061,7 +2061,7 @@
// deadline context to ensure completion of background routines waited for
//20200721: 10s proved to be less in 8*8 ONU test on local vbox machine with debug, might be further adapted
- deadline := time.Now().Add(30 * time.Second) //allowed run time to finish before execution
+ deadline := time.Now().Add(dh.pOpenOnuAc.maxTimeoutInterAdapterComm) //allowed run time to finish before execution
dctx, cancel := context.WithDeadline(context.Background(), deadline)
pDevEntry.resetKvProcessingErrorIndication()
diff --git a/internal/pkg/onuadaptercore/openonu.go b/internal/pkg/onuadaptercore/openonu.go
index b1994d7..7ad98f0 100644
--- a/internal/pkg/onuadaptercore/openonu.go
+++ b/internal/pkg/onuadaptercore/openonu.go
@@ -54,8 +54,9 @@
HeartbeatFailReportInterval time.Duration
AcceptIncrementalEvto bool
//GrpcTimeoutInterval time.Duration
- lockDeviceHandlersMap sync.RWMutex
- pSupportedFsms *OmciDeviceFsms
+ lockDeviceHandlersMap sync.RWMutex
+ pSupportedFsms *OmciDeviceFsms
+ maxTimeoutInterAdapterComm time.Duration
}
//NewOpenONUAC returns a new instance of OpenONU_AC
@@ -79,6 +80,7 @@
openOnuAc.HeartbeatCheckInterval = cfg.HeartbeatCheckInterval
openOnuAc.HeartbeatFailReportInterval = cfg.HeartbeatFailReportInterval
openOnuAc.AcceptIncrementalEvto = cfg.AccIncrEvto
+ openOnuAc.maxTimeoutInterAdapterComm = cfg.MaxTimeoutInterAdapterComm
//openOnuAc.GrpcTimeoutInterval = cfg.GrpcTimeoutInterval
openOnuAc.lockDeviceHandlersMap = sync.RWMutex{}