Package org.opendaylight.ovsdb.lib.impl
Class OvsdbConnectionService
- java.lang.Object
-
- org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService
-
- All Implemented Interfaces:
AutoCloseable,OvsdbConnection
@Singleton public class OvsdbConnectionService extends Object implements AutoCloseable, OvsdbConnection
OvsDBConnectionService provides OVSDB connection management functionality which includes both Active and Passive connections. From the Library perspective, Active OVSDB connections are those that are initiated from the Controller towards the ovsdb-manager. While Passive OVSDB connections are those that are initiated from the ovs towards the controller.Applications that use OvsDBConnectionService can use the OvsDBConnection class' connect APIs to initiate Active connections and can listen to the asynchronous Passive connections via registerConnectionListener listener API.
The library is designed as Java modular component that can work in both OSGi and non-OSGi environment. Hence a single instance of the service will be active (via Service Registry in OSGi) and a Singleton object in a non-OSGi environment.
-
-
Constructor Summary
Constructors Constructor Description OvsdbConnectionService(NettyBootstrapFactory bootstrapFactory, org.opendaylight.aaa.cert.api.ICertificateManager certManagerSrv)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidchannelClosed(OvsdbClient client)voidclose()OvsdbClientconnect(InetAddress address, int port)If the SSL flag is enabled, the method internally will establish TLS communication using the default ODL certificateManager SSLContext and attributes.OvsdbClientconnectWithSsl(InetAddress address, int port, org.opendaylight.aaa.cert.api.ICertificateManager certificateManagerSrv)connect API can be used by the applications to initiate Active ssl connection from the controller towards ovsdb-server.voiddisconnect(OvsdbClient client)Method to disconnect an existing connection.OvsdbClientgetClient(io.netty.channel.Channel channel)Collection<OvsdbClient>getConnections()Returns a Collection of all the active OVSDB Connections.static voidnotifyListenerForPassiveConnection(OvsdbClient client)voidregisterConnectionListener(OvsdbConnectionListener listener)Method to register a Passive Connection Listener with the ConnectionService.booleanrestartOvsdbManagerWithSsl(String ovsdbListenIp, int ovsdbListenPort, org.opendaylight.aaa.cert.api.ICertificateManager certificateManagerSrv, String[] protocols, String[] cipherSuites)Method to restart ovsdb server for passive connection with SSL and user specifies protocols and cipher suites.voidsetJsonRpcDecoderMaxFrameLength(int maxFrameLength)Blueprint property setter method.voidsetOvsdbListenerIp(String ip)voidsetOvsdbListenerPort(int portNumber)voidsetOvsdbRpcTaskTimeout(int timeout)voidsetUseSsl(boolean flag)Set useSSL flag.booleanstartOvsdbManager()Method that initiates the Passive OVSDB channel listening functionality.booleanstartOvsdbManagerWithSsl(String ovsdbListenIp, int ovsdbListenPort, org.opendaylight.aaa.cert.api.ICertificateManager certificateManagerSrv, String[] protocols, String[] cipherSuites)Method that initiates the Passive OVSDB channel listening functionality with ssl.By default the ovsdb passive connection will listen in port 6640 which can be overridden using the ovsdb.listenPort system property.voidunregisterConnectionListener(OvsdbConnectionListener listener)Method to unregister a Passive Connection Listener with the ConnectionService.voidupdateConfigParameter(Map<String,Object> configParameters)
-
-
-
Constructor Detail
-
OvsdbConnectionService
@Inject public OvsdbConnectionService(NettyBootstrapFactory bootstrapFactory, org.opendaylight.aaa.cert.api.ICertificateManager certManagerSrv)
-
-
Method Detail
-
connect
public OvsdbClient connect(InetAddress address, int port)
If the SSL flag is enabled, the method internally will establish TLS communication using the default ODL certificateManager SSLContext and attributes.- Specified by:
connectin interfaceOvsdbConnection- Parameters:
address- IP Address of the remote server that hosts the ovsdb server.port- Layer 4 port on which the remote ovsdb server is listening on.- Returns:
- OvsDBClient The primary Client interface for the ovsdb connection.
-
connectWithSsl
public OvsdbClient connectWithSsl(InetAddress address, int port, org.opendaylight.aaa.cert.api.ICertificateManager certificateManagerSrv)
Description copied from interface:OvsdbConnectionconnect API can be used by the applications to initiate Active ssl connection from the controller towards ovsdb-server.- Specified by:
connectWithSslin interfaceOvsdbConnection- Parameters:
address- IP Address of the remote server that hosts the ovsdb server.port- Layer 4 port on which the remote ovsdb server is listening on.certificateManagerSrv- Certificate manager for SSL/TLS- Returns:
- OvsDBClient The primary Client interface for the ovsdb connection.
-
disconnect
public void disconnect(OvsdbClient client)
Description copied from interface:OvsdbConnectionMethod to disconnect an existing connection.- Specified by:
disconnectin interfaceOvsdbConnection- Parameters:
client- that represents the ovsdb connection.
-
registerConnectionListener
public void registerConnectionListener(OvsdbConnectionListener listener)
Description copied from interface:OvsdbConnectionMethod to register a Passive Connection Listener with the ConnectionService.- Specified by:
registerConnectionListenerin interfaceOvsdbConnection- Parameters:
listener- Passive Connection listener interested in Passive OVSDB connection requests.
-
unregisterConnectionListener
public void unregisterConnectionListener(OvsdbConnectionListener listener)
Description copied from interface:OvsdbConnectionMethod to unregister a Passive Connection Listener with the ConnectionService.- Specified by:
unregisterConnectionListenerin interfaceOvsdbConnection
-
startOvsdbManager
public boolean startOvsdbManager()
Method that initiates the Passive OVSDB channel listening functionality. By default the ovsdb passive connection will listen in port 6640 which can be overridden using the ovsdb.listenPort system property.- Specified by:
startOvsdbManagerin interfaceOvsdbConnection
-
startOvsdbManagerWithSsl
public boolean startOvsdbManagerWithSsl(String ovsdbListenIp, int ovsdbListenPort, org.opendaylight.aaa.cert.api.ICertificateManager certificateManagerSrv, String[] protocols, String[] cipherSuites)
Method that initiates the Passive OVSDB channel listening functionality with ssl.By default the ovsdb passive connection will listen in port 6640 which can be overridden using the ovsdb.listenPort system property.- Specified by:
startOvsdbManagerWithSslin interfaceOvsdbConnection
-
restartOvsdbManagerWithSsl
public boolean restartOvsdbManagerWithSsl(String ovsdbListenIp, int ovsdbListenPort, org.opendaylight.aaa.cert.api.ICertificateManager certificateManagerSrv, String[] protocols, String[] cipherSuites)
Description copied from interface:OvsdbConnectionMethod to restart ovsdb server for passive connection with SSL and user specifies protocols and cipher suites.- Specified by:
restartOvsdbManagerWithSslin interfaceOvsdbConnection
-
channelClosed
public static void channelClosed(OvsdbClient client)
-
getConnections
public Collection<OvsdbClient> getConnections()
Description copied from interface:OvsdbConnectionReturns a Collection of all the active OVSDB Connections.- Specified by:
getConnectionsin interfaceOvsdbConnection- Returns:
- Collection of all the active OVSDB Connections
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
getClient
public OvsdbClient getClient(io.netty.channel.Channel channel)
- Specified by:
getClientin interfaceOvsdbConnection
-
notifyListenerForPassiveConnection
public static void notifyListenerForPassiveConnection(OvsdbClient client)
-
setOvsdbRpcTaskTimeout
public void setOvsdbRpcTaskTimeout(int timeout)
-
setUseSsl
public void setUseSsl(boolean flag)
Set useSSL flag.- Parameters:
flag- boolean for using ssl
-
setJsonRpcDecoderMaxFrameLength
public void setJsonRpcDecoderMaxFrameLength(int maxFrameLength)
Blueprint property setter method. Blueprint call this method and set the value of json rpc decoder max frame length to the value configured for config option (json-rpc-decoder-max-frame-length) in the configuration file. This option is only configured at the boot time of the controller. Any change at the run time will have no impact.- Parameters:
maxFrameLength- Max frame length (default : 100000)
-
setOvsdbListenerIp
public void setOvsdbListenerIp(String ip)
-
setOvsdbListenerPort
public void setOvsdbListenerPort(int portNumber)
-
-