@Test public void testOnSwitchConnected() { Mockito.doNothing().when(connectionHandler).handshake(connectionAdapter); connectionHandler.onSwitchConnected(connectionAdapter); Mockito.verify(registry).registerConnectionAdapter(connectionAdapter, null); Mockito.verify(connectionAdapter).setMessageListener(Matchers.any(ShimMessageListener.class)); Mockito.verify(connectionAdapter).setSystemListener(Matchers.any(ShimMessageListener.class)); Mockito.verify(connectionAdapter).setConnectionReadyListener(Matchers.any(ShimMessageListener.class)); Mockito.verify(connectionHandler).handshake(connectionAdapter); }
@Override public void onSwitchConnected(ConnectionAdapter connectionAdapter) { LOG.info("CREATING NEW LISTENER FOR {}", connectionAdapter.getRemoteAddress()); ShimMessageListener listener = new ShimMessageListener(coreConnector, connectionAdapter, shimRelay, this, notificationProviderService); mapListeners.put(connectionAdapter.getRemoteAddress(), listener); listener.registerConnectionAdaptersRegistry(connectionRegistry); listener.registerHandshakeListener(this); connectionRegistry.registerConnectionAdapter(connectionAdapter, null); connectionAdapter.setMessageListener(listener); connectionAdapter.setSystemListener(listener); connectionAdapter.setConnectionReadyListener(listener); handshake(connectionAdapter); }
ShimSwitchConnectionHandlerImpl implements SwitchConnectionHandler, ICoreListener, IHandshakeListener { @Override public void onSwitchConnected(ConnectionAdapter connectionAdapter) { LOG.info("CREATING NEW LISTENER FOR {}", connectionAdapter.getRemoteAddress()); ShimMessageListener listener = new ShimMessageListener(coreConnector, connectionAdapter, shimRelay, this, notificationProviderService); mapListeners.put(connectionAdapter.getRemoteAddress(), listener); listener.registerConnectionAdaptersRegistry(connectionRegistry); listener.registerHandshakeListener(this); connectionRegistry.registerConnectionAdapter(connectionAdapter, null); connectionAdapter.setMessageListener(listener); connectionAdapter.setSystemListener(listener); connectionAdapter.setConnectionReadyListener(listener); handshake(connectionAdapter); } }
ShimSwitchConnectionHandlerImpl implements SwitchConnectionHandler, ICoreListener, IHandshakeListener { @Override public void onSwitchConnected(ConnectionAdapter connectionAdapter) { LOG.info("CREATING NEW LISTENER FOR {}", connectionAdapter.getRemoteAddress()); ShimMessageListener listener = new ShimMessageListener(coreConnector, connectionAdapter, shimRelay, this, notificationProviderService); mapListeners.put(connectionAdapter.getRemoteAddress(), listener); listener.registerConnectionAdaptersRegistry(connectionRegistry); listener.registerHandshakeListener(this); connectionRegistry.registerConnectionAdapter(connectionAdapter, null); connectionAdapter.setMessageListener(listener); connectionAdapter.setSystemListener(listener); connectionAdapter.setConnectionReadyListener(listener); handshake(connectionAdapter); } ShimSwitchConnectionHandlerImpl(ZeroMQBaseConnector connector,
            NotificationPublishService _notificationProviderService); }
ShimSwitchConnectionHandlerImpl implements SwitchConnectionHandler, ICoreListener, IHandshakeListener { @Override public void onSwitchConnected(ConnectionAdapter connectionAdapter) { LOG.info("CREATING NEW LISTENER FOR {}", connectionAdapter.getRemoteAddress()); ShimMessageListener listener = new ShimMessageListener(coreConnector, connectionAdapter, shimRelay, this, notificationProviderService); mapListeners.put(connectionAdapter.getRemoteAddress(), listener); listener.registerConnectionAdaptersRegistry(connectionRegistry); listener.registerHandshakeListener(this); connectionRegistry.registerConnectionAdapter(connectionAdapter, null); connectionAdapter.setMessageListener(listener); connectionAdapter.setSystemListener(listener); connectionAdapter.setConnectionReadyListener(listener); handshake(connectionAdapter); } ShimSwitchConnectionHandlerImpl(ZeroMQBaseConnector connector,
            NotificationPublishService _notificationProviderService); void setSwitchFeaturesUtil(SwitchFeaturesUtil featureUtil); void init(); ShimRelay createShimRelay(); ConnectionAdaptersRegistry createConnectionAdaptersRegistry(); @Override boolean accept(InetAddress arg0); @Override void onSwitchConnected(ConnectionAdapter connectionAdapter); void handshake(ConnectionAdapter connectionAdapter); @Override void onSwitchHelloMessage(long xid, Short version, ConnectionAdapter connectionAdapter); NodeUpdated nodeAdded(ConnectionAdapter connectionAdapter); static InstanceIdentifier<Node> identifierFromDatapathId(final BigInteger datapathId); static NodeKey nodeKeyFromDatapathId(final BigInteger datapathId); static NodeId nodeIdFromDatapathId(final BigInteger datapathId); byte getMaxOFSupportedProtocol(); List<Byte> getSupportedOFProtocols(); int getNumberOfSwitches(); Pair<Protocol, ProtocolVersions> getSupportedProtocol(); void setSupportedProtocol(byte version); @Override void onOpenFlowCoreMessage(Long datapathId, ByteBuf msg, int moduleId); @Override void onHelloCoreMessage(List<Pair<Protocol, ProtocolVersions>> requestedProtocols, int moduleId); void collectGetFeaturesOuput(Future<RpcResult<GetFeaturesOutput>> switchReply,
            final ConnectionAdapter connectionAdapter); void sendGetFeaturesOuputToCore(final Short proposedVersion, final int moduleId,
            final ConnectionAdapter connectionAdapter); void sendGetFeaturesToSwitch(final Short proposedVersion, final Long xid,
            final ConnectionAdapter connectionAdapter); @Override void onSwitchDisconnected(ConnectionAdapter connectionAdapter); GetFeaturesOutput getFeaturesFromRegistry(ConnectionAdapter conn); }
ShimSwitchConnectionHandlerImpl implements SwitchConnectionHandler, ICoreListener, IHandshakeListener { @Override public void onSwitchConnected(ConnectionAdapter connectionAdapter) { LOG.info("CREATING NEW LISTENER FOR {}", connectionAdapter.getRemoteAddress()); ShimMessageListener listener = new ShimMessageListener(coreConnector, connectionAdapter, shimRelay, this, notificationProviderService); mapListeners.put(connectionAdapter.getRemoteAddress(), listener); listener.registerConnectionAdaptersRegistry(connectionRegistry); listener.registerHandshakeListener(this); connectionRegistry.registerConnectionAdapter(connectionAdapter, null); connectionAdapter.setMessageListener(listener); connectionAdapter.setSystemListener(listener); connectionAdapter.setConnectionReadyListener(listener); handshake(connectionAdapter); } ShimSwitchConnectionHandlerImpl(ZeroMQBaseConnector connector,
            NotificationPublishService _notificationProviderService); void setSwitchFeaturesUtil(SwitchFeaturesUtil featureUtil); void init(); ShimRelay createShimRelay(); ConnectionAdaptersRegistry createConnectionAdaptersRegistry(); @Override boolean accept(InetAddress arg0); @Override void onSwitchConnected(ConnectionAdapter connectionAdapter); void handshake(ConnectionAdapter connectionAdapter); @Override void onSwitchHelloMessage(long xid, Short version, ConnectionAdapter connectionAdapter); NodeUpdated nodeAdded(ConnectionAdapter connectionAdapter); static InstanceIdentifier<Node> identifierFromDatapathId(final BigInteger datapathId); static NodeKey nodeKeyFromDatapathId(final BigInteger datapathId); static NodeId nodeIdFromDatapathId(final BigInteger datapathId); byte getMaxOFSupportedProtocol(); List<Byte> getSupportedOFProtocols(); int getNumberOfSwitches(); Pair<Protocol, ProtocolVersions> getSupportedProtocol(); void setSupportedProtocol(byte version); @Override void onOpenFlowCoreMessage(Long datapathId, ByteBuf msg, int moduleId); @Override void onHelloCoreMessage(List<Pair<Protocol, ProtocolVersions>> requestedProtocols, int moduleId); void collectGetFeaturesOuput(Future<RpcResult<GetFeaturesOutput>> switchReply,
            final ConnectionAdapter connectionAdapter); void sendGetFeaturesOuputToCore(final Short proposedVersion, final int moduleId,
            final ConnectionAdapter connectionAdapter); void sendGetFeaturesToSwitch(final Short proposedVersion, final Long xid,
            final ConnectionAdapter connectionAdapter); @Override void onSwitchDisconnected(ConnectionAdapter connectionAdapter); GetFeaturesOutput getFeaturesFromRegistry(ConnectionAdapter conn); static final Long DEFAULT_XID; }