X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=o2ims%2Fdomain%2Falarm_repo.py;h=41205dbc47b6c7fb6552cfb9005c159b4378326e;hb=748a90298e8abff7f1ff2fdec6a36c2775fe7161;hp=d3e7f52b6ae44161f06820730251741965d45032;hpb=d2f6cc674bf3623caf114a8d7709e70d55ec9340;p=pti%2Fo2.git diff --git a/o2ims/domain/alarm_repo.py b/o2ims/domain/alarm_repo.py index d3e7f52..41205db 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, *args, **kwargs) -> \ + Tuple[int, List[obj.AlarmEventRecord]]: + return self._list(*args, **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 @@ -92,6 +96,10 @@ class AlarmDefinitionRepository(abc.ABC): def _get(self, definition_id) -> obj.AlarmDefinition: raise NotImplementedError + @abc.abstractmethod + def _list(self, **kwargs) -> List[obj.AlarmDefinition]: + raise NotImplementedError + @abc.abstractmethod def _update(self, definition: obj.AlarmDefinition): raise NotImplementedError @@ -133,7 +141,7 @@ class AlarmDictionaryRepository(abc.ABC): raise NotImplementedError @abc.abstractmethod - def _update(self, dictionary: obj.AlarmDictionary): + def _list(self, **kwargs) -> List[obj.AlarmDictionary]: raise NotImplementedError @abc.abstractmethod @@ -155,8 +163,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, *args, **kwargs) -> \ + Tuple[int, List[obj.AlarmSubscription]]: + return self._list(*args, **kwargs) def update(self, subscription: obj.AlarmSubscription): self._update(subscription) @@ -172,6 +184,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 @@ -212,6 +228,10 @@ class AlarmProbableCauseRepository(abc.ABC): def _get(self, probable_cause_id) -> obj.ProbableCause: raise NotImplementedError + @abc.abstractmethod + def _list(self, **kwargs) -> List[obj.ProbableCause]: + raise NotImplementedError + @abc.abstractmethod def _update(self, probable_cause: obj.ProbableCause): raise NotImplementedError