Bug 196 - Disabled periodic uptime updates causing transaction flooding 74/1974/1
authorvelandy <rajesh.velandy@riftio.com>
Sat, 24 Jun 2017 04:06:44 +0000 (00:06 -0400)
committervelandy <rajesh.velandy@riftio.com>
Sat, 24 Jun 2017 04:07:23 +0000 (00:07 -0400)
Signed-off-by: velandy <rajesh.velandy@riftio.com>
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py

index cf9b656..5ca0f3f 100644 (file)
@@ -928,7 +928,6 @@ class OpenmanoNsPlugin(rwnsmplugin.NsmPluginBase):
         self._cli_api = None
         self._http_api = None
         self._openmano_nsrs = {}
-        self._vnfr_uptime_tasks = {}
         self._openmano_nsr_by_vnfr_id = {}
         #self._nsr_uuid = None
 
@@ -1044,18 +1043,6 @@ class OpenmanoNsPlugin(rwnsmplugin.NsmPluginBase):
         self._log.debug("Attempting to publish openmano vnf: %s", vnfr_msg)
         with self._dts.transaction() as xact:
             yield from self._publisher.publish_vnfr(xact, vnfr_msg)
-        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")
 
     @asyncio.coroutine
     def instantiate_vl(self, nsr, vlr):
@@ -1108,8 +1095,6 @@ class OpenmanoNsPlugin(rwnsmplugin.NsmPluginBase):
             openmano_vnf_nsr.terminate()
             openmano_vnf_nsr.delete()
             yield from openmano_vnf_nsr.remove_vnf(vnfr)
-            if vnfr.id in self._vnfr_uptime_tasks:
-                self._vnfr_uptime_tasks[vnfr.id].cancel()
 
     @asyncio.coroutine
     def terminate_vl(self, vlr):
index efcd8f4..e600b9a 100755 (executable)
@@ -1260,8 +1260,6 @@ class NetworkServiceRecord(object):
         self._is_active = False
         self._vl_phase_completed = False
         self._vnf_phase_completed = False
-        self.vlr_uptime_tasks = {}
-
 
         # Initalise the state to init
         # The NSR moves through the following transitions
@@ -1455,19 +1453,6 @@ class NetworkServiceRecord(object):
             vlr.state = VlRecordState.ACTIVE
 
 
-    def vlr_uptime_update(self, vlr):
-        try:
-
-            vlr_ = RwVlrYang.YangData_Vlr_VlrCatalog_Vlr.from_dict({'id': vlr.id})
-            while True:
-                vlr_.uptime = int(time.time()) - vlr._create_time
-                yield from self._vlr_handler.update(None, VirtualLinkRecord.vlr_xpath(vlr), vlr_)
-                yield from asyncio.sleep(2, loop=self._loop)
-        except asyncio.CancelledError:
-            self._log.debug("Received cancellation request for vlr_uptime_update task")
-            yield from self._vlr_handler.delete(None, VirtualLinkRecord.vlr_xpath(vlr))
-
-
     @asyncio.coroutine
     def create(self, config_xact):
         """ Create this network service"""
@@ -2412,8 +2397,6 @@ class NetworkServiceRecord(object):
             for vlr in self.vlrs:
                 yield from self.nsm_plugin.terminate_vl(vlr)
                 vlr.state = VlRecordState.TERMINATED
-                if vlr.id in self.vlr_uptime_tasks:
-                    self.vlr_uptime_tasks[vlr.id].cancel()
 
         self._log.debug("Terminating network service id %s", self.id)