Add NdnApplication class to handle start and stop

refs: #2909

Change-Id: Ibe5760b155e0edf2227d2d7146f8b6552149a63b
diff --git a/ndn/nlsr.py b/ndn/nlsr.py
index 1807374..d1e1d3c 100644
--- a/ndn/nlsr.py
+++ b/ndn/nlsr.py
@@ -1,12 +1,11 @@
 #!/usr/bin/env python
-import os
+from ndn.ndn_application import NdnApplication
 
-class Nlsr:
+class Nlsr(NdnApplication):
     def __init__(self, node):
-        self.node = node
+        NdnApplication.__init__(self, node)
         self.routerName = "/%sC1.Router/cs/%s" % ('%', node.name)
         self.confFile = "/tmp/%s/nlsr.conf" % node.name
-        self.isRunning = False
 
         # Make directory for log file
         self.logDir = "/tmp/%s/log" % node.name
@@ -19,23 +18,7 @@
         node.cmd("sudo sed -i 's|prefix .*netlab|prefix /ndn/edu/%s|g' %s" % (node.name, self.confFile))
 
     def start(self):
-        if self.isRunning is True:
-            try:
-                os.kill(int(self.processId), 0)
-            except OSError:
-                self.isRunning = False
-
-        if self.isRunning is False: 
-            self.node.cmd("nlsr -d")
-            self.processId = self.node.cmd("echo $!")[:-1]
-
-            self.isRunning = True
-
-    def stop(self):
-        if self.isRunning:
-            self.node.cmd("sudo kill %s" % self.processId)
-
-            self.isRunning = False
+        NdnApplication.start(self, "nlsr -d")
 
 class NlsrConfigGenerator: