Merge "Unit test log writing improvements"
[ric-plt/submgr.git] / pkg / control / sdl_restSubsDb.go
index e9a7d2f..a0afbc0 100644 (file)
@@ -96,7 +96,7 @@ func (c *Control) ReadRESTSubscriptionFromSdl(restSubId string) (*RESTSubscripti
 
                restSubs = c.CreateRESTSubscription(restSubscriptionInfo, &jsonSubscriptionInfo)
 
-               restDuplicateCtrl.SetMd5sumFromLastOkRequest(restSubId, restSubs.lastReqMd5sum)
+               c.restDuplicateCtrl.SetMd5sumFromLastOkRequest(restSubId, restSubs.lastReqMd5sum)
        }
        return restSubs, nil
 }
@@ -176,3 +176,14 @@ func (c *Control) RemoveAllRESTSubscriptionsFromSdl() error {
        }
        return nil
 }
+
+func (c *Control) GetRESTKeyCount() (int, error) {
+
+       // Get all keys
+       keys, err := c.restSubsDb.GetAll(restSubSdlNs)
+       if err != nil {
+               c.UpdateCounter(cSDLReadFailure)
+               return 0, fmt.Errorf("SDL: GetRESTKeyCount(), GetAll(). Error while reading E2 subscriptions  keys from DBAAS %s\n", err.Error())
+       }
+       return len(keys), nil
+}