예제 #1
0
def flowRTTDebug(entryList, flows):
    # estimate the rtt first
    # dw.calc_tcp_rtt(entryList)
    effective_request_count = {"uplink": [], "downlink": []}
    effective_request_ratio = {"uplink": [], "downlink": []}

    DEL = "\t"
    for f in flows:
        if f.properties["http"] != None and f.flow != None:
            uplinkEffectiveCount = 0.0
            downlinkEffectiveCount = 0.0

            print "*" * 80
            print str(f.properties["http"])
            print "*" * 80

            #dw.calc_tcp_rtt(f.flow)
            flowTrace = f.getCrossLayerTrace(entryList)
            dw.calc_tcp_rtt(flowTrace)

            (synPacket, synackPacket) = findSYNandSYNACKpacket(flowTrace)
            if not synPacket:
                print "ERROR: no SYN packet found!"
                break
            if not synackPacket:
                print "ERROR: no SYN/ACK packet found!"
                break
            baseTime = synPacket.timestamp
            clt_ip = synPacket.ip["src_ip"]
            cltSeqBase = synPacket.tcp["seq_num"]
            srvSeqBase = synackPacket.tcp["seq_num"]
        
            # header
            print "Time" + DEL +\
                  "Clt/Srv" + DEL +\
                  "Seq Number" + DEL +\
                  "Ack Number" + DEL +\
                  "Payload Size" + DEL +\
                  "RTT"

            # print out the actual flow
            for tcpPacket in f.flow:
                line = ""
                payload = tcpPacket.ip["total_len"] - tcpPacket.ip["header_len"] - \
                          tcpPacket.tcp["header_len"]
                # client request
                if tcpPacket.ip["src_ip"] == clt_ip:
                    if payload > 0:
                        uplinkEffectiveCount += 1 
                    line += str(tcpPacket.timestamp - baseTime) + DEL + \
                            "Client" + DEL + \
                            str(tcpPacket.tcp["seq_num"] - cltSeqBase) + DEL + \
                            str(tcpPacket.tcp["ack_num"] - srvSeqBase) + DEL + \
                            str(payload) + DEL
                    if tcpPacket.rtt["tcp"] != None:
                        line += str(tcpPacket.rtt["tcp"] * 1000.0)
                    else:
                        line += "None"
                else:
                    if payload > 0:
                        downlinkEffectiveCount += 1
                    line += str(tcpPacket.timestamp - baseTime) + DEL + \
                            "Server" + DEL + \
                            str(tcpPacket.tcp["seq_num"] - srvSeqBase) + DEL + \
                            str(tcpPacket.tcp["ack_num"] - cltSeqBase) + DEL + \
                            str(payload) + DEL
                    if tcpPacket.rtt["tcp"]:
                        line += str(tcpPacket.rtt["tcp"] * 1000)
                    else:
                        line += "None"

                print line

            effective_request_count["uplink"].append(uplinkEffectiveCount)
            effective_request_count["downlink"].append(downlinkEffectiveCount)
            totalCount = uplinkEffectiveCount + downlinkEffectiveCount
            try:
                effective_request_ratio["uplink"].append(float(uplinkEffectiveCount / totalCount))
                effective_request_ratio["downlink"].append(float(downlinkEffectiveCount / totalCount))
            except ZeroDivisionError:
                print "ERROR: invalid flow!!!"

    print "#" * 80
    print "Uplink Effective Data request: " + str(util.quartileResult(effective_request_count["uplink"]))
    print "Uplink Effective Data ratio: " + str(util.quartileResult(effective_request_ratio["uplink"]))
    print "Downlink Effective Data request: " + str(util.quartileResult(effective_request_count["downlink"]))
    print "Downlink Effective Data ratio: " + str(util.quartileResult(effective_request_ratio["downlink"]))
예제 #2
0
def flowRTTDebug(entryList, flows):
    # estimate the rtt first
    # dw.calc_tcp_rtt(entryList)
    effective_request_count = {"uplink": [], "downlink": []}
    effective_request_ratio = {"uplink": [], "downlink": []}

    DEL = "\t"
    for f in flows:
        if f.properties["http"] != None and f.flow != None:
            uplinkEffectiveCount = 0.0
            downlinkEffectiveCount = 0.0

            print "*" * 80
            print str(f.properties["http"])
            print "*" * 80

            #dw.calc_tcp_rtt(f.flow)
            flowTrace = f.getCrossLayerTrace(entryList)
            dw.calc_tcp_rtt(flowTrace)

            (synPacket, synackPacket) = findSYNandSYNACKpacket(flowTrace)
            if not synPacket:
                print "ERROR: no SYN packet found!"
                break
            if not synackPacket:
                print "ERROR: no SYN/ACK packet found!"
                break
            baseTime = synPacket.timestamp
            clt_ip = synPacket.ip["src_ip"]
            cltSeqBase = synPacket.tcp["seq_num"]
            srvSeqBase = synackPacket.tcp["seq_num"]

            # header
            print "Time" + DEL +\
                  "Clt/Srv" + DEL +\
                  "Seq Number" + DEL +\
                  "Ack Number" + DEL +\
                  "Payload Size" + DEL +\
                  "RTT"

            # print out the actual flow
            for tcpPacket in f.flow:
                line = ""
                payload = tcpPacket.ip["total_len"] - tcpPacket.ip["header_len"] - \
                          tcpPacket.tcp["header_len"]
                # client request
                if tcpPacket.ip["src_ip"] == clt_ip:
                    if payload > 0:
                        uplinkEffectiveCount += 1
                    line += str(tcpPacket.timestamp - baseTime) + DEL + \
                            "Client" + DEL + \
                            str(tcpPacket.tcp["seq_num"] - cltSeqBase) + DEL + \
                            str(tcpPacket.tcp["ack_num"] - srvSeqBase) + DEL + \
                            str(payload) + DEL
                    if tcpPacket.rtt["tcp"] != None:
                        line += str(tcpPacket.rtt["tcp"] * 1000.0)
                    else:
                        line += "None"
                else:
                    if payload > 0:
                        downlinkEffectiveCount += 1
                    line += str(tcpPacket.timestamp - baseTime) + DEL + \
                            "Server" + DEL + \
                            str(tcpPacket.tcp["seq_num"] - srvSeqBase) + DEL + \
                            str(tcpPacket.tcp["ack_num"] - cltSeqBase) + DEL + \
                            str(payload) + DEL
                    if tcpPacket.rtt["tcp"]:
                        line += str(tcpPacket.rtt["tcp"] * 1000)
                    else:
                        line += "None"

                print line

            effective_request_count["uplink"].append(uplinkEffectiveCount)
            effective_request_count["downlink"].append(downlinkEffectiveCount)
            totalCount = uplinkEffectiveCount + downlinkEffectiveCount
            try:
                effective_request_ratio["uplink"].append(
                    float(uplinkEffectiveCount / totalCount))
                effective_request_ratio["downlink"].append(
                    float(downlinkEffectiveCount / totalCount))
            except ZeroDivisionError:
                print "ERROR: invalid flow!!!"

    print "#" * 80
    print "Uplink Effective Data request: " + str(
        util.quartileResult(effective_request_count["uplink"]))
    print "Uplink Effective Data ratio: " + str(
        util.quartileResult(effective_request_ratio["uplink"]))
    print "Downlink Effective Data request: " + str(
        util.quartileResult(effective_request_count["downlink"]))
    print "Downlink Effective Data ratio: " + str(
        util.quartileResult(effective_request_ratio["downlink"]))
예제 #3
0
def parse_http_fields(entryList):
    count = 0
    goodCount = 0
    DEL = "\t"

    if HTTP_EXTRA:
        # Assign TCP RTT
        dw.calc_tcp_rtt(entryList)
        log_of_interest_id = get_logID_of_interest("wcdma", "up")

        # Uniqueness analysis
        non_unique_rlc_tuples, dummy = vw.uniqueness_analysis(entryList, log_of_interest_id)

        # RLC retransmission analysis
        [RLCULReTxCountMap, RLCDLReTxCountMap] = rw.procRLCReTx(entryList, detail="simple")

    for i in range(len(entryList)):
        entry = entryList[i]
        if entry.logID == const.PROTOCOL_ID and \
           entry.tcp["dst_port"] == const.HTTP_DST_PORT:
            http_payload = entry.hex_dump["payload"][(const.Payload_Header_Len + \
                                                     entry.ip["header_len"] + \
                                                     entry.tcp["header_len"]):]
            http_payload_by_field = "".join(http_payload).decode("hex").split(const.HTTP_LINE_DEL)
            for field in http_payload_by_field:
                splitted_field = field.split(const.HTTP_FIELD_DEL)
                if splitted_field[0].lower() == "host":
                    entry.http["host"] = splitted_field[1]
                elif splitted_field[0].lower() == "referer":
                    entry.http["referer"] = splitted_field[1]
                elif splitted_field[0].lower() == "timer":
                    entry.http["timer"] = float(splitted_field[1])

                    # move on to the next entry when we get what we want
                    if TIMER_CHECK:
                        if entry.http["host"] and \
                           entry.http["timer"] and \
                           entry.http["host"] in const.HOST_OF_INTEREST:
                            print entry.http
            line = ""
            if HTTP_EXTRA:
                if entry.http["host"] or entry.http["referer"]:
                    count += 1
                    line += util.convert_ts_in_human(entry.timestamp) + DEL + \
                            str(const.RRC_MAP[entry.rrcID]) + DEL + \
                            str(entry.http) + DEL
                
                    # check whether interference exist
                    mapped_RLCs, mapped_sn = clw.cross_layer_mapping_WCDMA_uplink(entryList, i, log_of_interest_id)
                    if mapped_RLCs:
                        if vw.is_valid_cross_layer_mapping(mapped_RLCs, mapped_sn, log_of_interest_id, non_unique_rlc_tuples):
                            if entry.rtt["tcp"]:
                                paraCountMap = count_prach_aich_status(entryList, mapped_RLCs[0][-1], mapped_RLCs[-1][-1], const.PRACH_PARA_ID)
                                line += str(paraCountMap[const.PRACH_ABORT]) + DEL
                                line += str(paraCountMap[const.PRACH_DONE]) + DEL
                                eventCountMap = count_prach_aich_status(entryList, mapped_RLCs[0][-1], mapped_RLCs[-1][-1], const.EVENT_ID)
                                line += str(eventCountMap[const.PRACH_ABORT]) + DEL
                                line += str(eventCountMap[const.PRACH_DONE]) + DEL
                                if paraCountMap[const.PRACH_ABORT] > 0 or \
                                   paraCountMap[const.PRACH_DONE] > 0 or \
                                   eventCountMap[const.PRACH_ABORT] > 0 or \
                                   eventCountMap[const.PRACH_DONE] > 0:
                                    goodCount += 1    
                                    line += "Interred_request"
                            else:
                                line += "ERROR: fail to estimate TCP rtt"
                        else:
                            line += "ERROR: not unique mapping"
                    else:
                        line += "ERROR: not mapped RLC PDUs"
                    print line
    if HTTP_EXTRA:
        print "*"*80
        print "In total, " + str(count) + " requests."
        print "Interfered URL is " + str(goodCount)
예제 #4
0
def parse_http_fields(entryList):
    count = 0
    goodCount = 0
    DEL = "\t"

    if HTTP_EXTRA:
        # Assign TCP RTT
        dw.calc_tcp_rtt(entryList)
        log_of_interest_id = get_logID_of_interest("wcdma", "up")

        # Uniqueness analysis
        non_unique_rlc_tuples, dummy = vw.uniqueness_analysis(
            entryList, log_of_interest_id)

        # RLC retransmission analysis
        [RLCULReTxCountMap,
         RLCDLReTxCountMap] = rw.procRLCReTx(entryList, detail="simple")

    for i in range(len(entryList)):
        entry = entryList[i]
        if entry.logID == const.PROTOCOL_ID and \
           entry.tcp["dst_port"] == const.HTTP_DST_PORT:
            http_payload = entry.hex_dump["payload"][(const.Payload_Header_Len + \
                                                     entry.ip["header_len"] + \
                                                     entry.tcp["header_len"]):]
            http_payload_by_field = "".join(http_payload).decode("hex").split(
                const.HTTP_LINE_DEL)
            for field in http_payload_by_field:
                splitted_field = field.split(const.HTTP_FIELD_DEL)
                if splitted_field[0].lower() == "host":
                    entry.http["host"] = splitted_field[1]
                elif splitted_field[0].lower() == "referer":
                    entry.http["referer"] = splitted_field[1]
                elif splitted_field[0].lower() == "timer":
                    entry.http["timer"] = float(splitted_field[1])

                    # move on to the next entry when we get what we want
                    if TIMER_CHECK:
                        if entry.http["host"] and \
                           entry.http["timer"] and \
                           entry.http["host"] in const.HOST_OF_INTEREST:
                            print entry.http
            line = ""
            if HTTP_EXTRA:
                if entry.http["host"] or entry.http["referer"]:
                    count += 1
                    line += util.convert_ts_in_human(entry.timestamp) + DEL + \
                            str(const.RRC_MAP[entry.rrcID]) + DEL + \
                            str(entry.http) + DEL

                    # check whether interference exist
                    mapped_RLCs, mapped_sn = clw.cross_layer_mapping_WCDMA_uplink(
                        entryList, i, log_of_interest_id)
                    if mapped_RLCs:
                        if vw.is_valid_cross_layer_mapping(
                                mapped_RLCs, mapped_sn, log_of_interest_id,
                                non_unique_rlc_tuples):
                            if entry.rtt["tcp"]:
                                paraCountMap = count_prach_aich_status(
                                    entryList, mapped_RLCs[0][-1],
                                    mapped_RLCs[-1][-1], const.PRACH_PARA_ID)
                                line += str(
                                    paraCountMap[const.PRACH_ABORT]) + DEL
                                line += str(
                                    paraCountMap[const.PRACH_DONE]) + DEL
                                eventCountMap = count_prach_aich_status(
                                    entryList, mapped_RLCs[0][-1],
                                    mapped_RLCs[-1][-1], const.EVENT_ID)
                                line += str(
                                    eventCountMap[const.PRACH_ABORT]) + DEL
                                line += str(
                                    eventCountMap[const.PRACH_DONE]) + DEL
                                if paraCountMap[const.PRACH_ABORT] > 0 or \
                                   paraCountMap[const.PRACH_DONE] > 0 or \
                                   eventCountMap[const.PRACH_ABORT] > 0 or \
                                   eventCountMap[const.PRACH_DONE] > 0:
                                    goodCount += 1
                                    line += "Interred_request"
                            else:
                                line += "ERROR: fail to estimate TCP rtt"
                        else:
                            line += "ERROR: not unique mapping"
                    else:
                        line += "ERROR: not mapped RLC PDUs"
                    print line
    if HTTP_EXTRA:
        print "*" * 80
        print "In total, " + str(count) + " requests."
        print "Interfered URL is " + str(goodCount)