-
Notifications
You must be signed in to change notification settings - Fork 66
Add namespace-aware parsing for rpc-reply #51
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
Conversation
1dd5847 to
3d82547
Compare
c0052e4 to
d5aef3c
Compare
peterjhill
left a comment
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 is fantastic. Thanks for all this work!
| "</rpc>" + | ||
| NetconfConstants.DEVICE_PROMPT; | ||
| lastRpcReply = getRpcReply(rpc); | ||
| updateLastRpcReplyObject(); |
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 is fine. Would it make sense to update both the string and object lastRpcReply(Object) in the same private method below?
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.
Yes, that makes a lot of sense. Will do that as soon as I’m in front of a PC.
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 wait for this update before merging.
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.
OK, I've updated this. Two new private methods ...
setLastRpcReply(String) which updates the reply string and reply object, and
setHelloReply(String) which updates the reply string and hello object. It's only invoked the once, but added for consistency.
|
|
||
| @Value | ||
| @NonFinal | ||
| public abstract class AbstractNetconfElement { |
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.
oh, this is exciting!
| @Data | ||
| @Slf4j | ||
| public class Hello { | ||
| @Value |
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 loving all the changes in this class
| .build(); | ||
|
|
||
| XmlAssert.assertThat(hello.toXML()) | ||
| XmlAssert.assertThat(hello.getXml()) |
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.
love assertThat.. makes reading the cases so much easier.
…as OK, warning or error messages
d5aef3c to
a28c2fc
Compare
This builds on the earlier work for namespace-aware parsing of
<hello>, and is now ready for review.It introduces a new
RpcReplyclass that is used to parse<rpc-reply>messages (with some refactoring of theHelloclass to tease out common code).Instead of searching for the text
<ok/>in the String response,NetconfSessionnow uses the methods inRpcReplyto determine if a response is OK (similarly for warning and errors).Existing tests passes (a few textual exception messages changed slightly, I don't think that is a problem), and this also runs a suite of tests on my local device too.