Page MenuHomeVyOS Platform

the operational command "show interfaces ethernet ethx" doesn't reflect a call to 'clear counters'
Closed, ResolvedPublicBUG

Description

It seems that when the old code has been migrated to the new https://github.com/vyos/vyos-1x/blob/equuleus/src/op_mode/show_interfaces.py , it doesn't work properly when you clear count for all the interfaces or interface , it keeps showing all data :

vyos@vyos:~$ show interfaces ethernet eth0
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 50:00:00:03:00:00 brd ff:ff:ff:ff:ff:ff
    inet 203.0.113.2/30 brd 203.0.113.3 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5200:ff:fe03:0/64 scope link
       valid_lft forever preferred_lft forever
    Last clear: Fri Mar 17 16:19:39  2023
    Description: WAN

    RX:    bytes  packets  errors  dropped  overrun       mcast
         2222070    27099       0        0        0           0
    TX:    bytes  packets  errors  dropped  carrier  collisions
         2225208    27120       0        0        0           0

# clear counters 
vyos@vyos:~$ clear interfaces counters
Clearing eth0
Clearing eth1
Clearing eth2
Clearing eth3
Clearing lo
Clearing vtun1

# any clear counter was applied : 

vyos@vyos:~$ show interfaces ethernet eth0
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 50:00:00:03:00:00 brd ff:ff:ff:ff:ff:ff
    inet 203.0.113.2/30 brd 203.0.113.3 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5200:ff:fe03:0/64 scope link
       valid_lft forever preferred_lft forever
    Last clear: Fri Mar 17 16:19:39  2023
    Description: WAN

    RX:    bytes  packets  errors  dropped  overrun       mcast
         2223732    27120       0        0        0           0
    TX:    bytes  packets  errors  dropped  carrier  collisions
         2226972    27142       0        0        0           0

however, when running the following instruction, the excepted results are shown>

vyos@vyos:~$ ${vyatta_bindir}/vyatta-show-interfaces.pl --intf="eth0"
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 50:00:00:03:00:00 brd ff:ff:ff:ff:ff:ff
    inet 203.0.113.2/30 brd 203.0.113.3 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5200:ff:fe03:0/64 scope link
       valid_lft forever preferred_lft forever
    Last clear: Fri Mar 17 16:19:39 UTC 2023
    Description: WAN

    RX:  bytes    packets     errors    dropped    overrun      mcast
          3552         46          0          0          0          0
    TX:  bytes    packets     errors    dropped    carrier collisions
          3450         45          0          0          0          0

# new script : 

vyos@vyos:~$  ${vyos_op_scripts_dir}/show_interfaces.py --intf="eth0"
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 50:00:00:03:00:00 brd ff:ff:ff:ff:ff:ff
    inet 203.0.113.2/30 brd 203.0.113.3 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5200:ff:fe03:0/64 scope link
       valid_lft forever preferred_lft forever
    Last clear: Fri Mar 17 16:19:39  2023
    Description: WAN

    RX:    bytes  packets  errors  dropped  overrun       mcast
         2226012    27150       0        0        0           0
    TX:    bytes  packets  errors  dropped  carrier  collisions
         2229150    27171       0        0        0

`

Details

Version
VyOS 1.3.2
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

jestabro renamed this task from the operational command "show interfaces ethernet ethx" doesn't show when clears counts to the operational command "show interfaces ethernet ethx" doesn't reflect a call to 'clear counters'.Mar 24 2023, 12:37 AM
jestabro changed the task status from Open to In progress.
jestabro triaged this task as Normal priority.
jestabro moved this task from Open to Finished on the VyOS 1.4 Sagitta board.
jestabro moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.

confirm, it's working :

# before clear counters :

vyos@left:~$ show interfaces eth eth0
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 50:00:00:02:00:00 brd ff:ff:ff:ff:ff:ff
    inet 203.0.113.1/30 brd 203.0.113.3 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5200:ff:fe02:0/64 scope link
       valid_lft forever preferred_lft forever
    Description: WAN

    RX:  bytes  packets  errors  dropped  overrun       mcast
          3506       69       0        0        0           0
    TX:  bytes  packets  errors  dropped  carrier  collisions
          1734       17       0        0        0           0
vyos@left:~$ show interfaces counters
Interface    Rx Packets   Rx Bytes     Tx Packets   Tx Bytes
eth0                 69       3506             17       1734
eth1                  0          0              7        826
eth2                  0          0              7        826
eth3                  9       1106             49       5590
lo                  290      21412            290      21412
vtun1                 0          0              2        180

# after clear counters 

vyos@left:~$ clear interfaces ethernet eth0 counters
Clearing eth0

vyos@left:~$ show interfaces counters
Interface    Rx Packets   Rx Bytes     Tx Packets   Tx Bytes
eth0                  1        102              1        102
eth1                  0          0              7        826
eth2                  0          0              7        826
eth3                  9       1106             49       5590
lo                  314      23188            314      23188
vtun1                 0          0              2        180
vyos@left:~$ show interfaces eth eth0
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 50:00:00:02:00:00 brd ff:ff:ff:ff:ff:ff
    inet 203.0.113.1/30 brd 203.0.113.3 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5200:ff:fe02:0/64 scope link
       valid_lft forever preferred_lft forever
    Last clear: Thu Mar 30 12:42:04  2023
    Description: WAN

    RX:  bytes  packets  errors  dropped  overrun       mcast
           102        1       0        0        0           0
    TX:  bytes  packets  errors  dropped  carrier  collisions
           102        1       0        0        0           0

vyos@left:~$ show version

Version:          VyOS 1.3-stable-202303300442
Release train:    equuleus

Built by:         autobuild@vyos.net
Built on:         Thu 30 Mar 2023 04:42 UTC
Build UUID:       c949bda0-b8bc-4361-9f05-d4076f8cffe9
Build commit ID:  c46bdae0a62404

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID:    acdcad7b-70b3-4bcd-be3d-bfcb380fff87

Copyright:        VyOS maintainers and contributors