[config] Add checking of speed to "config interface speed" command #1391
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
to reject setting unsupportable port speeds.
Signed-off-by: d-dashkov [email protected]
Signed-off-by: Maksym Belei [email protected]
- What I did
Resolves sonic-net/sonic-buildimage#6424
Checking of speed parameter has added to disallow changing of port speed to non-standard values, which are not supported by the system.
- How I did it
Resolves sonic-net/sonic-buildimage#6424
List of standard port speeds has added. The passed speed parameter is being checked by the system. If the speed parameter value is not in port speed list, the system will return error to the CLI output.
- How to verify it
sudo config interface speed Ethernet8 12345678901
The system will return the next error:
Error: Invalid value for "<interface_speed>": 12345678901 is not in the valid range of 1000 to 400000.
sudo config interface speed Ethernet8 123456
The system will return the next error:
Error: The speed 123456 is not allowed. Allowed values: [1000, 2500, 5000, 10000, 25000, 40000, 50000, 100000, 200000, 400000]
sudo config interface speed Ethernet8 10000
The system will allow the speed. Command
show int status
will display 10G speed for the interface.- Previous command output (if the output of a command-line utility has changed)
Command
config interface speed
was allowing any speed value, even wrong.- New command output (if the output of a command-line utility has changed)
New behavior is described above.