Exemple #1
0
def main():
    # Read any Configuration
    S.load_from_dir(_CURR_DIR)

    # Cleanup any existing scapy files from /tmp/scapy folder.
    cleanup_scapy_files()

    # Get the P4 program from the user.
    # We will generate testcases to test this program.
    fname = get_p4program()

    # Create a scapy output for this program.
    create_scapy_out(fname)

    # Get all the possible packets to send to test the P4 Program.
    pp = get_possible_packets()

    # Create Test-Cases for each and every packet in the pssible-packet list
    index = 0
    filename = os.path.basename(fname)
    print(filename)
    tcprefix = filename.split('.')[0]
    print(tcprefix)
    for p in pp:
        # analyze_packet(p)
        destfile = tcprefix + str(index) + '.xml'
        dfile = os.path.join('/tmp', destfile)
        create_testcase(p, dfile)
        index = index + 1
def main():
    # configure settings
    S.load_from_dir(_CURR_DIR)
    vmcontrol = StressorVM()
    cachecontrol = CacheAllocator()
    input("Press Enter to start workload-1")
    vmcontrol.start(0)
    input("Enter to affinitize workload")
    vmcontrol.affinitize(0)
    #input("Press Enter to stop workload-1")
    #vmcontrol.stop(0)
    input("Press Enter to start workload-2")
    vmcontrol.start(1)
    input("Enter to affinitize workload")
    vmcontrol.affinitize(1)
    input("Press Enter to perform cache allocation")
    cachecontrol.setup_llc_allocation()
    #    input("Press Enter to start workload-1")
    #    vmcontrol.start(0)
    input("Press Enter to stop workload-2")
    vmcontrol.stop(1)
    input("Press Enter to stop workload-1")
    vmcontrol.stop(0)
    input("Press Enter to cleanup allocations")
    cachecontrol.cleanup_llc_allocation()
    print("RMD-Testing is done, Goodbye!")
Exemple #3
0
def main():
    """Main function.
    """
    #args = parse_arguments()

    # define the timestamp to be used by logs and results
    date = datetime.datetime.fromtimestamp(time.time())
    timestamp = date.strftime('%Y-%m-%d_%H-%M-%S')
    S.setValue('LOG_TIMESTAMP', timestamp)

    # configure settings
    S.load_from_dir(os.path.join(_CURR_DIR, 'conf'))
    openstack_params = utils.pack_openstack_params()
    print(openstack_params)
    output = act()
    print(output)
Exemple #4
0
            })

            # remove id and deployment from results before rendering
            # but after _get_env() is called; tests dict has its shallow copy
            del result[ResultsConstants.ID]
            del result[ResultsConstants.DEPLOYMENT]

        template_vars = {
            'tests': tests,
        }
        i = 0
        for output_file in output_files:
            template = template_env.get_template(_TEMPLATE_FILES[i])
            output_text = template.render(template_vars)  #pylint: disable=no-member
            with open(output_file, 'w') as file_:
                file_.write(output_text)
                logging.info('Test report written to "%s"', output_file)
            i += 1

    except KeyError:
        logging.info("Report: Ignoring file (Wrongly defined columns): %s",
                     (input_file))
        raise
    return output_files


if __name__ == '__main__':
    S.load_from_dir('conf')
    OUT = generate(sys.argv[1], '', '')
    print('Test report written to "%s"...' % OUT)
Exemple #5
0
    def go_menu():
        """
        Run the Unittest method menu
        :return: None
        """
        from conf import settings
        settings.load_from_dir('./conf')

        with Xena() as XENA_OBJ:

            TESTMETHODS = {
                1: [XENA_OBJ.send_rfc2544_throughput],
                2: [
                    XENA_OBJ.start_rfc2544_throughput,
                    XENA_OBJ.wait_rfc2544_throughput
                ],
                3: [XENA_OBJ.send_burst_traffic],
                4: [XENA_OBJ.send_cont_traffic],
                5: [XENA_OBJ.start_cont_traffic, XENA_OBJ.stop_cont_traffic],
                6: [XENA_OBJ.send_rfc2544_back2back],
                7: [
                    XENA_OBJ.start_rfc2544_back2back,
                    XENA_OBJ.wait_rfc2544_back2back
                ],
                8: [PROPS.decrease_framesize],
                9: [PROPS.increase_framesize],
                10: [PROPS.set_duration],
                11: [PROPS.set_trials],
                12: [sys.exit],
            }
            print("Packet size: {} | duration: {}".format(
                PROPS.framesize, PROPS.duration))
            print("Trials for 2544 tests: {}".format(PROPS.trials))
            print("Thread count: {}".format(threading.active_count()))
            print("What method to test?")
            for k in sorted(TESTMETHODS.keys()):
                line = "{}. ".format(k)
                for func in TESTMETHODS[k]:
                    line += "{}/".format(func.__name__)
                line = line.rstrip('/')
                print(line)
            ans = 0
            while ans not in TESTMETHODS.keys():
                ans = input("> ")
                try:
                    if len(TESTMETHODS.keys()) >= int(ans) > 0:
                        break
                    else:
                        print("!!Invalid entry!!")
                except ValueError:
                    print("!!Invalid entry!!")

            for func in TESTMETHODS[int(ans)]:
                if func.__name__ in XENA_OBJ.__dir__():
                    kwargs = dict()
                    if 'traffic' in inspect.getargspec(func)[0]:
                        params = {
                            'l2': {
                                'framesize': PROPS.framesize,
                            },
                        }
                        kwargs['traffic'] = params
                    if 'trials' in inspect.getargspec(func)[0]:
                        kwargs['trials'] = PROPS.trials
                    if 'duration' in inspect.getargspec(func)[0]:
                        kwargs['duration'] = PROPS.duration
                    result = func(**kwargs)
                    print(result)
                else:
                    func()
Exemple #6
0
    def go_menu():
        """
        Run the Unittest method menu
        :return: None
        """
        from conf import settings
        settings.load_from_dir('./conf')

        with Xena() as XENA_OBJ:

            TESTMETHODS = {
                1: [XENA_OBJ.send_rfc2544_throughput],
                2: [XENA_OBJ.start_rfc2544_throughput,
                    XENA_OBJ.wait_rfc2544_throughput],
                3: [XENA_OBJ.send_burst_traffic],
                4: [XENA_OBJ.send_cont_traffic],
                5: [XENA_OBJ.start_cont_traffic, XENA_OBJ.stop_cont_traffic],
                6: [XENA_OBJ.send_rfc2544_back2back],
                7: [XENA_OBJ.start_rfc2544_back2back,
                    XENA_OBJ.wait_rfc2544_back2back],
                8: [PROPS.decrease_framesize],
                9: [PROPS.increase_framesize],
                10: [PROPS.set_duration],
                11: [PROPS.set_trials],
                12: [sys.exit],
            }
            print("Packet size: {} | duration: {}".format(PROPS.framesize,
                                                          PROPS.duration))
            print("Trials for 2544 tests: {}".format(PROPS.trials))
            print("Thread count: {}".format(threading.active_count()))
            print("What method to test?")
            for k in sorted(TESTMETHODS.keys()):
                line = "{}. ".format(k)
                for func in TESTMETHODS[k]:
                    line += "{}/".format(func.__name__)
                line = line.rstrip('/')
                print(line)
            ans = 0
            while ans not in TESTMETHODS.keys():
                ans = input("> ")
                try:
                    if len(TESTMETHODS.keys()) >= int(ans) > 0:
                        break
                    else:
                        print("!!Invalid entry!!")
                except ValueError:
                    print("!!Invalid entry!!")

            for func in TESTMETHODS[int(ans)]:
                if func.__name__ in XENA_OBJ.__dir__():
                    kwargs = dict()
                    if 'traffic' in inspect.getargspec(func)[0]:
                        params = {
                            'l2': {
                                'framesize': PROPS.framesize,
                            },
                        }
                        kwargs['traffic'] = params
                    if 'trials' in inspect.getargspec(func)[0]:
                        kwargs['trials'] = PROPS.trials
                    if 'duration' in inspect.getargspec(func)[0]:
                        kwargs['duration'] = PROPS.duration
                    result = func(**kwargs)
                    print(result)
                else:
                    func()