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

add Tunnel yang model #12232

Merged
merged 3 commits into from
Dec 30, 2022
Merged

add Tunnel yang model #12232

merged 3 commits into from
Dec 30, 2022

Conversation

Ndancejic
Copy link
Contributor

Signed-off-by: Nikola Dancejic ndancejic@microsoft.com

Why I did it

Add yang model for TUNNEL config

How I did it

created sonic-tunnel.yang file and tests

How to verify it

make target/python-wheels/bullseye/sonic_yang_models-1.0-py3-none-any.whl

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#tunnel

A picture of a cute animal (not mandatory but encouraged)

Gizmo

@zhangyanzhao zhangyanzhao added the YANG YANG model related changes label Oct 4, 2022
@zhangyanzhao
Copy link
Collaborator

@praveen-li will add comments. @qiluo-msft will check the configuration part.

description "optional source IPv4 address.";
}

leaf dst_ip {
Copy link
Collaborator

@qiluo-msft qiluo-msft Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dst_ip

Is there any constrain on dst_ip? For example, must it be a dualtor peer IP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the correct way to specify this? other than in the description

Copy link
Collaborator

@qiluo-msft qiluo-msft Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, I am not asking you to modify yang model. The point of accurate yang model, is to capture exact backend (in this case orchagent/etc) behavior. If backend has the implementation to validate dst_ip with some constrains, yang model need to state the constains. If backend has no validation at all, current yang model is good enough.

```
{
"TUNNEL": {
"MuxTunnel0": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add couple of more Tunnel entries to show all possible configs. Such as "dscp_mode": "pipe" and ecn_mode values etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll add these and update!

}
},
"TUNNEL": {
"MuxTunnel0": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, more entries to show\parse different possible configs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add this and update as well

},
"TUNNEL_INVALID_IP": {
"desc": "Load TUNNEL with invalid IPv4 Address.",
"eStrKey": "Pattern"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"estr": ["Exact field name"]
may be dst_ip ? in this case.

},
"TUNNEL_MISSING_NAME": {
"desc": "Load PEER_SWITCH missing PEER Device name.",
"eStrKey": "Mandatory"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"estr": ["Exact field name"]

}
},

"TUNNEL_INVALID_IP": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TUNNEL_INVALID_IP -> TUNNEL_INVALID_FIELD_NAME

}
},

"TUNNEL_MISSING_NAME": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TUNNEL_MISSING_NAME -> TUNNEL_MISSING_MUX_TUNNEL

}

container sonic-tunnel {
container TUNNEL {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description

leaf decap_dscp_to_tc_map {
description "optional Decap DSCP to TC map";
type string {
pattern "AZURE_TUNNEL";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only 1 pattern needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell this was the only configuration supported, Is there a different way I should specify this?

@ganglyu ganglyu linked an issue Oct 12, 2022 that may be closed by this pull request
@ganglyu ganglyu linked an issue Oct 12, 2022 that may be closed by this pull request
@zhangyanzhao
Copy link
Collaborator

@Ndancejic can you please help to address the comments? Thanks.

"dscp_mode": "uniform",
"dst_ip": "10.1.0.32",
"ecn_mode": "copy_from_outer",
"encap_ecn_mode": "standard",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also include the encap and decap qos maps related attributes. I see that they have been added to the actual yang definition

@Ndancejic
Copy link
Contributor Author

@praveen-li @qiluo-msft I had a few questions on some of your comments

leaf decap_tc_to_pg_map {
description "optional Decap TC to PG map";
type string {
pattern "AZURE_TUNNEL";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try to avoid using specific pattern names?

}
}

leaf decap_dscp_to_tc_map {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create reference to DSCP to TC map table?

@ganglyu
Copy link
Contributor

ganglyu commented Nov 3, 2022

why do you update submodule for frr?

@Ndancejic
Copy link
Contributor Author

My mistake, it slipped past my diff. I'll update that

@zhangyanzhao
Copy link
Collaborator

@Ndancejic can you please help to address the comments? Thanks.

@ganglyu ganglyu self-requested a review November 11, 2022 01:28
@ganglyu
Copy link
Contributor

ganglyu commented Nov 11, 2022

@Ndancejic Some unit tests failed, please let me know if you need any help.

@prsunny
Copy link
Contributor

prsunny commented Nov 29, 2022

@Ndancejic , could you please check the failures?

@zhangyanzhao
Copy link
Collaborator

@Ndancejic please help to address the build failure. Thanks.

@Ndancejic
Copy link
Contributor Author

Ndancejic commented Dec 12, 2022

Rebased and cleaned up the commits a bit. I would appreciate a second look - edit: nvm I need to take another look at this :/ my build is still going through without an issue for some reason... I think I'll have to clean and rebuild

@ganglyu
Copy link
Contributor

ganglyu commented Dec 12, 2022

Rebased and cleaned up the commits a bit. I would appreciate a second look - edit: nvm I need to take another look at this :/ my build is still going through without an issue for some reason... I think I'll have to clean and rebuild

sonic-config-engine will run yang validation for generated config_db, and it seems that test_minigraph_tunnel_table can't pass yang validation.

@Ndancejic
Copy link
Contributor Author

Rebased and cleaned up the commits a bit. I would appreciate a second look - edit: nvm I need to take another look at this :/ my build is still going through without an issue for some reason... I think I'll have to clean and rebuild

sonic-config-engine will run yang validation for generated config_db, and it seems that test_minigraph_tunnel_table can't pass yang validation.

I can see the issue now, looks like it's because src/sonic-config-engine/tests/simple-sample-graph-case-remap-enabled.xml is configured with DecapDscpToTcMap="AZURE_TUNNEL" DecapTcToPgMap="AZURE_TUNNEL" EncapTcToQueueMap="AZURE_TUNNEL" EncapTcToDscpMap="AZURE_TUNNEL" However there is no AZURE_TUNNEL qos map.

@ganglyu
Copy link
Contributor

ganglyu commented Dec 13, 2022

Rebased and cleaned up the commits a bit. I would appreciate a second look - edit: nvm I need to take another look at this :/ my build is still going through without an issue for some reason... I think I'll have to clean and rebuild

sonic-config-engine will run yang validation for generated config_db, and it seems that test_minigraph_tunnel_table can't pass yang validation.

I can see the issue now, looks like it's because src/sonic-config-engine/tests/simple-sample-graph-case-remap-enabled.xml is configured with DecapDscpToTcMap="AZURE_TUNNEL" DecapTcToPgMap="AZURE_TUNNEL" EncapTcToQueueMap="AZURE_TUNNEL" EncapTcToDscpMap="AZURE_TUNNEL" However there is no AZURE_TUNNEL qos map.

Thanks! Would you please fix this unit test?

Signed-off-by: Nikola Dancejic <ndancejic@microsoft.com>
Signed-off-by: Nikola Dancejic <ndancejic@microsoft.com>
prefix inet;
}

import sonic-peer-switch {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please check the indent?

@ganglyu ganglyu self-requested a review December 23, 2022 00:48
Signed-off-by: Nikola Dancejic <ndancejic@microsoft.com>
@qiluo-msft qiluo-msft merged commit 86a5a7f into sonic-net:master Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
YANG YANG model related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[yang] Need Yang for TUNNEL table
8 participants