Added and enabled configuration.
Tested with odl, app peer and exabgp peer.
Corrected RD and labels extraction in RIB Support.
Change-Id: Iefb45ba3aad13428bda11e52222877d51cec6a7a
Signed-off-by: Iveta Halanova <ihalanov@cisco.com>
<artifactId>bgp-labeled-unicast</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>bgp-l3vpn</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-linkstate</artifactId>
<capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate?module=odl-bgp-linkstate-cfg&revision=2015-08-26</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:flowspec?module=odl-bgp-flowspec-cfg&revision=2015-04-23</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:labeled:unicast?module=odl-bgp-labeled-unicast-cfg&revision=2015-05-25</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:vpn:ipv4?module=odl-bgp-vpn-ipv4-cfg&revision=2016-02-19</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi?module=odl-bgp-parser-spi-cfg&revision=2013-11-15</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi?module=odl-bgp-rib-spi-cfg&revision=2013-11-15</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl?module=odl-bgp-rib-impl-cfg&revision=2013-04-09</capability>
<type xmlns:bgpspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi">bgpspi:extension</type>
<name>bgp-labeled-unicast</name>
</extension>
+ <extension>
+ <type xmlns:bgpspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi">bgpspi:extension</type>
+ <name>bgp-vpn-ipv4</name>
+ </extension>
</module>
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:base-bgp-parser</type>
<type xmlns:ribspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi">ribspi:extension</type>
<name>bgp-labeled-unicast</name>
</extension>
+ <extension>
+ <type xmlns:ribspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi">ribspi:extension</type>
+ <name>bgp-vpn-ipv4</name>
+ </extension>
</module>
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:base-bgp-rib</type>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:labeled:unicast">prefix:bgp-labeled-unicast</type>
<name>bgp-labeled-unicast</name>
</module>
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:vpn:ipv4">prefix:bgp-vpn-ipv4</type>
+ <name>bgp-vpn-ipv4</name>
+ </module>
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-dispatcher-impl</type>
<name>global-bgp-dispatcher</name>
<afi xmlns:bgp="urn:opendaylight:params:xml:ns:yang:bgp-types">bgp:ipv4-address-family</afi>
<safi xmlns:labeled-unicast="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">labeled-unicast:labeled-unicast-subsequent-address-family</safi>
</module>
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type-impl</type>
+ <name>ipv4-l3vpn</name>
+ <afi xmlns:bgp="urn:opendaylight:params:xml:ns:yang:bgp-types">bgp:ipv4-address-family</afi>
+ <safi xmlns:bgp-types="urn:opendaylight:params:xml:ns:yang:bgp-types">bgp-types:mpls-labeled-vpn-subsequent-address-family</safi>
+ </module>
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<name>bgp-labeled-unicast</name>
<provider>/modules/module[type='bgp-labeled-unicast'][name='bgp-labeled-unicast']</provider>
</instance>
+ <instance>
+ <name>bgp-vpn-ipv4</name>
+ <provider>/modules/module[type='bgp-vpn-ipv4'][name='bgp-vpn-ipv4']</provider>
+ </instance>
</service>
<service>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>labeled-unicast</name>
<provider>/modules/module[type='bgp-table-type-impl'][name='labeled-unicast']</provider>
</instance>
+ <instance>
+ <name>ipv4-l3vpn</name>
+ <provider>/modules/module[type='bgp-table-type-impl'][name='ipv4-l3vpn']</provider>
+ </instance>
</service>
<service>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:add-path</type>
<name>bgp-labeled-unicast</name>
<provider>/modules/module[type='bgp-labeled-unicast'][name='bgp-labeled-unicast']</provider>
</instance>
+ <instance>
+ <name>bgp-vpn-ipv4</name>
+ <provider>/modules/module[type='bgp-vpn-ipv4'][name='bgp-vpn-ipv4']</provider>
+ </instance>
</service>
<service>
<type xmlns:ribspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi">ribspi:extensions</type>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>labeled-unicast</name>
</advertized-table>
+ <advertized-table>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
+ <name>ipv4-l3vpn</name>
+ </advertized-table>
</module>
-->
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>labeled-unicast</name>
</local-table>
+ <local-table>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
+ <name>ipv4-l3vpn</name>
+ </local-table>
<extensions>
<type xmlns:ribspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi">ribspi:extensions</type>
<name>global-rib-extensions</name>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-labeled-unicast</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!-- test scope dependencies -->
<dependency>
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.RouteDistinguisher;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.RouteDistinguisherBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.CNextHop;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev160210.bgp.rib.rib.loc.rib.tables.routes.VpnIpv4RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev160210.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv4CaseBuilder;
private static final NodeIdentifier NLRI_ROUTES_LIST = NodeIdentifier.create(VpnIpv4Destination.QNAME);
private static final NodeIdentifier ROUTE = NodeIdentifier.create(VpnIpv4Route.QNAME);
private static final NodeIdentifier PREFIX_TYPE_NID = NodeIdentifier.create(QName.create(VpnIpv4Destination.QNAME, "prefix").intern());
+ private static final NodeIdentifier LABEL_STACK_NID = NodeIdentifier.create(QName.create(VpnIpv4Destination.QNAME, "label-stack").intern());
+ private static final NodeIdentifier LV_NID = NodeIdentifier.create(QName.create(VpnIpv4Destination.QNAME, "label-value").intern());
private static final QName ROUTE_KEY = QName.create(VpnIpv4Route.QNAME, "route-key").intern();
private static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(VpnIpv4Destination.QNAME, "route-distinguisher").intern());;
}
}
- private NodeIdentifierWithPredicates createRouteKey(final UnkeyedListEntryNode labeledUnicast) {
+ private NodeIdentifierWithPredicates createRouteKey(final UnkeyedListEntryNode l3vpn) {
final ByteBuf buffer = Unpooled.buffer();
- final VpnIpv4Destination dest = extractVpnIpv4Destination(labeledUnicast);
+ final VpnIpv4Destination dest = extractVpnIpv4Destination(l3vpn);
VpnIpv4NlriParser.serializeNlri(Collections.singletonList(dest), buffer);
return new NodeIdentifierWithPredicates(VpnIpv4Route.QNAME, ROUTE_KEY, ByteArray.readAllBytes(buffer));
}
private static VpnIpv4Destination extractVpnIpv4Destination(final DataContainerNode<? extends PathArgument> route) {
final VpnIpv4DestinationBuilder builder = new VpnIpv4DestinationBuilder();
builder.setPrefix(LabeledUnicastRIBSupport.extractPrefix(route, PREFIX_TYPE_NID));
- builder.setLabelStack(LabeledUnicastRIBSupport.extractLabel(route));
+ builder.setLabelStack(LabeledUnicastRIBSupport.extractLabel(route, LABEL_STACK_NID, LV_NID));
builder.setRouteDistinguisher(extractRouteDistinguisher(route));
return builder.build();
}
private static RouteDistinguisher extractRouteDistinguisher(final DataContainerNode<? extends PathArgument> route) {
if (route.getChild(RD_NID).isPresent()) {
- return (RouteDistinguisher) route.getChild(RD_NID).get();
+ return RouteDistinguisherBuilder.getDefaultInstance((String) route.getChild(RD_NID).get().getValue());
}
return null;
}
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.Label;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.LabeledUnicastSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.bgp.rib.rib.loc.rib.tables.routes.LabeledUnicastRoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.LabelStack;
private static final Logger LOG = LoggerFactory.getLogger(LabeledUnicastRIBSupport.class);
private static final NodeIdentifier PREFIX_TYPE_NID = NodeIdentifier.create(QName.create(CLabeledUnicastDestination.QNAME, "prefix").intern());
- private static final NodeIdentifier LABEL_STACK_NID = NodeIdentifier.create(LabelStack.QNAME);
- private static final NodeIdentifier LV_NID = NodeIdentifier.create(QName.create(Label.QNAME, "label-value"));
+ private static final NodeIdentifier LABEL_STACK_NID = NodeIdentifier.create(QName.create(CLabeledUnicastDestination.QNAME, "label-stack").intern());
+ private static final NodeIdentifier LV_NID = NodeIdentifier.create(QName.create(CLabeledUnicastDestination.QNAME, "label-value").intern());
private static final QName ROUTE_KEY = QName.create(LabeledUnicastRoute.QNAME, "route-key").intern();
private static final ApplyRoute DELETE_ROUTE = new DeleteRoute();
private static final class DeleteRoute extends ApplyRoute {
@Override
void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base,
- final NodeIdentifierWithPredicates routeKey,
- final DataContainerNode<?> route, final ContainerNode attributes) {
+ final NodeIdentifierWithPredicates routeKey,
+ final DataContainerNode<?> route, final ContainerNode attributes) {
tx.delete(LogicalDatastoreType.OPERATIONAL, base.node(routeKey));
}
}
private final class PutRoute extends ApplyRoute {
@Override
void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base,
- final NodeIdentifierWithPredicates routeKey,
- final DataContainerNode<?> route, final ContainerNode attributes) {
+ final NodeIdentifierWithPredicates routeKey,
+ final DataContainerNode<?> route, final ContainerNode attributes) {
// Build the DataContainer data
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> b = ImmutableNodes.mapEntryBuilder();
b.withNodeIdentifier(routeKey);
@Override
protected void deleteDestinationRoutes(final DOMDataWriteTransaction tx,
- final YangInstanceIdentifier tablePath, final ContainerNode destination,final NodeIdentifier routesNodeId) {
+ final YangInstanceIdentifier tablePath, final ContainerNode destination,final NodeIdentifier routesNodeId) {
processDestination(tx, tablePath.node(routesNodeId), destination, null, DELETE_ROUTE);
}
@Override
protected void putDestinationRoutes(final DOMDataWriteTransaction tx,
- final YangInstanceIdentifier tablePath, final ContainerNode destination,
- final ContainerNode attributes,final NodeIdentifier routesNodeId) {
+ final YangInstanceIdentifier tablePath, final ContainerNode destination,
+ final ContainerNode attributes,final NodeIdentifier routesNodeId) {
processDestination(tx, tablePath.node(routesNodeId), destination, attributes, this.putRoute);
}
@Override
protected MpReachNlri buildReach(final Collection<MapEntryNode> routes,
- final CNextHop hop) {
+ final CNextHop hop) {
final MpReachNlriBuilder mb = new MpReachNlriBuilder();
mb.setAfi(this.afiType);
mb.setSafi(LabeledUnicastSubsequentAddressFamily.class);
private static CLabeledUnicastDestination extractCLabeledUnicastDestination(final DataContainerNode<? extends PathArgument> route) {
final CLabeledUnicastDestinationBuilder builder = new CLabeledUnicastDestinationBuilder();
builder.setPrefix(extractPrefix(route, PREFIX_TYPE_NID));
- builder.setLabelStack(extractLabel(route));
+ builder.setLabelStack(extractLabel(route, LABEL_STACK_NID, LV_NID));
return builder.build();
}
return null;
}
- public static List<LabelStack> extractLabel(final DataContainerNode<? extends PathArgument> route) {
+ public static List<LabelStack> extractLabel(final DataContainerNode<? extends PathArgument> route, final NodeIdentifier labelStackNid, final NodeIdentifier labelValueNid) {
final List<LabelStack> labels = new ArrayList<>();
- final Optional<DataContainerChild<? extends PathArgument, ?>> labelStacks = route.getChild(LABEL_STACK_NID);
+ final Optional<DataContainerChild<? extends PathArgument, ?>> labelStacks = route.getChild(labelStackNid);
final LabelStackBuilder labelStackbuilder = new LabelStackBuilder();
if (labelStacks.isPresent()) {
for(final UnkeyedListEntryNode label : ((UnkeyedListNode)labelStacks.get()).getValue()) {
- final Optional<DataContainerChild<? extends PathArgument, ?>> labelStack = label.getChild(LV_NID);
+ final Optional<DataContainerChild<? extends PathArgument, ?>> labelStack = label.getChild(labelValueNid);
if (labelStack.isPresent()) {
- labelStackbuilder.setLabelValue((MplsLabel) labelStack.get());
+ labelStackbuilder.setLabelValue(new MplsLabel((Long) labelStack.get().getValue()));
}
}
}
<groupId>${project.groupId}</groupId>
<artifactId>bgp-labeled-unicast</artifactId>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>bgp-l3vpn</artifactId>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-inet</artifactId>
<feature version='${project.version}'>odl-bgpcep-bgp-linkstate</feature>
<feature version='${project.version}'>odl-bgpcep-bgp-flowspec</feature>
<feature version='${project.version}'>odl-bgpcep-bgp-labeled-unicast</feature>
+ <feature version='${project.version}'>odl-bgpcep-bgp-l3vpn</feature>
<feature version='${project.version}'>odl-bgpcep-bgp-topology</feature>
<feature version='${project.version}'>odl-bgpcep-bgp-openconfig</feature>
<configfile finalname="etc/opendaylight/karaf/31-bgp.xml">mvn:org.opendaylight.bgpcep/bgp-controller-config/{{VERSION}}/xml/config</configfile>
<bundle>mvn:org.opendaylight.bgpcep/bgp-bmp-api/{{VERSION}}</bundle>
</feature>
+ <feature name='odl-bgpcep-bgp-l3vpn' version='${project.version}'>
+ <feature version='${project.version}'>odl-bgpcep-bgp-parser</feature>
+ <feature version='${project.version}'>odl-bgpcep-bgp-rib-api</feature>
+ <feature version='${project.version}'>odl-bgpcep-bgp-labeled-unicast</feature>
+ <bundle>mvn:org.opendaylight.bgpcep/bgp-l3vpn/{{VERSION}}</bundle>
+ <bundle>mvn:org.opendaylight.bgpcep/bgp-bmp-api/{{VERSION}}</bundle>
+ </feature>
+
<feature name='odl-bgpcep-bgp-rib-impl' version='${project.version}'>
<feature version='${project.version}'>odl-bgpcep-bgp-dependencies</feature>
<feature version='${tcpmd5.version}'>odl-tcpmd5-netty</feature>