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

union: propagate apptag error if all errors use the same apptag #2356

Closed
wants to merge 1 commit into from

Conversation

bradh352
Copy link

If a union references various different leafref paths, and all leafref paths are invalid, it is nice to have the apptag returned as instance-required. There may be other use cases...

@bradh352 bradh352 force-pushed the union-propagate-apptag branch from 2970ac9 to 0ee3863 Compare February 24, 2025 17:11
Copy link
Member

@michalvasko michalvasko left a comment

Choose a reason for hiding this comment

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

Obviously, you have this specific use-case. But if you want to change it, I suppose the app-tag can be used if all types define it or not define any.

@bradh352
Copy link
Author

I'd view this as more of a "nice-to-have".

I would need to update some existing test cases in SONiC without this patch for expected errors, unless I wanted to go dirty and try to parse and evaluate the error message itself.

In SONiC's yang models, we do a lot of leafref unions, specifically for cross referencing physical and virtual interfaces ... like an ACL must be associated with a physical port, a port channel, or a vlan interface ... all of which are defined in different modules/schema paths.

I don't think we have any instance where we mix a union with leafref and non-leafref nodes, so not getting the "instance-required" apptag makes things a bit more ambiguous for being able to render our own error messages.

@michalvasko
Copy link
Member

michalvasko commented Feb 25, 2025

What I meant is that I will accept this PR if you change it so that an error-app-tag is used if the same or none is used for all the types. Using it only if all the types generate it seems too restrictive.

@bradh352 bradh352 force-pushed the union-propagate-apptag branch from 0ee3863 to 135e140 Compare February 25, 2025 14:28
@bradh352
Copy link
Author

What I meant is that I will accept this PR if you change it so that an error-app-tag is used if the same or none is used for all the types. Using it only if all the types generate it seems too restrictive.

Ah sorry, didn't understand that first time around. The latest update I just pushed should accomplish that.

@bradh352 bradh352 force-pushed the union-propagate-apptag branch from 135e140 to ed9a6f5 Compare February 25, 2025 14:29
If a union references various different leafref paths, and all leafref
paths are invalid, it is nice to have the apptag returned as
instance-required.  There may be other use cases...

Signed-off-by: Brad House <[email protected]>
@bradh352 bradh352 force-pushed the union-propagate-apptag branch from ed9a6f5 to e46c04d Compare February 25, 2025 14:40
michalvasko added a commit that referenced this pull request Feb 25, 2025
@michalvasko
Copy link
Member

When the tests did not pass, I decided to improve it a bit myself, should work.

@bradh352
Copy link
Author

it was an ubsan thing, where it didn't realize apptag couldn't be null if use_apptag was set. I had gone back and fixed that. But that's fine, yours works.

@bradh352 bradh352 deleted the union-propagate-apptag branch February 25, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants