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

sonic-yang-models updates for MPLS #7881

Merged
merged 1 commit into from Sep 2, 2021
Merged

Conversation

qbdwlr
Copy link
Contributor

@qbdwlr qbdwlr commented Jun 15, 2021

What I did
SONiC YANG model support in buildimage for MPLS:

  1. sonic-yang-model support for MPLS enable/disable
  2. sonic-yang-model support for MPLS CRM thresholds

Why I did it
SONiC yang-models support for MPLS

How I verified it
Unit-tests in sonic-swss/tests/test_mpls.py and sonic-utilities/tests
System tests in sonic-mgmt

Details if related
Refer to MPLS HLD sonic-net/SONiC#706

@@ -68,6 +68,12 @@ module sonic-interface {
}
default "0";
}

Choose a reason for hiding this comment

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

Can you add Yang model tests for mpls enable/disable on RIFs? Most of tests are in sonic-yang-models/tests/yang_model_tests/tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn I looked at the types of tests currently under sonic-yang-models. It looked like it was mostly parameter validation. Since this mpls knob has two fixed values, I wasn't sure what more needed to be checked for that. Do you have something specific in mind? Can you provide a pointer to an example?

Choose a reason for hiding this comment

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

I think it will be good to have a test for one type of interface. SAI default value for SAI_ROUTER_INTERFACE_ATTR_ADMIN_MPLS_STATE is disabled, we can use that. There are examples for NAT_ZONE in sonic-yang-models/tests/yang_model_tests/tests/interface.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn Type for mpls attribute has been changed from string to enum, which I believe should eliminate the need for valid/invalid attribute value tests. No explicit default should be defined in yang models due to lack of support for this atttribute in many existing platforms.

@@ -353,6 +353,46 @@ module sonic-crm {
type threshold;
}

leaf mpls_inseg_threshold_type {

Choose a reason for hiding this comment

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

Please add tests for MPLS CRM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn I looked at the existing CRM tests in sonic-yang-models. It appears that there exist currently generic parameter checking that is applicable for all CRM types. I don't think there needs to be anything specific for MPLS, since it can already make use of the generic CRM tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn I have added CRM tests for the 2 MPLS CRM types as requested.

leaf mpls {
description "Enable/disable MPLS routing for the interface";
type string {
pattern "enable|disable";

Choose a reason for hiding this comment

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

Default value for all the interface types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn I don't think we want to add a default value here, do we? What happens if the platform does not support this attribute? I think we do not want to explicitly set the attribute in that case.

@anshuv-mfst anshuv-mfst moved this from In progress to Review in progress in yang Jun 24, 2021
description "Enable/disable MPLS routing for the vlan interface";
type enumeration {
enum enable;
enum disable;
Copy link
Collaborator

Choose a reason for hiding this comment

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

As discussed in the meeting, please define typedef for enable/disable and use it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@venkatmahalingam There seems to be some inconsistency with regards to typedefs in sonic-yang-models. I see instances of enable/disable enum in sonic-device_metadata.yang and sonic-flex_counter.yang without a generic typedef being referenced. Also, I see that sonic-types.yang now requires a revision. I would suggest that a new revision of sonic-types.yang that incorporates a generic enable/disable typedef should be outside of the scope of this PR and done as a general cleanup of the yang_models to avoid churn on yang revisions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

why can't we add typedef for enable/disable in the sonic-types.yang and use it in this YANG? we can correct typedef in the other modules later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@venkatmahalingam Presumably any addition to sonic-types.yang requires a new revision for that file. It makes more sense to bundle multiple changes to sonic-types.yang together to avoid revision churn. This should be done as general cleanup prior to new release and should not be included in the scope of this PR.

@liat-grozovik
Copy link
Collaborator

@qbdwlr can you pls share some update on the review comments handling? it is blocking dpb from being executed on master.

@zhangyanzhao
Copy link
Collaborator

This PR is needed to solve the DPB break in the current master. DPB is nonfunctional for more than two months now.

@zhangyanzhao
Copy link
Collaborator

zhangyanzhao commented Aug 26, 2021

@qbdwlr would you please help to address this PR? #7881 (comment) @caizhenghui-juniper please help to drive the PR merge. Thanks.

@qbdwlr
Copy link
Contributor Author

qbdwlr commented Aug 31, 2021

@zhangyanzhao @liat-grozovik There is nothing preventing this PR from being merged in its current state. It may be merged now to resolve DPB issue.

@zhangyanzhao
Copy link
Collaborator

We will create a new PR to track the "why can't we add typedef for enable/disable in the sonic-types.yang and use it in this YANG? we can correct typedef in the other modules later?" issue. @venkatmahalingam please approve this PR and Guohan will merge.

@lguohan lguohan merged commit 7c9be31 into sonic-net:master Sep 2, 2021
yang automation moved this from Review in progress to Done Sep 2, 2021
judyjoseph pushed a commit that referenced this pull request Sep 2, 2021
SONiC YANG model support in buildimage for MPLS:

sonic-yang-model support for MPLS enable/disable
sonic-yang-model support for MPLS CRM thresholds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
yang
Done
Development

Successfully merging this pull request may close these issues.

None yet

8 participants