X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fdomain%2Falarm_repo.py;h=d712f1c6a03b9a6ce91492dfa54da4b940988f9a;hb=f7ef52a5b4ead0472b1b5828471b28c88d2a0aea;hp=d3e7f52b6ae44161f06820730251741965d45032;hpb=d2f6cc674bf3623caf114a8d7709e70d55ec9340;p=pti%2Fo2.git diff --git a/o2ims/domain/alarm_repo.py b/o2ims/domain/alarm_repo.py index d3e7f52..d712f1c 100644 --- a/o2ims/domain/alarm_repo.py +++ b/o2ims/domain/alarm_repo.py @@ -13,7 +13,7 @@ # limitations under the License. import abc -from typing import List, Set +from typing import List, Set, Tuple from o2ims.domain import alarm_obj as obj @@ -31,8 +31,12 @@ class AlarmEventRecordRepository(abc.ABC): self.seen.add(alarm_event_record) return alarm_event_record - def list(self) -> List[obj.AlarmEventRecord]: - return self._list() + def list(self, **kwargs) -> List[obj.AlarmEventRecord]: + return self._list(**kwargs)[1] + + def list_with_count(self, **kwargs) -> \ + Tuple[int, List[obj.AlarmEventRecord]]: + return self._list(**kwargs) def update(self, alarm_event_record: obj.AlarmEventRecord): self._update(alarm_event_record) @@ -49,7 +53,7 @@ class AlarmEventRecordRepository(abc.ABC): raise NotImplementedError @abc.abstractmethod - def _list(self) -> List[obj.AlarmEventRecord]: + def _list(self, **kwargs) -> Tuple[int, List[obj.AlarmEventRecord]]: raise NotImplementedError @abc.abstractmethod @@ -155,8 +159,12 @@ class AlarmSubscriptionRepository(abc.ABC): self.seen.add(subscription) return subscription - def list(self) -> List[obj.AlarmSubscription]: - return self._list() + def list(self, **kwargs) -> List[obj.AlarmSubscription]: + return self._list(**kwargs)[1] + + def list_with_count(self, **kwargs) -> \ + Tuple[int, List[obj.AlarmSubscription]]: + return self._list(**kwargs) def update(self, subscription: obj.AlarmSubscription): self._update(subscription) @@ -172,6 +180,10 @@ class AlarmSubscriptionRepository(abc.ABC): def _get(self, subscription_id) -> obj.AlarmSubscription: raise NotImplementedError + @abc.abstractmethod + def _list(self, **kwargs) -> Tuple[int, List[obj.AlarmSubscription]]: + raise NotImplementedError + @abc.abstractmethod def _update(self, subscription: obj.AlarmSubscription): raise NotImplementedError