Skip to content

Added command timeout #26

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

Merged
merged 7 commits into from
May 18, 2020
Merged

Added command timeout #26

merged 7 commits into from
May 18, 2020

Conversation

Vladislav-Kisliy
Copy link
Contributor

@Vladislav-Kisliy Vladislav-Kisliy commented Apr 6, 2020

improved a consuming performance, fixed an unit test, added device emulation to unit test

@peterjhill
Copy link
Contributor

Any chance you can squash this into less commits?

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.

(not someone who can merge in, but someone who has worked with the ones who can merge in)

love these changes. My only wishes are:

Comment on lines +65 to +66
private int connectionTimeout;
private int commandTimeout;
Copy link
Contributor

Choose a reason for hiding this comment

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

great call. Like this!


private static final String CANDIDATE_CONFIG = "candidate";
private static final String EMPTY_CONFIGURATION_TAG = "<configuration></configuration>";
private static final String RUNNING_CONFIG = "running";
private static final String NETCONF_SYNTAX_ERROR_MSG_FROM_DEVICE = "netconf error: syntax error";

NetconfSession(Channel netconfChannel, int timeout, String hello,
NetconfSession(Channel netconfChannel, int connectionTimeout, int commandTimeout,
String hello,
DocumentBuilder builder) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

do you have an overloaded method to make one of these with the old signature? The github diff is not making it obvious.

It would be nice to have both, plus it would be nice to have a builder to make one of these, but that is for a future feature pr. :)

Comment on lines +57 to +60
if (st.startsWith(LF))
st = st.substring(st.indexOf(LF) + 1);
if (st.endsWith(LF)) {
st = st.substring(0, st.lastIndexOf(LF));
Copy link
Contributor

Choose a reason for hiding this comment

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

love this!

@Vladislav-Kisliy
Copy link
Contributor Author

Any chance you can squash this into less commits?

@Vladislav-Kisliy
Copy link
Contributor Author

@peterjhill
Actually I thought you can squash when you merge it but anyway I'll do it.
Thanks for your comments, I'll change my PR and notify you

@peterjhill
Copy link
Contributor

I can't merge it. :) maybe the juniper devs can. As a fellow user of this library, thanks for your contributions.

@peterjhill
Copy link
Contributor

I think the only change I would want is to bump the version in the pom.xml from
2.0.1

to perhaps 2.1.0 ?
with the new required arg in netconf session class, it could be a breaking change?

…nit test, added device emulation to unit test
@Vladislav-Kisliy
Copy link
Contributor Author

@peterjhill Hi. Please have a look. I returned old constructor, modified builder and squashed several commits. For the rest of them I'm not sure it's even possible without recreation my fork from the scratch

Comment on lines -37 to +38
assertThat(device.getTimeout()).isEqualTo(DEFAULT_TIMEOUT);
assertThat(device.getConnectionTimeout()).isEqualTo(DEFAULT_TIMEOUT);
assertThat(device.getCommandTimeout()).isEqualTo(DEFAULT_TIMEOUT);
Copy link
Contributor

Choose a reason for hiding this comment

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

If you do create the second constructor, then it would be great to have tests for each constructor. Sort of duplicate this test with each version.

@peterjhill
Copy link
Contributor

I pinged someone I know at Juniper about the PR. Hopefully they can take a look at it. THanks again Vlad!

@@ -88,6 +89,8 @@ public Device(
@NonNull String hostName,
Integer port,
Integer timeout,
Copy link
Member

Choose a reason for hiding this comment

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

Is this still required? Where is this set?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is down here in NetconfSession:

NetconfSession(Channel netconfChannel, int connectionTimeout, int commandTimeout,
If only timeout is set, then Vlad's change sets both timeout flavors to the value of timeout.

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, it's for compatibility with old API

@ydnath ydnath merged commit 8f45ec3 into Juniper:master May 18, 2020
@Vladislav-Kisliy Vladislav-Kisliy deleted the pre-merge branch September 2, 2020 15:25
@Vladislav-Kisliy Vladislav-Kisliy restored the pre-merge branch September 2, 2020 15:54
@Vladislav-Kisliy Vladislav-Kisliy deleted the pre-merge branch September 2, 2020 16:30
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