def get_interfaces_counters(self):
counters = {}<EOL>command = "<STR_LIT>"<EOL>output = self._send_command(command)<EOL>sh_int_sum_cmd = "<STR_LIT>"<EOL>sh_int_sum_cmd_out = self._send_command(sh_int_sum_cmd)<EOL>interface_strings = re.split(r"<STR_LIT>", output, flags=re.M)<EOL>header_strings = re.findall(r"<STR_LIT>", output, flags=re.M)<EOL>empty = interface_strings.pop(<NUM_LIT:0>).strip()<EOL>if empty:<EOL><INDENT>raise ValueError("<STR_LIT>".format(command))<EOL><DEDENT>intf = []<EOL>for intf_line in header_strings:<EOL><INDENT>interface, _ = re.split(r"<STR_LIT>", intf_line)<EOL>intf.append(interface.strip())<EOL><DEDENT>if len(intf) != len(interface_strings):<EOL><INDENT>raise ValueError("<STR_LIT>".format(command))<EOL><DEDENT>for interface, interface_str in zip(intf, interface_strings):<EOL><INDENT>counters.setdefault(interface, {})<EOL>for line in interface_str.splitlines():<EOL><INDENT>if "<STR_LIT>" in line:<EOL><INDENT>match = re.search(r"<STR_LIT>", line)<EOL>counters[interface]["<STR_LIT>"] = int(match.group(<NUM_LIT:1>))<EOL>counters[interface]["<STR_LIT>"] = int(match.group(<NUM_LIT:2>))<EOL><DEDENT>elif "<STR_LIT>" in line:<EOL><INDENT>match = re.search(<EOL>r"<STR_LIT>", line<EOL>)<EOL>alt_match = re.search(r"<STR_LIT>", line)<EOL>if match:<EOL><INDENT>counters[interface]["<STR_LIT>"] = int(<EOL>match.group(<NUM_LIT:1>)<EOL>)<EOL>counters[interface]["<STR_LIT>"] = int(<EOL>match.group(<NUM_LIT:2>)<EOL>)<EOL><DEDENT>elif alt_match:<EOL><INDENT>counters[interface]["<STR_LIT>"] = int(<EOL>alt_match.group(<NUM_LIT:1>)<EOL>)<EOL>counters[interface]["<STR_LIT>"] = -<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>counters[interface]["<STR_LIT>"] = -<NUM_LIT:1><EOL>counters[interface]["<STR_LIT>"] = -<NUM_LIT:1><EOL><DEDENT><DEDENT>elif "<STR_LIT>" in line:<EOL><INDENT>match = re.search(r"<STR_LIT>", line)<EOL>counters[interface]["<STR_LIT>"] = int(match.group(<NUM_LIT:1>))<EOL>counters[interface]["<STR_LIT>"] = int(match.group(<NUM_LIT:2>))<EOL>counters[interface]["<STR_LIT>"] = -<NUM_LIT:1><EOL>counters[interface]["<STR_LIT>"] = -<NUM_LIT:1><EOL><DEDENT>elif "<STR_LIT>" in line:<EOL><INDENT>match = re.search(r"<STR_LIT>", line)<EOL>counters[interface]["<STR_LIT>"] = int(match.group(<NUM_LIT:1>))<EOL>counters[interface]["<STR_LIT>"] = -<NUM_LIT:1><EOL><DEDENT>elif "<STR_LIT>" in line:<EOL><INDENT>match = re.search(r"<STR_LIT>", line)<EOL>counters[interface]["<STR_LIT>"] = int(match.group(<NUM_LIT:1>))<EOL>counters[interface]["<STR_LIT>"] = -<NUM_LIT:1><EOL><DEDENT><DEDENT>for line in sh_int_sum_cmd_out.splitlines():<EOL><INDENT>if interface in line:<EOL><INDENT>regex = (<EOL>r"<STR_LIT>"<EOL>+ interface<EOL>+ r"<STR_LIT>"<EOL>+ r"<STR_LIT>"<EOL>+ r"<STR_LIT>"<EOL>)<EOL>match = re.search(regex, line)<EOL>if match:<EOL><INDENT>counters[interface]["<STR_LIT>"] = int(match.group("<STR_LIT>"))<EOL>counters[interface]["<STR_LIT>"] = int(match.group("<STR_LIT>"))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return counters<EOL>
Return interface counters and errors.

'tx_errors': int,
'rx_errors': int,
'tx_discards': int,
'rx_discards': int,
'tx_octets': int,
'rx_octets': int,
'tx_unicast_packets': int,
'rx_unicast_packets': int,
'tx_multicast_packets': int,
'rx_multicast_packets': int,
'tx_broadcast_packets': int,
'rx_broadcast_packets': int,

Currently doesn't determine output broadcasts, multicasts