Skip to content
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

Fix issue: out of range sflow polling interval is accepted and stored in config_db #2847

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

Junchao-Mellanox
Copy link
Collaborator

What I did

Fixed issue: out of range sflow polling interval is accepted and stored in config_db.

Reproduce step:

1. Enable sflow feature:   config feature state sflow enabled
2. Enable sflow itself:   config sflow enable 
3. Configure out of range polling interval:  config sflow polling-interval 1. Error message is shown as expected
4. Save config:    config save -y
5. Check "SFLOW" section inside config_db

As the interval is invalid, the expected behavior is that the interval is not saved to redis. But we see the invalid value was written to redis.

How I did it

Change click.echo to ctx.fail

How to verify it

  1. Manual test
  2. Add a check in existing unit test case to cover the change

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@keboliu keboliu added the Bug label May 24, 2023
@qiluo-msft qiluo-msft merged commit 5c9b217 into sonic-net:master Jun 5, 2023
dprital added a commit to dprital/sonic-buildimage that referenced this pull request Jun 5, 2023
Update sonic-utilities submodule pointer to include the following:
* 5c9b2177 Fix issue: out of range sflow polling interval is accepted and stored in config_db ([sonic-net#2847](sonic-net/sonic-utilities#2847))
* 72ca4848 Add CLI configuration options for teamd retry count feature ([sonic-net#2642](sonic-net/sonic-utilities#2642))
* 359dfc0c [Clock] Implement clock CLI ([sonic-net#2793](sonic-net/sonic-utilities#2793))
* b316fc27 Add transceiver status CLI to show output from TRANSCEIVER_STATUS table ([sonic-net#2772](sonic-net/sonic-utilities#2772))
* dc59dbd2 Replace pickle by json ([sonic-net#2849](sonic-net/sonic-utilities#2849))
* a66f41c4 [show] replace shell=True, replace xml by lxml, replace exit by sys.exit ([sonic-net#2666](sonic-net/sonic-utilities#2666))
* 57500572 [utilities_common] replace shell=True ([sonic-net#2718](sonic-net/sonic-utilities#2718))
* 6e0ee3e7 [CRM][DASH] Extend CRM utility to support DASH resources. ([sonic-net#2800](sonic-net/sonic-utilities#2800))
* b2c29b0b [config] Generate sysinfo in single asic ([sonic-net#2856](sonic-net/sonic-utilities#2856))

Signed-off-by: dprital <[email protected]>
@Junchao-Mellanox Junchao-Mellanox deleted the fix-sflow branch June 8, 2023 08:22
@Junchao-Mellanox
Copy link
Collaborator Author

Hi @StormLiangMS , could you please help cherry-pick to 202211?

StormLiangMS pushed a commit that referenced this pull request Jun 10, 2023
… in config_db (#2847)

#### What I did

Fixed issue: out of range sflow polling interval is accepted and stored in config_db.

Reproduce step:
```
1. Enable sflow feature:   config feature state sflow enabled
2. Enable sflow itself:   config sflow enable 
3. Configure out of range polling interval:  config sflow polling-interval 1. Error message is shown as expected
4. Save config:    config save -y
5. Check "SFLOW" section inside config_db
```

As the interval is invalid, the expected behavior is that the interval is not saved to redis. But we see the invalid value was written to redis.

#### How I did it

Change `click.echo` to `ctx.fail`

#### How to verify it

1. Manual test
2. Add a check in existing unit test case to cover the change
LGH-12 added a commit to LGH-12/sonic-utilities that referenced this pull request Jun 30, 2023
pdhruv-marvell pushed a commit to pdhruv-marvell/sonic-utilities that referenced this pull request Aug 23, 2023
… in config_db (sonic-net#2847)

#### What I did

Fixed issue: out of range sflow polling interval is accepted and stored in config_db.

Reproduce step:
```
1. Enable sflow feature:   config feature state sflow enabled
2. Enable sflow itself:   config sflow enable 
3. Configure out of range polling interval:  config sflow polling-interval 1. Error message is shown as expected
4. Save config:    config save -y
5. Check "SFLOW" section inside config_db
```

As the interval is invalid, the expected behavior is that the interval is not saved to redis. But we see the invalid value was written to redis.

#### How I did it

Change `click.echo` to `ctx.fail`

#### How to verify it

1. Manual test
2. Add a check in existing unit test case to cover the change
stephenxs pushed a commit to stephenxs/sonic-utilities that referenced this pull request Jan 15, 2024
… in config_db (sonic-net#2847)

Fixed issue: out of range sflow polling interval is accepted and stored in config_db.

Reproduce step:
```
1. Enable sflow feature:   config feature state sflow enabled
2. Enable sflow itself:   config sflow enable
3. Configure out of range polling interval:  config sflow polling-interval 1. Error message is shown as expected
4. Save config:    config save -y
5. Check "SFLOW" section inside config_db
```

As the interval is invalid, the expected behavior is that the interval is not saved to redis. But we see the invalid value was written to redis.

Change `click.echo` to `ctx.fail`

1. Manual test
2. Add a check in existing unit test case to cover the change
yxieca pushed a commit that referenced this pull request Jan 22, 2024
… in config_db (#2847) (#3123)

Fixed issue: out of range sflow polling interval is accepted and stored in config_db.

Reproduce step:
```
1. Enable sflow feature:   config feature state sflow enabled
2. Enable sflow itself:   config sflow enable
3. Configure out of range polling interval:  config sflow polling-interval 1. Error message is shown as expected
4. Save config:    config save -y
5. Check "SFLOW" section inside config_db
```

As the interval is invalid, the expected behavior is that the interval is not saved to redis. But we see the invalid value was written to redis.

Change `click.echo` to `ctx.fail`

1. Manual test
2. Add a check in existing unit test case to cover the change

Co-authored-by: Junchao-Mellanox <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants