summaryrefslogtreecommitdiffstats
path: root/infra
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-07-14 09:14:22 +0200
committerJan Srnicek <jsrnicek@cisco.com>2017-07-17 08:15:24 +0000
commita4a488f7cdd04498bfcda068bf171516a9afe4f0 (patch)
tree8601d776d71f5945bccd19e8394d61e412fbeb0d /infra
parent33f12d921cc503055ff82361f672fac7516d89ee (diff)
Make BGP protocol instance name configurable
Change-Id: I49a201b8e027d229a60bb76abe9b5688af7b7cdf Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra')
-rw-r--r--infra/bgp-distribution-test/src/test/resources/bgp.json1
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java17
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java8
-rw-r--r--infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json1
4 files changed, 16 insertions, 11 deletions
diff --git a/infra/bgp-distribution-test/src/test/resources/bgp.json b/infra/bgp-distribution-test/src/test/resources/bgp.json
index c352fb0..5cc9a41 100644
--- a/infra/bgp-distribution-test/src/test/resources/bgp.json
+++ b/infra/bgp-distribution-test/src/test/resources/bgp.json
@@ -4,5 +4,6 @@
"bgp-as-number": 65000,
"bgp-receive-multiple-paths": "true",
"bgp-send-max-paths": 0,
+ "bgp-protocol-instance-name": "hc-bgp-instance",
"bgp-netty-threads": 2
} \ No newline at end of file
diff --git a/infra/northbound/bgp/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 6cc245a..9335fb3 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
@@ -45,17 +45,20 @@ public class BgpConfiguration {
public Optional<String> bgpMultiplePaths;
@InjectConfig("bgp-send-max-paths")
public Optional<Integer> bgpSendMaxMaths;
+ @InjectConfig("bgp-protocol-instance-name")
+ public Optional<String> bgpProtocolInstanceName;
@InjectConfig("bgp-netty-threads")
public Integer bgpNettyThreads;
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
- .add("bgpBindingAddress", bgpBindingAddress)
- .add("bgpPort", bgpPort)
- .add("bgp-as-number", bgpAsNumber)
- .add("bgp-netty-threads", bgpNettyThreads)
- .add("bgp-receive-multiple-paths", bgpMultiplePaths)
- .add("bgp-send-max-paths", bgpSendMaxMaths)
- .toString();
+ .add("bgpBindingAddress", bgpBindingAddress)
+ .add("bgpPort", bgpPort)
+ .add("bgpAsNumber", bgpAsNumber)
+ .add("bgpMultiplePaths", bgpMultiplePaths)
+ .add("bgpSendMaxMaths", bgpSendMaxMaths)
+ .add("bgpProtocolInstanceName", bgpProtocolInstanceName)
+ .add("bgpNettyThreads", bgpNettyThreads)
+ .toString();
}
}
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 9cd02b4..7fcddfc 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
@@ -52,7 +52,6 @@ import org.slf4j.LoggerFactory;
final class BgpRIBProvider extends ProviderTrait<RIB> {
private static final Logger LOG = LoggerFactory.getLogger(BgpRIBProvider.class);
- private static final String HC_BGP_INSTANCE_NAME = "hc-bgp-instance";
@Inject
private BgpConfiguration cfg;
@@ -93,9 +92,10 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
new TablesKey(entry.getKey().getAfi(), entry.getKey().getSafi()), Map.Entry::getValue));
// based on RIBImpl.createRib
final RIBImpl rib =
- new RIBImpl(new NoopClusterSingletonServiceProvider(), new RibId(HC_BGP_INSTANCE_NAME), asNumber,
- new BgpId(routerId), clusterId, extensions, dispatcher, codec, new PingPongDataBroker(domBroker),
- mappingService.toTableTypes(afiSafi), pathSelectionModes, extensions.getClassLoadingStrategy(), null);
+ new RIBImpl(new NoopClusterSingletonServiceProvider(), new RibId(cfg.bgpProtocolInstanceName.get()),
+ asNumber, new BgpId(routerId), clusterId, extensions, dispatcher, codec,
+ new PingPongDataBroker(domBroker), mappingService.toTableTypes(afiSafi), pathSelectionModes,
+ extensions.getClassLoadingStrategy(), null);
// required for proper RIB's CodecRegistry initialization (based on RIBImpl.start)
schemaService.registerSchemaContextListener(rib);
diff --git a/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json
index 2efe55e..093acb8 100644
--- a/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json
+++ b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp.json
@@ -4,5 +4,6 @@
"bgp-as-number": 65000,
"bgp-receive-multiple-paths": "true",
"bgp-send-max-paths": 0,
+ "bgp-protocol-instance-name": "hc-bgp-instance",
"bgp-netty-threads": 2
} \ No newline at end of file