# Path: umit/icm/agent/logger.py
# LOGLEVEL = 'DEBUG'


import os,sys
import subprocess
import time
import socket
import re
import platform
from umit.icm.agent.logger import g_logger
            #Get time in ms
            curr_time = re.findall("(\d+)(\.){0,1}(\d*) ms",line)
            if curr_time == []:
                curr_time = [(0,),(0,),(0,)]
            #print curr_time
            #################
            #store the result
            trace = {}
            trace["hop"] = ttl
            trace["ip"] = str(curr_addr if curr_addr !=None else "0.0.0.0")
            print trace["ip"]
            trace["packetsTiming"] = []
            
            for item in curr_time:
                trace["packetsTiming"].append(int(item[0]))
            
            result["trace"].append(trace)
            
        p.wait()
        
        ##################
        #result statistics        
        result["hops"] = ttl if ttl <= max_hops else max_hops 
        
        ##########
        #DNS Parse
        try:
            resultAddr = socket.getaddrinfo(target_name, None)
            result["target"] = str(resultAddr[0][4][0])
        except :

# Path: umit/icm/agent/logger.py
# LOGLEVEL = 'DEBUG'


# Path: umit/icm/agent/utils/traceroute.py
import os,sys
import subprocess
import time
import socket
import re
import platform
from umit.icm.agent.logger import g_logger

            #Get time in ms
            curr_time = re.findall("(\d+)(\.){0,1}(\d*) ms",line)
            if curr_time == []:
                curr_time = [(0,),(0,),(0,)]
            #print curr_time
            #################
            #store the result
            trace = {}
            trace["hop"] = ttl
            trace["ip"] = str(curr_addr if curr_addr !=None else "0.0.0.0")
            print trace["ip"]
            trace["packetsTiming"] = []
            
            for item in curr_time:
                trace["packetsTiming"].append(int(item[0]))
            
            result["trace"].append(trace)
            
        p.wait()
        
        ##################
        #result statistics        
        result["hops"] = ttl if ttl <= max_hops else max_hops 
        
        ##########
        #DNS Parse
        try:
            resultAddr = socket.getaddrinfo(target_name, None)
            result["target"] = str(resultAddr[0][4][0])
        except :

            g_logger.debug("Notice:Cannot resolve host ip, we will fill '0.0.0.0'")