@Test public void testRemoveFilter() throws Exception { when(sxpNode.getDomains()).thenReturn(domains); domain.putConnection(getSxpConnection("127.0.0.1")); assertTrue(domain.addFilter(getFilter(FilterSpecific.AccessOrPrefixList, "domain8"))); assertTrue(domain.addFilter(getFilter(FilterSpecific.AccessOrPrefixList, "domain1"))); assertTrue(domain.addFilter(getFilter(FilterSpecific.PeerSequence, "domain1"))); assertNull(domain.removeFilter(FilterSpecific.AccessOrPrefixList, "tmp")); assertNull(domain.removeFilter(FilterSpecific.PeerSequence, "domain0")); assertNotNull(domain.removeFilter(FilterSpecific.AccessOrPrefixList, "domain1")); assertNotNull(domain.removeFilter(FilterSpecific.PeerSequence, "domain1")); assertNotNull(domain.removeFilter(FilterSpecific.AccessOrPrefixList, "domain8")); }
public SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name) { SxpBindingFilter<?, ? extends SxpDomainFilterFields> bindingFilter; synchronized (filters) { bindingFilter = filters.get(Preconditions.checkNotNull(specific)).remove(Preconditions.checkNotNull(name)); } if (Objects.nonNull(bindingFilter)) { for (SxpDomain domain : node.getDomains()) { if (!domain.getName().equals(getName()) && bindingFilter.getSxpFilter() .getDomains() .getDomain() .stream() .anyMatch(f -> f.getName().equals(domain.getName()))) { propagateToSharedMasterDatabases(getMasterDatabase().getBindings(BindingOriginsConfig.LOCAL_ORIGIN) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain); getConnections().stream().filter(SxpConnection::isModeListener).forEach(c -> { propagateToSharedSxpDatabases(getSxpDatabase().getBindings(c.getId()) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain, c.getId(), c.getFilter(FilterType.Inbound)); }); } } } return bindingFilter; }
SxpDomain implements AutoCloseable { public SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name) { SxpBindingFilter<?, ? extends SxpDomainFilterFields> bindingFilter; synchronized (filters) { bindingFilter = filters.get(Preconditions.checkNotNull(specific)).remove(Preconditions.checkNotNull(name)); } if (Objects.nonNull(bindingFilter)) { for (SxpDomain domain : node.getDomains()) { if (!domain.getName().equals(getName()) && bindingFilter.getSxpFilter() .getDomains() .getDomain() .stream() .anyMatch(f -> f.getName().equals(domain.getName()))) { propagateToSharedMasterDatabases(getMasterDatabase().getBindings(BindingOriginsConfig.LOCAL_ORIGIN) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain); getConnections().stream().filter(SxpConnection::isModeListener).forEach(c -> { propagateToSharedSxpDatabases(getSxpDatabase().getBindings(c.getId()) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain, c.getId(), c.getFilter(FilterType.Inbound)); }); } } } return bindingFilter; } }
SxpDomain implements AutoCloseable { public SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name) { SxpBindingFilter<?, ? extends SxpDomainFilterFields> bindingFilter; synchronized (filters) { bindingFilter = filters.get(Preconditions.checkNotNull(specific)).remove(Preconditions.checkNotNull(name)); } if (Objects.nonNull(bindingFilter)) { for (SxpDomain domain : node.getDomains()) { if (!domain.getName().equals(getName()) && bindingFilter.getSxpFilter() .getDomains() .getDomain() .stream() .anyMatch(f -> f.getName().equals(domain.getName()))) { propagateToSharedMasterDatabases(getMasterDatabase().getBindings(BindingOriginsConfig.LOCAL_ORIGIN) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain); getConnections().stream().filter(SxpConnection::isModeListener).forEach(c -> { propagateToSharedSxpDatabases(getSxpDatabase().getBindings(c.getId()) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain, c.getId(), c.getFilter(FilterType.Inbound)); }); } } } return bindingFilter; } private  SxpDomain(SxpNode owner, String name, SxpDatabaseInf sxpDatabase, MasterDatabaseInf masterDatabase); }
SxpDomain implements AutoCloseable { public SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name) { SxpBindingFilter<?, ? extends SxpDomainFilterFields> bindingFilter; synchronized (filters) { bindingFilter = filters.get(Preconditions.checkNotNull(specific)).remove(Preconditions.checkNotNull(name)); } if (Objects.nonNull(bindingFilter)) { for (SxpDomain domain : node.getDomains()) { if (!domain.getName().equals(getName()) && bindingFilter.getSxpFilter() .getDomains() .getDomain() .stream() .anyMatch(f -> f.getName().equals(domain.getName()))) { propagateToSharedMasterDatabases(getMasterDatabase().getBindings(BindingOriginsConfig.LOCAL_ORIGIN) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain); getConnections().stream().filter(SxpConnection::isModeListener).forEach(c -> { propagateToSharedSxpDatabases(getSxpDatabase().getBindings(c.getId()) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain, c.getId(), c.getFilter(FilterType.Inbound)); }); } } } return bindingFilter; } private  SxpDomain(SxpNode owner, String name, SxpDatabaseInf sxpDatabase, MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner, String name, SxpDatabaseInf sxpDatabase,
            MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner,
                                           org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain,
                                           MasterDatabaseInf masterDB,
                                           SxpDatabaseInf sxpDB); static SxpDomain createInstance(SxpNode owner,
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain); Map<String, SxpBindingFilter<?, ? extends SxpDomainFilterFields>> getFilters(); boolean addFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> filter); SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name); boolean updateFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> newFilter); void pushToSharedMasterDatabases(final List<T> removed, final List<T> added); void pushToSharedSxpDatabases(NodeId nodeIdRemote, SxpBindingFilter<?, ? extends SxpFilterFields> sxpFilter,
            List<SxpDatabaseBinding> removed, List<SxpDatabaseBinding> added); MasterDatabaseInf getMasterDatabase(); SxpDatabaseInf getSxpDatabase(); String getName(); List<SxpConnection> getConnections(); SxpConnection getConnection(InetSocketAddress address); boolean addConnectionTemplate(T template); SxpConnectionTemplateFields removeConnectionTemplate(IpPrefix templatePrefix); SxpConnectionTemplateFields getTemplate(InetSocketAddress address); Collection<SxpConnectionTemplateFields> getConnectionTemplates(); boolean hasConnection(InetSocketAddress address); SxpConnection putConnection(SxpConnection connection); SxpConnection removeConnection(InetSocketAddress address); @Override void close(); }
SxpDomain implements AutoCloseable { public SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name) { SxpBindingFilter<?, ? extends SxpDomainFilterFields> bindingFilter; synchronized (filters) { bindingFilter = filters.get(Preconditions.checkNotNull(specific)).remove(Preconditions.checkNotNull(name)); } if (Objects.nonNull(bindingFilter)) { for (SxpDomain domain : node.getDomains()) { if (!domain.getName().equals(getName()) && bindingFilter.getSxpFilter() .getDomains() .getDomain() .stream() .anyMatch(f -> f.getName().equals(domain.getName()))) { propagateToSharedMasterDatabases(getMasterDatabase().getBindings(BindingOriginsConfig.LOCAL_ORIGIN) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain); getConnections().stream().filter(SxpConnection::isModeListener).forEach(c -> { propagateToSharedSxpDatabases(getSxpDatabase().getBindings(c.getId()) .stream() .filter(bindingFilter) .collect(Collectors.toList()), Collections.emptyList(), domain, c.getId(), c.getFilter(FilterType.Inbound)); }); } } } return bindingFilter; } private  SxpDomain(SxpNode owner, String name, SxpDatabaseInf sxpDatabase, MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner, String name, SxpDatabaseInf sxpDatabase,
            MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner,
                                           org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain,
                                           MasterDatabaseInf masterDB,
                                           SxpDatabaseInf sxpDB); static SxpDomain createInstance(SxpNode owner,
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain); Map<String, SxpBindingFilter<?, ? extends SxpDomainFilterFields>> getFilters(); boolean addFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> filter); SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name); boolean updateFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> newFilter); void pushToSharedMasterDatabases(final List<T> removed, final List<T> added); void pushToSharedSxpDatabases(NodeId nodeIdRemote, SxpBindingFilter<?, ? extends SxpFilterFields> sxpFilter,
            List<SxpDatabaseBinding> removed, List<SxpDatabaseBinding> added); MasterDatabaseInf getMasterDatabase(); SxpDatabaseInf getSxpDatabase(); String getName(); List<SxpConnection> getConnections(); SxpConnection getConnection(InetSocketAddress address); boolean addConnectionTemplate(T template); SxpConnectionTemplateFields removeConnectionTemplate(IpPrefix templatePrefix); SxpConnectionTemplateFields getTemplate(InetSocketAddress address); Collection<SxpConnectionTemplateFields> getConnectionTemplates(); boolean hasConnection(InetSocketAddress address); SxpConnection putConnection(SxpConnection connection); SxpConnection removeConnection(InetSocketAddress address); @Override void close();  }