Skip to content

Conversation

@GregDThomas
Copy link
Contributor

@GregDThomas GregDThomas commented Jun 29, 2021

This builds on the earlier work for namespace-aware parsing of <hello>, and is now ready for review.

It introduces a new RpcReply class that is used to parse <rpc-reply> messages (with some refactoring of the Hello class to tease out common code).

Instead of searching for the text <ok/> in the String response, NetconfSession now uses the methods in RpcReply to 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.

@GregDThomas GregDThomas marked this pull request as draft June 29, 2021 15:40
@GregDThomas GregDThomas force-pushed the namespace-rpc-reply branch 4 times, most recently from 1dd5847 to 3d82547 Compare July 1, 2021 08:58
@GregDThomas GregDThomas force-pushed the namespace-rpc-reply branch from c0052e4 to d5aef3c Compare July 17, 2021 12:12
@GregDThomas GregDThomas marked this pull request as ready for review July 17, 2021 12:17
Copy link
Contributor

@peterjhill peterjhill left a 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();
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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
Copy link
Contributor

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())
Copy link
Contributor

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.

@GregDThomas GregDThomas force-pushed the namespace-rpc-reply branch from d5aef3c to a28c2fc Compare July 23, 2021 08:08
@ydnath ydnath merged commit 0e040c0 into Juniper:master Jul 23, 2021
@GregDThomas GregDThomas deleted the namespace-rpc-reply branch July 23, 2021 08:59
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.

3 participants