2 * Copyright (c) 2015 Cisco Systems, Inc. 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.openflowplugin.api.openflow.device;
10 import com.google.common.annotations.Beta;
11 import java.util.List;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
14 import org.opendaylight.openflowplugin.api.openflow.FlowGroupInfoHistory;
15 import org.opendaylight.openflowplugin.api.openflow.OFPContext;
16 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
17 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceReplyProcessor;
18 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
19 import org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainStateListener;
20 import org.opendaylight.openflowplugin.api.openflow.lifecycle.DeviceInitializationContext;
21 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
25 * The central entity of OFP is the Device Context, which encapsulate the logical state of a switch
26 * as seen by the controller. Each OpenFlow session is tracked by a Connection Context.
27 * These attach to a particular Device Context in such a way, that there is at most one primary
28 * session associated with a Device Context. Whenever the controller needs to interact with a
29 * particular switch, it will do so in the context of the calling thread, obtaining a lock on
30 * the corresponding Device Context – thus the Device Context becomes the fine-grained point
31 * of synchronization. The only two entities allowed to send requests towards the switch are
32 * Statistics Manager and RPC Manager. Each of them allocates a Request Context for interacting
33 * with a particular Device Context. The Request Contexts are the basic units of fairness,
34 * which is enforced by keeping a cap on the number of outstanding requests a particular Request
35 * Context can have at any point in time. Should this quota be exceeded, any further attempt to make
36 * a request to the switch will fail immediately, with proper error indication.
38 public interface DeviceContext extends
44 ContextChainStateListener,
45 DeviceInitializationContext {
48 * Method provides state of device represented by this device context.
50 * @return {@link DeviceState}
52 DeviceState getDeviceState();
57 * @return current devices connection context
59 ConnectionContext getPrimaryConnectionContext();
64 * @return translator library
66 TranslatorLibrary oook();
69 * Sets notification publish service.
71 * @param notificationPublishService the notification publish service
73 void setNotificationPublishService(NotificationPublishService notificationPublishService);
78 * @return the message spy
80 MessageSpy getMessageSpy();
83 * Gets multi msg collector.
85 * @param <T> the type parameter
86 * @param requestContext the request context
87 * @return the multi msg collector
89 <T extends OfHeader> MultiMsgCollector<T> getMultiMsgCollector(RequestContext<List<T>> requestContext);
92 * Indicates that device context is fully published (e.g.: packetIn messages should be passed).
97 * change packetIn rate limiter borders.
98 * @param upperBound max amount of outstanding packetIns
100 void updatePacketInRateLimit(long upperBound);
103 * Checks if device and controller supports single layer serialization.
104 * @return true if single layer serialization is supported
106 boolean canUseSingleLayerSerialization();
109 * Method for initial submit transaction after successful initial gathering.
111 boolean initialSubmitTransaction();
114 * Checks if the statistics polling property is enabled.
115 * @return true if statistics polling is enabled.
117 boolean isStatisticsPollingOn();
120 @Nullable FlowGroupInfoHistory getFlowGroupInfoHistory();