summaryrefslogtreecommitdiffstats
path: root/infra/bgp-distribution/src/main
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-06-19 08:25:04 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-06-19 08:25:04 +0200
commit1ebe244eb98ca8c5c4728caaa767e76a777580d6 (patch)
tree885f8cc489ca3380bd42c909c18753965722c8ae /infra/bgp-distribution/src/main
parent5e30997a790f77310dcaf08569244f081389b2a2 (diff)
Add support for BGP labeled unicast ipv4 extension
Change-Id: Id004eaf98d03daec260e7c13b79ced0f4785b952 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/bgp-distribution/src/main')
-rw-r--r--infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java12
-rw-r--r--infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java14
-rw-r--r--infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json5
3 files changed, 28 insertions, 3 deletions
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java b/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
index 11ee4cf8d..a2bd56df3 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
+++ b/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
@@ -37,6 +37,7 @@ import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4LABELLEDUNICAST;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -75,11 +76,18 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
final ClusterIdentifier clusterId = new ClusterIdentifier(routerId);
LOG.debug("Creating BGP RIB: routerId={}, asNumber={}", routerId, asNumber);
// TODO configure other BGP Multiprotocol extensions:
- final List<AfiSafi> afiSafi = ImmutableList.of(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class)
+ final List<AfiSafi> afiSafi = ImmutableList.of(
+ new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class)
.addAugmentation(AfiSafi2.class,
new AfiSafi2Builder().setReceive(cfg.isBgpMultiplePathsEnabled())
.setSendMax(cfg.bgpSendMaxMaths.get().shortValue()).build())
- .build());
+ .build(),
+ new AfiSafiBuilder().setAfiSafiName(IPV4LABELLEDUNICAST.class)
+ .addAugmentation(AfiSafi2.class,
+ new AfiSafi2Builder().setReceive(cfg.isBgpMultiplePathsEnabled())
+ .setSendMax(cfg.bgpSendMaxMaths.get().shortValue()).build())
+ .build()
+ );
final Map<TablesKey, PathSelectionMode> pathSelectionModes = mappingService.toPathSelectionMode(afiSafi)
.entrySet().stream().collect(Collectors.toMap(entry ->
new TablesKey(entry.getKey().getAfi(), entry.getKey().getSafi()), Map.Entry::getValue));
diff --git a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java b/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java
index 081fbd782..81faabbe5 100644
--- a/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java
+++ b/infra/bgp-distribution/src/main/java/io/fd/honeycomb/infra/bgp/BgpWriterFactoryProvider.java
@@ -26,6 +26,9 @@ import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.Ipv4Routes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.LabelStack;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.routes.LabeledUnicastRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.routes.list.LabeledUnicastRoute;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.LocalPref;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.Origin;
@@ -59,6 +62,8 @@ final class BgpWriterFactoryProvider extends ProviderTrait<WriterFactory> {
private static final InstanceIdentifier<Tables> TABLES_IID = AR_IID.child(Tables.class);
private static final InstanceIdentifier<Ipv4Routes> IPV4_ROUTES_IID = TABLES_IID.child((Class) Ipv4Routes.class);
private static final InstanceIdentifier<Ipv4Route> IPV4_ROUTE_IID = IPV4_ROUTES_IID.child(Ipv4Route.class);
+ private static final InstanceIdentifier<LabeledUnicastRoutes> LABELED_UNICAST_ROUTES_IID = TABLES_IID.child((Class) LabeledUnicastRoutes.class);
+ private static final InstanceIdentifier<LabeledUnicastRoute> LABELED_UNICAST_ROUTE_IID = LABELED_UNICAST_ROUTES_IID.child(LabeledUnicastRoute.class);
private BgpWriterFactory(final DataBroker dataBroker) {
this.dataBroker = dataBroker;
@@ -81,7 +86,14 @@ final class BgpWriterFactoryProvider extends ProviderTrait<WriterFactory> {
IPV4_ROUTE_IID.child(Attributes.class),
IPV4_ROUTE_IID.child(Attributes.class).child(Origin.class),
IPV4_ROUTE_IID.child(Attributes.class).child(LocalPref.class),
- IPV4_ROUTE_IID.child(Attributes.class).child(Ipv4NextHop.class)
+ IPV4_ROUTE_IID.child(Attributes.class).child(Ipv4NextHop.class),
+ LABELED_UNICAST_ROUTES_IID,
+ LABELED_UNICAST_ROUTE_IID,
+ LABELED_UNICAST_ROUTE_IID.child(Attributes.class),
+ LABELED_UNICAST_ROUTE_IID.child(Attributes.class).child(Origin.class),
+ LABELED_UNICAST_ROUTE_IID.child(Attributes.class).child(LocalPref.class),
+ LABELED_UNICAST_ROUTE_IID.child(Attributes.class).child(Ipv4NextHop.class),
+ LABELED_UNICAST_ROUTE_IID.child(LabelStack.class)
),
new BindingBrokerWriter<>(InstanceIdentifier.create(ApplicationRib.class), dataBroker)
);
diff --git a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json b/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
index 6de2065b8..93405fba6 100644
--- a/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
+++ b/infra/bgp-distribution/src/main/resources/honeycomb-minimal-resources/config/bgp-peers.json
@@ -12,6 +12,11 @@
"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
}
]
}