Commit ada81af2 authored by Jonathon Duerig's avatar Jonathon Duerig

Added an iplane client. It contacts the iplane server and pulls down the...

Added an iplane client. It contacts the iplane server and pulls down the latency of all pairs. It outputs a file suitable for use in cloudinfo-set to set initial conditions for an experiment.
parent e12ea1e2
#!/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2007 University of Utah and the Flux Group.
# All rights reserved.
#
use Socket;
# node_mapping is the reverse mapping of the one in init-elabnodes.
# The keys are the PlanetLab node names. The values are the Emulab node names.
my %node_mapping = ();
my $eprefix = "elab-";
my $pprefix = "planet-";
$pid = $ARGV[0];
$eid = $ARGV[1];
@nodelist = split('\s+', `cat /proj/$pid/exp/$eid/tmp/node_list`);
chomp(@nodelist);
foreach my $mapping (@nodelist) {
if ($mapping =~ /^(${pprefix}[\d]+)=([\w]*)$/) {
# vnode is the virtual node name in emulab.
my $vnode = $1;
# pnode is the planetlab node name.
my $pnode = $2.".emulab.net";
$vnode =~ s/${pprefix}/${eprefix}/;
$pnode = gethostbyname($pnode);
$pnode = inet_ntoa($pnode);
$node_mapping{$pnode} = $vnode
}
}
$command = "./query_iplane_client iplane.cs.washington.edu 1 iplane_pairwise.rb \""
.join(" ", keys(%node_mapping))."\"";
@replylist = `$command`;
print "$pid $eid\n";
foreach my $reply (@replylist) {
if ($reply =~ /\s*source=([0-9.]*)\s*dest=([0-9.]*)\s*latency=([0-9.]*)\s*/) {
my $source = $1;
my $dest = $2;
my $latency = $3;
print $node_mapping{$source}." ".$node_mapping{$dest}." "."10000"." ".($latency/2)." 0.0\n";
print $node_mapping{$dest}." ".$node_mapping{$source}." "."10000"." ".($latency/2)." 0.0\n";
}
}
......@@ -27,7 +27,7 @@ iplane = IPlane.new
#
nodes.each_index{ |n1|
(n1 + 1 .. nodes.length() - 1).each{ |n2|
puts "Adding path #{nodes[n1]} to #{nodes[n2]}"
# puts "Adding path #{nodes[n1]} to #{nodes[n2]}"
iplane.addPath(nodes[n1],nodes[n2])
}
}
......@@ -35,13 +35,14 @@ nodes.each_index{ |n1|
#
# Run the query on iplane
#
puts "Getting responses..."
#puts "Getting responses..."
responses = iplane.queryPendingPaths
puts "Got Respnses!"
#puts "Got Respnses!"
#
# And, simply print the data we care about from the responses
#
responses.each{ |r|
puts "src=#{r.src} dst=#{r.dst} lat=#{r.lat} predicted?=#{r.predicted_flag}"
puts "source=#{r.src} dest=#{r.dst} latency=#{r.lat}"
#"predicted?=#{r.predicted_flag}"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment