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

[TPID CONFIG]TPID attribute Yang model and default TPID for Minigraph to configDB Changes #7630

Merged
merged 4 commits into from
May 31, 2021

Conversation

gechiang
Copy link
Collaborator

@gechiang gechiang commented May 17, 2021

Why I did it

This PR is part of the TPID CONFIG SONiC feature set to support port/LAG TPID configuration.
TPID HLD PR: (sonic-net/SONiC#681)

There are total of 3 PRs across different submodules to achieve this feature support.

Please refer to the TPID HLD listed above for more details on the TPID configuration feature support.
Here is a quick summary for this PR changes:
By default TPID for port/LAG is 0x8100. With HW SKU that has capability to handle TPID configuration user is allowed to configure the port/LAG to non default TPID values such as (0x9100, 0x9200, 0x88A8).
This PR is to define this new TPID attribute for Port and LAG in the Yang model as well as to ensure all the ports/LAGs in the config DB generated from Minigraph should have a default TPID value of 0x8100 .

How to verify it

Test code were added for the Yang model to test the new TPID attribute in PORT and Portchannel.
Test code were also updated in test config gen, minigraph as well as multi-asic config gen to ensure the expected default TPID is in place.
Complete feature testing of TPID functionality were also performed on DUTs that has SAI support for TPID attribute to ensure the feature is working properly.

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

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

TPID port/LAG attribute Yang model and default TPID for Minigraph to configDB Changes

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

"admin_status": "up"
},
"Ethernet14": {
"alias": "Eth4/3",
"lanes": "79",
"description": "",
"speed": "11100",
"tpid": "0x8100",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We do not need to add it in all ports, just add it in 1 or 2 ports.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Going forward after this PR is approved and merged, the config DB when generated from the Minigraph will always have TPID 0x8100. It is similar to the MTU handling where there is a default value set in config DB.
I like to keep this change to set TPID attribute for all the interfaces (port and LAG). this way it is more in sync when user inspect config DB.

@@ -96,6 +96,14 @@ module sonic-port{
pattern "on|off";
}
}

leaf tpid {
Copy link
Collaborator Author

@gechiang gechiang May 27, 2021

Choose a reason for hiding this comment

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

  1. Add description field to describe what this attribute is about
  2. move to common so both port and LAG can share to avoid duplication
  3. No length required. remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we will not follow the open config model for this... for simplicity handling in config DB.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the future when stateDB validation method is agreed, we can come back to this and enhance it to check capability as part of the yang model validation for TPID attribute


leaf tpid {
type string {
length 6;
Copy link
Collaborator

Choose a reason for hiding this comment

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

See, if we can move type to stypes.yang, and use that typedef here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. Will have this changed in next commit.

@@ -10,6 +10,7 @@
"lanes": "65",
"mtu": 9000,
"name": "Ethernet0",
"tpid": "0x8100",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can avoid updating old tests, since it is not mandatory field. Just add it in new tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am actually leveraging this same test config file for the new attribute TPID testing. Are you saying that I should generate a new test file just for TPID purpose? since TPID is a new attribute for both port and portchannel, I thought of just expanding on existing test case instead of generating a new file for just one TPID test...
There are no other tests needed other than ensure that the model can catch invalid TPID values.

}
},

"PORT_INVALID_TPID_TEST": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We do not need extra test, once type is moved in stypes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure I understood your comment. moving the tpid type to a common typedef allows sharing of the same definition but testing is still required isn't it? LThis was added so that we can see that the Yang model correctly catches any attempt of using a wrong TPID value that is not specified in the model. Please clarify ...
Thanks!

@@ -12,6 +12,7 @@
"mtu": 9000,
"pfc_asym": "off",
"name": "Ethernet8",
"tpid": "0x8100",
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to update old tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TPID will be present in all config DB after thei feature is checked in so making sure it is consistently present in all interface configs.

{'PortChannel0002': {'admin_status': 'up', 'min_links': '2', 'members': ['Ethernet0', 'Ethernet4'], 'mtu': '9100'},
'PortChannel4001': {'admin_status': 'up', 'min_links': '2', 'members': ['Ethernet-BP0', 'Ethernet-BP4'], 'mtu': '9100'},
'PortChannel4002': {'admin_status': 'up', 'min_links': '2', 'members': ['Ethernet-BP8', 'Ethernet-BP12'], 'mtu': '9100'}})
{'PortChannel0002': {'admin_status': 'up', 'min_links': '2', 'members': ['Ethernet0', 'Ethernet4'], 'mtu': '9100', 'tpid': '0x8100'},
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 please correct the alignment in this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

…_type typedef for both LAG and PORT tpid attribute, added description in port and portchannel leaf for the tpid attribute
…finition missing brackets during earlier merge misshandled
@gechiang gechiang requested a review from yxieca May 29, 2021 00:21
@gechiang gechiang merged commit cff37b0 into sonic-net:master May 31, 2021
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
… to configDB Changes (sonic-net#7630)

* [TPID CONFIG]TPID attribute Yang model and default TPID for Minigraph to configDB Changes

* Fixed alignment spacing issue, removed length and convert to use tpid_type typedef for both LAG and PORT tpid attribute, added description in port and portchannel leaf for the tpid attribute
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.

4 participants