2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowjava.protocol.api.connection;
10 import com.google.common.annotations.Beta;
11 import java.math.BigInteger;
12 import java.net.InetSocketAddress;
13 import java.util.concurrent.Future;
14 import org.opendaylight.openflowjava.protocol.api.extensibility.AlienMessageListener;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolService;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
20 * Manages a switch connection.
23 * @author michal.polkorab
25 public interface ConnectionAdapter extends OpenflowProtocolService {
28 * Disconnect corresponding switch.
30 * @return future set to true, when disconnect completed
32 Future<Boolean> disconnect();
35 * Determines if the connection to the switch is alive.
37 * @return true, if connection to switch is alive
42 * Returns the address of the connected switch.
44 * @return address of the remote end - address of a switch if connected
46 InetSocketAddress getRemoteAddress();
49 * Sets the protocol message listener.
51 * @param messageListener here will be pushed all messages from switch
53 void setMessageListener(OpenflowProtocolListener messageListener);
56 * Sets the system message listener.
58 * @param systemListener here will be pushed all system messages from library
60 void setSystemListener(SystemNotificationsListener systemListener);
63 * Set handler for alien messages received from device.
65 * @param alienMessageListener here will be pushed all alien messages from switch
67 void setAlienMessageListener(AlienMessageListener alienMessageListener);
70 * Throws exception if any of required listeners is missing.
72 void checkListeners();
75 * Notify listener about connection ready-to-use event.
77 void fireConnectionReadyNotification();
80 * Set listener for connection became ready-to-use event.
82 * @param connectionReadyListener listens to connection ready event
84 void setConnectionReadyListener(ConnectionReadyListener connectionReadyListener);
87 * Sets option for automatic channel reading - if set to false, incoming messages won't be read.
89 * @param autoRead target value to be switched to
91 void setAutoRead(boolean autoRead);
94 * Determines if the channel is configured to auto-read.
96 * @return true, if channel is configured to auto-read
101 * Registers a new bypass outbound queue.
103 * @param <T> handler type
104 * @param handler queue handler
105 * @param maxQueueDepth max amount of not confirmed messaged in queue (i.e. edge for barrier message)
106 * @param maxBarrierNanos regular base for barrier message
107 * @return An {@link OutboundQueueHandlerRegistration}
110 <T extends OutboundQueueHandler> OutboundQueueHandlerRegistration<T> registerOutboundQueueHandler(T handler,
111 int maxQueueDepth, long maxBarrierNanos);
114 * Set filtering of PacketIn messages. By default these messages are not filtered.
115 * @param enabled True if PacketIn messages should be filtered, false if they should be reported.
118 void setPacketInFiltering(boolean enabled);
121 * Set datapathId for the dpn.
122 * @param datapathId of the dpn
124 void setDatapathId(BigInteger datapathId);