Example #1
0
                        cf.ether_daddr].lq  # rtetx of transmitting iface
                except KeyError:
                    current_lq = 10.0
                    print "No Link Quality of [%s] is acquired" % cf.ether_daddr

                ff.rx_frame = 0  # RX frame count set 0 for next channel
                ff.tx_frame = 0  # TX frame count set 0 for next channel

                cf.next()  # Configuration for next channel
                set_interface(backup, cf)  # Setup interface for next channel

                #Algorithm 2
                print "cf.ether_daddr: %s" % cf.ether_daddr
                if ff.is_higher(cf.ether_daddr):
                    print "Netperf Starts "
                    nf = Netperf(cf.ip_daddr)
                    nf.run('ping', '-q -s 1024 -c 500 -i 0.01 %s > /dev/null' %
                           cf.ip_daddr)  # since 200812152330
                    #nf.run('ping', '-q -s 1024 -c 2000 -i 0.01 %s > /dev/null' % cf.ip_daddr) # since 200812121800
                    #nf.run('ping', '-q -s 1024 -c 500 -i 0.01 %s > /dev/null' % cf.ip_daddr) # since 200812121703
                    #nf.run('netperf', '-l 1 -H %s > /dev/null' % cf.ip_daddr) # not yet tested
                    print "Netperf Ends"

                try:
                    lq_link1 = ff.addr_lq[
                        '00:80:92:3e:18:11'].lq  # link1 = robohoc46
                    lq_link2 = ff.addr_lq[
                        '00:80:92:3e:18:18'].lq  # link2 = robohoc56
                    if cf.ether_daddr == '00:80:92:3e:18:11':
                        tmp_lq = lq_link1
                    elif cf.ether_daddr == '00:80:92:3e:18:18':
Example #2
0
            return True

        except ZeroDivisionError:
            return False

    def refresh(self):
        self.rtt = []
        self.id += 1

if __name__=='__main__':
    #ping = Netperf("192.168.100.3")
    #while 1:
    #    timestamp = time.time()
    #    rtt = Netperf.ping('ping -s 1024 -W 1 -c 1 -q %s' % "192.168.100.3", "192.168.100.3")

    myping = Netperf("192.168.100.3")
    myrtt = RTT()

    exp_start = time.time()

    try:
        while (time.time() - exp_start) < 300:
            timestamp = time.time()
            rtt = myping.ping('ping -s 1024 -W 1 -c 2 -q %s' % "192.168.100.3", "192.168.100.3", 1) # timeout = -W * -c

            myrtt.recode(timestamp, rtt)

    except KeyboardInterrupt:
        print "recorded rtt:", myrtt.rtt
        print "past time", time.time() - exp_start
Example #3
0
                current_lq = ff.addr_lq[cf.ether_daddr].lq # rtetx of transmitting iface
             except KeyError:
                current_lq = 10.0
                print "No Link Quality of [%s] is acquired" % cf.ether_daddr

             ff.rx_frame = 0 # RX frame count set 0 for next channel
             ff.tx_frame = 0 # TX frame count set 0 for next channel

             cf.next() # Configuration for next channel
             set_interface(backup, cf) # Setup interface for next channel

             #Algorithm 2
             print "cf.ether_daddr: %s" % cf.ether_daddr
             if ff.is_higher(cf.ether_daddr):
                print "Netperf Starts "
                nf = Netperf(cf.ip_daddr)
                nf.run('ping', '-q -s 1024 -c 500 -i 0.01 %s > /dev/null' % cf.ip_daddr) # since 200812152330
                   #nf.run('ping', '-q -s 1024 -c 2000 -i 0.01 %s > /dev/null' % cf.ip_daddr) # since 200812121800
                   #nf.run('ping', '-q -s 1024 -c 500 -i 0.01 %s > /dev/null' % cf.ip_daddr) # since 200812121703
                   #nf.run('netperf', '-l 1 -H %s > /dev/null' % cf.ip_daddr) # not yet tested
                print "Netperf Ends"

             try:
                lq_link1 = ff.addr_lq['00:80:92:3e:18:11'].lq # link1 = robohoc46
                lq_link2 = ff.addr_lq['00:80:92:3e:18:18'].lq # link2 = robohoc56
                if cf.ether_daddr == '00:80:92:3e:18:11':
                   tmp_lq = lq_link1
                elif cf.ether_daddr == '00:80:92:3e:18:18':
                   tmp_lq = lq_link2
                else:
                   sys.exit(1)
Example #4
0
        except ZeroDivisionError:
            return False

    def refresh(self):
        self.rtt = []
        self.id += 1


if __name__ == '__main__':
    #ping = Netperf("192.168.100.3")
    #while 1:
    #    timestamp = time.time()
    #    rtt = Netperf.ping('ping -s 1024 -W 1 -c 1 -q %s' % "192.168.100.3", "192.168.100.3")

    myping = Netperf("192.168.100.3")
    myrtt = RTT()

    exp_start = time.time()

    try:
        while (time.time() - exp_start) < 300:
            timestamp = time.time()
            rtt = myping.ping('ping -s 1024 -W 1 -c 2 -q %s' % "192.168.100.3",
                              "192.168.100.3", 1)  # timeout = -W * -c

            myrtt.recode(timestamp, rtt)

    except KeyboardInterrupt:
        print "recorded rtt:", myrtt.rtt
        print "past time", time.time() - exp_start