Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(937)

Unified Diff: mininet_testing/topo_eval.py

Issue 339010043: Created table RIB that holds all path information, regardless if used for routing or not. FIB is a …
Patch Set: Added flow rule timeout. Added HUM metric for Admission Control. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mininet_testing/test-topo-5-csd ('k') | mininet_testing/topo_neighbors.txt.1 » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mininet_testing/topo_eval.py
diff --git a/mininet_testing/topo_eval.py b/mininet_testing/topo_eval.py
new file mode 100644
index 0000000000000000000000000000000000000000..7934a159ec88408baf4b49151aecb40a0991d8da
--- /dev/null
+++ b/mininet_testing/topo_eval.py
@@ -0,0 +1,33 @@
+import json
+
+
+# https://www.python.org/doc/essays/graphs/
+def _find_all_paths(neighbors, start, end, path=[]):
+ path = path + [start]
+ if start == end:
+ return [path]
+ if start not in neighbors.keys():
+ return []
+ paths = []
+ for node in neighbors[start]:
+ if node not in path:
+ newpaths = _find_all_paths(neighbors, node, end, path)
+ for newpath in newpaths:
+ paths.append(newpath)
+ return paths
+
+
+f = open('topo_neighbors.txt.1', 'r')
+topo_json = f.read()
+topo_dict = json.loads(topo_json)
+f.close()
+topo = {}
+
+# topo_dict has strings as keys. Changing to int
+for key, value in topo_dict.items():
+ topo[int(key)] = value
+
+# print topo_dict
+# print topo
+
+print _find_all_paths(topo, 303, 313)
« no previous file with comments | « mininet_testing/test-topo-5-csd ('k') | mininet_testing/topo_neighbors.txt.1 » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b