shill: Device: Add receive / transmit byte count properties
Create "RecieveByteCount" and "TransmitByteCount" properties for
Devices, which increment persistently across shill instances. Also
create a "ResetByteCount" method on Devices to set these counters
back to zero.
BUG=chromium-os:31584
TEST=New unit tests; list-devices on a real machine. Restart shill,
and ensure byte counts are persisted to disk. Write a "reset-counters"
test script and ensure that this resets the counters and the on-disk
values are set to 0 as well.
Change-Id: I8d285310d153e1e219ef523528b575e2c600de01
Reviewed-on: https://gerrit.chromium.org/gerrit/27300
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/mock_device_info.h b/mock_device_info.h
index 6175f13..4f5addb 100644
--- a/mock_device_info.h
+++ b/mock_device_info.h
@@ -32,6 +32,9 @@
MOCK_CONST_METHOD1(GetIndex, int(const std::string &interface_name));
MOCK_CONST_METHOD2(GetMACAddress, bool(int interface_index,
ByteString* address));
+ MOCK_CONST_METHOD3(GetByteCounts, bool(int interface_index,
+ uint64 *rx_bytes,
+ uint64 *tx_bytes));
MOCK_CONST_METHOD2(GetFlags, bool(int interface_index,
unsigned int* flags));
MOCK_CONST_METHOD2(GetAddresses, bool(int interface_index,