Example #1
0
    def errExit(self, str):
        # print erros from netplugin log file
        for node in self.nodes:
            node.checkForNetpluginErrors()

        # exit the script
        tutils.exit(str)
Example #2
0
    def errExit(self, str):
        # print erros from netplugin log file
        for node in self.nodes:
            node.chekForNetpluginErrors()

        # exit the script
        tutils.exit(str)
Example #3
0
 def sshConnect(self, username, password):
     ssh_object = paramiko.SSHClient()
     ssh_object.set_missing_host_key_policy(paramiko.AutoAddPolicy())
     print "Connecting to " + self.addr + " with userid: " + username + " password: "******"Authentication failed")
Example #4
0
 def sshConnect(self, username, password):
     ssh_object = paramiko.SSHClient()
     ssh_object.set_missing_host_key_policy( paramiko.AutoAddPolicy() )
     print "Connecting to " + self.addr + " with userid: " + username + " password: "******"Authentication failed")
Example #5
0
    def getIpAddr(self, intfName="eth0"):
        if intfName == "eth0":
            return self.eth0Addr

        # Read interface ip
        out, err, exitCode = self.execCmd("ifconfig " + intfName)
        if err != [] or exitCode != 0:
            print "Error during docker exec"
            print err
            tutils.exit("Failed to get IP address")

        return out[1].split('addr')[1].split(' ')[0].split(':')[1]
Example #6
0
    def getIpAddr(self, intfName="eth0"):
        if intfName == "eth0":
            return self.eth0Addr

        # Read interface ip
        out, err, exitCode = self.execCmd("ifconfig " + intfName)
        if err != [] or exitCode != 0:
            print "Error during docker exec"
            print err
            tutils.exit("Failed to get IP address")

        return out[1].split('addr')[1].split(' ')[0].split(':')[1]
Example #7
0
    def __init__(self, node, cid, cntName=""):
        self.node = node
        self.cid = cid
        self.cntName = cntName

        # Read interface ip
        out, err, exitCode = self.execCmd('ip addr show dev eth0 | grep "inet "')
        if err != [] or exitCode != 0:
            print "Error during docker exec"
            print err
            tutils.exit("Failed to get IP address")

        self.eth0Addr = out[0].strip().split(' ')[1].split('/')[0]
Example #8
0
    def __init__(self, node, cid, cntName=""):
        self.node = node
        self.cid = cid
        self.cntName = cntName

        # Read interface ip
        out, err, exitCode = self.execCmd('ip addr show dev eth0 | grep "inet "')
        if err != [] or exitCode != 0:
            print "Error during docker exec"
            print err
            tutils.exit("Failed to get IP address")

        self.eth0Addr = out[0].strip().split(' ')[1].split('/')[0]
Example #9
0
    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")
Example #10
0
    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")
Example #11
0
    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
Example #12
0
    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
Example #13
0
 def checkForNetpluginErrors(self):
     for node in self.nodes:
         ret = node.checkForNetpluginErrors()
         if ret == False and self.failOnError:
             tutils.exit("Errors in log file")
Example #14
0
 def errorExit(self, str, out, err):
     print str + " " + self.myId()
     print "Output: " + ''.join(out)
     print "Error: " + ''.join(err)
     tutils.exit(str)
Example #15
0
 def chekForNetpluginErrors(self):
     for node in self.nodes:
         ret = node.chekForNetpluginErrors()
         if ret == False and self.failOnError:
             tutils.exit("Errors in log file")
Example #16
0
 def errorExit(self, str, out, err):
     print str + " " + self.myId()
     print "Output: " + ''.join(out)
     print "Error: " + ''.join(err)
     tutils.exit(str)