Exemple #1
0
    def runTest(self):

        expected_faulures = 0

        self.setup_class()

        assert not self.simple_bool_return(), "error not correctly injected"
        self.config.err_injection_dict[self.cls_name].pop('simple_bool_return')
        print("simple_bool_return spoofed PASS")

        assert self.simple_bool_return(), "real value not received"
        print("simple_bool_return real value PASS")

        addr = self.get_dev_ip_address(lan)
        assert addr == self.config.err_injection_dict[
            self.cls_name]['get_dev_ip_address'], "spoofed value not received"
        print("received spoofed address: {}".format(str(addr)))
        print("get_dev_ip_address spoofed PASS")

        addr = self.get_dev_ip_address(lan)
        try:
            assert addr == lan.get_interface_ipaddr(lan.iface_dut)
            print("get_dev_ip_address: {}, UNEXPECTED FAILURE!!!! ".format(
                str(addr)))
        except:
            print("get_dev_ip_address: {}, EXPECTED FAILURE".format(str(addr)))
            expected_faulures += 1
        self.config.err_injection_dict[self.cls_name].pop('get_dev_ip_address')
        assert expected_faulures, "get_dev_ip_address spoofed with EXPECTED FAILURE PASS"

        addr = self.get_dev_ip_address(lan)
        assert addr == lan.get_interface_ipaddr(
            lan.iface_dut), "spoofed value not received"
        print("received real address: {}".format(addr))
        print("get_dev_ip_address real PASS")

        # just  for the sake of this test we check that all the errors have been injected
        # this may not be the case a real world scenario
        assert not self.config.err_injection_dict[
            self.cls_name], "Not all errors were injected"
        print("all errors have been injected")

        print("%s: PASS" % (self.cls_name))
    def runTest(self):
        if not wlan:
            self.skipTest("skipping test no wlan")

        self.fip = lan.get_interface_ipaddr(lan.iface_dut)
        self.rip = wlan.get_interface_ipaddr("wlan0")

        wlan.sendline('iwconfig')
        wlan.expect(prompt)
        super(iPerfBiDirTestLANtoWLAN, self).runTest(node1=wlan,
                                                     node2=lan,
                                                     firewall=False)
    def runTest(self):
        super(NetperfUdpTest, self).runTest()

        self.run_netperf(
            lan, "192.168.0.1 -c -C -l 30 -t UDP_STREAM -- -m 1460 -M 1460")

        # setup port forwarding to lan netperf server
        lan_priv_ip = lan.get_interface_ipaddr(lan.iface_dut)
        board.uci_forward_traffic_redirect("tcp", "12865", lan_priv_ip)
        # setup port for data socket separate from control port
        board.uci_forward_traffic_redirect("udp", "12866", lan_priv_ip)

        wan_ip = board.get_interface_ipaddr(board.wan_iface)

        # send at router ip, which will forward to lan client
        wan.sendline('')
        wan.expect(prompt)
        self.run_netperf(
            wan, wan_ip,
            "-c -C -l 30 -t UDP_STREAM -- -P ,12866 -m 1460 -M 1460")
Exemple #4
0
    def runTest(self):
        # setup port forwarding to lan netperf server
        lan_priv_ip = lan.get_interface_ipaddr(lan.iface_dut)
        board.uci_forward_traffic_redirect("tcp", "12865", lan_priv_ip)
        # setup port for data socket separate from control port
        board.uci_forward_traffic_redirect("tcp", "12866", lan_priv_ip)

        wan_ip = board.get_interface_ipaddr(board.wan_iface)

        # send at router ip, which will forward to lan client
        wan.sendline('')
        wan.expect(prompt)
        board.sendline('mpstat -P ALL 30 1')
        speed = self.run_netperf(wan, wan_ip,
                                 "-c -C -l 30 -t TCP_STREAM -- -P ,12866")
        board.expect(
            'Average.*idle\r\nAverage:\s+all(\s+[0-9]+.[0-9]+){10}\r\n')
        idle_cpu = float(board.match.group(1))
        avg_cpu = 100 - float(idle_cpu)
        lib.common.test_msg("Average cpu usage was %s" % avg_cpu)

        self.result_message = "Setup NetperfReverse and Ran Throughput (Speed = %s 10^6bits/sec, CPU = %s)" % (
            speed, avg_cpu)