Move the NDNPing wrapper method to a helper class.

Also updates GPL header for the current calendar year.

Refs: #3492

Change-Id: Ic4977c33edd0311b140e6db3688afbb182acec9e
diff --git a/bin/minindn b/bin/minindn
index 676ae6d..8d8d93d 100755
--- a/bin/minindn
+++ b/bin/minindn
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/bin/minindnedit b/bin/minindnedit
index 8669dde..0bdcb5d 100755
--- a/bin/minindnedit
+++ b/bin/minindnedit
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/__init__.py b/ndn/__init__.py
index 9978cda..e497565 100644
--- a/ndn/__init__.py
+++ b/ndn/__init__.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/apps/__init__.py b/ndn/apps/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ndn/apps/__init__.py
diff --git a/ndn/apps/ndn_ping_client.py b/ndn/apps/ndn_ping_client.py
new file mode 100644
index 0000000..7e7ff2a
--- /dev/null
+++ b/ndn/apps/ndn_ping_client.py
@@ -0,0 +1,43 @@
+# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2015-2018, The University of Memphis,
+#                          Arizona Board of Regents,
+#                          Regents of the University of California.
+#
+# This file is part of Mini-NDN.
+# See AUTHORS.md for a complete list of Mini-NDN authors and contributors.
+#
+# Mini-NDN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Mini-NDN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Mini-NDN, e.g., in COPYING.md file.
+# If not, see <http://www.gnu.org/licenses/>.
+
+import time
+
+class NDNPingClient:
+    @staticmethod
+    def ping(source, dest, nPings=1, interval=None, timeout=None, starting_seq_num=None,
+             identifier=None, allow_stale_data=False, print_timestamp=True, sleepTime=0.2):
+        print("Scheduling ping(s) from {} to {}".format(source.name, dest.name))
+        # Use "&" to run in background and perform parallel pings
+        source.cmd("ndnping{1}{2}{3}{4}{5}{6}{7} /ndn/{0}-site/{0} >> ping-data/{0}.txt &"
+        .format(
+            dest,
+            " -c {}".format(nPings),
+            " -i {}".format(interval) if interval else "",
+            " -o {}".format(timeout) if timeout  else "",
+            " -n {}".format(starting_seq_num) if starting_seq_num else "",
+            " -p {}".format(identifier) if identifier else "",
+            " -a" if allow_stale_data else "",
+            " -t" if print_timestamp else ""
+        ))
+        time.sleep(sleepTime)
\ No newline at end of file
diff --git a/ndn/conf_parser.py b/ndn/conf_parser.py
index dfadeab..85fda2b 100644
--- a/ndn/conf_parser.py
+++ b/ndn/conf_parser.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiment_manager.py b/ndn/experiment_manager.py
index d8ec0eb..1275a96 100644
--- a/ndn/experiment_manager.py
+++ b/ndn/experiment_manager.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiments/convergence_experiment.py b/ndn/experiments/convergence_experiment.py
index c67b184..f95da58 100644
--- a/ndn/experiments/convergence_experiment.py
+++ b/ndn/experiments/convergence_experiment.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiments/experiment.py b/ndn/experiments/experiment.py
index 5ada588..fa76370 100644
--- a/ndn/experiments/experiment.py
+++ b/ndn/experiments/experiment.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
@@ -23,6 +23,7 @@
 
 import time
 import sys
+from ndn.apps.ndn_ping_client import NDNPingClient
 from itertools import cycle
 
 from ndn import ExperimentManager
@@ -91,18 +92,12 @@
             self.net.stop()
             sys.exit(1)
 
-    def ping(self, source, dest, nPings):
-        # Use "&" to run in background and perform parallel pings
-        print "Scheduling ping(s) from %s to %s" % (source.name, dest.name)
-        source.cmd("ndnping -t -c "+ str(nPings) + " /ndn/" + dest.name + "-site/" + dest.name + " >> ping-data/" + dest.name + ".txt &")
-        time.sleep(0.2)
-
     def startPings(self):
         for host in self.net.hosts:
             for other in self.net.hosts:
                 # Do not ping self
                 if host.name != other.name:
-                    self.ping(host, other, self.nPings)
+                    NDNPingClient.ping(host, other, self.nPings)
 
     def failNode(self, host):
         print("Bringing %s down" % host.name)
@@ -137,7 +132,7 @@
 
                 # Do not ping self
                 if host.name != other.name:
-                    self.ping(host, other, self.nPings)
+                    NDNPingClient.ping(host, other, self.nPings)
                     nodesPingedList.append(other)
 
                 # Always increment because in 100% case a node should not ping itself
diff --git a/ndn/experiments/failure_experiment.py b/ndn/experiments/failure_experiment.py
index 8397836..b25cbfe 100644
--- a/ndn/experiments/failure_experiment.py
+++ b/ndn/experiments/failure_experiment.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiments/mcn_failure_convergence_experiment.py b/ndn/experiments/mcn_failure_convergence_experiment.py
index aced2dc..376d91f 100644
--- a/ndn/experiments/mcn_failure_convergence_experiment.py
+++ b/ndn/experiments/mcn_failure_convergence_experiment.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiments/mcn_failure_experiment.py b/ndn/experiments/mcn_failure_experiment.py
index bd85eff..019c214 100644
--- a/ndn/experiments/mcn_failure_experiment.py
+++ b/ndn/experiments/mcn_failure_experiment.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiments/multiple_failure_experiment.py b/ndn/experiments/multiple_failure_experiment.py
index 4fc8e8c..0836949 100644
--- a/ndn/experiments/multiple_failure_experiment.py
+++ b/ndn/experiments/multiple_failure_experiment.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiments/pingall_experiment.py b/ndn/experiments/pingall_experiment.py
index ebac539..cad27e2 100644
--- a/ndn/experiments/pingall_experiment.py
+++ b/ndn/experiments/pingall_experiment.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/experiments/prefix_propogation.py b/ndn/experiments/prefix_propogation.py
index 4fe7dee..a4f83b3 100644
--- a/ndn/experiments/prefix_propogation.py
+++ b/ndn/experiments/prefix_propogation.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/gui.py b/ndn/gui.py
index 0a0a756..54838c5 100644
--- a/ndn/gui.py
+++ b/ndn/gui.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/ndn_application.py b/ndn/ndn_application.py
index dd9100e..150c7c1 100644
--- a/ndn/ndn_application.py
+++ b/ndn/ndn_application.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/ndn_host.py b/ndn/ndn_host.py
index 7596f5f..2567794 100644
--- a/ndn/ndn_host.py
+++ b/ndn/ndn_host.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/nfd.py b/ndn/nfd.py
index 480e320..0368523 100644
--- a/ndn/nfd.py
+++ b/ndn/nfd.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/nlsr.py b/ndn/nlsr.py
index 6c5572e..b6a6009 100644
--- a/ndn/nlsr.py
+++ b/ndn/nlsr.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/placer.py b/ndn/placer.py
index ba521b8..412dc91 100644
--- a/ndn/placer.py
+++ b/ndn/placer.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/process_monitor.py b/ndn/process_monitor.py
index f8dca44..da41b1d 100644
--- a/ndn/process_monitor.py
+++ b/ndn/process_monitor.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/remote_ndn_link.py b/ndn/remote_ndn_link.py
index 6dd64f3..497c098 100644
--- a/ndn/remote_ndn_link.py
+++ b/ndn/remote_ndn_link.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #
diff --git a/ndn/util.py b/ndn/util.py
index 0ed570d..159a8e8 100644
--- a/ndn/util.py
+++ b/ndn/util.py
@@ -1,6 +1,6 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015-2017, The University of Memphis,
+# Copyright (C) 2015-2018, The University of Memphis,
 #                          Arizona Board of Regents,
 #                          Regents of the University of California.
 #