Exemplo n.º 1
0
    def runTest(self):
        #for d in [wan, lan]:
            #d.sendline('apt-get update && apt-get -o Dpkg::Options::="--force-confnew" -y install socat pv')
            #d.expect(prompt)

        max_time = 0
        single_max = 45

        # TODO: query interfaces but this is OK for now
        for i in range(1000):
            # keep long running test alive
            board.sendline()
            board.expect(prompt)
            print ("Starting connection %s" % i)
            sz, rate, ip, port = self.startSingleUDP(maxtime=single_max)
            print ("started UDP to %s:%s sz = %s, rate = %sk" % (ip, port, sz, rate))

            max_time = max(max_time, sz / ( rate * 1024))
            self.check_and_clean_ips()

        print ("waiting max time of %ss" % max_time)

        start = time.time()
        while time.time() - start < max_time + 5:
            lan.sendline('wait')
            lan.expect_exact('wait')
            if 0 != lan.expect([pexpect.TIMEOUT] + prompt, timeout=max_time + 5):
                lan.sendcontrol('c')
                lan.expect(prompt)
                self.check_and_clean_ips()

        self.recover()
Exemplo n.º 2
0
    def recover(self):
        board.touch()
        lan.sendcontrol('c')
        lan.expect(prompt)
        board.touch()

        print "Copying files from lan to dir = %s" % self.config.output_dir
        lan.sendline('readlink -f $HOME/%s/' % self.dir)
        lan.expect_exact('$HOME/%s/' % self.dir)
        board.touch()
        lan.expect(prompt)
        board.touch()
        fname = lan.before.replace('\n', '').replace('\r', '')
        board.touch()
        rm_r(os.path.join(self.config.output_dir, self.dir))
        scp_from(fname, lan.ipaddr, lan.username, lan.password, lan.port,
                 self.config.output_dir)

        # let board settle down
        board.expect(pexpect.TIMEOUT, timeout=30)
        board.touch()

        board.parse_stats(dict_to_log=self.logged)
        board.touch()
        self.result_message = 'JMeter: DONE, name = %s cpu usage = %s' % (
            self.shortname, self.logged['mpstat'])
Exemplo n.º 3
0
 def recover(self):
     lan.sendcontrol('c')
     time.sleep(5)  # Give router a few seconds to recover
     board.parse_stats(dict_to_log=self.logged)
     avg_cpu = self.logged['mpstat']
     msg = "ApacheBench measured %s connections/second, CPU use = %s%%." % (
         self.reqs_per_sec, avg_cpu)
     self.result_message = msg
Exemplo n.º 4
0
 def recover(self):
     lan.sendcontrol('c')
     lan.expect(lan.prompt)
     lan.sendline('rm -rf Fedora*')
     lan.expect(lan.prompt)
     board.sendcontrol('c')
     board.expect(board.prompt)
     board.sendline('fg')
     board.sendcontrol('c')
     board.expect(board.prompt)
Exemplo n.º 5
0
    def runTest(self):
        installers.apt_install(lan, "wget")

        urls = [
            'www.amazon.com',
            'www.apple.com',
            'www.baidu.com',
            'www.bing.com',
            'www.cnn.com',
            'www.ebay.com',
            'www.facebook.com',
            'www.google.com',
            'www.imdb.com',
            'www.imgur.com',
            'www.instagram.com',
            'www.linkedin.com',
            'www.microsoft.com',
            'www.nbcnews.com',
            'www.netflix.com',
            'www.pinterest.com',
            'www.reddit.com',
            'www.twitter.com',
            'www.wikipedia.org',
            'www.yahoo.com',
        ]
        #urls = 2 * urls  # browse more
        random.shuffle(urls)
        user = '******'
        cmd = "wget -Hp http://%(url)s " + \
              "-e robots=off " + \
              "-P /tmp/webbrowse-test " + \
              "-T 10 " + \
              "--header='Accept: text/html' " + \
              "-U '%(user)s' " + \
              "2>&1 | tail -1"
        for url in urls:
            lan.sendline("mkdir -p /tmp/webbrowse-test")
            print("\n%s" % url)
            tmp = cmd % {'url': url, 'user': user}
            lan.sendline(tmp)
            try:
                lan.expect('Downloaded:', timeout=20)
            except Exception:
                lan.sendcontrol('c')
            lan.expect(prompt)
            lan.sendline("rm -rf /tmp/webbrowse-test")
            lan.expect(prompt)

            board.touch()
Exemplo n.º 6
0
    def recover(self):
        lan.sendcontrol('c')
        lan.expect(prompt)
        lan.sendline('pkill -9 -f hping3')
        lan.expect_exact('pkill -9 -f hping3')
        lan.expect(prompt)

        wan.sendcontrol('c')
        wan.expect(prompt)
        wan.sendline('pkill -9 -f nc ')
        wan.expect_exact('pkill -9 -f nc')
        wan.expect(prompt)

        board.parse_stats(dict_to_log=self.logged)

        args = (self.conn_rate, self.max_conns, self.logged['mpstat'])
        self.result_message = "hping3 udp firewall test, conn_rate = %s, max_conns = %s, cpu usage = %.2f" % args
Exemplo n.º 7
0
    def runTest(self):
        installers.apt_install(lan, "wget")

        urls = ['www.amazon.com',
                'www.apple.com',
                'www.baidu.com',
                'www.bing.com',
                'www.cnn.com',
                'www.ebay.com',
                'www.facebook.com',
                'www.google.com',
                'www.imdb.com',
                'www.imgur.com',
                'www.instagram.com',
                'www.linkedin.com',
                'www.microsoft.com',
                'www.nbcnews.com',
                'www.netflix.com',
                'www.pinterest.com',
                'www.reddit.com',
                'www.twitter.com',
                'www.wikipedia.org',
                'www.yahoo.com',
                ]
        #urls = 2 * urls  # browse more
        random.shuffle(urls)
        user = '******'
        cmd = "wget -Hp http://%(url)s " + \
              "-e robots=off " + \
              "-P /tmp/webbrowse-test " + \
              "-T 10 " + \
              "--header='Accept: text/html' " + \
              "-U '%(user)s' " + \
              "2>&1 | tail -1"
        for url in urls:
            lan.sendline("mkdir -p /tmp/webbrowse-test")
            print("\n%s" % url)
            tmp = cmd % {'url': url, 'user': user}
            lan.sendline(tmp)
            try:
                lan.expect('Downloaded:', timeout=20)
            except Exception:
                lan.sendcontrol('c')
            lan.expect(prompt)
            lan.sendline("rm -rf /tmp/webbrowse-test")
            lan.expect(prompt)
Exemplo n.º 8
0
    def recover(self):
        lan.sendcontrol('c')
        lan.expect(prompt)

        print "Copying files from lan to dir = %s" % self.config.output_dir
        lan.sendline('readlink -f output/')
        lan.expect('readlink -f output/')
        lan.expect(prompt)
        fname = lan.before.strip()
        scp_from(
            fname, lan.ipaddr, lan.username, lan.password, lan.port,
            os.path.join(self.config.output_dir, 'jmeter_%s' % self.shortname))

        # let board settle down
        board.expect(pexpect.TIMEOUT, timeout=30)

        board.parse_stats(dict_to_log=self.logged)
        self.result_message = 'JMeter: DONE, name = %s cpu usage = %s' % (
            self.shortname, self.logged['mpstat'])
Exemplo n.º 9
0
    def runTest(self):
        board.sendcontrol('c')
        board.expect(board.prompt)
        board.sendline('logread -f &')
        board.expect(board.prompt)

        lan.sendline('rm -rf Fedora*')
        lan.expect(lan.prompt)
        # TODO: apt-get install bittornado
        for i in range(10):
            lan.sendline(
                "btdownloadheadless 'https://torrent.fedoraproject.org/torrents/Fedora-Games-Live-x86_64-28_Beta.torrent'"
            )
            lan.expect('saving:')
            done = False
            while not done:
                lan.expect(pexpect.TIMEOUT, timeout=1)  # flush buffer
                if 0 == lan.expect(
                    ['time left:      Download Succeeded!', pexpect.TIMEOUT],
                        timeout=10):
                    print("Finished, restarting....")
                    done = True
                board.expect(pexpect.TIMEOUT, timeout=5)
                board.sendline()  # keepalive
            lan.sendcontrol('c')
            lan.sendcontrol('c')
            lan.sendcontrol('c')
            lan.expect(lan.prompt)
            lan.sendline('rm -rf Fedora*')
            lan.expect(lan.prompt)
Exemplo n.º 10
0
    def runTest(self):
        random.seed(99)

        for d in [wan, lan]:
            d.sendline(
                'apt-get update && apt-get -o Dpkg::Options::="--force-confnew" -y install socat pv'
            )
            d.expect(prompt)

        max_time = 0
        single_max = 45

        board.collect_stats(stats=['mpstat'])

        # TODO: query interfaces but this is OK for now
        for i in range(self.conns):
            board.get_nf_conntrack_conn_count()
            board.touch()
            print("Starting connection %s" % i)
            sz, rate, ip, port = self.startSingleFlow(maxtime=single_max)
            print("started flow to %s:%s sz = %s, rate = %sk" %
                  (ip, port, sz, rate))

            max_time = max(max_time, sz / (rate * 1024))
            self.check_and_clean_ips()

        print("waiting max time of %ss" % max_time)

        start = time.time()
        while time.time() - start < max_time + 5:
            lan.sendline('wait')
            lan.expect_exact('wait')
            lan.expect([pexpect.TIMEOUT] + prompt, timeout=5)
            lan.sendcontrol('c')
            lan.expect(prompt)
            self.check_and_clean_ips()
            board.get_nf_conntrack_conn_count()
            board.touch()

        self.recover()
 def recover(self):
     board.sendcontrol('c')
     board.expect(prompt)
     lan.sendcontrol('c')
     time.sleep(2)  # Give router a few seconds to recover
Exemplo n.º 12
0
 def recover(self):
     lan.sendcontrol("c")
Exemplo n.º 13
0
 def recover(self):
     board.sendcontrol('c')
     lan.sendcontrol('c')
     board.sendline('rm -f /www/deleteme.txt')
     board.expect(prompt)
Exemplo n.º 14
0
 def recover(self):
     lan.sendcontrol('c')
     lib.common.test_msg("Recover..kill netserver on wan")
     self.kill_netserver(wan)
Exemplo n.º 15
0
 def recover(self):
     lan.sendcontrol('c')
Exemplo n.º 16
0
 def recover(self):
     lan.sendcontrol('c')
Exemplo n.º 17
0
 def recover(self):
     board.sendcontrol('c')
     lan.sendcontrol('c')
     board.sendline('rm -f /www/deleteme.txt')
     board.expect(prompt)
Exemplo n.º 18
0
 def recover(self):
     board.sendcontrol("c")
     board.expect(prompt)
     lan.sendcontrol("c")
     time.sleep(2)  # Give router a few seconds to recover