summaryrefslogtreecommitdiffstats
path: root/infra
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-07-14 09:31:18 +0200
committerJan Srnicek <jsrnicek@cisco.com>2017-07-17 08:15:18 +0000
commit33f12d921cc503055ff82361f672fac7516d89ee (patch)
tree6a62ec11a83de84ae158e02da09fa46860e630bf /infra
parent7d22608d89d8ff8c32e72d15039f1f27b7d659a8 (diff)
HONEYCOMB-370: make bgp peers configuration optional
Change-Id: I459425f4ee8f43d0bf196d2c762e741c58667907 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra')
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java8
-rw-r--r--infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json53
2 files changed, 6 insertions, 55 deletions
diff --git a/infra/northbound/bgp/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 9356b32b4..f79afc9a2 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpNeighboursProvider.java
@@ -17,7 +17,6 @@
package io.fd.honeycomb.infra.bgp;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
import static io.fd.honeycomb.translate.util.JsonUtils.readContainerEntryJson;
import static org.opendaylight.protocol.bgp.openconfig.impl.util.OpenConfigUtil.APPLICATION_PEER_GROUP_NAME;
import static org.opendaylight.yangtools.sal.binding.generator.impl.BindingSchemaContextUtils.findDataNodeContainer;
@@ -26,6 +25,7 @@ import com.google.common.base.Optional;
import com.google.inject.Inject;
import io.fd.honeycomb.binding.init.ProviderTrait;
import java.io.InputStream;
+import java.util.Collections;
import java.util.Map;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
@@ -40,6 +40,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNe
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Neighbors;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.NeighborsBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
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.NetworkInstanceKey;
@@ -94,7 +95,10 @@ final class BgpNeighboursProvider extends ProviderTrait<BgpNeighbors> {
private Neighbors readNeighbours() {
LOG.debug("Reading BGP neighbours from {}", PEERS_CFG);
final InputStream resourceStream = this.getClass().getResourceAsStream(PEERS_CFG);
- checkState(resourceStream != null, "Resource %s not found", PEERS_CFG);
+ if (resourceStream == null) {
+ LOG.warn("Unable to open {}. Skipping BGP neighbour configuration.", PEERS_CFG);
+ return new NeighborsBuilder().setNeighbor(Collections.emptyList()).build();
+ }
final InstanceIdentifier<Bgp> bgpII = InstanceIdentifier.create(NetworkInstances.class)
.child(NetworkInstance.class, new NetworkInstanceKey("dummy-value")).child(Protocols.class)
diff --git a/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
deleted file mode 100644
index 93405fba6..000000000
--- a/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "bgp-openconfig-extensions:neighbors": {
- "neighbor": [
- {
- "neighbor-address": "10.25.1.9",
- "config": {
- "peer-group": "application-peers"
- },
- "afi-safis": {
- "afi-safi": [
- {
- "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
- "receive": true,
- "send-max": 0
- },
- {
- "afi-safi-name": "openconfig-bgp-types:IPV4-LABELLED-UNICAST",
- "receive": true,
- "send-max": 0
- }
- ]
- }
- },
- {
- "neighbor-address": "127.0.0.2",
- "config": {
- "peer-type": "INTERNAL"
- },
- "timers": {
- "config": {
- "connect-retry": 10,
- "hold-time": 90
- }
- },
- "transport": {
- "config": {
- "remote-port": 17900,
- "passive-mode": false
- }
- },
- "afi-safis": {
- "afi-safi": [
- {
- "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
- "receive": true,
- "send-max": 0
- }
- ]
- }
- }
- ]
- }
-} \ No newline at end of file