summaryrefslogtreecommitdiffstats
path: root/infra/northbound/bgp
diff options
context:
space:
mode:
Diffstat (limited to 'infra/northbound/bgp')
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java4
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java22
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java4
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java5
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java6
-rw-r--r--infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java38
6 files changed, 50 insertions, 29 deletions
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java
index 00a12e7ac..05a2a9602 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java
@@ -23,8 +23,8 @@ import io.fd.honeycomb.translate.util.write.BindingBrokerWriter;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.ApplicationRib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
index 06444ae5b..76b34d5eb 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
@@ -16,9 +16,15 @@
package io.fd.honeycomb.infra.bgp;
+import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.toTableTypes;
+
import com.google.inject.Inject;
import io.fd.honeycomb.binding.init.ProviderTrait;
import io.fd.honeycomb.data.init.ShutdownHandler;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.broker.impl.PingPongDataBroker;
@@ -36,20 +42,13 @@ import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.toTableTypes;
-
final class BgpRIBProvider extends ProviderTrait<RIB> {
private static final Logger LOG = LoggerFactory.getLogger(BgpRIBProvider.class);
@@ -89,10 +88,11 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
// based on org.opendaylight.protocol.bgp.rib.impl.config.RibImpl.createRib
final PingPongDataBroker pingPongDataBroker = new PingPongDataBroker(domBroker);
final RIBImpl rib =
- new RIBImpl(new NoopClusterSingletonServiceProvider(), new RibId(cfg.bgpProtocolInstanceName.get()),
+ new RIBImpl(new RibId(cfg.bgpProtocolInstanceName.get()),
asNumber, new BgpId(routerId), clusterId, extensions, dispatcher, codec,
pingPongDataBroker, toTableTypes(afiSafiList, tableTypeRegistry), pathSelectionModes,
- extensions.getClassLoadingStrategy(), null);
+ extensions.getClassLoadingStrategy());
+ rib.instantiateServiceInstance();
// required for proper RIB's CodecRegistry initialization (based on RIBImpl.start)
schemaService.registerSchemaContextListener(rib);
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
index 728bb14e5..6f5bd5066 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
@@ -24,8 +24,8 @@ import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.util.read.BindingBrokerReader;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRibBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRibBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
final class BgpReaderFactoryProvider extends ProviderTrait<ReaderFactory> {
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java
index 848b4d504..5e924be7e 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java
@@ -21,6 +21,7 @@ import io.fd.honeycomb.infra.bgp.BgpConfiguration;
import io.fd.honeycomb.translate.impl.write.GenericListWriter;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import javax.annotation.Nonnull;
import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
@@ -31,11 +32,9 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.re
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.Protocols;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Protocol1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Protocol1;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import javax.annotation.Nonnull;
-
/**
* Initializes writer for Bgp Neighbors ({@link Neighbor} node) and all its parents required by HC infra.
*/
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 baccb9a1c..cdaffb6f6 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
@@ -88,7 +88,8 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
peer = new BgpPeer(null);
}
LOG.debug("Starting bgp peer for {}", id);
- peer.start(globalRib, neighbor, tableTypeRegistry, null);
+ peer.start(globalRib, neighbor, tableTypeRegistry);
+ peer.instantiateServiceInstance();
addPeer(id, peer);
}
@@ -102,7 +103,8 @@ 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, tableTypeRegistry, null);
+ peer.start(globalRib, dataAfter, tableTypeRegistry);
+ peer.instantiateServiceInstance();
LOG.debug("Peer instance updated {}", peer);
}
diff --git a/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java b/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java
index ba71cc90e..64e0b9bd1 100644
--- a/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java
+++ b/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java
@@ -18,22 +18,29 @@ package io.fd.honeycomb.infra.bgp.neighbors;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
+import com.google.common.util.concurrent.CheckedFuture;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
-import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
import org.opendaylight.protocol.bgp.rib.impl.config.PeerBean;
+import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
+import org.opendaylight.protocol.bgp.rib.impl.spi.ImportPolicyPeerTracker;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
+import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.ConfigBuilder;
@@ -45,12 +52,12 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.PeerType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Config2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Config2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.Rib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.RibKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -70,6 +77,12 @@ public class NeighborCustomizerTest {
private BGPTableTypeRegistryConsumer tableTypeRegistry;
@Mock
private WriteContext ctx;
+ @Mock
+ private DOMTransactionChain chain;
+ @Mock
+ private DOMDataWriteTransaction tx;
+ @Mock
+ private BGPDispatcher dispatcher;
private NeighborCustomizer customizer;
@@ -77,8 +90,15 @@ public class NeighborCustomizerTest {
public void setUp() {
initMocks(this);
when(globalRib.getYangRibId()).thenReturn(YangInstanceIdentifier.EMPTY);
- when(globalRib.getRibIServiceGroupIdentifier()).thenReturn(ServiceGroupIdentifier.create("sgid"));
when(globalRib.getInstanceIdentifier()).thenReturn(RIB_IID);
+ when(globalRib.createPeerChain(any())).thenReturn(chain);
+ when(chain.newWriteOnlyTransaction()).thenReturn(tx);
+ when(tx.submit()).thenReturn(mock(CheckedFuture.class));
+ when(globalRib.getImportPolicyPeerTracker()).thenReturn(mock(ImportPolicyPeerTracker.class));
+ when(globalRib.getRibSupportContext()).thenReturn(mock(RIBSupportContextRegistry.class));
+ when(globalRib.getService()).thenReturn(mock(DOMDataTreeChangeService.class));
+ when(globalRib.getDispatcher()).thenReturn(dispatcher);
+ when(dispatcher.getBGPPeerRegistry()).thenReturn(peerRegistry);
customizer = new NeighborCustomizer(globalRib, peerRegistry, tableTypeRegistry);
}
@@ -123,7 +143,7 @@ public class NeighborCustomizerTest {
customizer.updateCurrentAttributes(ID, before, after, ctx);
verify(peer).closeServiceInstance();
verify(peer).close();
- verify(peer).start(globalRib, after, tableTypeRegistry, null);
+ verify(peer).start(globalRib, after, tableTypeRegistry);
}
@Test