- self._log.debug("Creating a task to update uptime for vnfr: %s", vnfr.id)
- self._vnfr_uptime_tasks[vnfr.id] = self._loop.create_task(self.vnfr_uptime_update(vnfr))
-
- def vnfr_uptime_update(self, vnfr):
- try:
- vnfr_ = RwVnfrYang.YangData_Vnfr_VnfrCatalog_Vnfr.from_dict({'id': vnfr.id})
- while True:
- vnfr_.uptime = int(time.time()) - vnfr._create_time
- yield from self._publisher.publish_vnfr(None, vnfr_)
- yield from asyncio.sleep(2, loop=self._loop)
- except asyncio.CancelledError:
- self._log.debug("Received cancellation request for vnfr_uptime_update task")