[sflow][implement][polling interval]return code use ctx.fail replace click.echo, when exec command it should return true or false#2811
[sflow][implement][polling interval]return code use ctx.fail replace click.echo, when exec command it should return true or false#2811651477787 wants to merge 6 commits intosonic-net:masterfrom 651477787:master
Conversation
update ctx.fail in sflow
|
update ctx.fail in sflow What I did How I did it How to verify it Previous command output (if the output of a command-line utility has changed) admin@sonic:~$ show sflow sFlow Global Information: 2 Collectors configured: admin@sonic:$ sudo config sflow interface sample-rate Ethernet240 255 New command output (if the output of a command-line utility has changed) Error: Polling interval must be between 5-300 (0 to disable) sFlow Global Information: 2 Collectors configured: **admin@sonic:~$ sudo config sflow interface sample-rate Ethernet240 255 Error: Sample rate must be between 256 and 8388608 |
|
update ctx.fail in sflow What I did How I did it How to verify it Previous command output (if the output of a command-line utility has changed) admin@sonic:~$ show sflow sFlow Global Information: 2 Collectors configured: admin@sonic:$ sudo config sflow interface sample-rate Ethernet240 255 New command output (if the output of a command-line utility has changed) Error: Polling interval must be between 5-300 (0 to disable) |
|
Can this be reviewed? |
|
Can anyone help review, thx. |
|
@651477787 Please merge latest master code to trigger Semgrep. |
|
help me , review it. thanks |
looks like it is fixed in #2847? |
update ctx.fail in sflow
What I did
fix sflow part
when add sflow, interval is out of range, it will return fail and give info of range
How I did it
use ctx.fail replace the click.echo
How to verify it
verifty it in product
Previous command output (if the output of a command-line utility has changed)
admin@sonic:
$ sudo config feature state sflow enabled$ sudo config sflow enableadmin@sonic:
admin@sonic:
$ sudo config sflow polling-interval 4$ $?Polling interval must be between 5-300 (0 to disable)
admin@sonic:
-bash: 0: command not found
admin@sonic:~$ show sflow
sFlow Global Information:
sFlow Admin State: up
sFlow Polling Interval: 60
sFlow AgentID: Loopback1
2 Collectors configured:
Name: 1 IP addr: 10.17.0.2 UDP port: 65535 VRF: mgmt
Name: 2 IP addr: 2003::200 UDP port: 6343 VRF: default
admin@sonic:~$
admin@sonic:
$ sudo config sflow interface sample-rate Ethernet240 255$ $?Error: Sample rate must be between 256 and 8388608
admin@sonic:
-bash: 0: command not found
admin@sonic:~$
New command output (if the output of a command-line utility has changed)
**admin@sonic:~$ sudo config sflow polling-interval 4
Usage: config sflow polling-interval [OPTIONS] <polling_interval>
Try "config sflow polling-interval -h" for help.
Error: Polling interval must be between 5-300 (0 to disable)
admin@sonic:
$ $?$ show sflow-bash: 2: command not found**
admin@sonic:
sFlow Global Information:
sFlow Admin State: up
sFlow Polling Interval: 60
sFlow AgentID: Loopback1
2 Collectors configured:
Name: 1 IP addr: 10.17.0.2 UDP port: 65535 VRF: mgmt
Name: 2 IP addr: 2003::200 UDP port: 6343 VRF: default
admin@sonic:~$
**admin@sonic:~$ sudo config sflow interface sample-rate Ethernet240 255
Usage: config sflow interface sample-rate [OPTIONS] <interface_name>
<sample_rate>
Try "config sflow interface sample-rate -h" for help.
Error: Sample rate must be between 256 and 8388608
admin@sonic:
$ $?$-bash: 2: command not found**
admin@sonic: