Fixed type for counters
This commit is contained in:
1 parent
fe3d464473
commit
6b7678f3e0
1 file changed
+6
-6
+6
-6
@@ -257,18 +257,18 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
elif (data[1].startswith('RX packets') or data[1].startswith('TX packets')) and if_name:
|
elif (data[1].startswith('RX packets') or data[1].startswith('TX packets')) and if_name:
|
||||||
if_data = data[1].split(' ')
|
if_data = data[1].split(' ')
|
||||||
direction = if_data[0].lower()
|
direction = if_data[0].lower()
|
||||||
interface_counters[if_name][direction + '_unicast_packets'] = if_data[1].split(':')[1]
|
interface_counters[if_name][direction + '_unicast_packets'] = int(if_data[1].split(':')[1])
|
||||||
interface_counters[if_name][direction + '_errors'] = if_data[2].split(':')[1]
|
interface_counters[if_name][direction + '_errors'] = int(if_data[2].split(':')[1])
|
||||||
interface_counters[if_name][direction + '_discards'] = if_data[2].split(':')[1]
|
interface_counters[if_name][direction + '_discards'] = int(if_data[2].split(':')[1])
|
||||||
interface_counters[if_name][direction + '_multicast_packets'] = -1
|
interface_counters[if_name][direction + '_multicast_packets'] = -1
|
||||||
interface_counters[if_name][direction + '_broadcast_packets'] = -1
|
interface_counters[if_name][direction + '_broadcast_packets'] = -1
|
||||||
elif data[1].startswith('RX bytes'):
|
elif data[1].startswith('RX bytes'):
|
||||||
if_data = data[1].split(' ')
|
if_data = data[1].split(' ')
|
||||||
interface_counters[if_name]['rx_octets'] = if_data[1].split(':')[1]
|
interface_counters[if_name]['rx_octets'] = int(if_data[1].split(':')[1])
|
||||||
try:
|
try:
|
||||||
interface_counters[if_name]['tx_octets'] = if_data[6].split(':')[1]
|
interface_counters[if_name]['tx_octets'] = int(if_data[6].split(':')[1])
|
||||||
except IndexError:
|
except IndexError:
|
||||||
interface_counters[if_name]['tx_octets'] = if_data[7].split(':')[1]
|
interface_counters[if_name]['tx_octets'] = int(if_data[7].split(':')[1])
|
||||||
return interface_counters
|
return interface_counters
|
||||||
|
|
||||||
def get_lldp_neighbors(self):
|
def get_lldp_neighbors(self):
|
||||||
|
|||||||
Reference in new issue
Block a user