From 7774181101d483c0d4b9c03f9836c75b9206b24f Mon Sep 17 00:00:00 2001 From: minefuto Date: Wed, 24 Feb 2021 03:40:31 +0900 Subject: [PATCH] Add support for logical interface counters of Junos --- napalm/junos/junos.py | 7 ++++++ napalm/junos/utils/junos_views.yml | 39 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/napalm/junos/junos.py b/napalm/junos/junos.py index 26834dc0e..4b9205de8 100644 --- a/napalm/junos/junos.py +++ b/napalm/junos/junos.py @@ -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): diff --git a/napalm/junos/utils/junos_views.yml b/napalm/junos/utils/junos_views.yml index b2b76bbfc..e7b256ee3 100644 --- a/napalm/junos/utils/junos_views.yml +++ b/napalm/junos/utils/junos_views.yml @@ -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_" + 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: