Adding validations to CCND and PING log parser in nepi data
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Mon, 1 Sep 2014 15:20:46 +0000 (17:20 +0200)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Mon, 1 Sep 2014 15:20:46 +0000 (17:20 +0200)
examples/ccn_emu_live/dce.py
examples/ccn_emu_live/planetlab.py
src/nepi/data/processing/ccn/parser.py
src/nepi/data/processing/ping/parser.py

index 3386e79..06c3405 100644 (file)
@@ -105,17 +105,6 @@ def add_dce_ccncat(ec, nid):
     # Retrieve annotation from netgraph
     host = ec.netgraph.node_annotation(nid, "host")
    
     # Retrieve annotation from netgraph
     host = ec.netgraph.node_annotation(nid, "host")
    
-    ccnpeek = ec.register_resource("ns3::LinuxDceCCNPeek")
-    #ec.set (ccnpeek, "contentName", "ccnx:/chunk0")
-    ec.set (ccnpeek, "contentName", content_name)
-    ec.set (ccnpeek, "stackSize", 1<<20)
-    ec.set (ccnpeek, "StartTime", "5s")
-    ec.set (ccnpeek, "StopTime", STOP_TIME)
-    ec.register_connection(ccnpeek, host)
-
-    collector = add_collector(ec, "stdout", nid, "peek")
-    ec.register_connection(collector, ccnpeek)
-
     # Add a ccncat application to the dce host
     ccncat = ec.register_resource("ns3::LinuxDceCCNCat")
     ec.set (ccncat, "contentName", content_name)
     # Add a ccncat application to the dce host
     ccncat = ec.register_resource("ns3::LinuxDceCCNCat")
     ec.set (ccncat, "contentName", content_name)
index 766e96b..033076f 100644 (file)
@@ -159,8 +159,9 @@ def avg_interests(ec, run):
         interest_dupnonce_count,
         interest_count,
         content_count) = ccn_parser.process_content_history_logs(
         interest_dupnonce_count,
         interest_count,
         content_count) = ccn_parser.process_content_history_logs(
-                logs_dir, 
-                ec.netgraph.topology)
+                logs_dir,
+                ec.netgraph.topology,
+                parse_ping_logs = True)
 
     shortest_path = networkx.shortest_path(graph, 
             source = ec.netgraph.sources()[0], 
 
     shortest_path = networkx.shortest_path(graph, 
             source = ec.netgraph.sources()[0], 
index e3c1007..9b83a4c 100644 (file)
@@ -209,6 +209,8 @@ def annotate_cn_graph(logs_dir, graph, parse_ping_logs = False):
         for ip in ips:
             ips2nid[ip] = nid
 
         for ip in ips:
             ips2nid[ip] = nid
 
+    found_files = False
+
     # Now walk through the ccnd logs...
     for dirpath, dnames, fnames in os.walk(logs_dir):
         # continue if we are not at the leaf level (if there are subdirectories)
     # Now walk through the ccnd logs...
     for dirpath, dnames, fnames in os.walk(logs_dir):
         # continue if we are not at the leaf level (if there are subdirectories)
@@ -222,6 +224,7 @@ def annotate_cn_graph(logs_dir, graph, parse_ping_logs = False):
 
         for fname in fnames:
             if fname.endswith(".log"):
 
         for fname in fnames:
             if fname.endswith(".log"):
+                found_files = True
                 filename = os.path.join(dirpath, fname)
                 data = parse_file(filename)
                 annotate_cn_node(graph, nid, ips2nid, data, content_history)
                 filename = os.path.join(dirpath, fname)
                 data = parse_file(filename)
                 annotate_cn_node(graph, nid, ips2nid, data, content_history)
@@ -231,6 +234,10 @@ def annotate_cn_graph(logs_dir, graph, parse_ping_logs = False):
         fname = dump_content_history(content_history)
         graph.node[nid]["history"] = fname
 
         fname = dump_content_history(content_history)
         graph.node[nid]["history"] = fname
 
+    if not found_files:
+        msg = "No CCND output files were found to parse at %s " % logs_dir
+        raise RuntimeError, msg
+
     if parse_ping_logs:
         ping_parser.annotate_cn_graph(logs_dir, graph)
 
     if parse_ping_logs:
         ping_parser.annotate_cn_graph(logs_dir, graph)
 
@@ -365,7 +372,7 @@ def process_content_history(graph):
         interest_count,
         content_count)
 
         interest_count,
         content_count)
 
-def process_content_history_logs(logs_dir, graph):
+def process_content_history_logs(logs_dir, graph, parse_ping_logs = False):
     """ Parse CCN logs and aggregate content history information in graph.
     Returns annotated graph and message countn and content names history.
 
     """ Parse CCN logs and aggregate content history information in graph.
     Returns annotated graph and message countn and content names history.
 
@@ -373,7 +380,7 @@ def process_content_history_logs(logs_dir, graph):
     ## Process logs and analyse data
     try:
         graph = annotate_cn_graph(logs_dir, graph, 
     ## Process logs and analyse data
     try:
         graph = annotate_cn_graph(logs_dir, graph, 
-                parse_ping_logs = True)
+                parse_ping_logs = parse_ping_logs)
     except:
         print "Skipping: Error parsing ccnd logs", logs_dir
         raise
     except:
         print "Skipping: Error parsing ccnd logs", logs_dir
         raise
index 0248c8c..c5745a1 100644 (file)
@@ -90,6 +90,8 @@ def annotate_cn_graph(logs_dir, graph):
             ips2nid[ip] = nid
 
     # Walk through the ping logs...
             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: 
     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"):
     
         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)
 
                 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"])
     # Take as weight the most frequent value
     for nid1, nid2 in graph.edges():
         delays = collections.Counter(graph.edge[nid1][nid2]["delays"])