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 CBF MAPs Yang #9116

Merged
merged 5 commits into from
Dec 6, 2021
Merged

SONiC CBF MAPs Yang #9116

merged 5 commits into from
Dec 6, 2021

Conversation

Cosmin-Jinga-MS
Copy link
Contributor

Why I did it

Created SONiC Yang model for the following CBF MAPs:
DSCP_TO_FC_MAP
EXP_TO_FC_MAP

How I did it

Defined Yang models for CBF MAPs based on Guideline doc:
https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
and
https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md

How to verify it

sonic_yang_models package build

Description for the changelog

Added CBF yangs for DSCP_TO_FC_MAP and EXP_TO_FC_MAP resolves #9108

Signed-off-by: v-cjinga@microsoft.com

@smaheshm
Copy link
Contributor

@AshokDaparthi Since you've done similar work for QoS can you review this PR. Thanks!

@smaheshm smaheshm self-requested a review October 29, 2021 22:21
    Why I did it
    Created SONiC Yang model for the following CBF MAPs:
    DSCP_TO_FC_MAP
    EXP_TO_FC

    How I did it
    Defined Yang models for CBF MAPs based on Guideline doc:
    https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
    and
    https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md

    How to verify it
    sonic_yang_models package build

    Signed-off-by: v-cjinga@microsoft.com
@Cosmin-Jinga-MS
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@TACappleman
Copy link
Contributor

@smaheshm would you be able to review this, as we've not got any response otherwise?

AshokDaparthi
AshokDaparthi previously approved these changes Nov 10, 2021
@Cosmin-Jinga-MS
Copy link
Contributor Author

@smaheshm @lguohan can this PR be approved and merged?
I see Ashok has approved it.

@smaheshm
Copy link
Contributor

@praveen-li Can you also review this.. Thanks!

@Cosmin-Jinga-MS
Copy link
Contributor Author

Hi @praveen-li, can I have an estimate for when you can have this PR reviewed?

@praveen-li
Copy link
Collaborator

Hi @praveen-li, can I have an estimate for when you can have this PR reviewed?

I will try to finish this Friday Evening.

@TACappleman
Copy link
Contributor

@praveen-li How's the review going? We'd like to get this into the 202111 review with the rest of the CBF feature if possible

@Cosmin-Jinga-MS
Copy link
Contributor Author

@praveen-li any chance to have this reviewed today?

@@ -15,6 +15,9 @@
'MAP_PFC_PRIORITY_TO_QUEUE_LIST',
'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST']

cbf_maps_model = ['DSCP_TO_FC_MAP_LIST',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This for translation for a specific type, so let`s mark it as Type_1_list_maps_model. Add all lists in it.

@@ -413,7 +416,7 @@ def _yangConvert(val):
return vValue

"""
Xlate a Qos Maps list
Xlate a Maps list
Copy link
Collaborator

Choose a reason for hiding this comment

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

Xlate a Type 1 Lists, Similar to Qos Maps. Example Below:

@@ -465,7 +468,7 @@ def _yangConvert(val):
}
}
"""
def _xlateQosMapList(self, model, yang, config, table, exceptionList):
def _xlateMapList(self, model, yang, config, table, exceptionList):
Copy link
Collaborator

Choose a reason for hiding this comment

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

_xlateType1MapList

if model['@name'] in qos_maps_model:
self.sysLog(msg="_xlateQosMapList: {}".format(model['@name']))
self._xlateQosMapList(model, yang,config, table, exceptionList)
if model['@name'] in qos_maps_model or model['@name'] in cbf_maps_model:
Copy link
Collaborator

Choose a reason for hiding this comment

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

same list maps.

@@ -788,14 +791,14 @@ def _revYangConvert(val):
}
"""

def _revQosMapXlateList(self, model, yang, config, table):
def _revMapXlateList(self, model, yang, config, table):
Copy link
Collaborator

Choose a reason for hiding this comment

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

_revXlateType1MapList

"Initial revision.";
}

container sonic-dscp-fc-map {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not reviewing YANG models, since I am not SME for this. Thx

Copy link
Contributor

Choose a reason for hiding this comment

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

I will reviews, thanks for reviewing the rest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smaheshm since Praveen has approved the other changes is this PR ready to be merged in?
I've made a small update after his approval to correct some code comments only.

@smaheshm
Copy link
Contributor

smaheshm commented Dec 1, 2021

@Cosmin-Jinga-MS Once the comments are addressed this PR is good to go.

@Cosmin-Jinga-MS
Copy link
Contributor Author

@praveen-li please have a look over the changes and let me know if this is what you expected.

praveen-li
praveen-li previously approved these changes Dec 2, 2021
Copy link
Collaborator

@praveen-li praveen-li left a comment

Choose a reason for hiding this comment

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

LGTM except few Comments section changes.

@@ -744,7 +746,7 @@ def _revYangConvert(val):

"""
Rev xlate from <TABLE>_LIST to table in config DB
QOS MAP Yang has inner list, each inner list key:val should
Type 1 MAPs Yang has inner list, each inner list key:val should
Copy link
Collaborator

Choose a reason for hiding this comment

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

Type 1 Maps Lists or Type 1 Lists

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update, thanks

This function will xlate from a dict in config DB to a Yang JSON list
using yang model. Output will be go in self.xlateJson

Note: Exceptions from this function are collected in exceptionList and
are displayed only when an entry is not xlated properly from ConfigDB
to sonic_yang.json.

QOS MAPS Yang has inner list, which is diffrent from config DB.
Type 1 map Yang has inner list, which is diffrent from config DB.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Type 1 Lists has inner list, which is different from generic lists in config DB.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update, thanks

},
"DSCP_TO_FC_MAP_CREATE_INVALID_DSCP": {
"desc": "Configure a DSCP to Forwarding class map with invalid key.",
"eStr": "Invalid DSCP"
Copy link
Collaborator

Choose a reason for hiding this comment

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

eStr should match to the error from Libyang. This may not pass. Do you see successful build of PKG.

Copy link
Contributor Author

@Cosmin-Jinga-MS Cosmin-Jinga-MS Dec 3, 2021

Choose a reason for hiding this comment

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

            list DSCP_TO_FC_MAP { //this is list inside list for storing mapping between two fields

                key "dscp";

                leaf dscp {
                    type string {
                        pattern "6[0-3]|[1-5][0-9]?|[0-9]?" {
                            error-message "Invalid DSCP";
                            error-app-tag dscp-invalid;
                        }
                    }
                }

Unless I misunderstood what you meant I think the error strings do match in this case.
Can you please expand on what I need to run to build PKG in order to check?(I'd expect it to be in order since the pipeline checks have passed)

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.

[CBF][Yang] Create yang model for the following: "DSCP_TO_FC_MAP" "EXP_TO_FC_MAP"
6 participants