Skip to content

Commit

Permalink
Add support for logical interface counters of Junos
Browse files Browse the repository at this point in the history
  • Loading branch information
minefuto committed Feb 23, 2021
1 parent 70d74f1 commit 7774181
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
7 changes: 7 additions & 0 deletions napalm/junos/junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,18 @@ def get_interfaces_counters(self):
"""Return interfaces counters."""
query = junos_views.junos_iface_counter_table(self.device)
query.get()
query_logical = junos_views.junos_logical_iface_counter_table(self.device)
query_logical.get()
interface_counters = {}
for interface, counters in query.items():
interface_counters[interface] = {
k: v if v is not None else -1 for k, v in counters
}
for interface, counters in query_logical.items():
interface_counters[interface] = {
k: v if v is not None else -1 for k, v in counters
}

return interface_counters

def get_environment(self):
Expand Down
39 changes: 39 additions & 0 deletions napalm/junos/utils/junos_views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,45 @@ junos_environment_table:
key: name
view: junos_environment_view

junos_logical_iface_counter_table:
rpc: get-interface-information
args:
extensive: True
interface_name: '[vmfgxe][mlet]*'
args_key: interface_name
item: physical-interface/logical-interface
view: junos_logical_iface_counter_view

junos_logical_iface_counter_view:
groups:
ts: traffic-statistics
rxerrs: input-error-list
txerrs: output-error-list
ethernet_traffic_types: ethernet-mac-statistics


# fields that are part of groups are called
# "fields_<group-name>"
fields_ethernet_traffic_types:
rx_broadcast_packets: { input-broadcasts: int }
tx_broadcast_packets: { output-broadcasts: int }
rx_unicast_packets: { input-unicasts: int }
tx_unicast_packets: { output-unicasts: int }
rx_multicast_packets: { input-multicasts: int }
tx_multicast_packets: { output-multicasts: int }

fields_ts:
rx_octets: { input-bytes: int }
tx_octets: { output-bytes: int }

fields_rxerrs:
rx_errors: { input-errors: int }
rx_discards: { input-discards: int }

fields_txerrs:
tx_errors: { output-errors: int }
tx_discards: { output-drops: int }

junos_environment_table_srx_cluster:
rpc: get-environment-information
args:
Expand Down

0 comments on commit 7774181

Please sign in to comment.