VOL-3431: Following enhancement/changes are done in this patch
- Process ONUs in bulk rather than serial, significantly improves run time
- Used a separate API to get flow-id. This flow-id is not freed on failure,
as this adds to unnecessary complexity and unwarranted for a test tool .
- Print the total execution time at the end of the test
- Fixed the Dockerfile to not build vendor module at each docker build time
- Introduced new functions to retry scheduler, queue and flow adds on failure,
but these are not currently used
- Add vendor modules to repo just like all other ONF VOLTHA golang projects do
- Tested all three workflows - ATT, DT and TT
- Bump version to 1.1.0
Change-Id: I6102cb206e78ea04b49b7125b101946ca6f36bfb
diff --git a/core/onu_manager.go b/core/onu_manager.go
index 6fa9201..4fd665b 100644
--- a/core/onu_manager.go
+++ b/core/onu_manager.go
@@ -18,6 +18,7 @@
import (
"strconv"
+ "sync"
"time"
"github.com/opencord/openolt-scale-tester/config"
@@ -45,13 +46,13 @@
openOltClient oop.OpenoltClient
testConfig *config.OpenOltScaleTesterConfig
rsrMgr *OpenOltResourceMgr
+ onuWg *sync.WaitGroup
}
-func (onu *OnuDevice) Start(oltCh chan bool) {
+func (onu *OnuDevice) Start() {
onu.SubscriberMap = make(map[SubscriberKey]*Subscriber)
- onuCh := make(chan bool)
var subs uint
-
+ var subWg sync.WaitGroup
log.Infow("onu-provision-started-from-onu-manager", log.Fields{"onuID": onu.OnuID, "ponIntf": onu.PonIntf})
for subs = 0; subs < onu.testConfig.SubscribersPerOnu; subs++ {
@@ -67,24 +68,22 @@
OpenOltClient: onu.openOltClient,
TestConfig: onu.testConfig,
RsrMgr: onu.rsrMgr,
+ subWg: &subWg,
}
subsKey := SubscriberKey{subsName}
onu.SubscriberMap[subsKey] = &subs
+ subWg.Add(1)
log.Infow("subscriber-provision-started-from-onu-manager", log.Fields{"subsName": subsName})
// Start provisioning the subscriber
- go subs.Start(onuCh, onu.testConfig.IsGroupTest)
+ go subs.Start(onu.testConfig.IsGroupTest)
- // Wait for subscriber provision to complete
- <-onuCh
-
- log.Infow("subscriber-provision-completed-from-onu-manager", log.Fields{"subsName": subsName})
-
- //Sleep for configured interval before provisioning another subscriber
- time.Sleep(time.Duration(onu.testConfig.TimeIntervalBetweenSubs))
}
- // Indicate that the ONU provisioning is complete
- oltCh <- true
+
+ // Wait for all the subscribers on the ONU to complete provisioning
+ subWg.Wait()
+ // Signal that ONU provisioning is complete
+ onu.onuWg.Done()
log.Infow("onu-provision-completed-from-onu-manager", log.Fields{"onuID": onu.OnuID, "ponIntf": onu.PonIntf})
}