Move IPv4/6 Unicast extension to bgp-inet 42/41842/9
authorMilos Fabian <milfabia@cisco.com>
Thu, 14 Jul 2016 14:38:04 +0000 (16:38 +0200)
committerMilos Fabian <milfabia@cisco.com>
Wed, 20 Jul 2016 07:34:03 +0000 (07:34 +0000)
Separates IPv4/6 Unicast multiprotocol extension
from core implementation modules (rib-impl, parser-impl).

Motivation:
Moving code wiring to blueprint caused that rib-spi's
RIBExtensionProviderActivator service is waiting for
all RIB extensions activators and rib-impl contains
such extension too.
On the other hand, rib-impl's RIBImpl depends on
rib-spi's RIBExtensionConsumerContext
service.
In a result cyclic dependency is created - neither blueprint
container is resolved.

Change-Id: Ie2eae4458382a67dd446b2260c70f7a542384b1f
Signed-off-by: Milos Fabian <milfabia@cisco.com>
40 files changed:
bgp/bmp-impl/src/test/java/org/opendaylight/protocol/bmp/impl/app/BmpMonitorImplTest.java
bgp/flowspec/pom.xml
bgp/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/BGPActivator.java
bgp/inet/pom.xml
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/AbstractIPRIBSupport.java [moved from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractIPRIBSupport.java with 99% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/BGPActivator.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupport.java [moved from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/IPv4RIBSupport.java with 91% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupport.java [moved from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/IPv6RIBSupport.java with 86% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/RIBActivator.java [moved from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBActivator.java with 76% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv4NlriParser.java [moved from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/Ipv4NlriParser.java with 59% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv6BgpPrefixSidParser.java [moved from bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/Ipv6BgpPrefixSidParser.java with 97% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv6NlriParser.java [moved from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/Ipv6NlriParser.java with 50% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/nexthop/Ipv4NextHopParserSerializer.java [moved from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/next/hop/Ipv4NextHopParserSerializer.java with 95% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/nexthop/Ipv6NextHopParserSerializer.java [moved from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/next/hop/Ipv6NextHopParserSerializer.java with 94% similarity]
bgp/inet/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator [new file with mode: 0644]
bgp/inet/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator [moved from bgp/rib-impl/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator with 84% similarity]
bgp/inet/src/main/resources/org/opendaylight/blueprint/bgp-inet.xml [new file with mode: 0644]
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupportTest.java [moved from bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/IPv4RIBSupportTest.java with 94% similarity]
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupportTest.java [moved from bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/IPv6RIBSupportTest.java with 99% similarity]
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/Ipv6BgpPrefixSidParserTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/BGPParserTest.java [new file with mode: 0644]
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/Ipv4NlriParserTest.java [moved from bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/Ipv4NlriParserTest.java with 85% similarity]
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/nexthop/NextHopParserSerializerTest.java [moved from bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/next/hop/NextHopParserSerializerTest.java with 95% similarity]
bgp/inet/src/test/resources/up2.bin [new file with mode: 0644]
bgp/labeled-unicast/pom.xml
bgp/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/BGPActivator.java
bgp/parser-impl/pom.xml
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BGPActivator.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AdvertizedRoutesSerializer.java [deleted file]
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/WithdrawnRoutesSerializer.java [deleted file]
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java
bgp/path-selection-mode/pom.xml
bgp/rib-impl/pom.xml
bgp/rib-impl/src/main/resources/org/opendaylight/blueprint/bgp-rib.xml
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AbstractRIBTestSetup.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/LocRibWriterTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserToSalTest.java
bgp/rib-spi/pom.xml
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/SimpleRIBExtensionTest.java
features/bgp/src/main/features/features.xml

index d6c356c989e0bee729d0c94e13428173397d4dcd..30e60a9e250731356ae20003a757986d4f9463a1 100644 (file)
@@ -49,10 +49,10 @@ import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCo
 import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+import org.opendaylight.protocol.bgp.inet.RIBActivator;
 import org.opendaylight.protocol.bgp.parser.impl.BGPActivator;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
 import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
-import org.opendaylight.protocol.bgp.rib.impl.RIBActivator;
 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
 import org.opendaylight.protocol.bmp.api.BmpDispatcher;
index bf022f633109579da4ab73d84935758f2bb9191e..d1d3e6e272df201152def78932906321901df3c8 100644 (file)
@@ -50,7 +50,7 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>bgp-parser-impl</artifactId>
+            <artifactId>bgp-inet</artifactId>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
index 29336718e5c9dbe94afefe5fb2f234ead0c5145f..1990c4927198efb35909b8daa2da12beb83b2050 100644 (file)
@@ -21,8 +21,8 @@ import org.opendaylight.protocol.bgp.flowspec.extended.communities.TrafficMarkin
 import org.opendaylight.protocol.bgp.flowspec.extended.communities.TrafficRateEcHandler;
 import org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4.FlowspecL3vpnIpv4NlriParser;
 import org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6.FlowspecL3vpnIpv6NlriParser;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv4NextHopParserSerializer;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv6NextHopParserSerializer;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv4NextHopParserSerializer;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv6NextHopParserSerializer;
 import org.opendaylight.protocol.bgp.parser.spi.AbstractBGPExtensionProviderActivator;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.FlowspecL3vpnSubsequentAddressFamily;
@@ -69,30 +69,30 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         final SimpleFlowspecIpv4NlriParser fsIpv4Handler = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
         final SimpleFlowspecIpv6NlriParser fsIpv6Handler = new SimpleFlowspecIpv6NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
         regs.add(
-            context.registerNlriParser(
-                Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class, fsIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class
-            )
-        );
+                context.registerNlriParser(
+                        Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class, fsIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class
+                        )
+                );
         regs.add(
-            context.registerNlriParser(
-                Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class, fsIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class
-            )
-        );
+                context.registerNlriParser(
+                        Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class, fsIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class
+                        )
+                );
         regs.add(context.registerNlriSerializer(FlowspecRoutes.class, fsIpv4Handler));
         regs.add(context.registerNlriSerializer(FlowspecIpv6Routes.class, fsIpv6Handler));
 
         final FlowspecL3vpnIpv4NlriParser fsL3vpnIpv4Handler = new FlowspecL3vpnIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
         final FlowspecL3vpnIpv6NlriParser fsL3vpnIpv6Handler = new FlowspecL3vpnIpv6NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
         regs.add(
-            context.registerNlriParser(
-                Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, fsL3vpnIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class
-            )
-        );
+                context.registerNlriParser(
+                        Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, fsL3vpnIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class
+                        )
+                );
         regs.add(
-            context.registerNlriParser(
-                Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, fsL3vpnIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class
-            )
-        );
+                context.registerNlriParser(
+                        Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, fsL3vpnIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class
+                        )
+                );
         regs.add(context.registerNlriSerializer(FlowspecL3vpnIpv4Routes.class, fsL3vpnIpv4Handler));
         regs.add(context.registerNlriSerializer(FlowspecL3vpnIpv6Routes.class, fsL3vpnIpv6Handler));
 
index a4a617b687e5e008bb8c5bed3beabf29155e945b..c993299381383edfcd0cd85419141a262617baf4 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>bgp-rib-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bgp-rib-spi</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
          </dependency>
+         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bgp-rib-spi</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-broker-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bgp-parser-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
similarity index 99%
rename from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractIPRIBSupport.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/AbstractIPRIBSupport.java
index a7cb472a5d6cc5eeb798271a2602df5ceedc62b5..9e9a604867b885c3579c1ce7dcdfe9b30fe0fe3b 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.bgp.rib.impl;
+package org.opendaylight.protocol.bgp.inet;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
index 026e673957a99526b81da287ec558866a893c768..c3562c858e7dd5acd1175e020319c284155f1ed6 100644 (file)
@@ -9,15 +9,40 @@ package org.opendaylight.protocol.bgp.inet;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.opendaylight.protocol.bgp.inet.codec.Ipv4NlriParser;
+import org.opendaylight.protocol.bgp.inet.codec.Ipv6BgpPrefixSidParser;
+import org.opendaylight.protocol.bgp.inet.codec.Ipv6NlriParser;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv4NextHopParserSerializer;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv6NextHopParserSerializer;
 import org.opendaylight.protocol.bgp.parser.spi.AbstractBGPExtensionProviderActivator;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+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.ipv6.routes.Ipv6Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.bgp.prefix.sid.tlv.Ipv6SidTlv;
+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.Ipv6AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase;
 
 public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
 
     @Override
     protected List<AutoCloseable> startImpl(final BGPExtensionProviderContext context) {
-        final List<AutoCloseable> regs = new ArrayList<>(2);
+        final List<AutoCloseable> regs = new ArrayList<>(6);
+
+        final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
+        final Ipv4NlriParser ipv4Codec = new Ipv4NlriParser();
+        regs.add(context.registerNlriParser(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class,
+                ipv4Codec, ipv4NextHopParser, Ipv4NextHopCase.class, Ipv6NextHopCase.class));
+        regs.add(context.registerNlriSerializer(Ipv4Routes.class, ipv4Codec));
+
+        final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
+        final Ipv6NlriParser ipv6Codec = new Ipv6NlriParser();
+        regs.add(context.registerNlriParser(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, ipv6Codec,
+                ipv6NextHopParser, Ipv4NextHopCase.class, Ipv6NextHopCase.class));
+        regs.add(context.registerNlriSerializer(Ipv6Routes.class, ipv6Codec));
+
         final Ipv6BgpPrefixSidParser tlvHandler = new Ipv6BgpPrefixSidParser();
         regs.add(context.registerBgpPrefixSidTlvParser(tlvHandler.getType(), tlvHandler));
         regs.add(context.registerBgpPrefixSidTlvSerializer(Ipv6SidTlv.class, tlvHandler));
similarity index 91%
rename from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/IPv4RIBSupport.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupport.java
index a2e660382a82236131ef65bc168966b1664dea6e..2b185ef72b2b32c381a0744f6a1f23f16babc764 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.bgp.rib.impl;
+package org.opendaylight.protocol.bgp.inet;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -35,7 +35,7 @@ final class IPv4RIBSupport extends AbstractIPRIBSupport {
 
     private IPv4RIBSupport() {
         super(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.Ipv4Prefix.class, Ipv4AddressFamily.class,
-            Ipv4RoutesCase.class, Ipv4Routes.class, Ipv4Route.class, DestinationIpv4.QNAME, Ipv4Prefixes.QNAME);
+                Ipv4RoutesCase.class, Ipv4Routes.class, Ipv4Route.class, DestinationIpv4.QNAME, Ipv4Prefixes.QNAME);
     }
 
     static IPv4RIBSupport getInstance() {
@@ -45,9 +45,9 @@ final class IPv4RIBSupport extends AbstractIPRIBSupport {
     private List<Ipv4Prefixes> extractPrefixes(final Collection<MapEntryNode> routes) {
         final List<Ipv4Prefixes> prefs = new ArrayList<>(routes.size());
         for (final MapEntryNode route : routes) {
-            final String prefix = (String) NormalizedNodes.findNode(route, this.routePrefixIdentifier()).get().getValue();
+            final String prefix = (String) NormalizedNodes.findNode(route, routePrefixIdentifier()).get().getValue();
             final Ipv4PrefixesBuilder prefixBuilder = new Ipv4PrefixesBuilder().setPrefix(new Ipv4Prefix(prefix));
-            prefixBuilder.setPathId(PathIdUtil.buildPathId(route, this.routePathIdNid()));
+            prefixBuilder.setPathId(PathIdUtil.buildPathId(route, routePathIdNid()));
             prefs.add(prefixBuilder.build());
         }
         return prefs;
@@ -63,6 +63,6 @@ final class IPv4RIBSupport extends AbstractIPRIBSupport {
     @Override
     protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
         return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-            new DestinationIpv4Builder().setIpv4Prefixes(extractPrefixes(routes)).build()).build();
+                new DestinationIpv4Builder().setIpv4Prefixes(extractPrefixes(routes)).build()).build();
     }
 }
similarity index 86%
rename from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/IPv6RIBSupport.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupport.java
index aff4d51c373150d6b89e7e0e4a4c18df8fc9db54..d5061a87eb17e654b3ac400c6dd219dd350397d8 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.bgp.rib.impl;
+package org.opendaylight.protocol.bgp.inet;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -35,7 +35,7 @@ final class IPv6RIBSupport extends AbstractIPRIBSupport {
 
     private IPv6RIBSupport() {
         super(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.Ipv6Prefix.class,
-            Ipv6AddressFamily.class, Ipv6RoutesCase.class, Ipv6Routes.class, Ipv6Route.class, DestinationIpv6.QNAME, Ipv6Prefixes.QNAME);
+                Ipv6AddressFamily.class, Ipv6RoutesCase.class, Ipv6Routes.class, Ipv6Route.class, DestinationIpv6.QNAME, Ipv6Prefixes.QNAME);
     }
 
     static IPv6RIBSupport getInstance() {
@@ -52,15 +52,15 @@ final class IPv6RIBSupport extends AbstractIPRIBSupport {
     @Override
     protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
         return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes
-            .destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
-            new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build();
+                .destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
+                        new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build();
     }
 
     private List<Ipv6Prefixes> extractPrefixes(final Collection<MapEntryNode> routes) {
         final List<Ipv6Prefixes> prefs = new ArrayList<>(routes.size());
         for (final MapEntryNode route : routes) {
-            final String prefix = (String) NormalizedNodes.findNode(route, this.routePrefixIdentifier()).get().getValue();
-            prefs.add(new Ipv6PrefixesBuilder().setPathId(PathIdUtil.buildPathId(route, this.routePathIdNid())).setPrefix(new Ipv6Prefix(prefix)).build());
+            final String prefix = (String) NormalizedNodes.findNode(route, routePrefixIdentifier()).get().getValue();
+            prefs.add(new Ipv6PrefixesBuilder().setPathId(PathIdUtil.buildPathId(route, routePathIdNid())).setPrefix(new Ipv6Prefix(prefix)).build());
         }
         return prefs;
     }
similarity index 76%
rename from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBActivator.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/RIBActivator.java
index 78e75359a098aefe33ffe6e5df735e3dce69d026..b8c735593ca28ad435b5a3498c53f9b95144630d 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.bgp.rib.impl;
+package org.opendaylight.protocol.bgp.inet;
 
 import com.google.common.collect.Lists;
 import java.util.List;
@@ -20,7 +20,7 @@ public final class RIBActivator extends AbstractRIBExtensionProviderActivator {
     @Override
     protected List<AutoCloseable> startRIBExtensionProviderImpl(final RIBExtensionProviderContext context) {
         return Lists.newArrayList(
-            (AutoCloseable)context.registerRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv4RIBSupport.getInstance()),
-            (AutoCloseable)context.registerRIBSupport(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv6RIBSupport.getInstance()));
+                (AutoCloseable)context.registerRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv4RIBSupport.getInstance()),
+                (AutoCloseable)context.registerRIBSupport(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv6RIBSupport.getInstance()));
     }
 }
similarity index 59%
rename from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/Ipv4NlriParser.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv4NlriParser.java
index 9b545295fca6b695b4b2a82718a155f55173c94a..9e9dd684562dcb033d66a864b8b2dd0e86b322b0 100644 (file)
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.bgp.parser.impl.message.update;
+
+package org.opendaylight.protocol.bgp.inet.codec;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
@@ -19,16 +20,20 @@ import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
 import org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint;
 import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.protocol.util.Ipv4Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.DestinationIpv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.DestinationIpv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4Prefixes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4PrefixesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.Nlri;
+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.multiprotocol.rev130919.Attributes1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlriBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlriBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
@@ -36,15 +41,6 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 
 public final class Ipv4NlriParser implements NlriParser, NlriSerializer {
 
-    @Override
-    public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Nlri, "Attribute parameter is not a Nlri object.");
-        final Nlri nlri = (Nlri) attribute;
-        for (final Ipv4Prefix ipv4Prefix : nlri.getNlri()) {
-            ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix, byteAggregator);
-        }
-    }
-
     private static DestinationIpv4 prefixes(final ByteBuf nlri, final PeerSpecificParserConstraint constraints,
             final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
         final List<Ipv4Prefixes> prefixes = new ArrayList<>();
@@ -80,4 +76,32 @@ public final class Ipv4NlriParser implements NlriParser, NlriSerializer {
         builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
                 prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
     }
+
+    @Override
+    public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
+        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        final Attributes pathAttributes = (Attributes) attribute;
+        final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
+        final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+        if (pathAttributes1 != null) {
+            final AdvertizedRoutes advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
+            if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv4Case) {
+                final DestinationIpv4Case destinationIpv4Case = (DestinationIpv4Case) advertizedRoutes.getDestinationType();
+                for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) {
+                    PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator);
+                    ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator);
+                }
+            }
+        } else if (pathAttributes2 != null) {
+            final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
+            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case) {
+                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case destinationIpv4Case =
+                        (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case) withdrawnRoutes.getDestinationType();
+                for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) {
+                    PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator);
+                    ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator);
+                }
+            }
+        }
+    }
 }
\ No newline at end of file
similarity index 97%
rename from bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/Ipv6BgpPrefixSidParser.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv6BgpPrefixSidParser.java
index f806665fc044695202f39ff1ad44a50d29d75838..9891d707735dd0c8af21a86ddafef89ce3093056 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.bgp.inet;
+package org.opendaylight.protocol.bgp.inet.codec;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
similarity index 50%
rename from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/Ipv6NlriParser.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv6NlriParser.java
index 6549a5219c3900f42727a0b91d1f0a2f6d2a27b5..1f0dde518e32f84788d01b3d3db6d6b0280169c6 100644 (file)
@@ -1,12 +1,14 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.bgp.parser.impl.message.update;
 
+package org.opendaylight.protocol.bgp.inet.codec;
+
+import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
 import java.util.List;
@@ -16,25 +18,34 @@ import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
 import org.opendaylight.protocol.bgp.parser.spi.MultiPathSupportUtil;
 import org.opendaylight.protocol.bgp.parser.spi.NlriParser;
+import org.opendaylight.protocol.bgp.parser.spi.NlriSerializer;
 import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
 import org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint;
+import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.protocol.util.Ipv6Util;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6Prefixes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6PrefixesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6CaseBuilder;
+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.multiprotocol.rev130919.Attributes1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlriBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlriBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 
-public final class Ipv6NlriParser implements NlriParser {
+public final class Ipv6NlriParser implements NlriParser, NlriSerializer {
 
     private static DestinationIpv6 prefixes(final ByteBuf nlri, final PeerSpecificParserConstraint constraint,
-        final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
+            final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
         final List<Ipv6Prefixes> prefixes = new ArrayList<>();
         final boolean supported = MultiPathSupportUtil.isTableTypeSupported(constraint, new BgpTableTypeImpl(afi, safi));
         while (nlri.isReadable()) {
@@ -60,14 +71,42 @@ public final class Ipv6NlriParser implements NlriParser {
 
     @Override
     public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpReachNlriBuilder builder,
-        @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
+            @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
         builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv6CaseBuilder().
-            setDestinationIpv6(prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
+                setDestinationIpv6(prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
     }
 
     @Override
     public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpUnreachNlriBuilder builder, @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
         builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
-            prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
+                prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
+    }
+
+    @Override
+    public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
+        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        final Attributes pathAttributes = (Attributes) attribute;
+        final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
+        final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+        if (pathAttributes1 != null) {
+            final AdvertizedRoutes advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
+            if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv6Case) {
+                final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) advertizedRoutes.getDestinationType();
+                for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
+                    PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
+                    ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
+                }
+            }
+        } else if (pathAttributes2 != null) {
+            final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
+            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) {
+                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case destinationIpv6Case =
+                        (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) withdrawnRoutes.getDestinationType();
+                for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
+                    PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
+                    ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
+                }
+            }
+        }
     }
 }
\ No newline at end of file
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop;
+package org.opendaylight.protocol.bgp.inet.codec.nexthop;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop;
+package org.opendaylight.protocol.bgp.inet.codec.nexthop;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
diff --git a/bgp/inet/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator b/bgp/inet/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator
new file mode 100644 (file)
index 0000000..c3e5136
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+#
+# This program and the accompanying materials are made available
+# under the terms of the Eclipse Public License v1.0 which
+# accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+org.opendaylight.protocol.bgp.inet.BGPActivator
diff --git a/bgp/inet/src/main/resources/org/opendaylight/blueprint/bgp-inet.xml b/bgp/inet/src/main/resources/org/opendaylight/blueprint/bgp-inet.xml
new file mode 100644 (file)
index 0000000..e335b6d
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <bean id="BGPActivator" class="org.opendaylight.protocol.bgp.inet.BGPActivator"/>
+
+  <bean id="RIBActivator" class="org.opendaylight.protocol.bgp.inet.RIBActivator"/>
+
+  <service ref="BGPActivator" interface="org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.bgp.inet.BGPActivator"/>
+
+  <service ref="RIBActivator" interface="org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.bgp.inet.RIBActivator"/>
+</blueprint>
\ No newline at end of file
similarity index 94%
rename from bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/IPv4RIBSupportTest.java
rename to bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupportTest.java
index 733441a4ac404770e970c549003900888b7253d7..886a164d753b78335c43c2c71e66dad0bbd94e55 100644 (file)
@@ -6,11 +6,10 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.protocol.bgp.rib.impl;
+package org.opendaylight.protocol.bgp.inet;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
@@ -54,14 +53,14 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest {
     private static final Ipv4Prefix PREFIX = new Ipv4Prefix("1.2.3.4/32");
     private static final Ipv4RouteKey ROUTE_KEY = new Ipv4RouteKey(PATH_ID, PREFIX);
     private static final Ipv4Prefixes IPV4_PREFIXES = new Ipv4PrefixesBuilder().setPathId(PATH_ID)
-        .setPrefix(PREFIX).build();
+            .setPrefix(PREFIX).build();
     private static final DestinationIpv4Case REACH_NLRI = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
-        .setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
+    .setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update
-        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case UNREACH_NLRI =
-        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update
-            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
+    .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case UNREACH_NLRI =
+    new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update
+    .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
             new DestinationIpv4Builder().setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
 
     private static final Ipv4Route ROUTE = new Ipv4RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID).setPrefix(PREFIX).build();
@@ -148,7 +147,7 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testRouteAttributesIdentifier() {
         Assert.assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT
-            .routeAttributesIdentifier());
+                .routeAttributesIdentifier());
     }
 
     @Test
similarity index 99%
rename from bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/IPv6RIBSupportTest.java
rename to bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupportTest.java
index ee0143e0bfc7270b061ac4af71878658b7ce119b..ec1b8a60b151330322b77952c2319e1afc9e0343 100644 (file)
@@ -6,12 +6,11 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.protocol.bgp.rib.impl;
+package org.opendaylight.protocol.bgp.inet;
 
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
index 74576760f64593112b5ddc7e9f5861ee42080dfb..1424b8b36f133c1d0005a7ca353ff16eb34b8dc5 100644 (file)
@@ -10,9 +10,11 @@ package org.opendaylight.protocol.bgp.inet;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
+import org.opendaylight.protocol.bgp.inet.codec.Ipv6BgpPrefixSidParser;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.bgp.prefix.sid.tlv.Ipv6SidTlvBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.bgp.prefix.sid.bgp.prefix.sid.tlvs.BgpPrefixSidTlv;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
diff --git a/bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/BGPParserTest.java b/bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/BGPParserTest.java
new file mode 100644 (file)
index 0000000..056f6b2
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.bgp.inet.codec;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import com.google.common.collect.Lists;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
+import org.opendaylight.protocol.util.ByteArray;
+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;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6Prefixes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6PrefixesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6CaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.UpdateBuilder;
+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.AttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.AsPathBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.ClusterIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.MultiExitDiscBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.OriginBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.OriginatorIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.UnrecognizedAttributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.as.path.Segments;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.as.path.SegmentsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlriBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder;
+
+public class BGPParserTest {
+
+    private static int MAX_SIZE = 300;
+
+    private static MessageRegistry messageRegistry;
+
+    private static byte[] input;
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        messageRegistry = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getMessageRegistry();
+
+        final String name = "/up2.bin";
+        try (final InputStream is = BGPParserTest.class.getResourceAsStream(name)) {
+            if (is == null) {
+                throw new IOException("Failed to get resource " + name);
+            }
+            final ByteArrayOutputStream bis = new ByteArrayOutputStream();
+            final byte[] data = new byte[MAX_SIZE];
+            int nRead = 0;
+            while ((nRead = is.read(data, 0, data.length)) != -1) {
+                bis.write(data, 0, nRead);
+            }
+            bis.flush();
+
+            input = bis.toByteArray();
+            is.close();
+        }
+    }
+
+    /*
+     * Tests IPv6 NEXT_HOP, NLRI, ORIGIN.IGP, MULTI_EXIT_DISC, ORIGINATOR-ID, CLUSTER_LIST.
+     *
+     * ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff <- marker
+     * 00 80 <- length (128) - including header
+     * 02 <- message type
+     * 00 00 <- withdrawn routes length
+     * 00 69 <- total path attribute length (105)
+     * 40 <- attribute flags
+     * 01 <- attribute type code (origin)
+     * 01 <- attribute length
+     * 00 <- Origin value (IGP)
+     * 40 <- attribute flags
+     * 02 <- attribute type code (as path)
+     * 06 <- attribute length
+     * 02 <- AS_SEQUENCE
+     * 01 <- path segment count
+     * 00 00 fd e9 <- path segment value (65001)
+     * 40 <- attribute flags
+     * 03 <- attribute type code (next hop)
+     * 04 <- attribute length
+     * 0a 00 00 00 <- next hop value (10.0.0.0)
+     * 80 <- attribute flags
+     * 04 <- attribute type code (multi exit disc)
+     * 04 <- attribute length
+     * 00 00 00 00 <- value
+     * 80 <- attribute flags
+     * 09 <- attribute type code (originator id)
+     * 04 <- attribute length
+     * 7f 00 00 01 <- value (localhost ip)
+     * 80 <- attribute flags
+     * 0a <- attribute type code (cluster list)
+     * 08 <- attribute length
+     * 01 02 03 04 <- value
+     * 05 06 07 08 <- value
+     * 80 <- attribute flags
+     * 0e <- attribute type code (mp reach nlri)
+     * 40 <- attribute length
+     * 00 02 <- AFI (Ipv6)
+     * 01 <- SAFI (Unicast)
+     * 20 <- length of next hop
+     * 20 01 0d b8 00 00 00 00 00 00 00 00 00 00 00 01 <- global
+     * fe 80 00 00 00 00 00 00 c0 01 0b ff fe 7e 00 <- link local
+     * 00 <- reserved
+     *
+     * //NLRI
+     * 40 20 01 0d b8 00 01 00 02 <- IPv6 Prefix (2001:db8:1:2:: / 64)
+     * 40 20 01 0d b8 00 01 00 01 <- IPv6 Prefix (2001:db8:1:1:: / 64)
+     * 40 20 01 0d b8 00 01 00 00 <- IPv6 Prefix (2001:db8:1:: / 64)
+     *
+     */
+    @Test
+    public void testIPv6Nlri() throws Exception {
+        final Update message = (Update) messageRegistry.parseMessage(Unpooled.wrappedBuffer(input), null);
+
+        // check fields
+        assertNull(message.getWithdrawnRoutes());
+
+        final UpdateBuilder builder = new UpdateBuilder();
+
+        // check NLRI
+
+        final List<Ipv6Prefixes> prefs = new ArrayList<>();
+        prefs.add(new Ipv6PrefixesBuilder().setPrefix(new Ipv6Prefix("2001:db8:1:2::/64")).build());
+        prefs.add(new Ipv6PrefixesBuilder().setPrefix(new Ipv6Prefix("2001:db8:1:1::/64")).build());
+        prefs.add(new Ipv6PrefixesBuilder().setPrefix(new Ipv6Prefix("2001:db8:1::/64")).build());
+
+        assertNull(message.getNlri());
+
+        // attributes
+        final List<AsNumber> asNumbers = new ArrayList<AsNumber>();
+        asNumbers.add(new AsNumber(65001L));
+        final List<Segments> asPath = Lists.newArrayList();
+        asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
+
+        final Ipv6NextHopCase nextHop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(
+                new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8::1")).setLinkLocal(new Ipv6Address("fe80::c001:bff:fe7e:0")).build()).build();
+
+        final List<ClusterIdentifier> clusters = Lists.newArrayList(new ClusterIdentifier(new Ipv4Address("1.2.3.4")),
+                new ClusterIdentifier(new Ipv4Address("5.6.7.8")));
+
+        // check path attributes
+
+        final Attributes attrs = message.getAttributes();
+
+        final AttributesBuilder paBuilder = new AttributesBuilder();
+
+        paBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
+        assertEquals(paBuilder.getOrigin(), attrs.getOrigin());
+
+        paBuilder.setAsPath(new AsPathBuilder().setSegments(asPath).build());
+        assertEquals(paBuilder.getAsPath(), attrs.getAsPath());
+
+        paBuilder.setMultiExitDisc(new MultiExitDiscBuilder().setMed((long) 0).build());
+        assertEquals(paBuilder.getMultiExitDisc(), attrs.getMultiExitDisc());
+
+        paBuilder.setOriginatorId(new OriginatorIdBuilder().setOriginator(new Ipv4Address("127.0.0.1")).build());
+        assertEquals(paBuilder.getOriginatorId(), attrs.getOriginatorId());
+
+        paBuilder.setClusterId(new ClusterIdBuilder().setCluster(clusters).build());
+        assertEquals(paBuilder.getClusterId(), attrs.getClusterId());
+
+        final MpReachNlriBuilder mpBuilder = new MpReachNlriBuilder();
+        mpBuilder.setAfi(Ipv6AddressFamily.class);
+        mpBuilder.setSafi(UnicastSubsequentAddressFamily.class);
+        mpBuilder.setCNextHop(nextHop);
+        mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
+                new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder().setIpv6Prefixes(prefs).build()).build()).build());
+
+        paBuilder.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mpBuilder.build()).build());
+        assertEquals(paBuilder.getAugmentation(Attributes1.class).getMpReachNlri(),
+                attrs.getAugmentation(Attributes1.class).getMpReachNlri());
+        paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
+        // check API message
+
+        builder.setAttributes(paBuilder.build());
+        assertEquals(builder.build(), message);
+
+        final ByteBuf buffer = Unpooled.buffer();
+        messageRegistry.serializeMessage(message, buffer);
+        assertArrayEquals(input, ByteArray.readAllBytes(buffer));
+    }
+
+}
similarity index 85%
rename from bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/Ipv4NlriParserTest.java
rename to bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/Ipv4NlriParserTest.java
index 7d6aed6e10416630f5429d267757f292edf2925c..bbf8d4abc6ca81d8ee93194233593ed023b76afb 100644 (file)
@@ -6,9 +6,8 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.inet.codec;
 
-import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -17,9 +16,7 @@ import static org.junit.Assert.assertTrue;
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Assert;
@@ -29,9 +26,6 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.AdvertizedRoutesSerializer;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.Ipv4NlriParser;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.WithdrawnRoutesSerializer;
 import org.opendaylight.protocol.bgp.parser.spi.MultiPathSupport;
 import org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint;
 import org.opendaylight.protocol.util.Ipv4Util;
@@ -44,8 +38,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathId;
 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.AttributesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.Nlri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.NlriBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2;
@@ -84,9 +76,6 @@ public class Ipv4NlriParserTest {
     private DestinationIpv4Case ip4caseAD;
     private DestinationIpv4Case ip4caseADWrong;
 
-    private Nlri nlri;
-    private Nlri nlriWrong;
-
     @Mock
     private PeerSpecificParserConstraint constraint;
 
@@ -103,26 +92,19 @@ public class Ipv4NlriParserTest {
         this.prefixes.add(new Ipv4PrefixesBuilder().setPrefix(prefix2).build());
 
         this.ip4caseWD = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-            new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
+                new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
         this.ip4caseAD = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
 
         final ArrayList<Ipv4Prefixes> fakePrefixes = new ArrayList<Ipv4Prefixes>(this.prefixes);
         fakePrefixes.add(new Ipv4PrefixesBuilder().setPrefix(wrongPrefix).build());
         this.ip4caseWDWrong = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-            new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
+                new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
         this.ip4caseADWrong = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
 
         this.inputBytes.writeBytes(Ipv4Util.bytesForPrefixBegin(prefix1));
         this.inputBytes.writeBytes(Ipv4Util.bytesForPrefixBegin(prefix2));
 
-        final List<Ipv4Prefix> prefixList = new ArrayList<Ipv4Prefix>();
-        prefixList.add(prefix1);
-        prefixList.add(prefix2);
-        this.nlri = new NlriBuilder().setNlri(prefixList).build();
-        final List<Ipv4Prefix> prefixWrongList = Lists.newArrayList(prefixList.iterator());
-        prefixWrongList.add(wrongPrefix);
-        this.nlriWrong = new NlriBuilder().setNlri(prefixWrongList).build();
-        Mockito.doReturn(Optional.of(this.muliPathSupport)).when(constraint).getPeerConstraint(Mockito.any());
+        Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
         Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
     }
 
@@ -133,16 +115,6 @@ public class Ipv4NlriParserTest {
         assertEquals(2, this.prefixes.size());
     }
 
-    @Test
-    public void serializeAttributeTest() throws UnsupportedEncodingException {
-        final ByteBuf outputBytes = Unpooled.buffer();
-
-        this.parser.serializeAttribute(this.nlri, outputBytes);
-        assertArrayEquals(this.inputBytes.array(), outputBytes.array());
-        this.parser.serializeAttribute(this.nlriWrong, outputBytes);
-        assertFalse(Arrays.equals(this.inputBytes.array(), outputBytes.array()));
-    }
-
     @Test
     public void parseUnreachedNlriTest() {
         final MpUnreachNlriBuilder b = new MpUnreachNlriBuilder();
@@ -184,7 +156,7 @@ public class Ipv4NlriParserTest {
         mpReachNlriBuilder.setAfi(null).setSafi(null);
         Assert.assertEquals(mpReachNlri, mpReachNlriBuilder.build());
 
-        final AdvertizedRoutesSerializer serializer = new AdvertizedRoutesSerializer();
+        final Ipv4NlriParser serializer = new Ipv4NlriParser();
         final ByteBuf output = Unpooled.buffer(MP_NLRI_BYTES.length);
         final Attributes attributes = new AttributesBuilder().addAugmentation(Attributes1.class,
                 new Attributes1Builder().setMpReachNlri(mpReachNlri).build()).build();
@@ -205,7 +177,7 @@ public class Ipv4NlriParserTest {
         mpUnreachNlriBuilder.setAfi(null).setSafi(null);
         Assert.assertEquals(mpUnreachNlri, mpUnreachNlriBuilder.build());
 
-        final WithdrawnRoutesSerializer serializer = new WithdrawnRoutesSerializer();
+        final Ipv4NlriParser serializer = new Ipv4NlriParser();
         final ByteBuf output = Unpooled.buffer(MP_NLRI_BYTES.length);
         final Attributes attributes = new AttributesBuilder().addAugmentation(Attributes2.class,
                 new Attributes2Builder().setMpUnreachNlri(mpUnreachNlri).build()).build();
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop;
+package org.opendaylight.protocol.bgp.inet.codec.nexthop;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -16,6 +16,8 @@ import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv4NextHopParserSerializer;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv6NextHopParserSerializer;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
diff --git a/bgp/inet/src/test/resources/up2.bin b/bgp/inet/src/test/resources/up2.bin
new file mode 100644 (file)
index 0000000..c3aba85
Binary files /dev/null and b/bgp/inet/src/test/resources/up2.bin differ
index 377bfe48b239f8b4e34dd6564c33e5e02858bbc1..2b90853fd67f358c9a276b06fbf5e5ac012c4927 100644 (file)
@@ -50,7 +50,7 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>bgp-parser-impl</artifactId>
+            <artifactId>bgp-inet</artifactId>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
index bbf36b34e076599e854436b8c6b74fbdfcfa639e..dadfa5befac950d172f2879b71b1f586b43be994 100644 (file)
@@ -9,8 +9,8 @@ package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv4NextHopParserSerializer;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv6NextHopParserSerializer;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv4NextHopParserSerializer;
+import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv6NextHopParserSerializer;
 import org.opendaylight.protocol.bgp.parser.spi.AbstractBGPExtensionProviderActivator;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.LabeledUnicastSubsequentAddressFamily;
@@ -36,9 +36,9 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
         final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
         regs.add(context.registerNlriParser(Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class,
-            luNlriParser, ipv4NextHopParser, Ipv4NextHopCase.class));
+                luNlriParser, ipv4NextHopParser, Ipv4NextHopCase.class));
         regs.add(context.registerNlriParser(Ipv6AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class,
-            luNlriParser, ipv6NextHopParser, Ipv6NextHopCase.class));
+                luNlriParser, ipv6NextHopParser, Ipv6NextHopCase.class));
 
         regs.add(context.registerNlriSerializer(LabeledUnicastRoutes.class, luNlriParser));
 
index 13c19d57f423e0a3412057d235c638ea96cd82c1..3b7b98558edfe03803dd97a8ee6aaeda2ad4c244 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>bgp-concepts</artifactId>
         </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>bgp-inet</artifactId>
-        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>bgp-parser-api</artifactId>
index d25d56a4077388f8e54eb8159ecb509f003491ec..851a4b076433d0054a924a4add3a51eef2ebc37f 100755 (executable)
@@ -23,7 +23,6 @@ import org.opendaylight.protocol.bgp.parser.impl.message.open.MultiProtocolCapab
 import org.opendaylight.protocol.bgp.parser.impl.message.open.RouteRefreshCapabilityHandler;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.AS4AggregatorAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.AS4PathAttributeParser;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.AdvertizedRoutesSerializer;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.AggregatorAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.AigpAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathAttributeParser;
@@ -32,8 +31,6 @@ import org.opendaylight.protocol.bgp.parser.impl.message.update.BgpPrefixSidAttr
 import org.opendaylight.protocol.bgp.parser.impl.message.update.ClusterIdAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.CommunitiesAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.ExtendedCommunitiesAttributeParser;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.Ipv4NlriParser;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.Ipv6NlriParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.LocalPreferenceAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.MPReachAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.MPUnreachAttributeParser;
@@ -42,7 +39,6 @@ import org.opendaylight.protocol.bgp.parser.impl.message.update.NextHopAttribute
 import org.opendaylight.protocol.bgp.parser.impl.message.update.OriginAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.OriginatorIdAttributeParser;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.UnrecognizedAttributesSerializer;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.WithdrawnRoutesSerializer;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.AsTwoOctetSpecificEcHandler;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.EncapsulationEC;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.Ipv4SpecificEcHandler;
@@ -55,8 +51,6 @@ import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communi
 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.four.octect.as.specific.Generic4OctASEcHandler;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.four.octect.as.specific.RouteOrigin4OctectASEcHandler;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.four.octect.as.specific.RouteTarget4OctectASEcHandler;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv4NextHopParserSerializer;
-import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv6NextHopParserSerializer;
 import org.opendaylight.protocol.bgp.parser.spi.AbstractBGPExtensionProviderActivator;
 import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
@@ -82,7 +76,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.Origin;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.OriginatorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.UnrecognizedAttributes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.WithdrawnRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.RouteRefresh;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.AddPathCapability;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.GracefulRestartCapability;
@@ -90,7 +83,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.RouteRefreshCapability;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutes;
 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.Ipv6AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
@@ -108,8 +100,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.RouteOriginIpv4Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.RouteTargetExtendedCommunityCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.RouteTargetIpv4Case;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase;
 
 public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
 
@@ -123,27 +113,16 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
     protected List<AutoCloseable> startImpl(final BGPExtensionProviderContext context) {
         final List<AutoCloseable> regs = new ArrayList<>();
 
-        regs.add(context.registerNlriSerializer(AdvertizedRoutes.class, new AdvertizedRoutesSerializer()));
-        regs.add(context.registerNlriSerializer(WithdrawnRoutes.class, new WithdrawnRoutesSerializer()));
-
         regs.add(context.registerAddressFamily(Ipv4AddressFamily.class, IPV4_AFI));
         regs.add(context.registerAddressFamily(Ipv6AddressFamily.class, IPV6_AFI));
 
         regs.add(context.registerSubsequentAddressFamily(UnicastSubsequentAddressFamily.class, UNICAST_SAFI));
         regs.add(context.registerSubsequentAddressFamily(MplsLabeledVpnSubsequentAddressFamily.class, VPN_SAFI));
 
-        final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
-        regs.add(context.registerNlriParser(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class,
-            new Ipv4NlriParser(), ipv4NextHopParser, Ipv4NextHopCase.class, Ipv6NextHopCase.class));
-
-        final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
-        regs.add(context.registerNlriParser(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, new
-            Ipv6NlriParser(), ipv6NextHopParser, Ipv4NextHopCase.class, Ipv6NextHopCase.class));
-
-        this.registerExtendedCommunities(regs, context);
-        this.registerCapabilityParsers(regs, context);
-        this.registerAttributeParsers(regs, context);
-        this.registerMessageParsers(regs, context);
+        registerExtendedCommunities(regs, context);
+        registerCapabilityParsers(regs, context);
+        registerAttributeParsers(regs, context);
+        registerMessageParsers(regs, context);
         return regs;
     }
 
@@ -276,56 +255,56 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
     private void registerExtendedCommunities(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
         final AsTwoOctetSpecificEcHandler twoOctetSpecificEcHandler = new AsTwoOctetSpecificEcHandler();
         regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(true), twoOctetSpecificEcHandler.getSubType(),
-            twoOctetSpecificEcHandler));
+                twoOctetSpecificEcHandler));
         regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(false), twoOctetSpecificEcHandler.getSubType(),
-            twoOctetSpecificEcHandler));
+                twoOctetSpecificEcHandler));
         regs.add(context.registerExtendedCommunitySerializer(AsSpecificExtendedCommunityCase.class, twoOctetSpecificEcHandler));
 
         final Ipv4SpecificEcHandler ipv4SpecificEcHandler = new Ipv4SpecificEcHandler();
         regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(true), ipv4SpecificEcHandler.getSubType(),
-            ipv4SpecificEcHandler));
+                ipv4SpecificEcHandler));
         regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(false), ipv4SpecificEcHandler.getSubType(),
-            ipv4SpecificEcHandler));
+                ipv4SpecificEcHandler));
         regs.add(context.registerExtendedCommunitySerializer(Inet4SpecificExtendedCommunityCase.class, ipv4SpecificEcHandler));
 
         final OpaqueEcHandler opaqueEcHandler = new OpaqueEcHandler();
         regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(true), opaqueEcHandler.getSubType(),
-            opaqueEcHandler));
+                opaqueEcHandler));
         regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(false), opaqueEcHandler.getSubType(),
-            opaqueEcHandler));
+                opaqueEcHandler));
         regs.add(context.registerExtendedCommunitySerializer(OpaqueExtendedCommunityCase.class, opaqueEcHandler));
 
         final RouteOriginAsTwoOctetEcHandler routeOriginAS2bEcHandler = new RouteOriginAsTwoOctetEcHandler();
         regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(true), routeOriginAS2bEcHandler.getSubType(),
-            routeOriginAS2bEcHandler));
+                routeOriginAS2bEcHandler));
         regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(false), routeOriginAS2bEcHandler.getSubType(),
-            routeOriginAS2bEcHandler));
+                routeOriginAS2bEcHandler));
         regs.add(context.registerExtendedCommunitySerializer(RouteOriginExtendedCommunityCase.class, routeOriginAS2bEcHandler));
 
         final RouteTargetAsTwoOctetEcHandler routeTargetAS2bEcHandler = new RouteTargetAsTwoOctetEcHandler();
         regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(true), routeTargetAS2bEcHandler.getSubType(),
-            routeTargetAS2bEcHandler));
+                routeTargetAS2bEcHandler));
         regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(false), routeTargetAS2bEcHandler.getSubType(),
-            routeTargetAS2bEcHandler));
+                routeTargetAS2bEcHandler));
         regs.add(context.registerExtendedCommunitySerializer(RouteTargetExtendedCommunityCase.class, routeTargetAS2bEcHandler));
 
         final RouteOriginIpv4EcHandler routeOriginIpv4EcHandler = new RouteOriginIpv4EcHandler();
         regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(true), routeOriginIpv4EcHandler.getSubType(),
-            routeOriginIpv4EcHandler));
+                routeOriginIpv4EcHandler));
         regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(false), routeOriginIpv4EcHandler.getSubType(),
-            routeOriginIpv4EcHandler));
+                routeOriginIpv4EcHandler));
         regs.add(context.registerExtendedCommunitySerializer(RouteOriginIpv4Case.class, routeOriginIpv4EcHandler));
 
         final RouteTargetIpv4EcHandler routeTargetIpv4EcHandler = new RouteTargetIpv4EcHandler();
         regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(true), routeTargetIpv4EcHandler.getSubType(),
-            routeTargetIpv4EcHandler));
+                routeTargetIpv4EcHandler));
         regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(false), routeTargetIpv4EcHandler.getSubType(),
-            routeTargetIpv4EcHandler));
+                routeTargetIpv4EcHandler));
         regs.add(context.registerExtendedCommunitySerializer(RouteTargetIpv4Case.class, routeTargetIpv4EcHandler));
 
         final LinkBandwidthEC linkBandwidthECHandler = new LinkBandwidthEC();
         regs.add(context.registerExtendedCommunityParser(linkBandwidthECHandler.getType(false), linkBandwidthECHandler.getSubType(),
-            linkBandwidthECHandler));
+                linkBandwidthECHandler));
         regs.add(context.registerExtendedCommunitySerializer(LinkBandwidthCase.class, linkBandwidthECHandler));
 
         final Generic4OctASEcHandler gen4OctASEcHandler = new Generic4OctASEcHandler();
diff --git a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AdvertizedRoutesSerializer.java b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AdvertizedRoutesSerializer.java
deleted file mode 100644 (file)
index 60b7f55..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.parser.impl.message.update;
-
-import com.google.common.base.Preconditions;
-import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.spi.NlriSerializer;
-import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4Prefixes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6Prefixes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4Case;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6Case;
-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.multiprotocol.rev130919.Attributes1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutes;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-
-public class AdvertizedRoutesSerializer implements NlriSerializer {
-
-    @Override
-    public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
-        final Attributes1 pathAttributes1 = ((Attributes) attribute).getAugmentation(Attributes1.class);
-        if (pathAttributes1 == null) {
-            return;
-        }
-        final MpReachNlri mpReachNlri = pathAttributes1.getMpReachNlri();
-        if (mpReachNlri == null) {
-            return;
-        }
-        final AdvertizedRoutes routes = mpReachNlri.getAdvertizedRoutes();
-        if (routes.getDestinationType() instanceof DestinationIpv4Case) {
-            final DestinationIpv4Case destinationIpv4Case = (DestinationIpv4Case) routes.getDestinationType();
-            for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) {
-                PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator);
-                ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator);
-            }
-        } else if (routes.getDestinationType() instanceof DestinationIpv6Case) {
-            final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) routes.getDestinationType();
-            for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
-                PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
-                ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
-            }
-        }
-    }
-}
diff --git a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/WithdrawnRoutesSerializer.java b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/WithdrawnRoutesSerializer.java
deleted file mode 100644 (file)
index 706fc4c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.parser.impl.message.update;
-
-import com.google.common.base.Preconditions;
-import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.spi.NlriSerializer;
-import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4Prefixes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6Prefixes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case;
-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.multiprotocol.rev130919.Attributes2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-
-public class WithdrawnRoutesSerializer implements NlriSerializer {
-
-    @Override
-    public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
-        final Attributes2 pathAttributes2 = ((Attributes) attribute).getAugmentation(Attributes2.class);
-        if (pathAttributes2 == null) {
-            return;
-        }
-        final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri();
-        if (mpUnreachNlri == null) {
-            return;
-        }
-        final WithdrawnRoutes routes = mpUnreachNlri.getWithdrawnRoutes();
-        if (routes != null) {
-            serializeRoutes(routes, byteAggregator);
-        }
-    }
-
-    private static void serializeRoutes(final WithdrawnRoutes routes, final ByteBuf byteAggregator) {
-        if (routes.getDestinationType() instanceof DestinationIpv4Case) {
-            final DestinationIpv4Case destinationIpv4Case = (DestinationIpv4Case) routes.getDestinationType();
-            if (destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes() != null) {
-                for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) {
-                    PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator);
-                    ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator);
-                }
-            }
-        } else if (routes.getDestinationType() instanceof DestinationIpv6Case) {
-            final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) routes.getDestinationType();
-            if (destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes() != null) {
-                for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
-                    PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
-                    ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
-                }
-            }
-        }
-    }
-}
index f50a5953b7def252816cd3074088886f71c7aad4..5170e990194f74bd039eea571b0dbda8c3ea2820 100644 (file)
@@ -32,12 +32,6 @@ import org.opendaylight.protocol.util.NoopReferenceCache;
 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;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6Prefixes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6PrefixesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6CaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.UpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes;
@@ -46,28 +40,21 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.AggregatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.AsPathBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.AtomicAggregateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.ClusterIdBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.Communities;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.ExtendedCommunities;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.ExtendedCommunitiesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.LocalPrefBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.MultiExitDiscBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.OriginBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.OriginatorIdBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.UnrecognizedAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.as.path.Segments;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.as.path.SegmentsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.Nlri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.NlriBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.WithdrawnRoutesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlriBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
@@ -75,10 +62,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.route.target.ipv4._case.RouteTargetIpv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder;
 
 public class BGPParserTest {
 
@@ -184,7 +168,7 @@ public class BGPParserTest {
         asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
 
         final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
-            new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("10.0.0.2")).build()).build();
+                new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("10.0.0.2")).build()).build();
 
         final List<Communities> comms = Lists.newArrayList();
         comms.add((Communities) CommunityUtil.NO_EXPORT);
@@ -242,131 +226,6 @@ public class BGPParserTest {
         assertArrayEquals(inputBytes.get(0), ByteArray.readAllBytes(buffer));
     }
 
-    /*
-     * Tests IPv6 NEXT_HOP, NLRI, ORIGIN.IGP, MULTI_EXIT_DISC, ORIGINATOR-ID, CLUSTER_LIST.
-     *
-     * ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff <- marker
-     * 00 80 <- length (128) - including header
-     * 02 <- message type
-     * 00 00 <- withdrawn routes length
-     * 00 69 <- total path attribute length (105)
-     * 40 <- attribute flags
-     * 01 <- attribute type code (origin)
-     * 01 <- attribute length
-     * 00 <- Origin value (IGP)
-     * 40 <- attribute flags
-     * 02 <- attribute type code (as path)
-     * 06 <- attribute length
-     * 02 <- AS_SEQUENCE
-     * 01 <- path segment count
-     * 00 00 fd e9 <- path segment value (65001)
-     * 40 <- attribute flags
-     * 03 <- attribute type code (next hop)
-     * 04 <- attribute length
-     * 0a 00 00 00 <- next hop value (10.0.0.0)
-     * 80 <- attribute flags
-     * 04 <- attribute type code (multi exit disc)
-     * 04 <- attribute length
-     * 00 00 00 00 <- value
-     * 80 <- attribute flags
-     * 09 <- attribute type code (originator id)
-     * 04 <- attribute length
-     * 7f 00 00 01 <- value (localhost ip)
-     * 80 <- attribute flags
-     * 0a <- attribute type code (cluster list)
-     * 08 <- attribute length
-     * 01 02 03 04 <- value
-     * 05 06 07 08 <- value
-     * 80 <- attribute flags
-     * 0e <- attribute type code (mp reach nlri)
-     * 40 <- attribute length
-     * 00 02 <- AFI (Ipv6)
-     * 01 <- SAFI (Unicast)
-     * 20 <- length of next hop
-     * 20 01 0d b8 00 00 00 00 00 00 00 00 00 00 00 01 <- global
-     * fe 80 00 00 00 00 00 00 c0 01 0b ff fe 7e 00 <- link local
-     * 00 <- reserved
-     *
-     * //NLRI
-     * 40 20 01 0d b8 00 01 00 02 <- IPv6 Prefix (2001:db8:1:2:: / 64)
-     * 40 20 01 0d b8 00 01 00 01 <- IPv6 Prefix (2001:db8:1:1:: / 64)
-     * 40 20 01 0d b8 00 01 00 00 <- IPv6 Prefix (2001:db8:1:: / 64)
-     *
-     */
-    @Test
-    public void testGetUpdateMessage2() throws Exception {
-        final byte[] body = ByteArray.cutBytes(inputBytes.get(1), MessageUtil.COMMON_HEADER_LENGTH);
-        final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(1), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
-        final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength);
-
-        // check fields
-        assertNull(message.getWithdrawnRoutes());
-
-        final UpdateBuilder builder = new UpdateBuilder();
-
-        // check NLRI
-
-        final List<Ipv6Prefixes> prefs = new ArrayList<>();
-        prefs.add(new Ipv6PrefixesBuilder().setPrefix(new Ipv6Prefix("2001:db8:1:2::/64")).build());
-        prefs.add(new Ipv6PrefixesBuilder().setPrefix(new Ipv6Prefix("2001:db8:1:1::/64")).build());
-        prefs.add(new Ipv6PrefixesBuilder().setPrefix(new Ipv6Prefix("2001:db8:1::/64")).build());
-
-        assertNull(message.getNlri());
-
-        // attributes
-        final List<AsNumber> asNumbers = new ArrayList<AsNumber>();
-        asNumbers.add(new AsNumber(65001L));
-        final List<Segments> asPath = Lists.newArrayList();
-        asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
-
-        final Ipv6NextHopCase nextHop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(
-            new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8::1")).setLinkLocal(new Ipv6Address("fe80::c001:bff:fe7e:0")).build()).build();
-
-        final List<ClusterIdentifier> clusters = Lists.newArrayList(new ClusterIdentifier(new Ipv4Address("1.2.3.4")),
-            new ClusterIdentifier(new Ipv4Address("5.6.7.8")));
-
-        // check path attributes
-
-        final Attributes attrs = message.getAttributes();
-
-        final AttributesBuilder paBuilder = new AttributesBuilder();
-
-        paBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
-        assertEquals(paBuilder.getOrigin(), attrs.getOrigin());
-
-        paBuilder.setAsPath(new AsPathBuilder().setSegments(asPath).build());
-        assertEquals(paBuilder.getAsPath(), attrs.getAsPath());
-
-        paBuilder.setMultiExitDisc(new MultiExitDiscBuilder().setMed((long) 0).build());
-        assertEquals(paBuilder.getMultiExitDisc(), attrs.getMultiExitDisc());
-
-        paBuilder.setOriginatorId(new OriginatorIdBuilder().setOriginator(new Ipv4Address("127.0.0.1")).build());
-        assertEquals(paBuilder.getOriginatorId(), attrs.getOriginatorId());
-
-        paBuilder.setClusterId(new ClusterIdBuilder().setCluster(clusters).build());
-        assertEquals(paBuilder.getClusterId(), attrs.getClusterId());
-
-        final MpReachNlriBuilder mpBuilder = new MpReachNlriBuilder();
-        mpBuilder.setAfi(Ipv6AddressFamily.class);
-        mpBuilder.setSafi(UnicastSubsequentAddressFamily.class);
-        mpBuilder.setCNextHop(nextHop);
-        mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
-            new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder().setIpv6Prefixes(prefs).build()).build()).build());
-
-        paBuilder.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mpBuilder.build()).build());
-        assertEquals(paBuilder.getAugmentation(Attributes1.class).getMpReachNlri(),
-            attrs.getAugmentation(Attributes1.class).getMpReachNlri());
-        paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
-        // check API message
-
-        builder.setAttributes(paBuilder.build());
-        assertEquals(builder.build(), message);
-
-        final ByteBuf buffer = Unpooled.buffer();
-        BGPParserTest.updateParser.serializeMessage(message, buffer);
-        assertArrayEquals(inputBytes.get(1), ByteArray.readAllBytes(buffer));
-    }
-
     /*
      * Tests more AS Numbers in AS_PATH, AGGREGATOR, ORIGIN.INCOMPLETE
      *
@@ -433,9 +292,9 @@ public class BGPParserTest {
         asPath.add(new SegmentsBuilder().setAsSet(asSet).build());
 
         final Aggregator aggregator = new AggregatorBuilder().setAsNumber(new AsNumber((long) 30)).setNetworkAddress(
-            new Ipv4Address("10.0.0.9")).build();
+                new Ipv4Address("10.0.0.9")).build();
         final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
-            new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("10.0.0.9")).build()).build();
+                new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("10.0.0.9")).build()).build();
 
         // check path attributes
         final Attributes attrs = message.getAttributes();
@@ -527,13 +386,13 @@ public class BGPParserTest {
 
         // attributes
         final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
-            new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("3.3.3.3")).build()).build();
+                new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("3.3.3.3")).build()).build();
 
         final List<ExtendedCommunities> comms = Lists.newArrayList();
         comms.add(new ExtendedCommunitiesBuilder().setTransitive(true).setExtendedCommunity(
-            new RouteTargetIpv4CaseBuilder().setRouteTargetIpv4(
-                new RouteTargetIpv4Builder().setGlobalAdministrator(
-                    new Ipv4Address("192.168.1.0")).setLocalAdministrator(4660).build()).build()).build());
+                new RouteTargetIpv4CaseBuilder().setRouteTargetIpv4(
+                        new RouteTargetIpv4Builder().setGlobalAdministrator(
+                                new Ipv4Address("192.168.1.0")).setLocalAdministrator(4660).build()).build()).build());
 
         // check path attributes
         final Attributes attrs = message.getAttributes();
@@ -589,7 +448,7 @@ public class BGPParserTest {
 
         // check API message
         final Update expectedMessage = new UpdateBuilder().setWithdrawnRoutes(
-            new WithdrawnRoutesBuilder().setWithdrawnRoutes(prefs).build()).build();
+                new WithdrawnRoutesBuilder().setWithdrawnRoutes(prefs).build()).build();
 
         assertEquals(expectedMessage.getWithdrawnRoutes(), message.getWithdrawnRoutes());
 
index c93c424776993cc408cef3cdfaa8e48f7641f86d..c80d8839cbb688450fc21385f7ddd98e1c70be6c 100644 (file)
             <artifactId>config-util</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.bgpcep</groupId>
+            <artifactId>bgp-inet</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
index 24255195c7353e3af40d26d71d1078b720f65784..0cc8294863ce44cd3fec3e67eb12f5535dff5280 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>bgp-path-selection-mode</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bgp-inet</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.osgi</groupId>
index e5c43440c2a81bbefa559a516eb10ec46e04350b..afa6e24bb74607462f5890dbef9d5a515bc5cdcf 100644 (file)
@@ -2,10 +2,6 @@
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
 
-  <bean id="RIBActivator" class="org.opendaylight.protocol.bgp.rib.impl.RIBActivator"/>
-
-  <service ref="RIBActivator" interface="org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator"
-          odl:type="org.opendaylight.protocol.bgp.rib.impl.RIBActivator"/>
 
   <reference id="BGPExtensionContext" interface="org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext"/>
   <reference id="globalBossGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-boss-group"/>
index c74b57ac4ea9f5e5ea7e6792559d6a76e8b8b339..68262083c2876d3306487849d340d750b27d700d 100755 (executable)
@@ -36,6 +36,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.protocol.bgp.inet.RIBActivator;
 import org.opendaylight.protocol.bgp.mode.impl.base.BasePathSelectionModeFactory;
 import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
@@ -144,8 +145,8 @@ public class AbstractRIBTestSetup {
         mockedMethods();
         this.rib = new RIBImpl(new RibId("test"), new AsNumber(5L), this.RIB_ID,
             this.CLUSTER_ID, context, this.dispatcher, this.codecFactory, this.dom,
-            localTables, Collections.singletonMap(new TablesKey(AFI, SAFI), BasePathSelectionModeFactory.createBestPathSelectionStrategy()),
-            GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
+                localTables, Collections.singletonMap(new TablesKey(AFI, SAFI), BasePathSelectionModeFactory.createBestPathSelectionStrategy()),
+                GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
         this.rib.onGlobalContextUpdated(schemaContext);
         this.ribSupport = getRib().getRibSupportContext().getRIBSupportContext(KEY).getRibSupport();
     }
@@ -251,6 +252,7 @@ public class AbstractRIBTestSetup {
             return null;
         }
 
+        @Override
         public void close() {
         }
     }
index dacd8dd81807742f1b9e4613f1cb090f40c27f25..9449b8af7460a84902ab43813d48804ebcb47693 100644 (file)
@@ -26,7 +26,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
@@ -34,11 +33,14 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.protocol.bgp.inet.RIBActivator;
 import org.opendaylight.protocol.bgp.mode.impl.base.BasePathSelectionModeFactory;
 import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContext;
 import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry;
 import org.opendaylight.protocol.bgp.rib.impl.stats.UnsignedInt32Counter;
+import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.rib.spi.RibSupportUtils;
+import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route;
@@ -84,40 +86,39 @@ public class LocRibWriterTest {
     private final TablesKey tablesKey = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
     private final UnsignedInt32Counter routeCounter = new UnsignedInt32Counter("loc-rib");
 
+    private RIBActivator ribActivator;
+
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
 
-        Answer<Object> answer = new Answer<Object>() {
-            @Override
-            public Object answer(final InvocationOnMock invocation) throws Throwable {
-                final Object[] args = invocation.getArguments();
-                final NormalizedNode<?, ?> node = (NormalizedNode<?, ?>) args[2];
-                if (node.getNodeType().equals(Ipv4Route.QNAME) || node.getNodeType().equals(PREFIX_QNAME)) {
-                    LocRibWriterTest.this.routes.add((YangInstanceIdentifier) args[1]);
-                }
-                return args[1];
+        this.ribActivator = new RIBActivator();
+        final RIBExtensionProviderContext ribExtension = new SimpleRIBExtensionProviderContext();
+        this.ribActivator.startRIBExtensionProvider(ribExtension);
+
+        final Answer<Object> answer = invocation -> {
+            final Object[] args = invocation.getArguments();
+            final NormalizedNode<?, ?> node = (NormalizedNode<?, ?>) args[2];
+            if (node.getNodeType().equals(Ipv4Route.QNAME) || node.getNodeType().equals(PREFIX_QNAME)) {
+                LocRibWriterTest.this.routes.add((YangInstanceIdentifier) args[1]);
             }
+            return args[1];
         };
         doAnswer(answer).when(this.domTransWrite).put(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
         doAnswer(answer).when(this.domTransWrite).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
-        doAnswer(new Answer<Object>() {
-
-            @Override
-            public Object answer(final InvocationOnMock invocation) throws Throwable {
-                final Object[] args = invocation.getArguments();
-                LocRibWriterTest.this.routes.remove(args[1]);
-                return args[1];
-            }
+        doAnswer(invocation -> {
+            final Object[] args = invocation.getArguments();
+            LocRibWriterTest.this.routes.remove(args[1]);
+            return args[1];
         }).when(this.domTransWrite).delete(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
         doReturn(this.context).when(this.registry).getRIBSupportContext(any(TablesKey.class));
-        doReturn(IPv4RIBSupport.getInstance()).when(this.context).getRibSupport();
+        doReturn(ribExtension.getRIBSupport(this.tablesKey)).when(this.context).getRibSupport();
         doReturn(this.domTransWrite).when(this.chain).newWriteOnlyTransaction();
         doReturn(this.future).when(this.domTransWrite).submit();
         doReturn(null).when(this.service).registerDataTreeChangeListener(any(DOMDataTreeIdentifier.class), any(DOMDataTreeChangeListener.class));
         this.locRibWriter = LocRibWriter.create(this.registry, this.tablesKey, this.chain, YangInstanceIdentifier.of(BgpRib.QNAME),
-            new AsNumber((long) 35), this.service, this.pd, new CacheDisconnectedPeersImpl(), BasePathSelectionModeFactory.createBestPathSelectionStrategy(),
-            routeCounter);
+                new AsNumber((long) 35), this.service, this.pd, new CacheDisconnectedPeersImpl(), BasePathSelectionModeFactory.createBestPathSelectionStrategy(),
+                this.routeCounter);
     }
 
     private DataTreeCandidate prepareUpdate() {
index 75cadeac9e4b6a5a3536b602fc3756fbedfc8350..8a2e3eb056c0a8577812743cdf35b8eaac0abb11 100755 (executable)
@@ -9,7 +9,7 @@ package org.opendaylight.protocol.bgp.rib.impl;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import com.google.common.base.Function;
+
 import com.google.common.base.Optional;
 import com.google.common.base.Throwables;
 import com.google.common.collect.Collections2;
@@ -23,7 +23,6 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
-import javax.annotation.Nullable;
 import org.junit.After;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -34,6 +33,7 @@ import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
 import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestCustomizer;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.protocol.bgp.inet.RIBActivator;
 import org.opendaylight.protocol.bgp.mode.impl.base.BasePathSelectionModeFactory;
 import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
 import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
@@ -45,7 +45,6 @@ import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.util.HexDumpBGPFileParser;
 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;
 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.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateAddressFamily;
@@ -133,9 +132,9 @@ public class ParserToSalTest extends AbstractDataBrokerTest {
         final List<BgpTableType> tables = ImmutableList.of(
                 (BgpTableType) new BgpTableTypeImpl(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class));
         final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new BgpId("127.0.0.1"), null, this.ext2, this.dispatcher,
-            this.codecFactory, getDomBroker(), tables,
-            Collections.singletonMap(new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class),
-                BasePathSelectionModeFactory.createBestPathSelectionStrategy()), GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
+                this.codecFactory, getDomBroker(), tables,
+                Collections.singletonMap(new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class),
+                        BasePathSelectionModeFactory.createBestPathSelectionStrategy()), GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
         assertTablesExists(tables, true);
         rib.onGlobalContextUpdated(this.schemaService.getGlobalContext());
         final BGPPeer peer = new BGPPeer("peer-" + this.mock.toString(), rib, PeerRole.Ibgp, null);
@@ -148,9 +147,9 @@ public class ParserToSalTest extends AbstractDataBrokerTest {
     public void testWithoutLinkstate() throws InterruptedException, ExecutionException {
         final List<BgpTableType> tables = ImmutableList.of((BgpTableType) new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class));
         final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new BgpId("127.0.0.1"), null, this.ext1, this.dispatcher,
-            this.codecFactory, getDomBroker(), tables,
-            Collections.singletonMap(new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class),
-                BasePathSelectionModeFactory.createBestPathSelectionStrategy()), GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
+                this.codecFactory, getDomBroker(), tables,
+                Collections.singletonMap(new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class),
+                        BasePathSelectionModeFactory.createBestPathSelectionStrategy()), GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
         rib.onGlobalContextUpdated(this.schemaService.getGlobalContext());
         assertTablesExists(tables, true);
         final BGPPeer peer = new BGPPeer("peer-" + this.mock.toString(), rib, PeerRole.Ibgp, null);
@@ -160,19 +159,14 @@ public class ParserToSalTest extends AbstractDataBrokerTest {
     }
 
     private static Collection<byte[]> fixMessages(final Collection<byte[]> bgpMessages) {
-        return Collections2.transform(bgpMessages, new Function<byte[], byte[]>() {
-
-            @Nullable
-            @Override
-            public byte[] apply(@Nullable final byte[] input) {
-                final byte[] ret = new byte[input.length + 1];
-                // ff
-                ret[0] = -1;
-                for (int i = 0; i < input.length; i++) {
-                    ret[i + 1] = input[i];
-                }
-                return ret;
+        return Collections2.transform(bgpMessages, input -> {
+            final byte[] ret = new byte[input.length + 1];
+            // ff
+            ret[0] = -1;
+            for (int i = 0; i < input.length; i++) {
+                ret[i + 1] = input[i];
             }
+            return ret;
         });
     }
 
index b35fbd1d5412766b6de05eb3b62b804fc1ae77d0..28793b3b320bff00f4a490598a15efb63234ab98 100644 (file)
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>bgp-rib-api</artifactId>
+            <artifactId>bgp-parser-spi</artifactId>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>bgp-inet</artifactId>
+            <artifactId>bgp-rib-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.model</groupId>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>com.google.code.findbugs</groupId>
index d6bb5388bd72eaf6f93c646a9d1e7beb1e55b3e0..68c23c4ee5f3959fbdd1075265cb15d70e429054 100644 (file)
@@ -12,11 +12,10 @@ import java.util.List;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCase;
-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.rib.rev130925.Route;
 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.UnicastSubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 
 public class SimpleRIBExtensionTest {
 
@@ -35,10 +34,10 @@ public class SimpleRIBExtensionTest {
     private final class TestActivator extends AbstractRIBExtensionProviderActivator {
         @Override
         protected List<AutoCloseable> startRIBExtensionProviderImpl(final RIBExtensionProviderContext context) {
-            RIBSupport support = Mockito.mock(RIBSupport.class);
-            Mockito.doReturn(Ipv4Route.class).when(support).routesListClass();
-            Mockito.doReturn(Ipv4Routes.class).when(support).routesContainerClass();
-            Mockito.doReturn(Ipv4RoutesCase.class).when(support).routesCaseClass();
+            final RIBSupport support = Mockito.mock(RIBSupport.class);
+            Mockito.doReturn(Route.class).when(support).routesListClass();
+            Mockito.doReturn(DataObject.class).when(support).routesContainerClass();
+            Mockito.doReturn(DataObject.class).when(support).routesCaseClass();
             return Lists.newArrayList((AutoCloseable)context.registerRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, support));
         }
     }
index 5b1feca8fc60051107e4203d1fd11984f959e1a6..61a23472a7b0532aff44554e88eed23005a71dc3 100644 (file)
     </feature>
 
     <feature name='odl-bgpcep-bgp-inet' version='${project.version}'>
-        <feature version='${project.version}'>odl-bgpcep-bgp-dependencies</feature>
-        <feature version='${config.version}'>odl-config-api</feature>
-        <feature version='${yangtools.version}'>odl-yangtools-yang-data</feature>
-        <bundle>mvn:org.opendaylight.bgpcep/bgp-parser-api/{{VERSION}}</bundle>
-        <bundle>mvn:org.opendaylight.bgpcep/bgp-parser-spi/{{VERSION}}</bundle>
-        <bundle>mvn:org.opendaylight.bgpcep/bgp-rib-api/{{VERSION}}</bundle>
+        <feature version='${project.version}'>odl-bgpcep-bgp-parser</feature>
+        <feature version='${project.version}'>odl-bgpcep-bgp-rib-api</feature>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-inet/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-bmp-api/{{VERSION}}</bundle>
     </feature>
 
     <feature name='odl-bgpcep-bgp-parser' version='${project.version}'>
         <feature version='${project.version}'>odl-bgpcep-bgp-dependencies</feature>
-        <feature version='${project.version}'>odl-bgpcep-bgp-inet</feature>
         <feature version='${config.version}'>odl-config-api</feature>
         <feature version='${yangtools.version}'>odl-yangtools-yang-data</feature>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-parser-api/{{VERSION}}</bundle>
     <feature name='odl-bgpcep-bgp-flowspec' 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-inet</feature>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-flowspec/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-bmp-api/{{VERSION}}</bundle>
     </feature>
     <feature name='odl-bgpcep-bgp-labeled-unicast' 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-inet</feature>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-labeled-unicast/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-bmp-api/{{VERSION}}</bundle>
     </feature>
         <feature version='${project.version}'>odl-bgpcep-bgp-linkstate</feature>
         <feature version='${project.version}'>odl-bgpcep-bgp-rib-api</feature>
         <feature version='${project.version}'>odl-bgpcep-bgp-path-selection-mode</feature>
+        <feature version='${project.version}'>odl-bgpcep-bgp-inet</feature>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-openconfig-spi/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-rib-impl/{{VERSION}}</bundle>
     </feature>