From 2ef45cf1ca5c237729888f36dbe5bf9d285ba9af Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 14 Jul 2017 09:14:22 +0200 Subject: Make BGP protocol instance name configurable Change-Id: I49a201b8e027d229a60bb76abe9b5688af7b7cdf Signed-off-by: Marek Gradzki --- infra/bgp-distribution-test/src/test/resources/bgp.json | 1 + .../io/fd/honeycomb/infra/bgp/BgpConfiguration.java | 17 ++++++++++------- .../java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java | 8 ++++---- .../honeycomb-minimal-resources/config/bgp.json | 1 + 4 files changed, 16 insertions(+), 11 deletions(-) (limited to 'infra') diff --git a/infra/bgp-distribution-test/src/test/resources/bgp.json b/infra/bgp-distribution-test/src/test/resources/bgp.json index c352fb0f2..5cc9a419c 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 6cc245af7..9335fb33d 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 bgpMultiplePaths; @InjectConfig("bgp-send-max-paths") public Optional bgpSendMaxMaths; + @InjectConfig("bgp-protocol-instance-name") + public Optional 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 9cd02b49e..7fcddfc5c 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 { 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 { 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 2efe55ee3..093acb85b 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 -- cgit 1.2.3-korg