forked from Juniper/netconf-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to ssh library and bug fixes.
* Replaced the ssh library with [sshj](https://github.com/hierynomus/sshj) * Adds support for new ssh crypto algorithms * Adds support for FIPS compliant algorithms * More modern ssh implementation * Added support for importing and building the library with maven * Added FindBugs code testing to maven build This is a major change to the netconf-java library. This version changes how Devices are created. Instead of passing in parameters in a constructor, Device now uses a Builder. This allows passing in whichver parameters you need and creating a unique Device object. Once created, you no longer change change attributes like userName or port. You would need to create a new Device object. See the Examples/CreateDevice class for examples on how to create a new Device.
- Loading branch information
Peter Hill
committed
Jun 25, 2019
1 parent
5d189cb
commit e8bf727
Showing
669 changed files
with
11,106 additions
and
117,199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import net.juniper.netconf.Device; | ||
import net.juniper.netconf.NetconfException; | ||
|
||
class CreateDevice { | ||
|
||
private static final String HOSTNAME = "HOSTNAME"; | ||
private static final String USERNAME = "username"; | ||
private static final String PASSWORD = "passwd!"; | ||
private static final String PEM_KEY_FILE_PATH = "/tmp/pemFile"; | ||
|
||
|
||
/** | ||
* Create a new Device using username and password authentication. | ||
* | ||
* @return an unconnected Device object. | ||
* @throws NetconfException if there are issues creating the Device. | ||
*/ | ||
public static Device createDevice() throws NetconfException { | ||
return Device.builder() | ||
.hostName(HOSTNAME) | ||
.userName(USERNAME) | ||
.password(PASSWORD) | ||
.strictHostKeyChecking(false) | ||
.build(); | ||
} | ||
|
||
/** | ||
* Create a new Device using username and public key file. | ||
* | ||
* @param keyFile the path to a private key file used to authenticate to the Device. | ||
* @return an unconnected Device object. | ||
* @throws NetconfException if there are issues creating the Device. | ||
*/ | ||
public static Device createDeviceWithKeyAuth(String keyFile) throws NetconfException { | ||
return Device.builder() | ||
.hostName(HOSTNAME) | ||
.userName(USERNAME) | ||
.pemKeyFile(PEM_KEY_FILE_PATH) | ||
.strictHostKeyChecking(false) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.