summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--infra/bgp-distribution-test/pom.xml2
-rw-r--r--infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java5
-rw-r--r--infra/bgp-distribution/asciidoc/Readme.adoc3
-rw-r--r--infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/distro/Main.java69
-rw-r--r--infra/minimal-distribution/pom.xml11
-rw-r--r--infra/northbound/bgp/asciidoc/Readme.adoc4
-rw-r--r--infra/northbound/bgp/bgp_postman_collection.json (renamed from infra/bgp-distribution/bgp_postman_collection.json)0
-rw-r--r--infra/northbound/bgp/pom.xml (renamed from infra/bgp-distribution/pom.xml)88
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BGPDispatcherImplProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BGPDispatcherImplProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BGPExtensionConsumerContextProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BGPExtensionConsumerContextProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfigurationModule.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfigurationModule.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpExtensionsModule.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpExtensionsModule.java)16
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java)29
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java)2
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNettyThreadGroupProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpNettyThreadGroupProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReadersModule.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpReadersModule.java)16
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpServerProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpServerProvider.java)2
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpWritersModule.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWritersModule.java)16
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/LocRibWriterProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/LocRibWriterProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/RIBExtensionConsumerContextProvider.java (renamed from infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/RIBExtensionConsumerContextProvider.java)0
-rw-r--r--infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/activation.json (renamed from infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/activation.json)0
-rw-r--r--infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json (renamed from infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json)0
-rw-r--r--infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json (renamed from infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp.json)2
-rw-r--r--infra/northbound/pom.xml1
-rw-r--r--infra/pom.xml1
29 files changed, 129 insertions, 138 deletions
diff --git a/infra/bgp-distribution-test/pom.xml b/infra/bgp-distribution-test/pom.xml
index 34eeda39b..858f21ee8 100644
--- a/infra/bgp-distribution-test/pom.xml
+++ b/infra/bgp-distribution-test/pom.xml
@@ -32,7 +32,7 @@
<dependencies>
<dependency>
<groupId>io.fd.honeycomb</groupId>
- <artifactId>bgp-distribution</artifactId>
+ <artifactId>minimal-distribution</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
diff --git a/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java b/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java
index be927a64e..d6f03f9a8 100644
--- a/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java
+++ b/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Cisco and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package io.fd.honeycomb.infra.bgp.distro;
import com.google.common.io.ByteStreams;
import com.mashape.unirest.http.Unirest;
+import io.fd.honeycomb.infra.distro.Main;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
@@ -60,7 +61,7 @@ public class BgpDistributionTest {
@Test(timeout = 120000)
public void test() throws Exception {
- io.fd.honeycomb.infra.bgp.distro.Main.init();
+ Main.init();
LOG.info("Testing Honeycomb BGP distribution");
assertBgp();
}
diff --git a/infra/bgp-distribution/asciidoc/Readme.adoc b/infra/bgp-distribution/asciidoc/Readme.adoc
deleted file mode 100644
index f6222d4d0..000000000
--- a/infra/bgp-distribution/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= bgp-distribution
-
-Honeycomb distribution that adds BGP to NETCONF and RESTCONF northbound intrerfaces provided by minimal-distribution. \ No newline at end of file
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/distro/Main.java b/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/distro/Main.java
deleted file mode 100644
index 8994f0415..000000000
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/distro/Main.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.infra.bgp.distro;
-
-import com.google.inject.ConfigurationException;
-import com.google.inject.CreationException;
-import com.google.inject.Injector;
-import com.google.inject.ProvisionException;
-import io.fd.honeycomb.infra.bgp.BgpConfiguration;
-import io.fd.honeycomb.infra.bgp.BgpServerProvider;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighbors;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class Main {
-
- private static final Logger LOG = LoggerFactory.getLogger(Main.class);
-
- private Main() {
- }
-
- public static void main(String[] args) {
- init();
- }
-
- /**
- * Initialize the Honeycomb with provided modules
- */
- public static Injector init() {
- try {
- Injector injector = io.fd.honeycomb.infra.distro.Main.init();
- final BgpConfiguration bgpAttributes = injector.getInstance(BgpConfiguration.class);
-
- if (bgpAttributes.isBgpEnabled()) {
- LOG.info("Starting BGP");
- injector.getInstance(BgpServerProvider.BgpServer.class);
- LOG.info("Initializing BgpNeighbours");
- injector.getInstance(BgpNeighbors.class);
- LOG.info("BGP started successfully!");
- }
-
- return injector;
- } catch (CreationException | ProvisionException | ConfigurationException e) {
- LOG.error("Failed to initialize Honeycomb components", e);
- throw e;
- } catch (RuntimeException e) {
- LOG.error("Unexpected initialization failure", e);
- throw e;
- } finally {
- // Trigger gc to force collect initial garbage + dedicated classloader
- System.gc();
- }
- }
-
-}
diff --git a/infra/minimal-distribution/pom.xml b/infra/minimal-distribution/pom.xml
index 66f15f770..37c010f5c 100644
--- a/infra/minimal-distribution/pom.xml
+++ b/infra/minimal-distribution/pom.xml
@@ -40,7 +40,11 @@
io.fd.honeycomb.infra.distro.netconf.NetconfModule,
io.fd.honeycomb.infra.distro.netconf.NetconfReadersModule,
io.fd.honeycomb.infra.distro.restconf.RestconfModule,
- io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule
+ io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule,
+ // io.fd.honeycomb.infra.bgp.BgpModule,
+ // io.fd.honeycomb.infra.bgp.BgpExtensionsModule,
+ // io.fd.honeycomb.infra.bgp.BgpReadersModule,
+ // io.fd.honeycomb.infra.bgp.BgpWritersModule
</distribution.modules>
</properties>
@@ -69,5 +73,10 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.fd.honeycomb.northbound</groupId>
+ <artifactId>bgp</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/infra/northbound/bgp/asciidoc/Readme.adoc b/infra/northbound/bgp/asciidoc/Readme.adoc
new file mode 100644
index 000000000..d125fb623
--- /dev/null
+++ b/infra/northbound/bgp/asciidoc/Readme.adoc
@@ -0,0 +1,4 @@
+= bgp
+
+Adds BGP support to Honeycomb's northbound interfaces.
+Depends on ODL's BGP implementation. \ No newline at end of file
diff --git a/infra/bgp-distribution/bgp_postman_collection.json b/infra/northbound/bgp/bgp_postman_collection.json
index 31297287d..31297287d 100644
--- a/infra/bgp-distribution/bgp_postman_collection.json
+++ b/infra/northbound/bgp/bgp_postman_collection.json
diff --git a/infra/bgp-distribution/pom.xml b/infra/northbound/bgp/pom.xml
index 545885933..60860a50a 100644
--- a/infra/bgp-distribution/pom.xml
+++ b/infra/northbound/bgp/pom.xml
@@ -1,62 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2017 Cisco and/or its affiliates.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at:
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
+ <artifactId>impl-parent</artifactId>
<groupId>io.fd.honeycomb.common</groupId>
- <artifactId>minimal-distribution-parent</artifactId>
<version>1.17.07-SNAPSHOT</version>
- <relativePath>../../common/minimal-distribution-parent</relativePath>
+ <relativePath>../../../common/impl-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>bgp-distribution</artifactId>
- <name>${project.artifactId}</name>
- <version>1.17.07-SNAPSHOT</version>
-
- <properties>
- <main.class>io.fd.honeycomb.infra.bgp.distro.Main</main.class>
- <sonar.skip>true</sonar.skip>
- <distribution.modules>
- io.fd.honeycomb.infra.bgp.BgpModule,
- io.fd.honeycomb.infra.bgp.BgpExtensionsModule,
- io.fd.honeycomb.infra.bgp.BgpReadersModule,
- io.fd.honeycomb.infra.bgp.BgpWritersModule,
- io.fd.honeycomb.infra.bgp.BgpConfigurationModule
- </distribution.modules>
- </properties>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>groovy-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
+ <groupId>io.fd.honeycomb.northbound</groupId>
+ <artifactId>bgp</artifactId>
+ <version>1.17.07-SNAPSHOT</version>
<dependencies>
+ <!-- Common northbound configuration -->
+ <dependency>
+ <groupId>io.fd.honeycomb.northbound</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Common HC infra utils -->
<dependency>
<groupId>io.fd.honeycomb</groupId>
- <artifactId>minimal-distribution</artifactId>
+ <artifactId>minimal-distribution-core</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <!-- DI-->
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.jmob</groupId>
+ <artifactId>guice.conf</artifactId>
+ </dependency>
+
+ <!-- BGP translation layer -->
<dependency>
<groupId>io.fd.honeycomb</groupId>
<artifactId>bgp-translate-api</artifactId>
@@ -68,7 +68,7 @@
<version>${project.version}</version>
</dependency>
- <!-- ODL-BGP -->
+ <!-- ODL BGP -->
<dependency>
<groupId>org.opendaylight.bgpcep</groupId>
<artifactId>bgp-rib-impl</artifactId>
@@ -84,7 +84,8 @@
<groupId>org.opendaylight.bgpcep</groupId>
<artifactId>bgp-openconfig-impl</artifactId>
</dependency>
- <!-- BGP extensions -->
+
+ <!-- ODL BGP extensions -->
<dependency>
<groupId>org.opendaylight.bgpcep</groupId>
<artifactId>bgp-evpn</artifactId>
@@ -106,4 +107,5 @@
<artifactId>bgp-l3vpn</artifactId>
</dependency>
</dependencies>
+
</project> \ No newline at end of file
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BGPDispatcherImplProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BGPDispatcherImplProvider.java
index c9ec39f35..c9ec39f35 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BGPDispatcherImplProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BGPDispatcherImplProvider.java
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BGPExtensionConsumerContextProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BGPExtensionConsumerContextProvider.java
index 00e99ab99..00e99ab99 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BGPExtensionConsumerContextProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BGPExtensionConsumerContextProvider.java
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
index 9182dd3a0..9182dd3a0 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfigurationModule.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfigurationModule.java
index a1c2e765b..a1c2e765b 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfigurationModule.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfigurationModule.java
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpExtensionsModule.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpExtensionsModule.java
index 650f637e5..d744065fb 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpExtensionsModule.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpExtensionsModule.java
@@ -16,21 +16,33 @@
package io.fd.honeycomb.infra.bgp;
-import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import com.google.inject.multibindings.Multibinder;
+import io.fd.honeycomb.northbound.NorthboundAbstractModule;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Registers BGP extensions provided by ODL implementation.
* TODO add support for flowspec (requires some special initialization)
*/
-public final class BgpExtensionsModule extends AbstractModule {
+public final class BgpExtensionsModule extends NorthboundAbstractModule<BgpConfiguration> {
+ private static final Logger LOG = LoggerFactory.getLogger(BgpExtensionsModule.class);
+
+ public BgpExtensionsModule() {
+ super(new BgpConfigurationModule(), BgpConfiguration.class);
+ }
protected void configure() {
+ if (!getConfiguration().isBgpEnabled()) {
+ LOG.debug("BGP disabled. Skipping initialization");
+ return;
+ }
+ LOG.debug("Initializing BgpExtensionsModule");
// This should be part of BgpModule, but that one is Private and Multibinders + private BASE_MODULES
// do not work together, that's why there's a dedicated module here
// https://github.com/google/guice/issues/906
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java
index a26b5c158..32c4440e0 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java
@@ -19,12 +19,12 @@ package io.fd.honeycomb.infra.bgp;
import static io.fd.honeycomb.infra.distro.data.InmemoryDOMDataBrokerProvider.CONFIG;
import static io.fd.honeycomb.infra.distro.data.InmemoryDOMDataBrokerProvider.OPERATIONAL;
-import com.google.inject.PrivateModule;
import com.google.inject.Singleton;
import com.google.inject.name.Names;
import io.fd.honeycomb.infra.distro.data.BindingDataBrokerProvider;
import io.fd.honeycomb.infra.distro.data.DataStoreProvider;
import io.fd.honeycomb.infra.distro.data.InmemoryDOMDataBrokerProvider;
+import io.fd.honeycomb.northbound.NorthboundPrivateModule;
import io.fd.honeycomb.translate.bgp.RibWriter;
import io.netty.channel.EventLoopGroup;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
@@ -38,12 +38,25 @@ 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.RIB;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighbors;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public final class BgpModule extends PrivateModule {
+public final class BgpModule extends NorthboundPrivateModule<BgpConfiguration> {
+ private static final Logger LOG = LoggerFactory.getLogger(BgpModule.class);
static final String HONEYCOMB_BGP = "honeycomb-bgp";
+ public BgpModule() {
+ super(new BgpConfigurationModule(), BgpConfiguration.class);
+ }
+
protected void configure() {
+ if (!getConfiguration().isBgpEnabled()) {
+ LOG.debug("BGP disabled. Skipping initialization");
+ return;
+ }
+ LOG.debug("Initializing BgpModule");
+ install(getConfigurationModule());
// Create BGPDispatcher BGPDispatcher for creating BGP clients
bind(EventLoopGroup.class).toProvider(BgpNettyThreadGroupProvider.class).in(Singleton.class);
bind(BGPDispatcher.class).toProvider(BGPDispatcherImplProvider.class).in(Singleton.class);
@@ -54,16 +67,14 @@ public final class BgpModule extends PrivateModule {
bind(BGPOpenConfigMappingService.class).toInstance(new BGPOpenConfigMappingServiceImpl());
bind(BGPPeerRegistry.class).toInstance(StrictBGPPeerRegistry.instance());
+ // Create BGP server instance (initialize eagerly to start BGP)
+ bind(BgpServerProvider.BgpServer.class).toProvider(BgpServerProvider.class).asEagerSingleton();
- // Create BGP server instance
- bind(BgpServerProvider.BgpServer.class).toProvider(BgpServerProvider.class).in(Singleton.class);
- expose(BgpServerProvider.BgpServer.class);
-
- // Initialize BgpNeighbours
- bind(BgpNeighbors.class).toProvider(BgpNeighboursProvider.class).in(Singleton.class);
- expose(BgpNeighbors.class);
+ // Initialize BgpNeighbours (initialize eagerly to start BGP neighbours)
+ bind(BgpNeighbors.class).toProvider(BgpNeighboursProvider.class).asEagerSingleton();
// Listens for local RIB modifications and passes routes to translation layer
+ // (initialize eagerly to configure RouteWriters)
bind(RibWriter.class).toProvider(LocRibWriterProvider.class).asEagerSingleton();
expose(RibWriter.class);
}
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java
index fab14e827..b62444108 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java
@@ -31,7 +31,6 @@ import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.protocol.bgp.openconfig.spi.BGPOpenConfigMappingService;
-import org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry;
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.spi.BGPPeerRegistry;
@@ -77,6 +76,7 @@ final class BgpNeighboursProvider extends ProviderTrait<BgpNeighbors> {
@Override
protected BgpNeighbors create() {
+ LOG.info("Initializing BgpNeighbours");
final BgpNeighbors neighbors = readNeighbours();
for (final Neighbor neighbor : neighbors.getNeighbor()) {
if (isApplicationPeer(neighbor)) {
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpNettyThreadGroupProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNettyThreadGroupProvider.java
index 8208a4320..8208a4320 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpNettyThreadGroupProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNettyThreadGroupProvider.java
diff --git a/infra/bgp-distribution/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 a2bd56df3..a2bd56df3 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
diff --git a/infra/bgp-distribution/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 b79074f10..b79074f10 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpReadersModule.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReadersModule.java
index 745a94269..9f819614e 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpReadersModule.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReadersModule.java
@@ -16,14 +16,26 @@
package io.fd.honeycomb.infra.bgp;
-import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import com.google.inject.multibindings.Multibinder;
+import io.fd.honeycomb.northbound.NorthboundAbstractModule;
import io.fd.honeycomb.translate.read.ReaderFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public class BgpReadersModule extends AbstractModule {
+public class BgpReadersModule extends NorthboundAbstractModule<BgpConfiguration> {
+ private static final Logger LOG = LoggerFactory.getLogger(BgpReadersModule.class);
+
+ public BgpReadersModule() {
+ super(new BgpConfigurationModule(), BgpConfiguration.class);
+ }
protected void configure() {
+ if (!getConfiguration().isBgpEnabled()) {
+ LOG.debug("BGP disabled. Skipping initialization");
+ return;
+ }
+ LOG.debug("Initializing BgpReadersModule");
// This should be part of BgpModule, but that one is Private and Multibinders + private BASE_MODULES
// do not work together, that's why there's a dedicated module here
// https://github.com/google/guice/issues/906
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpServerProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpServerProvider.java
index 27dad8840..b972ee297 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpServerProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpServerProvider.java
@@ -66,7 +66,7 @@ public final class BgpServerProvider extends ProviderTrait<BgpServerProvider.Bg
}
});
final BgpServer server = new BgpServer(localServer);
- LOG.debug("BgpServer successfully created.");
+ LOG.debug("BgpServer successfully started.");
return server;
}
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java
index 81faabbe5..81faabbe5 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWritersModule.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpWritersModule.java
index f1e92c4ba..690a7feb2 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWritersModule.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpWritersModule.java
@@ -16,14 +16,26 @@
package io.fd.honeycomb.infra.bgp;
-import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import com.google.inject.multibindings.Multibinder;
+import io.fd.honeycomb.northbound.NorthboundAbstractModule;
import io.fd.honeycomb.translate.write.WriterFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public class BgpWritersModule extends AbstractModule {
+public class BgpWritersModule extends NorthboundAbstractModule<BgpConfiguration> {
+ private static final Logger LOG = LoggerFactory.getLogger(BgpWritersModule.class);
+
+ public BgpWritersModule() {
+ super(new BgpConfigurationModule(), BgpConfiguration.class);
+ }
protected void configure() {
+ if (!getConfiguration().isBgpEnabled()) {
+ LOG.debug("BGP disabled. Skipping initialization");
+ return;
+ }
+ LOG.debug("Initializing BgpReadersModule");
// This should be part of BgpModule, but that one is Private and Multibinders + private BASE_MODULES
// do not work together, that's why there's a dedicated module here
// https://github.com/google/guice/issues/906
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/LocRibWriterProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/LocRibWriterProvider.java
index 1fc6b25ed..1fc6b25ed 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/LocRibWriterProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/LocRibWriterProvider.java
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/RIBExtensionConsumerContextProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/RIBExtensionConsumerContextProvider.java
index b90b7880c..b90b7880c 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/RIBExtensionConsumerContextProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/RIBExtensionConsumerContextProvider.java
diff --git a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/activation.json b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/activation.json
index 8dd168702..8dd168702 100644
--- a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/activation.json
+++ b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/activation.json
diff --git a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
index 93405fba6..93405fba6 100644
--- a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
+++ b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
diff --git a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp.json b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json
index 2664c9ed6..c0981429f 100644
--- a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp.json
+++ b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json
@@ -1,5 +1,5 @@
{
- "bgp-enabled": "true",
+ "bgp-enabled": "false",
"bgp-binding-address": "127.0.0.1",
"bgp-port": 1790,
"bgp-as-number": 65000,
diff --git a/infra/northbound/pom.xml b/infra/northbound/pom.xml
index a768b32f6..3ae2859db 100644
--- a/infra/northbound/pom.xml
+++ b/infra/northbound/pom.xml
@@ -32,6 +32,7 @@
<modules>
<module>common</module>
+ <module>bgp</module>
</modules>
</project> \ No newline at end of file
diff --git a/infra/pom.xml b/infra/pom.xml
index 4540520c0..845cad0fa 100644
--- a/infra/pom.xml
+++ b/infra/pom.xml
@@ -43,7 +43,6 @@
<module>minimal-distribution</module>
<module>bgp-translate-api</module>
<module>bgp-translate-impl</module>
- <module>bgp-distribution</module>
<module>it</module>
<module>test-utils</module>
<module>rpc</module>