X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=doc%2Fsphinx%2F_build%2Fhtml%2F_modules%2Fnepi%2Fresources%2Flinux%2Fccn%2Fccnpingserver.html;fp=doc%2Fsphinx%2F_build%2Fhtml%2F_modules%2Fnepi%2Fresources%2Flinux%2Fccn%2Fccnpingserver.html;h=4c8fd496f0b05380da96f07dc677a6b029dd4e9d;hb=9b6a92c1bb6c85d1b6d194624e49ea01ce3893e7;hp=0000000000000000000000000000000000000000;hpb=ed00cc0dfbe89c748c07b7da96dfff338cdb301a;p=nepi.git diff --git a/doc/sphinx/_build/html/_modules/nepi/resources/linux/ccn/ccnpingserver.html b/doc/sphinx/_build/html/_modules/nepi/resources/linux/ccn/ccnpingserver.html new file mode 100644 index 00000000..4c8fd496 --- /dev/null +++ b/doc/sphinx/_build/html/_modules/nepi/resources/linux/ccn/ccnpingserver.html @@ -0,0 +1,225 @@ + + + + +
+ + +
+#
+# 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.ccnapplication import LinuxCCNApplication
+from nepi.util.timefuncs import tnow, tdiffsec
+
+import os
+
+@clsinit_copy
+[docs]class LinuxCCNPingServer(LinuxCCNApplication):
+ _rtype = "linux::CCNPingServer"
+
+ @classmethod
+ def _register_attributes(cls):
+ daemon = Attribute("d",
+ "Run ccnping server as a daemon in background",
+ type = Types.Bool,
+ default = False,
+ flags = Flags.Design)
+
+ freshness = Attribute("x",
+ "Set FreshnessSeconds",
+ type = Types.Integer,
+ flags = Flags.Design)
+
+ prefix = Attribute("prefix",
+ "Prefix to serve content (e.g. ccnx:/name/prefix)",
+ flags = Flags.Design)
+
+ cls._register_attribute(daemon)
+ cls._register_attribute(freshness)
+ cls._register_attribute(prefix)
+
+ def __init__(self, ec, guid):
+ super(LinuxCCNPingServer, self).__init__(ec, guid)
+ self._home = "ccnping-serv-%s" % self.guid
+
+[docs] def do_deploy(self):
+ if not self.get("command"):
+ self.set("command", self._start_command)
+
+ if not self.get("env"):
+ self.set("env", self._environment)
+
+ if not self.get("depends"):
+ self.set("depends", self._dependencies)
+
+ if not self.get("build"):
+ self.set("build", self._build)
+
+ if not self.get("install"):
+ self.set("install", self._install)
+
+ super(LinuxCCNPingServer, self).do_deploy()
+
+ @property
+ def _start_command(self):
+ args = []
+ args.append("ccnpingserver")
+ args.append(self.get("prefix"))
+ if self.get("d") == True:
+ args.append("-d")
+ if self.get("x"):
+ args.append("-x %d" % self.get("x"))
+
+ command = " ".join(args)
+
+ return command
+
+ @property
+ def _dependencies(self):
+ return "git"
+
+ @property
+ def _build(self):
+ return (
+ # Evaluate if ccnx binaries are already installed
+ " ( "
+ " test -f ${BIN}/ccnping && "
+ " echo 'binaries found, nothing to do' "
+ " ) || ( "
+ # If not, untar and build
+ " ( "
+ " git clone git://github.com/NDN-Routing/ccnping ${SRC}/ccnping "
+ " ) && "
+ # build
+ "cd ${SRC}/ccnping && "
+ " ( "
+ " ./configure LDFLAGS=-L${SRC}/ccnx-0.7.2/lib CFLAGS=-I${SRC}/ccnx-0.7.2/include "
+ " --prefix=${BIN}/ccnping && make "
+ " ) "
+ " )")
+
+ @property
+ def _install(self):
+ return (
+ # Evaluate if ccnx binaries are already installed
+ " ( "
+ " test -f ${BIN}/ccnping && "
+ " echo 'binaries found, nothing to do' "
+ " ) || ( "
+ # If not, install
+ " mkdir -p ${BIN}/ccnping && "
+ " mv ${SRC}/ccnping/ccnping ${BIN}/ccnping/ && "
+ " mv ${SRC}/ccnping/ccnpingserver ${BIN}/ccnping/ "
+ " )"
+ )
+
+ @property
+ def _environment(self):
+ return "%s:%s" % (self.ccnd.path, "${BIN}/ccnping")
+
+