update comp-nwmap-sw.py
diff --git a/cluster-mgmt/bin/comp-nwmap-sw.py b/cluster-mgmt/bin/comp-nwmap-sw.py
index 3a8c8e1..b534516 100755
--- a/cluster-mgmt/bin/comp-nwmap-sw.py
+++ b/cluster-mgmt/bin/comp-nwmap-sw.py
@@ -15,15 +15,21 @@
cmd="dsh \"cd ONOS/scripts; ./showflow.sh\""
f=open(filename, 'w')
result=os.popen(cmd).read()
+
f.write(result)
f.close()
def dump_network_map(filename):
url="http://%s1:%d/wm/flow/getall/json" % (basename, RestPort)
- cmd="curl -s %s | python -m json.tool" % url
+ cmd="curl -s %s" % url
f=open(filename, 'w')
- result=os.popen(cmd).read()
- f.write(result)
+ try:
+ result=os.popen(cmd).read()
+ except:
+ print "REST has issue"
+ sys.exit(1)
+
+ json.dump(result, f, indent=2, sort_keys=True)
f.close()
def make_key(*kargs):
@@ -111,7 +117,6 @@
f1 = sys.argv[1]
f2 = sys.argv[2]
- print "dumpfiles: %s %s" % (f1, f2)
fdb_nmap = fdb_nmap(f1)
fdb_raw = fdb_raw(f2)
@@ -130,3 +135,4 @@
print "Network Map has %d flow entries, %d not found in switch" % (len(fdb_nmap), nr_not_found_in_switch)
print "Switches have %d flow entries, %d not found in network map" % (len(fdb_raw), nr_not_found_in_nmap)
+ print "dumpfiles: %s %s" % (f1, f2)