-
Notifications
You must be signed in to change notification settings - Fork 87
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
New session creation is failing #139
Comments
it's hard to guess without any logs/error - why don't you write what specific exception/error message you see? |
Hi @jomiklos , Exception occured : null java.lang.NullPointerException |
This is because you need to have an active connection to that device, i.e. you need to call one of |
Actually we will be checking the one initially created Device object is null or not. If not null we will be using that device object to call newSession even then we facing above issue. |
So as to start a NETCONF session you need to have a
I suspect you are missing an equivalent of the fourth line, i.e. the |
Okay, I am facing issue in close the opened new session. if(device!=null) { |
You seem to be using quite old JNC version, can you migrate to the latest one? |
Hi @martin-volf , could you please suggest what is the latest JNC version and what is the fix for above issue? |
You can fetch/clone the recent code from this repository, or use a Maven repository. Please refer to the top-level README file for more details. |
Hi @martin-volf , from the code base I could not find pom.xml to build using maven. It has only gradle. Could you please share me link where can download with maven supported? |
It does not support Maven per se, i.e. you cannot build the library using mvn; but if you are using it for your project, have a look at the example gradle build file - just point Maven to use the repository url mentioned there and use the artifact (group |
Hi @martin-volf/ Team , Please help to resolve the same. String emsUserName = "bobby"; java.net.ConnectException: Connection refused |
Hi @martin-volf , |
You wrote at several places that you are using the new call-home feature; if that's the case, you should not call du = new DeviceUser("bob", "admin", "admin");
dev = new Device.CallHome("confd").waitForCallHome();
dev.addUser(du);
dev.authenticate("bob"); (A side note: confd-7.1 is 5 years old, is that indeed your best option?) |
Hi @martin-volf , You wrote at several places that you are using the new call-home feature; if that's the case, you should not call Device.connect(), the device is already connected when waitForCallHome() finishes. Call-home should be used like this: du = new DeviceUser("bob", "admin", "admin"); I have used above code where it got stuck in waitForCallHome() method itself its not coming out. How can I add loggers in JNC code and which can enable in spring boot application? (A side note: confd-7.1 is 5 years old, is that indeed your best option?) |
The method $ confd_cmd -c "netconf_ssh_call_home 127.0.0.1 4334" You need this only if the device is not accessible from the host where the client is running, e.g. if the device is behind a firewall or a NAT gateway. As for compatibility - yes, the protocol is NETCONF, so I would not expect incompatibility issues with confd-7.1. |
Hi @martin-volf , The method waitForCallHome() waits till the device "calls home", i.e. connects to the call-home port, by default 4334. With ConfD you can make it "call home" using maapi_netconf_ssh_call_home function or with the confd_cmd tool as in $ confd_cmd -c "netconf_ssh_call_home 10.10.10.10 4334" We have spring boot application. Where our application act as server keeps listening on 4334 call home port. There is another application where it has confd from that above command will be trigger with our application IP. So when we run below command in our application pod. netstat -anpt | grep 4334 So how to handle this case. Since waitForCallHome() internally connect to 4334 but call home established on 51618 port. Seems due to this code is stuck on waitForCallHome() method itself it is not coming out. The other side confd application expecting our application needs to accept call home and complete subscriptions withing 5 sec other wise it keeps sending one more call home with diff port. Please help on this to further proceed. |
There may be multiple reasons for this, we may need to investigate more, but let me first ask you - what version of the SSHJ library are you using, how do you integrate it? |
|
That is likely the problem. This SSHJ release does not support call-home feature. The support has been implemented and merged to the SSHJ master branch, but it has not been released yet. So as to use the feature, you need to build SSHJ from the source and use that, or perhaps make a fork and do a release to your own Maven repo or something like that, I'm by far not a Maven expert. |
Can you please share SSHJ master branch url here to download source to compile and use of that jar in our application. |
Ah, of course: https://github.com/hierynomus/sshj It uses gradle, so you should be able to get a jar with |
I have downloaded sshj code from above link compiled it and used sshj jar in both JNC as well as my spring boot application but still same issue. Below is code used where it still stuck in Device.CallHome method only its not printing next log message . Here I have overridden new method of Device.CallHome accept both incoming ip address with its port to connect the call home. Please help further. log.error("Before device.callhome.waitForCallhome"); |
Can you test it without modifications? Please understand, it is very difficult to provide any support when you are using a number of unspecified modifications to the library code. |
Hi Team,
Facing issue some times create new session to confd is failing before push the config using below api.
String sessionName = IP + "" + VNF_TYPE +""+"CP";
NetconfSession session = null;
try {
session = device.getSession(sessionName);
if(session == null) {
device.newSession(sessionName); // Here it will throw exception.
}
}catch(Exception e) {
device.newSession(sessionName); // then here as well.
}
What could be the reason?
The text was updated successfully, but these errors were encountered: