X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Flinux%2Fnping.py;h=f0269af35b42cfc1b1f18b428e5c733f4bebeeaf;hb=d50ba1a08e541ded7a8b322493ebb1d0cc59c6ff;hp=f85f5830d955f54cfc384afe3f78609ef6f47f85;hpb=4e7d16755f3336712e2ffd88b4f5eb040cf14b38;p=nepi.git diff --git a/src/nepi/resources/linux/nping.py b/src/nepi/resources/linux/nping.py index f85f5830..f0269af3 100644 --- a/src/nepi/resources/linux/nping.py +++ b/src/nepi/resources/linux/nping.py @@ -18,20 +18,15 @@ # Author: Alina Quereilhac 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): @@ -39,84 +34,84 @@ class LinuxNPing(LinuxApplication): "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) @@ -138,7 +133,7 @@ class LinuxNPing(LinuxApplication): 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) @@ -151,7 +146,7 @@ class LinuxNPing(LinuxApplication): if not self.get("depends"): self.set("depends", "nmap") - super(LinuxNPing, self).deploy() + super(LinuxNPing, self).do_deploy() @property def _start_command(self): @@ -219,7 +214,7 @@ class LinuxNPing(LinuxApplication): " )" " && %s && sudo alien -i nping.rpm ) " % install_alien) - return ("( nping || %s )" % install) + return ("( nping --version || %s )" % install) def valid_connection(self, guid): # TODO: Validate!