install-apps: script to install NDN applications required for testing
test-ndntlvping: sample test case for testing ndn-tlv-ping

Change-Id: Ib54bd606f6854672ed890d3971ff5827197435e8
refs: #1220
diff --git a/install_apps.py b/install_apps.py
new file mode 100755
index 0000000..c2c0edc
--- /dev/null
+++ b/install_apps.py
@@ -0,0 +1,79 @@
+#!/usr/bin/python2
+import os
+import sys
+import inspect
+from sets import Set
+
+def usage():
+    print "\nUSAGE:"
+    print "  ./install_apps.py [OPTIONS]\n"
+    print "  Install NDN applications"
+    print "  Latest source codes will be downloaded from their GitHub"
+    print "  named-data repositories (https://github.com/named-data)"
+    print "\nOPTIONS:"
+    print "  install_ndncppdev  - install ndn-cpp-dev (named-data/ndn-cpp-dev)"
+    print "  setup_security     - create an identity using ndnsec (/tmp/nfd_integration)"
+    print "  install_NFD        - install NFD (named-data/NFD)"
+    print "  install_ndntraffic - install ndn-traffic-generator (named-data/ndn-traffic-generator)"
+    print "  install_ndntlvping - install ndn-tlv-ping (named-data/ndn-tlv-ping)"
+    print "  install_all        - do all of the above"
+    print "  help               - print this message and exit\n"
+
+
+def main():
+    cmd_subfolder = os.path.realpath(
+        os.path.abspath(os.path.join(os.path.split(
+            inspect.getfile(inspect.currentframe()))[0], "install_helpers")))
+    if cmd_subfolder not in sys.path:
+        sys.path.insert(0, cmd_subfolder)
+    validOptions = [ "install_ndncppdev",
+                     "setup_security",
+                     "install_NFD",
+                     "install_ndntraffic",
+                     "install_ndntlvping",
+                     "install_all",
+                     "help" ]
+
+    if len(sys.argv) > 1:
+        actionList = Set(sys.argv[1:])
+        optionsStatus = 0
+        for option in actionList:
+            if option not in validOptions:
+                print "Invalid option provided - " + option
+                optionsStatus = -1
+                break
+        if optionsStatus == 0 and "help" not in actionList:
+            if "install_all" in actionList:
+                actionList.add("install_ndncppdev")
+                actionList.add("setup_security")
+                actionList.add("install_NFD")
+                actionList.add("install_ndntraffic")
+                actionList.add("install_ndntlvping")
+            module = __import__("setup_preparation_folder")
+            module.run()
+            module = __import__("install_dependencies")
+            module.run()
+            if "install_ndncppdev" in actionList:
+                module = __import__("install_ndncppdev")
+                module.run()
+            if "setup_security" in actionList:
+                module = __import__("setup_security")
+                module.run()
+            if "install_NFD" in actionList:
+                module = __import__("install_NFD")
+                module.run()
+            if "install_ndntraffic" in actionList:
+                module = __import__("install_ndntraffic")
+                module.run()
+            if "install_ndntlvping" in actionList:
+                module = __import__("install_ndntlvping")
+                module.run()
+            print ""
+        else:
+            usage()
+    else:
+        usage()
+
+
+if __name__ == "__main__":
+    main()