From 424a6d9e85e42e920b190e96f87355b5540f725f Mon Sep 17 00:00:00 2001
From: Robert Ricci <ricci@cs.utah.edu>
Date: Mon, 18 Dec 2006 21:35:31 +0000
Subject: [PATCH] Simple script to get pairwise latency predictions from iplane

---
 pelab/iplane/iplane_pairwise.rb | 47 +++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 pelab/iplane/iplane_pairwise.rb

diff --git a/pelab/iplane/iplane_pairwise.rb b/pelab/iplane/iplane_pairwise.rb
new file mode 100644
index 0000000000..48eca67828
--- /dev/null
+++ b/pelab/iplane/iplane_pairwise.rb
@@ -0,0 +1,47 @@
+#!/usr/bin/ruby
+#
+# EMULAB-COPYRIGHT
+# Copyright (c) 2006 University of Utah and the Flux Group.
+# All rights reserved.
+#
+
+#
+# Get pairwise predictions from iplane
+#
+# To run:
+# iplane_query_client iplane.cs.washington.edu 1 iplane_pairwise.rb
+#     'space seperated list of IP addresses'
+#
+
+require 'iplane'
+
+#
+# Get pairwise information for all nodes passed on the command line
+#
+nodes = ARGV
+
+iplane = IPlane.new
+
+#
+# For now, query one-way only - the upper right corner of the NxN matrix
+#
+nodes.each_index{ |n1|
+    (n1 + 1 .. nodes.length() - 1).each{ |n2| 
+        puts "Adding path #{nodes[n1]} to #{nodes[n2]}"
+        iplane.addPath(nodes[n1],nodes[n2])
+    }
+}
+
+#
+# Run the query on iplane
+#
+puts "Getting responses..."
+responses = iplane.queryPendingPaths
+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}"
+}
-- 
GitLab