summaryrefslogtreecommitdiff
path: root/bin
diff options
authorJeff Lane <jeffrey.lane@canonical.com>2017-04-27 11:24:15 -0400
committerJeff Lane <jeffrey.lane@canonical.com>2017-04-27 11:24:15 -0400
commitc71173a9f525146301c8f3bc84df55652df0dc41 (patch)
treed70739c1591239d7ebabc53a7ba1e00fb0614728 /bin
parent7519e519749f87e4564acc0fa2460b2226543728 (diff)
Add connection speed to network_info script. LP: #1686746
Diffstat (limited to 'bin')
-rwxr-xr-xbin/network_info14
1 files changed, 13 insertions, 1 deletions
diff --git a/bin/network_info b/bin/network_info
index 9c20b89..38d5ada 100755
--- a/bin/network_info
+++ b/bin/network_info
@@ -51,12 +51,23 @@ def get_mac_address(interface):
address = ''
try:
- address = _read_file(address_file)
+ address = _read_file(address_file).strip()
except IOError:
pass
return address
+def get_speed(interface):
+ speed_file = os.path.join(SYS_PATH, interface, 'speed')
+
+ speed = ''
+ try:
+ speed = _read_file(speed_file).strip()
+ except IOError:
+ pass
+
+ return speed
+
def main(args):
for interface in args:
@@ -74,6 +85,7 @@ def main(args):
except:
print("IPv6: n/a")
print("MAC: %s\n" % get_mac_address(interface))
+ print("Connect Speed: %s" % get_speed(interface))
return 0