-
Notifications
You must be signed in to change notification settings - Fork 1.5k
SONiC CBF MAPs Yang #9116
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
Conversation
@AshokDaparthi Since you've done similar work for QoS can you review this PR. Thanks! |
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: [email protected]
03cce0b
to
b9cc150
Compare
/azpw run |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
@smaheshm would you be able to review this, as we've not got any response otherwise? |
@praveen-li Can you also review this.. Thanks! |
Hi @praveen-li, can I have an estimate for when you can have this PR reviewed? |
I will try to finish this Friday Evening. |
@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 |
@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', |
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.
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 |
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.
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): |
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.
_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: |
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.
same list maps.
@@ -788,14 +791,14 @@ def _revYangConvert(val): | |||
} | |||
""" | |||
|
|||
def _revQosMapXlateList(self, model, yang, config, table): | |||
def _revMapXlateList(self, model, yang, config, table): |
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.
_revXlateType1MapList
"Initial revision."; | ||
} | ||
|
||
container sonic-dscp-fc-map { |
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 am not reviewing YANG models, since I am not SME for this. Thx
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 will reviews, thanks for reviewing the rest.
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.
@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.
@Cosmin-Jinga-MS Once the comments are addressed this PR is good to go. |
@praveen-li please have a look over the changes and let me know if this is what you expected. |
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.
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 |
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.
Type 1 Maps Lists or Type 1 Lists
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.
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. |
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.
Type 1 Lists has inner list, which is different from generic lists in config DB.
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.
Will update, thanks
}, | ||
"DSCP_TO_FC_MAP_CREATE_INVALID_DSCP": { | ||
"desc": "Configure a DSCP to Forwarding class map with invalid key.", | ||
"eStr": "Invalid DSCP" |
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.
eStr should match to the error from Libyang. This may not pass. Do you see successful build of PKG.
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.
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)
Why I did it
How I did it
How to verify it
Description for the changelog
Added CBF yangs for DSCP_TO_FC_MAP and EXP_TO_FC_MAP resolves #9108
Signed-off-by: [email protected]