コード例 #1
0
def run(topology, path, state):
    (node_count, link_count) = shared.json_count(state)

    with open(f'{prefix}scalability1-{protocol}-{topology}.csv',
              'a') as csvfile:
        print(f'run {protocol} on {path}')

        # Start routing software
        software_start_ms = shared.millis()
        software.start(protocol, remotes)
        software_stop_ms = shared.millis()

        # Let the nodes start up and discover themselves.
        shared.sleep(60)

        traffic_start_ms = shared.millis()
        traffic_begin = traffic.traffic(remotes)

        # Send <node_count> pings.
        # For a good routing algorithm, the traffic per node should be constant.
        paths = ping.get_random_paths(state, 2 * node_count)
        paths = ping.filter_paths(state,
                                  paths,
                                  min_hops=2,
                                  path_count=node_count)
        ping_result = ping.ping(remotes=remotes,
                                paths=paths,
                                duration_ms=300000,
                                verbosity='verbose')

        traffic_stop_ms = shared.millis()
        traffic_end = traffic.traffic(remotes)

        sysload_result = shared.sysload(remotes)

        # Stop routing software
        software.clear(remotes)

        # Add data to csv file
        extra = ([
            'node_count', 'software_startup_ms', 'traffic_measurement_ms'
        ], [
            node_count, (software_stop_ms - software_start_ms),
            (traffic_stop_ms - traffic_start_ms)
        ])
        shared.csv_update(csvfile, '\t', extra,
                          (traffic_end - traffic_begin).getData(),
                          ping_result.getData(), sysload_result)

        return (100.0 * ping_result.received / ping_result.send)
コード例 #2
0
ファイル: run.py プロジェクト: mwarning/meshnet-lab
def run(protocol, files, csvfile):
    shared.seed_random(1234)

    for path in sorted(glob.glob(files)):
        state = shared.load_json(path)
        (node_count, link_count) = shared.json_count(state)

        print(f'run {protocol} on {path}')

        network.apply(state=state,
                      link_command=get_tc_command,
                      remotes=remotes)

        shared.sleep(10)

        for offset in range(0, 60, 2):
            tmp_ms = shared.millis()
            traffic_beg = traffic.traffic(remotes)
            traffic_ms = shared.millis() - tmp_ms

            tmp_ms = shared.millis()
            software.start(protocol)
            software_ms = shared.millis() - tmp_ms

            # Wait until wait seconds are over, else error
            shared.sleep(offset)

            paths = ping.get_random_paths(state, 2 * 200)
            paths = ping.filter_paths(state, paths, min_hops=2, path_count=200)
            ping_result = ping.ping(paths=paths,
                                    duration_ms=2000,
                                    verbosity='verbose',
                                    remotes=remotes)

            traffic_end = traffic.traffic(remotes)

            sysload_result = shared.sysload(remotes)

            software.clear(remotes)

            # add data to csv file
            extra = (['node_count', 'traffic_ms', 'software_ms', 'offset_ms'],
                     [node_count, traffic_ms, software_ms, offset * 1000])
            shared.csv_update(csvfile, '\t', extra,
                              (traffic_end - traffic_beg).getData(),
                              ping_result.getData(), sysload_result)

        network.clear(remotes)
コード例 #3
0
def run(protocol, files, csvfile):
    for path in sorted(glob.glob(files)):
        state = shared.load_json(path)
        (node_count, link_count) = shared.json_count(state)

        # Limit node count to 300
        if node_count > 300:
            continue

        print(f'run {protocol} on {path}')

        network.apply(state=state,
                      link_command=get_tc_command,
                      remotes=remotes)

        shared.sleep(10)

        software_start_ms = shared.millis()
        software.start(protocol, remotes)
        software_startup_ms = shared.millis() - software_start_ms

        shared.sleep(300)

        start_ms = shared.millis()
        traffic_beg = traffic.traffic(remotes)

        paths = ping.get_random_paths(state, 2 * 200)
        paths = ping.filter_paths(state, paths, min_hops=2, path_count=200)
        ping_result = ping.ping(remotes=remotes,
                                paths=paths,
                                duration_ms=300000,
                                verbosity='verbose')

        traffic_ms = shared.millis() - start_ms
        traffic_end = traffic.traffic(remotes)

        sysload_result = shared.sysload(remotes)

        software.clear(remotes)
        network.clear(remotes)

        # add data to csv file
        extra = (['node_count', 'traffic_ms', 'software_startup_ms'],
                 [node_count, traffic_ms, software_startup_ms])
        shared.csv_update(csvfile, '\t', extra,
                          (traffic_end - traffic_beg).getData(),
                          ping_result.getData(), sysload_result)
コード例 #4
0
def run(protocol, csvfile):
    for path in sorted(glob.glob(f'../../data/grid4/*.json')):
        state = shared.load_json(path)
        (node_count, link_count) = shared.json_count(state)

        print(f'run {protocol} on {path}')

        network.apply(state=state,
                      link_command=get_tc_command,
                      remotes=remotes)
        shared.sleep(10)

        software_start_ms = shared.millis()
        software.start(protocol, remotes)
        software_startup_ms = shared.millis() - software_start_ms

        shared.sleep(30)

        paths = ping.get_random_paths(state, 2 * link_count)
        paths = ping.filter_paths(state,
                                  paths,
                                  min_hops=2,
                                  path_count=link_count)
        ping_result = ping.ping(remotes=remotes,
                                paths=paths,
                                duration_ms=30000,
                                verbosity='verbose')

        sysload_result = shared.sysload(remotes)

        software.clear(remotes)

        # add data to csv file
        extra = (['node_count',
                  'software_startup_ms'], [node_count, software_startup_ms])
        shared.csv_update(csvfile, '\t', extra, ping_result.getData(),
                          sysload_result)

        network.clear(remotes)

        # abort benchmark when less then 40% of the pings arrive
        if ping_result.transmitted == 0 or (ping_result.received /
                                            ping_result.transmitted) < 0.4:
            break
コード例 #5
0
def run(protocol, csvfile):
	shared.seed_random(1377)

	for path in sorted(glob.glob(f'../../data/freifunk/*.json')):
		state = shared.load_json(path)

		(node_count, link_count) = shared.json_count(state)
		dataset_name = '{}-{:04d}'.format(os.path.basename(path)[9:-5], node_count)

		# limit to what the host can handle
		if node_count > 310:
			continue

		print(f'run {protocol} on {path}')

		state = network.apply(state=state, link_command=get_tc_command, remotes=remotes)
		shared.sleep(10)

		software.start(protocol, remotes)

		shared.sleep(300)

		start_ms = shared.millis()
		traffic_beg = traffic.traffic(remotes)

		paths = ping.get_random_paths(state, 2 * node_count)
		paths = shared.filter_paths(state, paths, min_hops=2, path_count=node_count)
		ping_result = shared.ping(remotes=remotes, paths=paths, duration_ms=300000, verbosity='verbose')

		sysload_result = shared.sysload(remotes)

		traffic_ms = shared.millis() - start_ms
		traffic_end = traffic.traffic(remotes)
		software.clear(remotes)

		# add data to csv file
		extra = (['dataset_name', 'node_count', 'traffic_ms'], [dataset_name, node_count, traffic_ms])
		shared.csv_update(csvfile, '\t', extra, (traffic_end - traffic_beg).getData(), ping_result.getData(), sysload_result)

		network.clear(remotes)
コード例 #6
0
ファイル: run.py プロジェクト: mwarning/meshnet-lab
def run(protocol, tasks, csvfile):
	for path, gateways in tasks:
		state = shared.load_json(path)
		(node_count, link_count) = shared.json_count(state)

		# Limit node count to 300
		if node_count > 300:
			continue

		print(f'run {protocol} on {path}')

		network.apply(state=state, remotes=remotes)

		shared.sleep(10)

		software_start_ms = shared.millis()
		software.start(protocol, remotes)
		software_startup_ms = shared.millis() - software_start_ms

		shared.sleep(30)

		start_ms = shared.millis()
		traffic_beg = traffic.traffic(remotes)

		paths = ping.get_paths_to_gateways(state, gateways)
		ping_result = ping.ping(remotes=remotes, paths=paths, duration_ms=300000, verbosity='verbose')

		traffic_ms = shared.millis() - start_ms
		traffic_end = traffic.traffic(remotes)

		sysload_result = shared.sysload(remotes)

		software.clear(remotes)
		network.clear(remotes)

		# add data to csv file
		extra = (['node_count', 'traffic_ms', 'software_startup_ms'], [node_count, traffic_ms, software_startup_ms])
		shared.csv_update(csvfile, '\t', extra, (traffic_end - traffic_beg).getData(), ping_result.getData(), sysload_result)
コード例 #7
0
                          ping_result.getData(), sysload_result)

        return (100.0 * ping_result.received / ping_result.send)


# Keep track of tests that exceed the machines resources and skip bigger networks
drop_test = set()
protocols = [
    'babel', 'batman-adv', 'bmx6', 'bmx7', 'cjdns', 'olsr1', 'olsr2', 'ospf',
    'yggdrasil'
]

for topology in ['line', 'grid4', 'grid8', 'rtree']:
    for path in sorted(glob.glob(f'../../data/{topology}/*.json')):
        state = shared.load_json(path)
        (node_count, link_count) = shared.json_count(state)

        # No test to be done for this topology
        if all((f'{p}_{topology}' in drop_test) for p in protocols):
            continue

        # Create network
        network.apply(state=state, remotes=remotes)

        for protocol in protocols:
            if f'{protocol}_{topology}' in drop_test:
                continue

            pc = run(topology, path, state)

            # Skip test if the successful pings drop below 60%