@Test public void testAddConnection() throws Exception { assertEquals(0, node.getAllConnections().size()); List<SxpPeer> sxpPeers = new ArrayList<>(); Connection connection = mockConnection(ConnectionMode.Listener, ConnectionState.On); sxpPeers.add(new SxpPeerBuilder().setPeerAddress(connection.getPeerAddress()).build()); node.addPeerGroup(getGroup("TEST", null, sxpPeers)); node.addFilterToPeerGroup("TEST", getFilter(FilterType.Inbound)); node.addConnection(connection); assertEquals(1, node.getAllConnections().size()); node.addConnection(mockConnection(ConnectionMode.Both, ConnectionState.On)); assertEquals(2, node.getAllConnections().size()); }
public SxpConnection addConnection(SxpConnection connection) { synchronized (peerGroupMap) { for (SxpPeerGroup peerGroup : getPeerGroup(connection)) { for (SxpFilter filter : peerGroup.getSxpFilter()) { connection.putFilter(SxpBindingFilter.generateFilter(filter, peerGroup.getName())); } } } synchronized (sxpDomains) { if (!sxpDomains.containsKey(connection.getDomainName())) { LOG.warn("{} Domain {} does not exist", this, connection.getDomainName()); throw new DomainNotFoundException(getName(), connection.getDomainName()); } sxpDomains.get(connection.getDomainName()).putConnection(connection); } if (connection.hasNonEmptyPassword()) { updateMD5keys(); } Future<Void> openConnection = connection.openConnection(); openConnection.addListener((FutureListener<Void>) future -> { if (!future.isSuccess() && !future.isCancelled()) { LOG.warn("{} Failed to connect to remote peer, scheduling retry", connection); connection.scheduleRetryOpen(); } }); return connection; }
SxpNode { public SxpConnection addConnection(SxpConnection connection) { synchronized (peerGroupMap) { for (SxpPeerGroup peerGroup : getPeerGroup(connection)) { for (SxpFilter filter : peerGroup.getSxpFilter()) { connection.putFilter(SxpBindingFilter.generateFilter(filter, peerGroup.getName())); } } } synchronized (sxpDomains) { if (!sxpDomains.containsKey(connection.getDomainName())) { LOG.warn("{} Domain {} does not exist", this, connection.getDomainName()); throw new DomainNotFoundException(getName(), connection.getDomainName()); } sxpDomains.get(connection.getDomainName()).putConnection(connection); } if (connection.hasNonEmptyPassword()) { updateMD5keys(); } Future<Void> openConnection = connection.openConnection(); openConnection.addListener((FutureListener<Void>) future -> { if (!future.isSuccess() && !future.isCancelled()) { LOG.warn("{} Failed to connect to remote peer, scheduling retry", connection); connection.scheduleRetryOpen(); } }); return connection; } }
SxpNode { public SxpConnection addConnection(SxpConnection connection) { synchronized (peerGroupMap) { for (SxpPeerGroup peerGroup : getPeerGroup(connection)) { for (SxpFilter filter : peerGroup.getSxpFilter()) { connection.putFilter(SxpBindingFilter.generateFilter(filter, peerGroup.getName())); } } } synchronized (sxpDomains) { if (!sxpDomains.containsKey(connection.getDomainName())) { LOG.warn("{} Domain {} does not exist", this, connection.getDomainName()); throw new DomainNotFoundException(getName(), connection.getDomainName()); } sxpDomains.get(connection.getDomainName()).putConnection(connection); } if (connection.hasNonEmptyPassword()) { updateMD5keys(); } Future<Void> openConnection = connection.openConnection(); openConnection.addListener((FutureListener<Void>) future -> { if (!future.isSuccess() && !future.isCancelled()) { LOG.warn("{} Failed to connect to remote peer, scheduling retry", connection); connection.scheduleRetryOpen(); } }); return connection; } protected  SxpNode(NodeId nodeId, SxpNodeIdentity node, ThreadsWorker worker); }
SxpNode { public SxpConnection addConnection(SxpConnection connection) { synchronized (peerGroupMap) { for (SxpPeerGroup peerGroup : getPeerGroup(connection)) { for (SxpFilter filter : peerGroup.getSxpFilter()) { connection.putFilter(SxpBindingFilter.generateFilter(filter, peerGroup.getName())); } } } synchronized (sxpDomains) { if (!sxpDomains.containsKey(connection.getDomainName())) { LOG.warn("{} Domain {} does not exist", this, connection.getDomainName()); throw new DomainNotFoundException(getName(), connection.getDomainName()); } sxpDomains.get(connection.getDomainName()).putConnection(connection); } if (connection.hasNonEmptyPassword()) { updateMD5keys(); } Future<Void> openConnection = connection.openConnection(); openConnection.addListener((FutureListener<Void>) future -> { if (!future.isSuccess() && !future.isCancelled()) { LOG.warn("{} Failed to connect to remote peer, scheduling retry", connection); connection.scheduleRetryOpen(); } }); return connection; } protected  SxpNode(NodeId nodeId, SxpNodeIdentity node, ThreadsWorker worker); static SxpNode createInstance(NodeId nodeId, SxpNodeIdentity node); static SxpNode createInstance(NodeId nodeId, SxpNodeIdentity node, MasterDatabaseInf masterDatabase,
            SxpDatabaseInf sxpDatabase); static SxpNode createInstance(NodeId nodeId, SxpNodeIdentity node, MasterDatabaseInf masterDatabase,
            SxpDatabaseInf sxpDatabase, ThreadsWorker worker); SxpConnection addConnection(SxpConnection connection); boolean addPeerGroup(SxpPeerGroup peerGroup); SxpPeerGroup getPeerGroup(String peerGroupName); SxpPeerGroup removePeerGroup(String peerGroupName); Collection<SxpPeerGroup> getPeerGroups(); boolean addFilterToPeerGroup(String peerGroupName, SxpFilter sxpFilter); SxpFilter updateFilterInPeerGroup(String peerGroupName, SxpFilter newFilter); boolean removeFilterFromPeerGroup(String peerGroupName, FilterType filterType, FilterSpecific specific); boolean addDomain(
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain); boolean addDomain(
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain,
            MasterDatabaseInf masterDB,
            SxpDatabaseInf sxpDB); SxpDomain removeDomain(String domainName); SxpDomain getDomain(String name); Collection<SxpDomain> getDomains(); boolean addFilterToDomain(String domain, DomainFilter filter); SxpBindingFilter removeFilterFromDomain(String domain, FilterSpecific specific, String filterName); boolean updateDomainFilter(String domain, DomainFilter newFilter); @Deprecated void addConnection(Connection connection); SxpConnection addConnection(Connection connection, String domain); @Deprecated void addConnections(Connections connections); void addConnections(Connections connections, String domain); List<SxpConnection> getAllConnections(); List<SxpConnection> getAllConnections(String domain); InetAddress getSourceIp(); List<SxpConnection> getAllDeleteHoldDownConnections(); List<SxpConnection> getAllDeleteHoldDownConnections(String domain); List<SxpConnection> getAllOffConnections(); List<SxpConnection> getAllOffConnections(String domain); List<SxpConnection> getAllOnConnections(); List<SxpConnection> getAllOnConnections(String domain); @Deprecated List<SxpConnection> getAllOnListenerConnections(); List<SxpConnection> getAllOnListenerConnections(String domain); @Deprecated List<SxpConnection> getAllOnSpeakerConnections(); List<SxpConnection> getAllOnSpeakerConnections(String domain); @Deprecated MasterDatabaseInf getBindingMasterDatabase(); @Deprecated SxpDatabaseInf getBindingSxpDatabase(); MasterDatabaseInf getBindingMasterDatabase(String domainName); SxpDatabaseInf getBindingSxpDatabase(String domainName); SxpConnection getByAddress(final InetSocketAddress inetSocketAddress); @Deprecated SxpConnection getByPort(final int port); SxpConnection getConnection(SocketAddress socketAddress); int getExpansionQuantity(); int getHoldTime(); int getHoldTimeMax(); int getHoldTimeMin(); int getHoldTimeMinAcceptable(); int getKeepAliveTime(); String getName(); NodeId getNodeId(); String getPassword(); int getRetryOpenTime(); int getServerPort(); ListenableScheduledFuture<?> getTimer(TimerType timerType); Version getVersion(); boolean isEnabled(); synchronized ListenableFuture openConnections(); BindingDispatcher getSvcBindingDispatcher(); BindingHandler getSvcBindingHandler(); List<MasterDatabaseBinding> putBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); List<MasterDatabaseBinding> removeBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); SxpConnection removeConnection(InetSocketAddress destination); void setSecurity(
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.sxp.node.fields.Security security); void setRetryOpenTimerPeriod(int retryOpenTimerPeriod); void setMessagePartitionSize(int size); void setMessageMergeSize(int size); ThreadsWorker getWorker(); void shutdownConnections(); synchronized ListenableFuture<Boolean> shutdown(); synchronized ListenableFuture<Boolean> start(); void updateMD5keys(); SslContextFactory getSslContextFactory(); @Override String toString(); }
SxpNode { public SxpConnection addConnection(SxpConnection connection) { synchronized (peerGroupMap) { for (SxpPeerGroup peerGroup : getPeerGroup(connection)) { for (SxpFilter filter : peerGroup.getSxpFilter()) { connection.putFilter(SxpBindingFilter.generateFilter(filter, peerGroup.getName())); } } } synchronized (sxpDomains) { if (!sxpDomains.containsKey(connection.getDomainName())) { LOG.warn("{} Domain {} does not exist", this, connection.getDomainName()); throw new DomainNotFoundException(getName(), connection.getDomainName()); } sxpDomains.get(connection.getDomainName()).putConnection(connection); } if (connection.hasNonEmptyPassword()) { updateMD5keys(); } Future<Void> openConnection = connection.openConnection(); openConnection.addListener((FutureListener<Void>) future -> { if (!future.isSuccess() && !future.isCancelled()) { LOG.warn("{} Failed to connect to remote peer, scheduling retry", connection); connection.scheduleRetryOpen(); } }); return connection; } protected  SxpNode(NodeId nodeId, SxpNodeIdentity node, ThreadsWorker worker); static SxpNode createInstance(NodeId nodeId, SxpNodeIdentity node); static SxpNode createInstance(NodeId nodeId, SxpNodeIdentity node, MasterDatabaseInf masterDatabase,
            SxpDatabaseInf sxpDatabase); static SxpNode createInstance(NodeId nodeId, SxpNodeIdentity node, MasterDatabaseInf masterDatabase,
            SxpDatabaseInf sxpDatabase, ThreadsWorker worker); SxpConnection addConnection(SxpConnection connection); boolean addPeerGroup(SxpPeerGroup peerGroup); SxpPeerGroup getPeerGroup(String peerGroupName); SxpPeerGroup removePeerGroup(String peerGroupName); Collection<SxpPeerGroup> getPeerGroups(); boolean addFilterToPeerGroup(String peerGroupName, SxpFilter sxpFilter); SxpFilter updateFilterInPeerGroup(String peerGroupName, SxpFilter newFilter); boolean removeFilterFromPeerGroup(String peerGroupName, FilterType filterType, FilterSpecific specific); boolean addDomain(
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain); boolean addDomain(
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain,
            MasterDatabaseInf masterDB,
            SxpDatabaseInf sxpDB); SxpDomain removeDomain(String domainName); SxpDomain getDomain(String name); Collection<SxpDomain> getDomains(); boolean addFilterToDomain(String domain, DomainFilter filter); SxpBindingFilter removeFilterFromDomain(String domain, FilterSpecific specific, String filterName); boolean updateDomainFilter(String domain, DomainFilter newFilter); @Deprecated void addConnection(Connection connection); SxpConnection addConnection(Connection connection, String domain); @Deprecated void addConnections(Connections connections); void addConnections(Connections connections, String domain); List<SxpConnection> getAllConnections(); List<SxpConnection> getAllConnections(String domain); InetAddress getSourceIp(); List<SxpConnection> getAllDeleteHoldDownConnections(); List<SxpConnection> getAllDeleteHoldDownConnections(String domain); List<SxpConnection> getAllOffConnections(); List<SxpConnection> getAllOffConnections(String domain); List<SxpConnection> getAllOnConnections(); List<SxpConnection> getAllOnConnections(String domain); @Deprecated List<SxpConnection> getAllOnListenerConnections(); List<SxpConnection> getAllOnListenerConnections(String domain); @Deprecated List<SxpConnection> getAllOnSpeakerConnections(); List<SxpConnection> getAllOnSpeakerConnections(String domain); @Deprecated MasterDatabaseInf getBindingMasterDatabase(); @Deprecated SxpDatabaseInf getBindingSxpDatabase(); MasterDatabaseInf getBindingMasterDatabase(String domainName); SxpDatabaseInf getBindingSxpDatabase(String domainName); SxpConnection getByAddress(final InetSocketAddress inetSocketAddress); @Deprecated SxpConnection getByPort(final int port); SxpConnection getConnection(SocketAddress socketAddress); int getExpansionQuantity(); int getHoldTime(); int getHoldTimeMax(); int getHoldTimeMin(); int getHoldTimeMinAcceptable(); int getKeepAliveTime(); String getName(); NodeId getNodeId(); String getPassword(); int getRetryOpenTime(); int getServerPort(); ListenableScheduledFuture<?> getTimer(TimerType timerType); Version getVersion(); boolean isEnabled(); synchronized ListenableFuture openConnections(); BindingDispatcher getSvcBindingDispatcher(); BindingHandler getSvcBindingHandler(); List<MasterDatabaseBinding> putBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); List<MasterDatabaseBinding> removeBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); SxpConnection removeConnection(InetSocketAddress destination); void setSecurity(
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.sxp.node.fields.Security security); void setRetryOpenTimerPeriod(int retryOpenTimerPeriod); void setMessagePartitionSize(int size); void setMessageMergeSize(int size); ThreadsWorker getWorker(); void shutdownConnections(); synchronized ListenableFuture<Boolean> shutdown(); synchronized ListenableFuture<Boolean> start(); void updateMD5keys(); SslContextFactory getSslContextFactory(); @Override String toString(); static final String DEFAULT_DOMAIN; }