diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-07-14 09:14:22 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-07-14 09:14:31 +0200 |
commit | 2ef45cf1ca5c237729888f36dbe5bf9d285ba9af (patch) | |
tree | c1cf40fcba0652f24fc04d6b043e2bfe98627b93 | |
parent | 7d9dc808b56564474759ecb9d166353c45944cb4 (diff) |
Make BGP protocol instance name configurable
Change-Id: I49a201b8e027d229a60bb76abe9b5688af7b7cdf
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
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 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<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 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<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 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 |