X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2ims%2Fservice%2Fwatcher%2Fpserver_cpu_watcher.py;h=51a5a76e1715f54343f88f3c43e1f0457800ef82;hb=f73c8e3b01b8f5b7438ba544870e06d8f30cdea0;hp=e99cdc0eecfd665344ee2f2dda19f6fd166e0025;hpb=e60b74de2ecaccc5f2fef8e75a44649d0e90d362;p=pti%2Fo2.git diff --git a/o2ims/service/watcher/pserver_cpu_watcher.py b/o2ims/service/watcher/pserver_cpu_watcher.py index e99cdc0..51a5a76 100644 --- a/o2ims/service/watcher/pserver_cpu_watcher.py +++ b/o2ims/service/watcher/pserver_cpu_watcher.py @@ -12,25 +12,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -from o2ims.service.client.base_client import BaseClient -from o2ims.service.unit_of_work import AbstractUnitOfWork +from o2ims.domain.stx_object import StxGenericModel +from o2common.service.client.base_client import BaseClient +# from o2common.service.unit_of_work import AbstractUnitOfWork from o2ims.service.watcher.resource_watcher import ResourceWatcher +from o2ims.domain import commands +from o2common.service.messagebus import MessageBus -import logging -logger = logging.getLogger(__name__) +from o2common.helper import o2logging +logger = o2logging.get_logger(__name__) class PServerCpuWatcher(ResourceWatcher): def __init__(self, client: BaseClient, - uow: AbstractUnitOfWork) -> None: - super().__init__(client, uow) + bus: MessageBus) -> None: + super().__init__(client, bus) def _targetname(self): return "pserver_cpu" - def _probe(self, parent: object = None): - hostid = parent.id if parent else None + def _probe(self, parent: StxGenericModel): + hostid = parent.id newmodels = self._client.list(hostid=hostid) - for newmodel in newmodels: - super()._compare_and_update(newmodel) - return newmodels + return [commands.UpdatePserverCpu(data=m, parentid=hostid) + for m in newmodels]