import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-public abstract class AbstractModelDrivenSwitchRegistration extends AbstractObjectRegistration<ModelDrivenSwitch>
- implements ModelDrivenSwitchRegistration {
+public abstract class AbstractModelDrivenSwitchRegistration
+ extends AbstractObjectRegistration<ModelDrivenSwitch>
+ implements ModelDrivenSwitchRegistration {
protected AbstractModelDrivenSwitchRegistration(final ModelDrivenSwitch instance) {
super(instance);
import org.opendaylight.yangtools.yang.binding.DataObject;
-/**
- * @author mirehak
- */
public interface ConnectionConductor {
- /** distinguished connection states */
- public enum CONDUCTOR_STATE {
- /** initial phase of talking to switch */
+ /** distinguished connection states. */
+ @SuppressWarnings({"checkstyle:abbreviationaswordinname", "checkstyle:typename"})
+ enum CONDUCTOR_STATE {
+ /** initial phase of talking to switch. */
HANDSHAKING,
- /** standard phase - interacting with switch */
+ /** standard phase - interacting with switch. */
WORKING,
- /** connection is idle, waiting for echo reply from switch */
+ /** connection is idle, waiting for echo reply from switch. */
TIMEOUTING,
- /** talking to switch is over - resting in pieces */
+ /** talking to switch is over - resting in pieces. */
RIP
}
- /** supported version ordered by height (highest version is at the beginning) */
- List<Short> versionOrder = Lists.newArrayList((short) 0x04, (short) 0x01);
+ /** supported version ordered by height (highest version is at the beginning). */
+ List<Short> VERSION_ORDER = Lists.newArrayList((short) 0x04, (short) 0x01);
/**
- * initialize wiring around {@link ConnectionAdapter}
+ * initialize wiring around {@link ConnectionAdapter}.
*/
void init();
/**
- * @return the negotiated version
+ * return the negotiated version.
*/
Short getVersion();
/**
- * @return the state of conductor
+ * return the state of conductor.
*/
CONDUCTOR_STATE getConductorState();
/**
- * @param conductorState
+ * Setter.
+ * @param conductorState state
*/
void setConductorState(CONDUCTOR_STATE conductorState);
/**
- * terminates owned connection
+ * terminates owned connection.
* @return future result of disconnect action
*/
Future<Boolean> disconnect();
/**
- * assign corresponding {@link SessionContext} to this conductor (to handle disconnect caused by switch)
- * @param context
+ * assign corresponding {@link SessionContext} to this conductor (to handle disconnect caused by switch).
+ * @param context session context
*/
void setSessionContext(SessionContext context);
/**
- * assign corresponding {@link org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher} to this conductor
- * to handle disconnect caused by switch. This involves auxiliary conductors only.
- * @param auxiliaryKey
+ * assign corresponding {@link org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher}
+ * to this conductor to handle disconnect caused by switch. This involves auxiliary conductors only.
+ * @param auxiliaryKey key
*/
void setConnectionCookie(SwitchConnectionDistinguisher auxiliaryKey);
/**
- * @return the sessionContext
+ * return the sessionContext.
*/
SessionContext getSessionContext();
/**
- * @return the auxiliaryKey (null if this is a primary connection)
+ * return the auxiliaryKey (null if this is a primary connection).
*/
SwitchConnectionDistinguisher getAuxiliaryKey();
/**
- * @return the connectionAdapter
+ * return the connectionAdapter.
*/
ConnectionAdapter getConnectionAdapter();
/**
- * assign global queueKeeper
- * @param queueKeeper
+ * assign global queueKeeper.
+ * @param queueKeeper keeper
*/
void setQueueProcessor(QueueProcessor<OfHeader, DataObject> queueKeeper);
/**
+ * Setter.
* @param errorHandler for internal exception handling
*/
void setErrorHandler(ErrorHandler errorHandler);
/**
- * @param conductorId
+ * Setter.
+ * @param conductorId id
*/
void setId(int conductorId);
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
-/**
- * @author mirehak
- *
- */
public interface ErrorHandler {
/**
- * @param e cause
+ * Exception handler.
+ * @param throwable cause
* @param sessionContext of source
*/
- void handleException(Throwable e, SessionContext sessionContext);
+ void handleException(Throwable throwable, SessionContext sessionContext);
}
import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
-/**
- * @author mirehak
- *
- */
public interface HandshakeListener {
/**
+ * Handshake successfull.
* @param featureOutput obtained
* @param version negotiated
*/
void onHandshakeFailure();
/**
- * @param handshakeContext
+ * Setter.
+ * @param handshakeContext context
*/
void setHandshakeContext(HandshakeContext handshakeContext);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
-/**
- * @author mirehak
- */
public interface HandshakeManager {
/**
- * @return negotiated version
+ * return negotiated version.
*/
Short getVersion();
/**
+ * Setter.
* @param errorHandler the errorHandler to set
*/
void setErrorHandler(ErrorHandler errorHandler);
/**
+ * Setter.
* @param handshakeListener the handshakeListener to set
*/
void setHandshakeListener(HandshakeListener handshakeListener);
/**
- * @param isBitmapNegotiationEnable
+ * should use negotiation bit map.
+ * @param isBitmapNegotiationEnable yes/no
*/
void setUseVersionBitmap(boolean isBitmapNegotiationEnable);
/**
+ * process current handshake step.
* @param receivedHello message from device we need to act upon
- * process current handshake step
*/
void shake(HelloMessage receivedHello);
}
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
/**
- * translates between messages
+ * translates between messages.
* @param <I> source message type (IN)
* @param <O> result message type (OUT)
*/
/**
* This method is called in order to translate message to MD-SAL or from MD-SAL.
- *
- * @param cookie
- * auxiliary connection identifier
- * @param sc
- * The SessionContext which sent the OF message
- * @param msg
- * The OF message
- *
+ * @param cookie auxiliary connection identifier
+ * @param sc The SessionContext which sent the OF message
+ * @param msg The OF message
* @return translated message
*/
O translate(SwitchConnectionDistinguisher cookie, SessionContext sc, I msg);
-/**
+/*
* Copyright (c) 2014 Cisco Systems, 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.openflowplugin.api.openflow.md.core;
/**
- * provider of wrapped notification enqueue
+ * provider of wrapped notification enqueue.
*/
public interface NotificationEnqueuer {
/**
- * enqueue given notification into standard message processing queue
- *
- * @param notification
+ * enqueue given notification into standard message processing queue.
+ * @param notification notification
*/
void enqueueNotification(NotificationQueueWrapper notification);
-/**
+/*
* Copyright (c) 2014 Cisco Systems, 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
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.opendaylight.yangtools.yang.binding.Notification;
-/**
- *
- */
public class NotificationQueueWrapper implements OfHeader {
-
+
private final Notification notification;
private final Short version;
private Long xid = -1L;
-
+
/**
- * @param notification
- * @param version
+ * Notofication queue wrapper.
+ * @param notification notofication
+ * @param version version
*/
public NotificationQueueWrapper(final Notification notification, final Short version) {
Preconditions.checkArgument(notification != null, "wrapped notification must not be null");
Preconditions.checkArgument(version != null, "message version of wrapped notification must not be null");
- this.notification = notification;
+ this.notification = notification;
this.version = version;
}
}
/**
- * @return the notification
+ * return the notification.
*/
public Notification getNotification() {
return notification;
}
/**
+ * Setter.
* @param xid the xid to set
*/
public void setXid(Long xid) {
private HandshakeManager createHandshakeManager(final ConnectionAdapter connectionAdapter,
final HandshakeListener handshakeListener) {
HandshakeManagerImpl handshakeManager = new HandshakeManagerImpl(connectionAdapter,
- ConnectionConductor.versionOrder.get(0),
- ConnectionConductor.versionOrder);
+ ConnectionConductor.VERSION_ORDER.get(0),
+ ConnectionConductor.VERSION_ORDER);
handshakeManager.setUseVersionBitmap(BITMAP_NEGOTIATION_ENABLED);
handshakeManager.setHandshakeListener(handshakeListener);
handshakeManager.setErrorHandler(new ErrorHandlerSimpleImpl());
conductorState = CONDUCTOR_STATE.HANDSHAKING;
firstHelloProcessed = false;
handshakeManager = new HandshakeManagerImpl(connectionAdapter,
- ConnectionConductor.versionOrder.get(0),
- ConnectionConductor.versionOrder);
+ ConnectionConductor.VERSION_ORDER.get(0),
+ ConnectionConductor.VERSION_ORDER);
handshakeManager.setUseVersionBitmap(isBitmapNegotiationEnable);
handshakeManager.setHandshakeListener(this);
portFeaturesUtils = PortFeaturesUtil.getInstance();
for(Elements element : list) {
List<Boolean> bitmap = element.getVersionBitmap();
// check for version bitmap
- for(short bitPos : ConnectionConductor.versionOrder) {
+ for(short bitPos : ConnectionConductor.VERSION_ORDER) {
// with all the version it should work.
if(bitmap.get(bitPos % Integer.SIZE)) {
supportedHighestVersion = bitPos;
@Before
public void setUp() {
handshakeManager = new HandshakeManagerImpl(adapter, OFConstants.OFP_VERSION_1_3,
- ConnectionConductor.versionOrder);
+ ConnectionConductor.VERSION_ORDER);
handshakeManager.setErrorHandler(errorHandler);
handshakeManager.setHandshakeListener(handshakeListener);
handshakeManager.setUseVersionBitmap(false);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements;
-/**
- * @author mirehak
- *
- */
public class MessageFactoryTest {
- /**
- * Test method for {@link org.opendaylight.openflowplugin.openflow.md.core.MessageFactory#createHelloInputWoElements(java.lang.Short, java.lang.Long)}.
- */
@Test
public void testCreateHelloInputWoElements() {
short highestVersion = (short) 0x04;
Assert.assertNull(helloMsg.getElements());
}
- /**
- * Test method for {@link org.opendaylight.openflowplugin.openflow.md.core.MessageFactory#createHelloInputWithElements(java.lang.Short, java.lang.Long, java.util.List)}.
- */
@Test
public void testCreateHelloInputWithElements() {
short highestVersion = (short) 0x04;
false, true, false, false, true};
HelloInput helloMsg = MessageFactory.createHelloInput(highestVersion, xid,
- ConnectionConductor.versionOrder);
+ ConnectionConductor.VERSION_ORDER);
Assert.assertEquals(highestVersion, helloMsg.getVersion().shortValue());
Assert.assertEquals(xid, helloMsg.getXid().longValue());
Assert.assertEquals(1, helloMsg.getElements().size());