-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[yang] Update YANG model for mirror session to support decimal value for GRE type #10140
[yang] Update YANG model for mirror session to support decimal value for GRE type #10140
Conversation
Signed-off-by: bingwang <bingwang@microsoft.com>
/azp run |
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
@@ -99,7 +99,7 @@ module sonic-mirror-session { | |||
leaf gre_type { | |||
when "current()/../type = 'ERSPAN'"; | |||
type string { | |||
pattern "0[xX][0-9a-fA-F]*"; | |||
pattern "0[xX][0-9a-fA-F]*|[1-9][0-9]*"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be the pattern. This would allow values out of range. The pattern should restrict values from 0-65535.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I updated the pattern for matching decimal, and some test cases as well. Not we only accept values in range [0, 65535].
Please be noticed that values as 0x0
and 0
are also accepted.
Signed-off-by: bingwang <wang.bing@microsoft.com>
Signed-off-by: bingwang <wang.bing@microsoft.com>
@dgsudharsan Please help take a look one more time. Thanks |
} | ||
} | ||
}, | ||
"MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_3": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this hex value example for GRE type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I fixed the typo. Thanks
/azp run |
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
/azp run |
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
@qiluo-msft Can you please review and sign off? |
…for GRE type (#10140) #### Why I did it PR sonic-net/sonic-utilities#1825 added validation for the input of `config mirror session add`, and only decimal value is accepted. An issue #10096 was raised to suggest accepting HEX value as well, and the suggestion makes sense to me. To accept HEX value for GRE type, and keep backward compatibility as well, I updated the YANG model to support both decimal and hexadecimal input for GRE type. #### How I did it Update the regex for GRE type. #### How to verify it Verified by UT ``` platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0 rootdir: /sonic/src/sonic-yang-models plugins: pyfakefs-4.5.4, cov-2.10.1 collected 3 items tests/test_sonic_yang_models.py .. [ 66%] tests/yang_model_tests/test_yang_model.py . [100%] ========================================================================================== 3 passed in 2.53s ========================================================================================== ``` #### Description for the changelog Update YANG model for mirror session to support decimal value for GRE type.
…for GRE type (sonic-net#10140) #### Why I did it PR sonic-net/sonic-utilities#1825 added validation for the input of `config mirror session add`, and only decimal value is accepted. An issue sonic-net#10096 was raised to suggest accepting HEX value as well, and the suggestion makes sense to me. To accept HEX value for GRE type, and keep backward compatibility as well, I updated the YANG model to support both decimal and hexadecimal input for GRE type. #### How I did it Update the regex for GRE type. #### How to verify it Verified by UT ``` platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0 rootdir: /sonic/src/sonic-yang-models plugins: pyfakefs-4.5.4, cov-2.10.1 collected 3 items tests/test_sonic_yang_models.py .. [ 66%] tests/yang_model_tests/test_yang_model.py . [100%] ========================================================================================== 3 passed in 2.53s ========================================================================================== ``` #### Description for the changelog Update YANG model for mirror session to support decimal value for GRE type.
Signed-off-by: bingwang bingwang@microsoft.com
Why I did it
PR sonic-net/sonic-utilities#1825 added validation for the input of
config mirror session add
, and only decimal value is accepted.An issue #10096 was raised to suggest accepting HEX value as well, and the suggestion makes sense to me.
To accept HEX value for GRE type, and keep backward compatibility as well, I updated the YANG model to support both decimal and hexadecimal input for GRE type.
How I did it
Update the regex for GRE type.
How to verify it
Verified by UT
Which release branch to backport (provide reason below if selected)
Description for the changelog
Update YANG model for mirror session to support decimal value for GRE type.
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)