summaryrefslogtreecommitdiffstats
path: root/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java
diff options
context:
space:
mode:
Diffstat (limited to 'infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java')
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java27
1 files changed, 9 insertions, 18 deletions
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java
index 50ae45b40..baccb9a1c 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java
@@ -18,7 +18,7 @@ package io.fd.honeycomb.infra.bgp.neighbors;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
-import static org.opendaylight.protocol.bgp.openconfig.impl.util.OpenConfigUtil.APPLICATION_PEER_GROUP_NAME;
+import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.isApplicationPeer;
import com.google.common.annotations.VisibleForTesting;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
@@ -29,16 +29,14 @@ import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
-import org.opendaylight.protocol.bgp.openconfig.spi.BGPOpenConfigMappingService;
+import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
import org.opendaylight.protocol.bgp.rib.impl.config.AppPeer;
import org.opendaylight.protocol.bgp.rib.impl.config.BgpPeer;
import org.opendaylight.protocol.bgp.rib.impl.config.PeerBean;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighborPeerGroupConfig;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Config2;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,16 +50,17 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
private static final Logger LOG = LoggerFactory.getLogger(NeighborCustomizer.class);
private final RIB globalRib;
private final BGPPeerRegistry peerRegistry;
- private final BGPOpenConfigMappingService mappingService;
+ private BGPTableTypeRegistryConsumer tableTypeRegistry;
+
@GuardedBy("this")
private final Map<InstanceIdentifier<Neighbor>, PeerBean> peers = new HashMap<>();
public NeighborCustomizer(@Nonnull final RIB globalRib, @Nonnull final BGPPeerRegistry peerRegistry,
- @Nonnull final BGPOpenConfigMappingService mappingService) {
+ @Nonnull final BGPTableTypeRegistryConsumer tableTypeRegistry) {
this.globalRib = checkNotNull(globalRib, "globalRib should not be null");
this.peerRegistry = checkNotNull(peerRegistry, "globalRib should not be null");
- this.mappingService = checkNotNull(mappingService, "globalRib should not be null");
+ this.tableTypeRegistry = checkNotNull(tableTypeRegistry, "tableTypeRegistry should not be null");
}
@VisibleForTesting
@@ -86,10 +85,10 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
peer = new AppPeer();
} else {
LOG.debug("Starting BgpPeer bean for {}: {}", id, neighbor);
- peer = new BgpPeer(null, peerRegistry);
+ peer = new BgpPeer(null);
}
LOG.debug("Starting bgp peer for {}", id);
- peer.start(globalRib, neighbor, mappingService, null);
+ peer.start(globalRib, neighbor, tableTypeRegistry, null);
addPeer(id, peer);
}
@@ -103,7 +102,7 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
final PeerBean peer = peers.get(id);
checkState(peer != null, "Could not find peer bean while updating neighbor {}", id);
closePeerBean(peer);
- peer.start(globalRib, dataAfter, mappingService, null);
+ peer.start(globalRib, dataAfter, tableTypeRegistry, null);
LOG.debug("Peer instance updated {}", peer);
}
@@ -120,14 +119,6 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
}
}
- private static boolean isApplicationPeer(@Nonnull final Neighbor neighbor) {
- return java.util.Optional.of(neighbor.getConfig())
- .map(config -> config.getAugmentation(Config2.class))
- .map(BgpNeighborPeerGroupConfig::getPeerGroup)
- .map(APPLICATION_PEER_GROUP_NAME::equals)
- .orElse(false);
- }
-
private static void closePeerBean(final PeerBean peer) {
try {
peer.closeServiceInstance().get();