/* * Copyright (c) 2014, 2015 Red Hat, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.ovsdb.lib; import io.netty.channel.Channel; import java.net.InetAddress; import java.util.Collection; import org.opendaylight.aaa.cert.api.ICertificateManager; /** * OvsDBConnection Interface provides OVSDB connection management APIs 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 connect APIs to initiate Active * connections and can listen to the asynchronous Passive connections via registerConnectionListener * listener API. */ public interface OvsdbConnection { /** * connect API can be used by the applications to initiate Active connection from * the controller towards ovsdb-server. * @param address IP Address of the remote server that hosts the ovsdb server. * @param port Layer 4 port on which the remote ovsdb server is listening on. * @return OvsDBClient The primary Client interface for the ovsdb connection. */ OvsdbClient connect(InetAddress address, int port); /** * connect API can be used by the applications to initiate Active ssl * connection from the controller towards ovsdb-server. * @param address IP Address of the remote server that hosts the ovsdb server. * @param port Layer 4 port on which the remote ovsdb server is listening on. * @param certificateManagerSrv Certificate manager for SSL/TLS * @return OvsDBClient The primary Client interface for the ovsdb connection. */ OvsdbClient connectWithSsl(InetAddress address, int port, ICertificateManager certificateManagerSrv); /** * Method to disconnect an existing connection. * @param client that represents the ovsdb connection. */ void disconnect(OvsdbClient client); /** * Method to start ovsdb server for passive connection. */ boolean startOvsdbManager(); /** * Method to start ovsdb server for passive connection with SSL. */ boolean startOvsdbManagerWithSsl(String ovsdbListenIp, int ovsdbListenPort, ICertificateManager certificateManagerSrv, String[] protocols, String[] cipherSuites); /** * Method to restart ovsdb server for passive connection with SSL and user * specifies protocols and cipher suites. */ boolean restartOvsdbManagerWithSsl(String ovsdbListenIp, int ovsdbListenPort, ICertificateManager certificateManagerSrv, String[] protocols, String[] cipherSuites); /** * Method to register a Passive Connection Listener with the ConnectionService. * @param listener Passive Connection listener interested in Passive OVSDB connection requests. */ void registerConnectionListener(OvsdbConnectionListener listener); /** * Method to unregister a Passive Connection Listener with the ConnectionService. */ void unregisterConnectionListener(OvsdbConnectionListener listener); /** * Returns a Collection of all the active OVSDB Connections. * * @return Collection of all the active OVSDB Connections */ Collection getConnections(); OvsdbClient getClient(Channel channel); }