Skip to content

[201911] "show sflow interface" doesn't show all interfaces enabled with sflow #5481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tonytitus opened this issue Sep 28, 2020 · 3 comments

Comments

@tonytitus
Copy link
Contributor

Description
"show sflow interface" doesn't show all interfaces enabled with sflow

Steps to reproduce the issue:

  1. config sflow interface enable all
  2. show sflow interface

Describe the results you received:
If port_config.ini has 4 interfaces with same index number then only 1 interface in the list is shown.

Describe the results you expected:
All the interfaces configured with sflow should be shown

Additional information you deem important (e.g. issue happens only occasionally):

**Output of `show version`:**

```
SONiC Software Version: SONiC.201911.0-74d7d3e0
Distribution: Debian 9.13
Kernel: 4.9.0-11-2-amd64
Build commit: 74d7d3e0
Build date: Tue Sep 22 23:38:49 UTC 2020
```

**Possible Fix

# git diff sonic-src/sonic-buildimage/src/sonic-utilities/show/main.p
@@ -2209,13 +2209,10 @@ def show_sflow_interface(config_db):
       click.echo("No ports configured")
       return

-    idx_to_port_map = {int(port_tbl[name]['index']): name for name in
-                       port_tbl.keys()}
   click.echo("\nsFlow interface configurations")
   header = ['Interface', 'Admin State', 'Sampling Rate']
   body = []
-    for idx in sorted(idx_to_port_map.keys()):
-        pname = idx_to_port_map[idx] 
+    for pname in natsorted(port_tbl.keys()):
       intf_key = 'SFLOW_SESSION_TABLE:' + pname
       sess_info = sess_db.get_all(sess_db.APPL_DB, intf_key)
       if sess_info is None:

@anshuv-mfst
Copy link

Dell is looking into the issue, please coordinate with @padmanarayana.

@tonytitus
Copy link
Contributor Author

Dell is looking into the issue, please coordinate with @padmanarayana.

Raised PRS sonic-net/sonic-utilities#1141 and sonic-net/sonic-utilities#1143 with the proposed fix

@prsunny
Copy link
Contributor

prsunny commented Sep 30, 2020

Merged PR - sonic-net/sonic-utilities#1143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants