Example #1
0
def run(node_count, csvfile):
    print(f'run for node_count: {node_count}')

    state = topology.create_nodes(node_count)
    for max_range in float_range(0.0, 0.8, 0.01):
        # calculate every value 100 times
        for _ in range(0, 100):
            mobility.randomize_positions(state, xy_range=1.0)
            mobility.connect_range(state, max_distance=max_range)

            paths = get_all_paths(node_count)

            (connected_path_count, connected_median_hop_count,
             connected_max_hop_count) = get_connectivity(state, paths)
            mean_geo_distance = get_mean_geo_distance(state, paths)

            # add data to csv file
            connectivity_per = 100 * connected_path_count / len(paths)
            extra = ([
                'node_count', 'max_range', 'mean_geo_distance',
                'connectivity_per', 'connected_median_hop_count',
                'connected_max_hop_count'
            ], [
                node_count, max_range, mean_geo_distance, connectivity_per,
                connected_median_hop_count, connected_max_hop_count
            ])
            tools.csv_update(csvfile, '\t', extra)
Example #2
0
def run(protocol, csvfile):
	for path in sorted(glob.glob(f'../../data/grid4/*.json')):
		state = tools.load_json(path)
		(node_count, link_count) = tools.json_count(state)

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

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

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

		tools.sleep(30)

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

		sysload_result = tools.sysload(remotes)

		software.clear(remotes)

		# add data to csv file
		extra = (['node_count', 'software_startup_ms'], [node_count, software_startup_ms])
		tools.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.received / ping_result.transmitted) < 0.4:
			break
Example #3
0
def run(protocol, csvfile):
	tools.seed_random(23)

	node_count = 50
	state = topology.create_nodes(node_count)
	mobility.randomize_positions(state, xy_range=1000)
	mobility.connect_range(state, max_links=150)

	# create network and start routing software
	network.apply(state=state, link_command=get_tc_command)
	software.start(protocol)
	tools.sleep(30)

	for step_distance in [50, 100, 150, 200, 250, 300, 350, 400]:
		print(f'{protocol}: step_distance {step_distance}')

		traffic_beg = tools.traffic()
		for n in range(0, 6):
			#with open(f'graph-{step_distance}-{n}.json', 'w+') as file:
			#	json.dump(state, file, indent='  ')

			# connect nodes range
			wait_beg_ms = tools.millis()

			# update network representation
			mobility.move_random(state, distance=step_distance)
			mobility.connect_range(state, max_links=150)

			# update network
			network.apply(state=state, link_command=get_tc_command)

			# Wait until wait seconds are over, else error
			tools.wait(wait_beg_ms, 10)

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

			packets_arrived_pc = 100 * (ping_result.received / ping_result.send)
			traffic_end = tools.traffic()

			# add data to csv file
			extra = (['node_count', 'time_ms', 'step_distance_m', 'n', 'packets_arrived_pc'], [node_count, tools.millis() - wait_beg_ms, step_distance, n, packets_arrived_pc])
			tools.csv_update(csvfile, '\t', extra, (traffic_end - traffic_beg).getData(), ping_result.getData())

			traffic_beg = traffic_end

	software.clear()
	network.clear()
Example #4
0
def run(protocol, files, csvfile):
    tools.seed_random(1234)

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

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

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

        tools.sleep(10)

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

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

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

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

            traffic_end = tools.traffic()

            sysload_result = tools.sysload()

            software.clear()

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

        network.clear()
Example #5
0
def run(protocol, files, csvfile):
    for path in sorted(glob.glob(files)):
        state = tools.load_json(path)
        (node_count, link_count) = tools.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)

        tools.sleep(10)

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

        tools.sleep(300)

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

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

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

        sysload_result = tools.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])
        tools.csv_update(csvfile, '\t', extra,
                         (traffic_end - traffic_beg).getData(),
                         ping_result.getData(), sysload_result)
Example #6
0
def run(protocol, csvfile):
	tools.seed_random(1377)

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

		(node_count, link_count) = tools.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(remotes=remotes, state=state, link_command=get_tc_command)
		tools.sleep(10)

		software.start(protocol, remotes)

		tools.sleep(300)

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

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

		sysload_result = tools.sysload(remotes)

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

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

		network.clear(remotes)