summaryrefslogtreecommitdiffstats
path: root/vnfs/vnf
diff options
context:
space:
mode:
Diffstat (limited to 'vnfs/vnf')
-rw-r--r--vnfs/vnf/vnf.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/vnfs/vnf/vnf.py b/vnfs/vnf/vnf.py
index 483faf38..1410a0c4 100644
--- a/vnfs/vnf/vnf.py
+++ b/vnfs/vnf/vnf.py
@@ -51,11 +51,12 @@ class IVnf(tasks.Process):
"""
Stops VNF instance.
"""
- self._logger.info('Killing VNF...')
+ if self.is_running():
+ self._logger.info('Killing VNF...')
- # force termination of VNF and wait for it to terminate; It will avoid
- # sporadic reboot of host. (caused by hugepages or DPDK ports)
- super(IVnf, self).kill(signal='-9', sleep=10)
+ # force termination of VNF and wait for it to terminate; It will avoid
+ # sporadic reboot of host. (caused by hugepages or DPDK ports)
+ super(IVnf, self).kill(signal='-9', sleep=10)
def execute(self, cmd, delay=0):
"""
@@ -122,6 +123,19 @@ class IVnf(tasks.Process):
self.execute(cmd)
self.wait(prompt=prompt, timeout=timeout)
+ def validate_start(self, dummy_result):
+ """ Validate call of VNF start()
+ """
+ if self._child and self._child.isalive():
+ return True
+ else:
+ return False
+
+ def validate_stop(self, result):
+ """ Validate call of fVNF stop()
+ """
+ return not self.validate_start(result)
+
@staticmethod
def reset_vnf_counter():
"""