public class IpmiConnector
extends java.lang.Object
Synchronous API for connecting to BMC via IPMI.
Creating connection consists of the following steps:
Connection
and get associated with it ConnectionHandle
via
createConnection(InetAddress)
CipherSuite
s that are available for the connection via
getAvailableCipherSuites(ConnectionHandle)
CipherSuite
and PrivilegeLevel
that will
be used during session and get GetChannelAuthenticationCapabilitiesResponseData
to find out allowed
authentication options via
getChannelAuthenticationCapabilities(ConnectionHandle, CipherSuite, PrivilegeLevel)
openSession(ConnectionHandle, String, String, byte[])
Send message register via
sendMessage(ConnectionHandle, IpmiCommandCoder)
To close session call
closeSession(ConnectionHandle)
When done with work, clean up via tearDown()
Constructor and Description |
---|
IpmiConnector(int port)
Starts
IpmiConnector and initiates the ConnectionManager at the given port. |
IpmiConnector(int port,
java.net.InetAddress address)
Starts
IpmiConnector and initiates the ConnectionManager at the given port and IP interface. |
Modifier and Type | Method and Description |
---|---|
void |
closeConnection(ConnectionHandle handle)
Closes the connection with the given handle
|
void |
closeSession(ConnectionHandle connectionHandle)
Closes the session with the remote host if it is currently in open state.
|
ConnectionHandle |
createConnection(java.net.InetAddress address)
Creates connection to the remote host.
|
java.util.List<CipherSuite> |
getAvailableCipherSuites(ConnectionHandle connectionHandle)
Gets
CipherSuite s available for the connection with the remote host. |
GetChannelAuthenticationCapabilitiesResponseData |
getChannelAuthenticationCapabilities(ConnectionHandle connectionHandle,
CipherSuite cipherSuite,
PrivilegeLevel requestedPrivilegeLevel)
Gets the authentication capabilities for the connection with the remote host.
|
void |
openSession(ConnectionHandle connectionHandle,
java.lang.String username,
java.lang.String password,
byte[] bmcKey)
Establishes the session with the remote host.
|
ResponseData |
sendMessage(ConnectionHandle connectionHandle,
IpmiCommandCoder request)
Sends the IPMI message to the remote host.
|
void |
tearDown()
Finalizes the connector and closes all connections.
|
public IpmiConnector(int port) throws java.io.FileNotFoundException, java.io.IOException
IpmiConnector
and initiates the ConnectionManager
at the given port. Wildcard IP address
will be used.port
- - the port that will be used by IpmiAsyncConnector
to communicate with the remote hosts.java.io.FileNotFoundException
- when properties file was not foundjava.io.IOException
- when properties file was not foundpublic IpmiConnector(int port, java.net.InetAddress address) throws java.io.FileNotFoundException, java.io.IOException
IpmiConnector
and initiates the ConnectionManager
at the given port and IP interface.port
- - the port that will be used by IpmiAsyncConnector
to communicate with the remote hosts.address
- - the IP address that will be used by IpmiAsyncConnector
to communicate with the remote hosts.java.io.FileNotFoundException
- when properties file was not foundjava.io.IOException
- when properties file was not foundpublic ConnectionHandle createConnection(java.net.InetAddress address) throws java.io.FileNotFoundException, java.io.IOException
address
- - InetAddress
of the remote hostjava.io.IOException
- when properties file was not foundjava.io.FileNotFoundException
- when properties file was not foundpublic java.util.List<CipherSuite> getAvailableCipherSuites(ConnectionHandle connectionHandle) throws java.lang.Exception
CipherSuite
s available for the connection with the remote host.connectionHandle
- ConnectionHandle
to the connection created beforeCipherSuite
s that are allowed during the connectionjava.lang.Exception
- when sending message to the managed system failscreateConnection(InetAddress)
public GetChannelAuthenticationCapabilitiesResponseData getChannelAuthenticationCapabilities(ConnectionHandle connectionHandle, CipherSuite cipherSuite, PrivilegeLevel requestedPrivilegeLevel) throws java.lang.Exception
connectionHandle
- - ConnectionHandle
associated with the hostcipherSuite
- - CipherSuite
that will be used during the connectionrequestedPrivilegeLevel
- - PrivilegeLevel
that is requested for the sessionGetChannelAuthenticationCapabilitiesResponseData
ConnectionException
- when connection is in the state that does not allow to perform this operation.java.lang.Exception
- when sending message to the managed system failspublic void openSession(ConnectionHandle connectionHandle, java.lang.String username, java.lang.String password, byte[] bmcKey) throws java.lang.Exception
connectionHandle
- - ConnectionHandle
associated with the remote host.username
- - the usernamepassword
- - password matching the usernamebmcKey
- - the key that should be provided if the two-key authentication is enabled, null otherwise.ConnectionException
- when connection is in the state that does not allow to perform this operation.java.lang.Exception
- when sending message to the managed system or initializing one of the cipherSuite's algorithms failspublic void closeSession(ConnectionHandle connectionHandle) throws java.lang.Exception
connectionHandle
- - ConnectionHandle
associated with the remote host.ConnectionException
- when connection is in the state that does not allow to perform this operation.java.lang.Exception
- when sending message to the managed system or initializing one of the cipherSuite's algorithms failspublic ResponseData sendMessage(ConnectionHandle connectionHandle, IpmiCommandCoder request) throws java.lang.Exception
connectionHandle
- - ConnectionHandle
associated with the remote host.request
- - IpmiCommandCoder
containing the request to be sentResponseData
for the requestConnectionException
- when connection is in the state that does not allow to perform this operation.java.lang.Exception
- when sending message to the managed system or initializing one of the cipherSuite's algorithms failspublic void closeConnection(ConnectionHandle handle)
public void tearDown()