Revision bc1cc761

View differences:

network_builder.py
64 64
        return links
65 65

  
66 66
    def linkSentPackets(self,link):
67
        packets1 = int(link.intf1.node.cmd("ifconfig ",link.intf1.name ,"| grep -Eo 'TX packets:[0-9]+' | cut -d':' -f 2"))
68
        packets2 = int(link.intf2.node.cmd("ifconfig ",link.intf2.name ,"| grep -Eo 'TX packets:[0-9]+' | cut -d':' -f 2"))
67
        packets1 = int(link.intf1.node.cmd("ifconfig ",link.intf1.name ,
68
            "| grep -Eo 'TX packets:[0-9]+' | cut -d':' -f 2"))
69
        packets2 = int(link.intf2.node.cmd("ifconfig ",link.intf2.name ,
70
            "| grep -Eo 'TX packets:[0-9]+' | cut -d':' -f 2"))
69 71
        return packets1+packets2
70 72

  
71 73
    def hostSentPackets(self,host):
......
73 75
        sent_bytes = 0
74 76
        intfs = host.intfNames()
75 77
        for intf in intfs:
76
            host.cmd("ifconfig",intf ,"| grep -Eo 'TX bytes:[0-9]+' | cut -d':' -f 2")
77
            sent_bytes += int(host.cmd("ifconfig",intf ,"| grep -Eo 'TX bytes:[0-9]+' | cut -d':' -f 2"))
78
            sent_packets += int(host.cmd("ifconfig ",intf ,"| grep -Eo 'TX packets:[0-9]+' | cut -d':' -f 2"))
78
            host.cmd("ifconfig",intf ,
79
                    "| grep -Eo 'TX bytes:[0-9]+' | cut -d':' -f 2")
80
            sent_bytes += int(host.cmd("ifconfig",intf ,
81
                "| grep -Eo 'TX bytes:[0-9]+' | cut -d':' -f 2"))
82
            sent_packets += int(host.cmd("ifconfig ",intf ,
83
                "| grep -Eo 'TX packets:[0-9]+' | cut -d':' -f 2"))
79 84
        return (sent_packets,sent_bytes)
80 85

  
81 86
    def hostReceivedPackets(self,host):

Also available in: Unified diff