Add a set of Python scripts that can be used as frontends
for the Flow Path measurements.
Typical usage:
1. Prepare the flows to measure
web/measurement_store_flow.py -f measurement_flows.txt
2. Install the flows with a single thread
web/measurement_install_paths.py 1
3. Obtain the time to install the flows
web/measurement_get_install_paths_time_nsec.py
4. Double-check the flows were installed into the Network MAP
and the switches:
web/get_flow.py all
5. Repeat the experiment: delete the flows from the Network MAP
and reinstall them with two threads:
web/delete_flow.py 1 100
web/get_flow.py all
web/measurement_install_paths.py 2
web/measurement_get_install_paths_time_nsec.py
web/get_flow.py all
6. End of experiment: clear the measurement flow state,
the network map and switch flow state:
web/measurement_clear_all_paths.py
web/delete_flow.py 1 100
web/get_flow.py all
diff --git a/web/measurement_get_install_paths_time_nsec.py b/web/measurement_get_install_paths_time_nsec.py
new file mode 100755
index 0000000..d64dc49
--- /dev/null
+++ b/web/measurement_get_install_paths_time_nsec.py
@@ -0,0 +1,61 @@
+#! /usr/bin/env python
+# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
+
+import pprint
+import os
+import sys
+import subprocess
+import json
+import argparse
+import io
+import time
+
+from flask import Flask, json, Response, render_template, make_response, request
+
+#
+# TODO: remove this! We don't use JSON argument here!
+# curl http://127.0.0.1:8080/wm/flow/delete/{"value":"0xf"}/json'
+#
+
+## Global Var ##
+ControllerIP="127.0.0.1"
+ControllerPort=8080
+
+DEBUG=0
+pp = pprint.PrettyPrinter(indent=4)
+
+app = Flask(__name__)
+
+## Worker Functions ##
+def log_error(txt):
+ print '%s' % (txt)
+
+def debug(txt):
+ if DEBUG:
+ print '%s' % (txt)
+
+# @app.route("/wm/flow/measurement-get-install-paths-time-nsec/json")
+def measurement_get_install_paths_time_nsec():
+ command = "curl -s \"http://%s:%s/wm/flow/measurement-get-install-paths-time-nsec/json\"" % (ControllerIP, ControllerPort)
+ debug("measurement_get_install_paths_time_nsec %s" % command)
+ result = os.popen(command).read()
+ print '%s nsec' % (result)
+ # parsedResult = json.loads(result)
+ # debug("parsed %s" % parsedResult)
+
+if __name__ == "__main__":
+ usage_msg = "Get the measured time to install the stored flow paths\n"
+ usage_msg = usage_msg + "Usage: %s\n" % (sys.argv[0])
+ usage_msg = usage_msg + "\n"
+
+ # app.debug = False;
+
+ # Usage info
+ if len(sys.argv) > 1 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
+ print(usage_msg)
+ exit(0)
+
+ # Check arguments
+
+ # Do the work
+ measurement_get_install_paths_time_nsec()