-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
tools, vtysh: add the cli write callback, unhide an NB show command #14764
Conversation
CI:rerun |
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 don't think this is correct. Config output is context-specific – sometimes we implement a single callback for the whole container and sometimes we implement it for leafs but not the container. We shouldn't blindly generate the code for all containers and leafs in a schema.
Sure - I was just trying to extend the example that's already there. It's useful (at least, I found it useful) to have the auto-gen tool emit the xpaths, and offer the core callbacks. I don't disagree that not every node needs a config-cli callback - but not every node needs all of the other callbacks either? I found that using the auto-generated template as a reference helped me see how the tooling was seeing changes I made to a model; perhaps that's more helpful to newbies than to real first-class yang-ers? But it was helpful, and it was easier to skip 'write' callbacks that I didn't need than to manually add them in.
|
Actually all other generated callbacks are required. If they are not defined then daemon fails on initialization. But anyway your idea sounds reasonable. How about we add some comment before the callback definition mentioning that it's optional and can be deleted if not needed? Also, can we change |
sure, I'll add a comment and push an update. I'm glad you asked about that callback name - I did want to raise the question about the existing convention. I've found the "show" function name confusing: we really use "show" to mean "show operational state", to mean "show xxx" cli commands. These callbacks don't have anything to do with oper state - just the opposite - and now that we're trying to talk about incorporating state retrieval into the northbound, it seemed like an opportunity to try to make the naming less ambiguous. What do you think about that?
|
When I look at it, a comment per function is kind of a lot - would a single comment at the top of the output be enough, do you think? Or is it better to have each generated line get the comment? Here's an example:
|
Okay, |
sounds good - I've pushed a change that updates the comment in the generated 'write' function. |
retrying CI... |
CI:rerun |
Added a doc entry too, after some discussion at today's dev meeting. |
Rebasing, let's see if we can get through CI now |
CI:rerun |
Hi @idryzhov I think CI has finally passed - the 'checkout' error is from the presence of the copyright string for the auto-generated skeleton file. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
rebased to current master, resolved conflicts |
@idryzhov any chance you could re-visit this one? |
Hi Mark, sorry for the late response. I actually used this code to generate callbacks for my zebra conversion. It helps and overall works fine. I have two suggestions:
|
Thanks: I'll move the I didn't understand exactly what you'd like in your (2) though. It looks like staticd has two structs with the same name, in two different modules. that seems a little weird? but staticd aside, are you saying you'd like the tool to generate two module_info structs - one with
|
I agree the naming is confusing, the second one is going to be renamed to |
ok, got that: do you want the
|
No, I think |
argh - needed to finish rebasing, not leave a temp commit hanging out... |
ok, what's present now should include those changes...
|
looks like CI has passed now? |
@mjstapp everything is good now, thanks for the updates! But we need to update |
Add the cli_show (config write) callback when emitting the create or modify callback in the northbound template. Split the config-handling and config-output callbacks into two structs/arrays; this seems to be helpful when doing mgmtd conversion. Signed-off-by: Mark Stapp <[email protected]>
The "show configuration running" cli is pretty useful when doing NB work; unhide it so it's easier to use. Signed-off-by: Mark Stapp <[email protected]>
Add a doc entry for the newly-unhidden 'show configuration running ...' command. Signed-off-by: Mark Stapp <[email protected]>
and rebased again, to catch up with current master |
Add the cli_show (config write) callback when emitting the create or modify callback in the northbound template. These are pretty necessary, and if they're not in the template, they have to be hand-crafted. Also unhide the "show configuration running" cli that interrogates the NB: this is pretty darn useful when doing NB work, and it's hard to use if it's hidden.
The CI checkpatch script complains because I've added the bare copyright line to the auto-gen nb template file.