Adding validations to CCND and PING log parser in nepi data
[nepi.git] / src / nepi / data / processing / ping / parser.py
index 0248c8c..c5745a1 100644 (file)
@@ -90,6 +90,8 @@ def annotate_cn_graph(logs_dir, graph):
             ips2nid[ip] = nid
 
     # Walk through the ping logs...
+    found_files = False
+
     for dirpath, dnames, fnames in os.walk(logs_dir):
         # continue if we are not at the leaf level (if there are subdirectories)
         if dnames: 
@@ -100,10 +102,15 @@ def annotate_cn_graph(logs_dir, graph):
     
         for fname in fnames:
             if fname.endswith(".ping"):
+                found_files = True
                 filename = os.path.join(dirpath, fname)
                 data = parse_file(filename)
                 annotate_cn_node(graph, nid, ips2nid, data)
 
+    if not found_files:
+        msg = "No PING output files were found to parse at %s " % logs_dir 
+        raise RuntimeError, msg
+
     # Take as weight the most frequent value
     for nid1, nid2 in graph.edges():
         delays = collections.Counter(graph.edge[nid1][nid2]["delays"])