X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=doc%2Fsphinx%2F_build%2Fhtml%2F_modules%2Fnepi%2Fresources%2Flinux%2Fccn%2Fccnping.html;fp=doc%2Fsphinx%2F_build%2Fhtml%2F_modules%2Fnepi%2Fresources%2Flinux%2Fccn%2Fccnping.html;h=e0aad66c173545ffc558dc47eafdf5429b688b0d;hb=9b6a92c1bb6c85d1b6d194624e49ea01ce3893e7;hp=0000000000000000000000000000000000000000;hpb=ed00cc0dfbe89c748c07b7da96dfff338cdb301a;p=nepi.git diff --git a/doc/sphinx/_build/html/_modules/nepi/resources/linux/ccn/ccnping.html b/doc/sphinx/_build/html/_modules/nepi/resources/linux/ccn/ccnping.html new file mode 100644 index 00000000..e0aad66c --- /dev/null +++ b/doc/sphinx/_build/html/_modules/nepi/resources/linux/ccn/ccnping.html @@ -0,0 +1,186 @@ + + + + +
+ + +
+#
+# NEPI, a framework to manage network experiments
+# Copyright (C) 2013 INRIA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation;
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+
+from nepi.execution.attribute import Attribute, Flags, Types
+from nepi.execution.resource import ResourceManager, clsinit_copy, \
+ ResourceState
+from nepi.resources.linux.ccn.ccnpingserver import LinuxCCNPingServer
+from nepi.util.timefuncs import tnow, tdiffsec
+
+import os
+
+@clsinit_copy
+[docs]class LinuxCCNPing(LinuxCCNPingServer):
+ _rtype = "linux::CCNPing"
+
+ @classmethod
+ def _register_attributes(cls):
+ interval = Attribute("i",
+ "Set ping interval in seconds (minimum 0.10 second) ",
+ type = Types.Integer,
+ flags = Flags.Design)
+
+ count = Attribute("c",
+ "Total number of pings",
+ type = Types.Double,
+ flags = Flags.Design)
+
+ number = Attribute("n",
+ "Set the starting number, the number is incremented by 1 after each Interest ",
+ type = Types.Integer,
+ flags = Flags.Design)
+
+ prefix = Attribute("prefix",
+ "Prefix to serve content (e.g. ccnx:/name/prefix)",
+ flags = Flags.Design)
+
+ cls._register_attribute(interval)
+ cls._register_attribute(count)
+ cls._register_attribute(number)
+ cls._register_attribute(prefix)
+
+ def __init__(self, ec, guid):
+ super(LinuxCCNPing, self).__init__(ec, guid)
+ self._home = "ccnping-%s" % self.guid
+
+ @property
+[docs] def ccnpingserver(self):
+ ccnpingserver = self.get_connected(LinuxCCNPingServer.get_rtype())
+ if ccnpingserver: return ccnpingserver[0]
+ return None
+
+[docs] def do_start(self):
+ if not self.ccnpingserver or \
+ self.ccnpingserver.state < ResourceState.STARTED:
+ self.debug("---- RESCHEDULING START---- ccnpingserver state %s " % \
+ self.ccnpingserver.state )
+ self.ec.schedule(self.reschedule_delay, self.start)
+ else:
+ super(LinuxCCNPing, self).do_start()
+
+ @property
+ def _start_command(self):
+ args = []
+ args.append("ccnping")
+ args.append(self.get("prefix"))
+ if self.get("c"):
+ args.append("-c %d" % self.get("c"))
+ if self.get("n"):
+ args.append("-n %d" % self.get("n"))
+ if self.get("i"):
+ args.append("-i %.2f" % self.get("i"))
+
+ command = " ".join(args)
+
+ return command
+
+