def chekForNetpluginErrors(self): out, err, exitCode = self.runCmd("grep error /tmp/net*") if out != [] or err != []: print "Error: ".join(out).join(err) tutils.log("Errors seen in log files on: " + self.hostname) return False return True
def chekForNetpluginErrors(self): out, err, exitCode = self.runCmd('grep "error\|fatal" /tmp/net*') if out != [] or err != []: print "Error: ".join(out).join(err) tutils.log("Errors seen in log files on: " + self.hostname) return False return True
def checkForNetpluginErrors(self): out, err, exitCode = self.runCmd('grep "error\|fatal" /tmp/net*') if out != [] or err != []: print "\n\n\n\n\n\n" tutils.log("Error:\n" + ''.join(out) + ''.join(err)) tutils.log("Errors seen in log files on: " + self.hostname) return False return True
def checkConnection(self, ipAddr, port, protocol="tcp"): tutils.log("Checking connection from " + self.myId() + " to " + ipAddr + " port " + str(port)) protoStr = "-u " if protocol == "udp" else " " out, err, exitCode = self.execCmd("netcat -z -n -v -w 1 " + protoStr + ipAddr + " " + str(port)) print "checkConnection Output(" + str(exitCode) + "): " + ''.join(out) print "checkConnection Err: " + ''.join(err) ncOut = ''.join(out) + ''.join(err) if "succeeded" in ncOut and exitCode == 0: return True else: return False
def checkPing(self, ipAddr): tutils.log("Checking ping from " + self.myId() + " to " + ipAddr) out, err, exitCode = self.execCmd("ping -c 5 -i 0.2 " + ipAddr) if err != [] or exitCode != 0: print "ping exit(" + str(exitCode) + ") Output: " + ''.join(out) print "Error during ping" print err tutils.exit("Ping failed") # Check if ping succeeded pingOutput = ''.join(out) if "0 received, 100% packet loss" in pingOutput: print "Ping failed. Output: " + pingOutput tutils.exit("Ping failed") tutils.log("ping from " + self.myId() + " to " + ipAddr + " Successful!") return True
def checkPing(self, ipAddr): tutils.log("Checking ping from " + self.myId() + " to " + ipAddr) out, err, exitCode = self.execCmd("ping -c 5 -i 0.2 " + ipAddr) if err != [] or exitCode != 0: print "ping exit(" + str(exitCode) + ") Output: " + pingOutput print "Error during ping" print err tutils.exit("Ping failed") # Check if ping succeded pingOutput = ''.join(out) if "0 received, 100% packet loss" in pingOutput: print "Ping failed. Output: " + pingOutput tutils.exit("Ping failed") tutils.log("ping from " + self.myId() + " to " + ipAddr + " Successful!") return True
def checkPingFailure(self, ipAddr): tutils.log("Checking ping failure from " + self.myId() + " to " + ipAddr) out, err, exitCode = self.execCmd("ping -c 5 -i 0.5 -W 1 " + ipAddr) pingOutput = ''.join(out) if err != [] or exitCode != 0: print "ping exit(" + str(exitCode) + ") Output: " + pingOutput tutils.log("Ping failed as expected.") return True # Check if ping succeeded if "0 received, 100% packet loss" in pingOutput: tutils.log("Ping failed as expected. Output: " + pingOutput) return True tutils.log("ping from " + self.myId() + " to " + ipAddr + " succeeded while expecting failure") tutils.exit("Ping succeeded while expecting failure")
def checkPingFailure(self, ipAddr): tutils.log("Checking ping failure from " + self.myId() + " to " + ipAddr) out, err, exitCode = self.execCmd("ping -c 5 -i 0.5 -W 1 " + ipAddr) pingOutput = ''.join(out) if err != [] or exitCode != 0: print "ping exit(" + str(exitCode) + ") Output: " + pingOutput tutils.log("Ping failed as expected.") return True # Check if ping succeded if "0 received, 100% packet loss" in pingOutput: tutils.log("Ping failed as expected. Output: " + pingOutput) return True tutils.log("ping from " + self.myId() + " to " + ipAddr + " succeeded while expecting failure") tutils.exit("Ping succeeded while expecting failure")