import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;
import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderImpl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
* @author michal.polkorab
*
*/
-public class MockPlugin implements OpenflowProtocolListener, SwitchConnectionHandler,
+public class MockPlugin implements OpenflowProtocolListener, SwitchConnectionHandler,
SystemNotificationsListener, ConnectionReadyListener {
protected static final Logger LOGGER = LoggerFactory.getLogger(MockPlugin.class);
finishedFuture = SettableFuture.create();
LOGGER.debug("mockPlugin: "+System.identityHashCode(this));
}
-
+
@Override
public void onSwitchConnected(ConnectionAdapter connection) {
LOGGER.debug("onSwitchConnected: " + connection);
@Override
public void onErrorMessage(ErrorMessage notification) {
LOGGER.debug("Error message received");
-
+
}
@Override
public void onExperimenterMessage(ExperimenterMessage notification) {
LOGGER.debug("Experimenter message received");
-
+
}
@Override
public void onFlowRemovedMessage(FlowRemovedMessage notification) {
LOGGER.debug("FlowRemoved message received");
-
+
}
@Override
}).start();
}
-
+
protected void getSwitchFeatures() {
GetFeaturesInputBuilder featuresBuilder = new GetFeaturesInputBuilder();
featuresBuilder.setVersion((short) 4);
Future<Boolean> disconnect = adapter.disconnect();
disconnect.get();
LOGGER.debug("MockPlugin.shutdown() Disconnected");
- }
+ }
} catch (Exception e) {
LOGGER.error("MockPlugin.shutdown() exception caught: ", e.getMessage(), e);
}
@Override
public void onMultipartReplyMessage(MultipartReplyMessage notification) {
LOGGER.debug("MultipartReply message received");
-
+
}
@Override
LOGGER.debug("Reason: " + notification.getReason());
LOGGER.debug("TableId: " + notification.getTableId());
LOGGER.debug("Cookie: " + notification.getCookie());
- LOGGER.debug("Class: " + notification.getMatch().getMatchEntries().get(0).getOxmClass());
- LOGGER.debug("Field: " + notification.getMatch().getMatchEntries().get(0).getOxmMatchField());
+ LOGGER.debug("Class: " + notification.getMatch().getMatchEntry().get(0).getOxmClass());
+ LOGGER.debug("Field: " + notification.getMatch().getMatchEntry().get(0).getOxmMatchField());
LOGGER.debug("Datasize: " + notification.getData().length);
}
@Override
public void onPortStatusMessage(PortStatusMessage notification) {
LOGGER.debug("MockPlugin.onPortStatusMessage() message received");
-
+
}
@Override
public int getIdleCounter() {
return idleCounter;
}
-
+
@Override
public void onConnectionReady() {
LOGGER.trace("MockPlugin().onConnectionReady()");
}
-
+ /**
+ * Initiates connection to device
+ * @param switchConnectionProvider
+ * @param host - host IP
+ * @param port - port number
+ */
+ public void initiateConnection(SwitchConnectionProviderImpl switchConnectionProvider, String host, int port) {
+ LOGGER.trace("MockPlugin().initiateConnection()");
+ switchConnectionProvider.initiateConnection(host, port);
+ }
}