BUG-4825: BGP L3VPN configuration 39/35539/5
authorIveta Halanova <ihalanov@cisco.com>
Mon, 22 Feb 2016 14:11:27 +0000 (15:11 +0100)
committerIveta Halanova <ihalanov@cisco.com>
Tue, 1 Mar 2016 12:53:26 +0000 (13:53 +0100)
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>
artifacts/pom.xml
bgp/controller-config/src/main/resources/initial/31-bgp.xml
bgp/controller-config/src/main/resources/initial/41-bgp-example.xml
bgp/l3vpn/pom.xml
bgp/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/VpnIpv4RIBSupport.java
bgp/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastRIBSupport.java
features/bgp/pom.xml
features/bgp/src/main/features/features.xml

index aea2219331fc591d8f5b05827d97bd65f4da3f15..fdb450e2a01976cc639d3f4a581906127fa88e34 100644 (file)
                 <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>
index 5f845da397b739c7ab8baa3e849591013e1d5b66..634c060f3d121c7184403a40fd9b9de9b18430e7 100644 (file)
@@ -14,6 +14,7 @@
         <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate?module=odl-bgp-linkstate-cfg&amp;revision=2015-08-26</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:flowspec?module=odl-bgp-flowspec-cfg&amp;revision=2015-04-23</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:labeled:unicast?module=odl-bgp-labeled-unicast-cfg&amp;revision=2015-05-25</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:vpn:ipv4?module=odl-bgp-vpn-ipv4-cfg&amp;revision=2016-02-19</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi?module=odl-bgp-parser-spi-cfg&amp;revision=2013-11-15</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi?module=odl-bgp-rib-spi-cfg&amp;revision=2013-11-15</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl?module=odl-bgp-rib-impl-cfg&amp;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>
index 15c17db37a583c6b2823f93b59ce22354284c175..2659fa1e06598d6606eb98254b5b6222dbf488ba 100755 (executable)
                         <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>
index 0640366aec5206386c6aee246e72555caf220620..115e92a2184e5e4b5ea00d24e4cbfb8c2ec4b08e 100644 (file)
             <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>
index 99f7269fc80100290321074b0c562a7cd10e71fa..ae71776564fc9efab176564b9a9d39d384599355 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 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;
@@ -75,6 +76,8 @@ final class VpnIpv4RIBSupport extends AbstractRIBSupport {
     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());;
@@ -162,10 +165,10 @@ final class VpnIpv4RIBSupport extends AbstractRIBSupport {
         }
     }
 
-    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));
     }
@@ -218,14 +221,14 @@ final class VpnIpv4RIBSupport extends AbstractRIBSupport {
     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;
     }
index 07c0edbfda226c01e91288e982afa639e73415bb..01ca1f4d709967911b66dfac19cac6e73a2cb788 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.protocol.util.Ipv4Util;
 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;
@@ -71,8 +70,8 @@ public final class LabeledUnicastRIBSupport extends AbstractRIBSupport {
     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();
@@ -95,8 +94,8 @@ public final class LabeledUnicastRIBSupport extends AbstractRIBSupport {
     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));
         }
     }
@@ -104,8 +103,8 @@ public final class LabeledUnicastRIBSupport extends AbstractRIBSupport {
     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);
@@ -182,20 +181,20 @@ public final class LabeledUnicastRIBSupport extends AbstractRIBSupport {
 
     @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);
@@ -232,7 +231,7 @@ public final class LabeledUnicastRIBSupport extends AbstractRIBSupport {
     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();
     }
 
@@ -250,15 +249,15 @@ public final class LabeledUnicastRIBSupport extends AbstractRIBSupport {
         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()));
                 }
             }
         }
index 0d6f1085714ce1086201a85d6470c76906cd2171..ed2096ea83de549923c5b90231ae40a8f9a3e1e5 100644 (file)
           <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>
index 49ee224ea071ead0cf49aff336dd400a32d07ff6..b0c0b622c04c6f83bcfdee398a46fc87457296e2 100644 (file)
@@ -34,6 +34,7 @@
         <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>