# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
from nepi.execution.attribute import Attribute, Flags, Types
-from nepi.execution.resource import clsinit_copy
+from nepi.execution.resource import clsinit_copy
from nepi.resources.linux.application import LinuxApplication
from nepi.util.timefuncs import tnow
import os
-nping_sources = dict({
- "i686": "http://nmap.org/dist/nping-0.6.25-1.i386.rpm",
- "amd64": "http://nmap.org/dist/nping-0.6.25-1.x86_64.rpm",
- })
-
@clsinit_copy
class LinuxNPing(LinuxApplication):
- _rtype = "LinuxNPing"
+ _rtype = "linux::NPing"
@classmethod
def _register_attributes(cls):
"Sets nping -c option. "
"Stop after a given number of rounds. ",
type = Types.Integer,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
e = Attribute("e",
"Sets nping -e option. "
"Set the network interface to be used.",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
delay = Attribute("delay",
"Sets nping --delay option. "
"Delay between probes ",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
rate = Attribute("rate",
"Sets nping --rate option. "
"Send probes at a given rate ",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
ttl = Attribute("ttl",
"Sets nping --ttl option. "
"Time To Live. ",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
p = Attribute("p",
"Sets nping -p option. "
"Target ports. ",
type = Types.Integer,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
tcp = Attribute("tcp",
"Sets nping --tcp option. "
"TCP mode. ",
type = Types.Bool,
default = False,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
udp = Attribute("udp",
"Sets nping --udp option. "
"UDP mode. ",
type = Types.Bool,
default = False,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
icmp = Attribute("icmp",
"Sets nping --icmp option. "
"ICMP mode. ",
type = Types.Bool,
default = False,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
arp = Attribute("arp",
"Sets nping --arp option. "
"ARP mode. ",
type = Types.Bool,
default = False,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
traceroute = Attribute("traceroute",
"Sets nping --traceroute option. "
"Traceroute mode. ",
type = Types.Bool,
default = False,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
countinuous = Attribute("continuous",
"Run nping in a while loop",
type = Types.Bool,
default = False,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
print_timestamp = Attribute("printTimestamp",
"Print timestamp before running nping",
type = Types.Bool,
default = False,
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
target = Attribute("target",
"nping target host (host that will be pinged)",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
cls._register_attribute(c)
cls._register_attribute(e)
self._home = "nping-%s" % self.guid
self._sudo_kill = True
- def deploy(self):
+ def do_deploy(self):
if not self.get("command"):
self.set("command", self._start_command)
if not self.get("depends"):
self.set("depends", "nmap")
- super(LinuxNPing, self).deploy()
+ super(LinuxNPing, self).do_deploy()
@property
def _start_command(self):
" )"
" && %s && sudo alien -i nping.rpm ) " % install_alien)
- return ("( nping || %s )" % install)
+ return ("( nping --version || %s )" % install)
def valid_connection(self, guid):
# TODO: Validate!