Created
May 13, 2021 22:40
-
-
Save netletic/5b9def1968b3ae7ee98d360b9ca72874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_rx_bytes(file: Path) -> Counter: | |
rx = {} | |
with open(file) as fp: | |
for line in fp.readlines(): | |
if "Chassis/Slot/Port" in line: | |
_, port, _ = line.split() | |
elif "Bytes Received" in line: | |
_, bytes_rx, *_ = line.split(":") | |
bytes_rx = bytes_rx.replace(", Unicast Frames ", "").lstrip() | |
rx[port] = int(bytes_rx) | |
return Counter(rx) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment