Use long instead of PathId wrapper 60/69360/4
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Sun, 11 Mar 2018 20:35:48 +0000 (21:35 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 12 Mar 2018 15:31:14 +0000 (16:31 +0100)
until the moment a PathId is required.

Change-Id: Idc2ce010fe4f2081f0d8131f2af226dfe88aec72
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
32 files changed:
bgp/benchmark-app/src/main/java/org/opendaylight/protocol/bgp/benchmark/app/AppPeerBenchmark.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnRibSupport.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnRibSupportTest.java
bgp/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv4RIBSupport.java
bgp/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv6RIBSupport.java
bgp/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/l3vpn/ipv4/FlowspecL3vpnIpv4RIBSupport.java
bgp/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/l3vpn/ipv6/FlowspecL3vpnIpv6RIBSupport.java
bgp/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv4RIBSupportTest.java
bgp/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv6RIBSupportTest.java
bgp/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecL3vpnIpv4RIBSupportTest.java
bgp/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecL3vpnIpv6RIBSupportTest.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupport.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupport.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupportTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupportTest.java
bgp/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/AbstractVpnRIBSupport.java
bgp/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/ipv4/VpnIpv4RIBSupportTest.java
bgp/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/ipv6/VpnIpv6RIBSupportTest.java
bgp/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/AbstractLabeledUnicastRIBSupport.java
bgp/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupportTest.java
bgp/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupportTest.java
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/LinkstateRIBSupport.java
bgp/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateRIBSupportTest.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/PathIdUtil.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/PathIdUtilTest.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/add/AddPathAbstractRouteEntry.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AddPathRibSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/MultiPathAbstractRIBSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBSupport.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/AddPathRibSupportTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/MultiPathAbstractRIBSupportTest.java
bgp/rib-spi/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/bgp/inet/rev150305/ipv4/routes/ipv4/routes/MultiPathAbstractTest.java

index 9109cfb85685a5b6a1ca542383bde33912eb5185..abfb78394131501fd1651b90e7880c1c39f68384 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.protocol.bgp.benchmark.app;
 
 import static java.util.Objects.requireNonNull;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Stopwatch;
@@ -38,7 +39,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.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4RouteBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4RouteKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AsPath;
@@ -93,8 +93,6 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
     private static final String SLASH = "/";
     private static final String PREFIX = SLASH + "32";
 
-    private static final PathId PATH_ID = new PathId(0L);
-
     private final BindingTransactionChain txChain;
     private final RpcRegistration<OdlBgpAppPeerBenchmarkService> rpcRegistration;
     private final InstanceIdentifier<ApplicationRib> appIID;
@@ -212,7 +210,7 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
         String address = getAdddressFromPrefix(ipv4Prefix);
         final Stopwatch stopwatch = Stopwatch.createStarted();
         for (int i = 1; i <= count; i++) {
-            final Ipv4RouteKey routeKey = new Ipv4RouteKey(PATH_ID, createPrefix(address));
+            final Ipv4RouteKey routeKey = new Ipv4RouteKey(NON_PATH_ID, createPrefix(address));
             final KeyedInstanceIdentifier<Ipv4Route, Ipv4RouteKey> routeIId =
                 this.routesIId.child(Ipv4Route.class, routeKey);
             if (attributes != null) {
index f6aaa0b3ad907d07c75a1557cd1a55c7b2dd3f5e..1aef60d629f9f9aa31d30fb48ef8b76e6727a190 100644 (file)
@@ -31,7 +31,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.evpn._case.DestinationEvpn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.evpn._case.DestinationEvpnBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.destination.DestinationType;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -126,7 +125,7 @@ final class EvpnRibSupport extends AbstractRIBSupport<EvpnRoute, EvpnRouteKey> {
     }
 
     @Override
-    public EvpnRoute createRoute(final EvpnRoute route, final EvpnRouteKey routeKey, final PathId pathId,
+    public EvpnRoute createRoute(final EvpnRoute route, final EvpnRouteKey routeKey, final long pathId,
             final Attributes attributes) {
         final EvpnRouteBuilder builder;
         if (route != null) {
index 7c95b667d4b0b1a1fe8dd697ce2d9251cd4e4e44..87d42c432840711e95462e85c73cf2a294e4b06e 100644 (file)
@@ -12,7 +12,7 @@ import static org.junit.Assert.assertNull;
 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.RD;
 import static org.opendaylight.protocol.bgp.evpn.impl.nlri.EthADRParserTest.ETHERNET_AD_ROUTE_CASE;
 import static org.opendaylight.protocol.bgp.evpn.impl.nlri.EthADRParserTest.ETHERNET_AD_ROUTE_CASE_KEY;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
@@ -148,7 +148,7 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testRouteIdAddPath() {
-        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, null));
+        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(1L, null));
     }
 
     @Test
@@ -160,7 +160,7 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index 4ba2fefca8f3f4fb25335e3d1c27db795262ee45..38ef274aae432150e2139247901d50fda610cf6e 100644 (file)
@@ -7,9 +7,6 @@
  */
 package org.opendaylight.protocol.bgp.flowspec;
 
-import java.util.Collection;
-import java.util.Collections;
-import javax.annotation.Nonnull;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.FlowspecSubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.loc.rib.tables.routes.FlowspecRoutesCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.ipv4.DestinationFlowspec;
@@ -42,24 +39,21 @@ public final class FlowspecIpv4RIBSupport extends AbstractFlowspecRIBSupport<Sim
         return new FlowspecIpv4RIBSupport(context);
     }
 
-    @Nonnull
     @Override
-    public FlowspecRoute createRoute(
-            final FlowspecRoute route,
-            final FlowspecRouteKey routeKey,
-            final PathId pathId,
-            final Attributes attributes) {
+    public FlowspecRoute createRoute(final FlowspecRoute route, final FlowspecRouteKey routeKey,
+            final long pathId, final Attributes attributes) {
         final FlowspecRouteBuilder builder;
         if (route != null) {
             builder = new FlowspecRouteBuilder(route);
         } else {
             builder = new FlowspecRouteBuilder();
         }
-        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(new PathId(pathId))
+                .setAttributes(attributes).build();
     }
 
     @Override
-    public FlowspecRouteKey createNewRouteKey(final PathId pathId, final FlowspecRouteKey routeKey) {
-        return new FlowspecRouteKey(pathId, routeKey.getRouteKey());
+    public FlowspecRouteKey createNewRouteKey(final long pathId, final FlowspecRouteKey routeKey) {
+        return new FlowspecRouteKey(new PathId(pathId), routeKey.getRouteKey());
     }
 }
index 2c3d6896a3605e49d877df7d405c17a7ed9a6f78..124c54bf2a84fcc846bef2de2c26d0d12553433a 100644 (file)
@@ -41,18 +41,19 @@ public final class FlowspecIpv6RIBSupport extends AbstractFlowspecRIBSupport<Sim
 
     @Override
     public FlowspecRoute createRoute(final FlowspecRoute route, final FlowspecRouteKey routeKey,
-            final PathId pathId, final Attributes attributes) {
+            final long pathId, final Attributes attributes) {
         final FlowspecRouteBuilder builder;
         if (route != null) {
             builder = new FlowspecRouteBuilder(route);
         } else {
             builder = new FlowspecRouteBuilder();
         }
-        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setRouteKey(routeKey.getRouteKey())
+                .setPathId(new PathId(pathId)).setAttributes(attributes).build();
     }
 
     @Override
-    public FlowspecRouteKey createNewRouteKey(final PathId pathId, final FlowspecRouteKey routeKey) {
-        return new FlowspecRouteKey(pathId, routeKey.getRouteKey());
+    public FlowspecRouteKey createNewRouteKey(final long pathId, final FlowspecRouteKey routeKey) {
+        return new FlowspecRouteKey(new PathId(pathId), routeKey.getRouteKey());
     }
 }
index 51fe882f93e11d8eaa6a4f2594459c67c9b9601b..01fdf0372e731d18a5109d6b10cd89e5396cb3e4 100644 (file)
@@ -40,22 +40,20 @@ public final class FlowspecL3vpnIpv4RIBSupport extends AbstractFlowspecL3vpnRIBS
     }
 
     @Override
-    public final FlowspecL3vpnRouteKey createNewRouteKey(final PathId pathId, final FlowspecL3vpnRouteKey routeKey) {
-        return new FlowspecL3vpnRouteKey(pathId, routeKey.getRouteKey());
+    public final FlowspecL3vpnRouteKey createNewRouteKey(final long pathId, final FlowspecL3vpnRouteKey routeKey) {
+        return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey.getRouteKey());
     }
 
     @Override
-    public FlowspecL3vpnRoute createRoute(
-            final FlowspecL3vpnRoute route,
-            final FlowspecL3vpnRouteKey routeKey,
-            final PathId pathId,
-            final Attributes attributes) {
+    public FlowspecL3vpnRoute createRoute(final FlowspecL3vpnRoute route, final FlowspecL3vpnRouteKey routeKey,
+            final long pathId, final Attributes attributes) {
         final FlowspecL3vpnRouteBuilder builder;
         if (route != null) {
             builder = new FlowspecL3vpnRouteBuilder(route);
         } else {
             builder = new FlowspecL3vpnRouteBuilder();
         }
-        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(new PathId(pathId))
+                .setAttributes(attributes).build();
     }
 }
index b246759eeba778c2beea48ae7321e4fa2901958a..97c6693b28341046551a7a52bbc742186a4d5cd6 100644 (file)
@@ -39,22 +39,20 @@ public final class FlowspecL3vpnIpv6RIBSupport extends AbstractFlowspecL3vpnRIBS
     }
 
     @Override
-    public final FlowspecL3vpnRouteKey createNewRouteKey(final PathId pathId, final FlowspecL3vpnRouteKey routeKey) {
-        return new FlowspecL3vpnRouteKey(pathId, routeKey.getRouteKey());
+    public final FlowspecL3vpnRouteKey createNewRouteKey(final long pathId, final FlowspecL3vpnRouteKey routeKey) {
+        return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey.getRouteKey());
     }
 
     @Override
-    public FlowspecL3vpnRoute createRoute(
-            final FlowspecL3vpnRoute route,
-            final FlowspecL3vpnRouteKey routeKey,
-            final PathId pathId,
-            final Attributes attributes) {
+    public FlowspecL3vpnRoute createRoute(final FlowspecL3vpnRoute route, final FlowspecL3vpnRouteKey routeKey,
+            final long pathId, final Attributes attributes) {
         final FlowspecL3vpnRouteBuilder builder;
         if (route != null) {
             builder = new FlowspecL3vpnRouteBuilder(route);
         } else {
             builder = new FlowspecL3vpnRouteBuilder();
         }
-        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(new PathId(pathId))
+                .setAttributes(attributes).build();
     }
 }
index 4279a6d410ca13c33fa62078c563820c1a950da3..9b024b326868cf6960f23847783499c0d3387129 100644 (file)
@@ -10,9 +10,8 @@ package org.opendaylight.protocol.bgp.flowspec;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
 import java.util.Collections;
@@ -146,7 +145,7 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testRouteIdAddPath() {
         final FlowspecRouteKey oldKey = new FlowspecRouteKey(new PathId(100L), ROUTE_KEY.getRouteKey());
-        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldKey));
+        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(1L, oldKey));
     }
 
     @Test
@@ -157,7 +156,7 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        Assert.assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        Assert.assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index bc413a568f2fcc0643e6763b9e077fae92935862..2f3fcf6c6b3d02d3a5668254ab94b6529bd9e89c 100644 (file)
@@ -10,9 +10,8 @@ package org.opendaylight.protocol.bgp.flowspec;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
 import java.util.Collections;
@@ -145,7 +144,7 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testRouteIdAddPath() {
         final FlowspecRouteKey oldKey = new FlowspecRouteKey(new PathId(100L), ROUTE_KEY.getRouteKey());
-        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldKey));
+        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(1L, oldKey));
     }
 
     @Test
@@ -156,7 +155,7 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        Assert.assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        Assert.assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index 3dc71bbc56d65f41bf7b9db0efe9ee7268d3cc97..ac6ab0839cb462c350b590a4c2811bcdf4085e25 100644 (file)
@@ -9,9 +9,8 @@ package org.opendaylight.protocol.bgp.flowspec;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
 import java.util.Collections;
@@ -142,7 +141,7 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testRouteIdAddPath() {
         final FlowspecL3vpnRouteKey oldKey = new FlowspecL3vpnRouteKey(new PathId(100L), ROUTE_KEY.getRouteKey());
-        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldKey));
+        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(1L, oldKey));
     }
 
     @Test
@@ -153,7 +152,7 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        Assert.assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        Assert.assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index e43f613090e098ccd649950aae8d42ff4200ae57..833a54eceb4a20cf7fb8aa726defdcbbe36c84cf 100644 (file)
@@ -9,9 +9,8 @@ package org.opendaylight.protocol.bgp.flowspec;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
 import java.util.Collections;
@@ -143,7 +142,7 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest {
     public void testRouteIdAddPath() {
         final FlowspecL3vpnRouteKey oldRouteKey
                 = new FlowspecL3vpnRouteKey(new PathId(10L), ROUTE_KEY.getRouteKey());
-        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldRouteKey));
+        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(1L, oldRouteKey));
     }
 
     @Test
@@ -154,7 +153,7 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        Assert.assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        Assert.assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index eb010764e2259b87ffcffd099d0a604304276e28..9bc8426a0cb41b271b41b42bd3825172e45749e6 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.bgp.inet;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import javax.annotation.Nonnull;
 import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
 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.rev171207.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCase;
@@ -58,16 +57,14 @@ final class IPv4RIBSupport extends AbstractIPRibSupport<Ipv4Route, Ipv4RouteKey>
         return prefs;
     }
 
-    @Nonnull
     @Override
-    protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
+    protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
         return new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
                 .setIpv4Prefixes(extractPrefixes(routes)).build()).build();
     }
 
-    @Nonnull
     @Override
-    protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
+    protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
         return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
                 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
                 .setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(extractPrefixes(routes))
@@ -75,7 +72,7 @@ final class IPv4RIBSupport extends AbstractIPRibSupport<Ipv4Route, Ipv4RouteKey>
     }
 
     @Override
-    public Ipv4Route createRoute(final Ipv4Route route, final Ipv4RouteKey routeKey, final PathId pathId,
+    public Ipv4Route createRoute(final Ipv4Route route, final Ipv4RouteKey routeKey, final long pathId,
             final Attributes attributes) {
         final Ipv4RouteBuilder builder;
         if (route != null) {
@@ -83,11 +80,11 @@ final class IPv4RIBSupport extends AbstractIPRibSupport<Ipv4Route, Ipv4RouteKey>
         } else {
             builder = new Ipv4RouteBuilder();
         }
-        return builder.setPrefix(routeKey.getPrefix()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setPrefix(routeKey.getPrefix()).setPathId(new PathId(pathId)).setAttributes(attributes).build();
     }
 
     @Override
-    public Ipv4RouteKey createNewRouteKey(final PathId pathId, final Ipv4RouteKey routeKey) {
-        return new Ipv4RouteKey(pathId, routeKey.getPrefix());
+    public Ipv4RouteKey createNewRouteKey(final long pathId, final Ipv4RouteKey routeKey) {
+        return new Ipv4RouteKey(new PathId(pathId), routeKey.getPrefix());
     }
 }
index d65bf421942c34b6797d81b99a7873115d34991c..130c9dc5f5b3c89b169e03bba7d9b0f108ab35bd 100644 (file)
@@ -71,7 +71,7 @@ final class IPv6RIBSupport extends AbstractIPRibSupport<Ipv6Route, Ipv6RouteKey>
     }
 
     @Override
-    public Ipv6Route createRoute(final Ipv6Route route, final Ipv6RouteKey routeKey, final PathId pathId,
+    public Ipv6Route createRoute(final Ipv6Route route, final Ipv6RouteKey routeKey, final long pathId,
             final Attributes attributes) {
         final Ipv6RouteBuilder builder;
         if (route != null) {
@@ -79,11 +79,11 @@ final class IPv6RIBSupport extends AbstractIPRibSupport<Ipv6Route, Ipv6RouteKey>
         } else {
             builder = new Ipv6RouteBuilder();
         }
-        return builder.setPrefix(routeKey.getPrefix()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setPrefix(routeKey.getPrefix()).setPathId(new PathId(pathId)).setAttributes(attributes).build();
     }
 
     @Override
-    public Ipv6RouteKey createNewRouteKey(final PathId pathId, final Ipv6RouteKey routeKey) {
-        return new Ipv6RouteKey(pathId, routeKey.getPrefix());
+    public Ipv6RouteKey createNewRouteKey(final long pathId, final Ipv6RouteKey routeKey) {
+        return new Ipv6RouteKey(new PathId(pathId), routeKey.getPrefix());
     }
 }
index bb814667a016eb368db838ed5524916cbb5707a6..7985f9661e325fe5af4103cac44bcba6d68013c4 100644 (file)
@@ -137,7 +137,7 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest {
     public void testRouteIdAddPath() {
         final Ipv4RouteKey expected = new Ipv4RouteKey(new PathId(1L), PREFIX);
         final Ipv4RouteKey oldKey = new Ipv4RouteKey(new PathId(100L), PREFIX);
-        assertEquals(expected, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldKey));
+        assertEquals(expected, RIB_SUPPORT.createNewRouteKey(expected.getPathId().getValue(), oldKey));
     }
 
     @Test
index 9dfd32838bb79bf069c3ab9b27fe72c4a20ae6a9..28087dfe7e03887c48ada27593ce26870d6ed13f 100644 (file)
@@ -93,7 +93,7 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
 
 
     @Test
-    public void testEmptyRoute() throws Exception {
+    public void testEmptyRoute() {
         final Routes empty = new Ipv6RoutesCaseBuilder().setIpv6Routes(EMPTY_ROUTES).build();
         final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
         assertEquals(createRoutes(empty), emptyRoutes);
@@ -135,7 +135,7 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
     public void testRouteIdAddPath() {
         final Ipv6RouteKey expected = new Ipv6RouteKey(new PathId(1L), PREFIX);
         final Ipv6RouteKey oldKey = new Ipv6RouteKey(new PathId(100L), PREFIX);
-        assertEquals(expected, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldKey));
+        assertEquals(expected, RIB_SUPPORT.createNewRouteKey(expected.getPathId().getValue(), oldKey));
     }
 
     @Test
index c5f37495dee7c744c355c064599b2f55a83fc8cd..c96712271300872efcd5df952879dfefc24f4cc3 100644 (file)
@@ -17,7 +17,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
 import org.opendaylight.bgp.concepts.RouteDistinguisherUtil;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.protocol.bgp.labeled.unicast.LUNlriParser;
@@ -113,15 +112,13 @@ public abstract class AbstractVpnRIBSupport extends AbstractRIBSupport<VpnRoute,
 
     protected abstract DestinationType getWithdrawnDestinationType(List<VpnDestination> dests);
 
-    @Nonnull
     @Override
-    protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
+    protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
         return getAdvertisedDestinationType(extractRoutes(routes));
     }
 
-    @Nonnull
     @Override
-    protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
+    protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
         return getWithdrawnDestinationType(extractRoutes(routes));
     }
 
@@ -129,13 +126,11 @@ public abstract class AbstractVpnRIBSupport extends AbstractRIBSupport<VpnRoute,
         return routes.stream().map(this::extractVpnDestination).collect(Collectors.toList());
     }
 
-    @Nonnull
     @Override
     public ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
         return ImmutableSet.of();
     }
 
-    @Nonnull
     @Override
     public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
         return ImmutableSet.of();
@@ -193,17 +188,15 @@ public abstract class AbstractVpnRIBSupport extends AbstractRIBSupport<VpnRoute,
     }
 
     @Override
-    public final VpnRoute createRoute(
-            final VpnRoute route,
-            final VpnRouteKey vpnRouteKey,
-            final PathId pathId,
-            final Attributes attributes) {
+    public final VpnRoute createRoute(final VpnRoute route, final VpnRouteKey vpnRouteKey,
+            final long pathId, final Attributes attributes) {
         final VpnRouteBuilder builder;
         if (route != null) {
             builder = new VpnRouteBuilder(route);
         } else {
             builder = new VpnRouteBuilder();
         }
-        return builder.setRouteKey(vpnRouteKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setRouteKey(vpnRouteKey.getRouteKey()).setPathId(new PathId(pathId))
+                .setAttributes(attributes).build();
     }
 }
index fde068a03e99d0bacb51de55f8392c196a35f034..b577c518ce8f0efd47e954c5d659acd75d43bd77 100644 (file)
@@ -16,6 +16,7 @@ import static org.opendaylight.protocol.bgp.l3vpn.ipv4.VpnIpv4NlriParserTest.IPV
 import static org.opendaylight.protocol.bgp.l3vpn.ipv4.VpnIpv4NlriParserTest.IPV4_VPN;
 import static org.opendaylight.protocol.bgp.l3vpn.ipv4.VpnIpv4NlriParserTest.LABEL_STACK;
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
@@ -23,7 +24,6 @@ import java.util.Collections;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1;
@@ -61,7 +61,7 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest {
                             .setVpnDestination(Collections.singletonList(IPV4_VPN)).build()).build();
     private static final VpnRouteKey ROUTE_KEY = new VpnRouteKey("WAABAQIDBAECIgEW");
 
-    private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(new PathId(NON_PATH_ID))
+    private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(NON_PATH_ID)
             .setAttributes(ATTRIBUTES).setPrefix(IPV4_PREFIX)
         .setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).setKey(ROUTE_KEY).build();
     private static final VpnIpv4Routes ROUTES = new VpnIpv4RoutesBuilder()
@@ -131,7 +131,7 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testRouteIdAddPath() {
-        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, null));
+        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(1L, null));
     }
 
     @Test
@@ -143,7 +143,7 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index bda393d5ce72ff0cd2bcf4e0b532abcd64e6af9c..76866b8631733892205cec7ca8cb9821bc888bfc 100644 (file)
@@ -15,6 +15,7 @@ import static org.opendaylight.protocol.bgp.l3vpn.ipv6.VpnIpv6NlriParserTest.IPV
 import static org.opendaylight.protocol.bgp.l3vpn.ipv6.VpnIpv6NlriParserTest.IPV6_VPN;
 import static org.opendaylight.protocol.bgp.l3vpn.ipv6.VpnIpv6NlriParserTest.LABEL_STACK;
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
@@ -23,7 +24,6 @@ import java.util.Collections;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1;
@@ -61,7 +61,7 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest {
                     .setVpnIpv6Destination(new VpnIpv6DestinationBuilder()
                             .setVpnDestination(Collections.singletonList(IPV6_VPN)).build()).build();
     private static final VpnRouteKey ROUTE_KEY = new VpnRouteKey("cAABAQIDBAECIAEjRVaJ");
-    private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(new PathId(NON_PATH_ID))
+    private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(NON_PATH_ID)
             .setAttributes(ATTRIBUTES).setPrefix(IPV6PREFIX)
             .setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).setKey(ROUTE_KEY).build();
     private static final VpnIpv6Routes ROUTES = new VpnIpv6RoutesBuilder()
@@ -89,7 +89,7 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest {
     }
 
     @Test
-    public void testEmptyRoute() throws Exception {
+    public void testEmptyRoute() {
         final Routes empty = new VpnIpv6RoutesCaseBuilder().setVpnIpv6Routes(new VpnIpv6RoutesBuilder()
                 .setVpnRoute(Collections.emptyList()).build()).build();
         final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
@@ -129,7 +129,7 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testRouteIdAddPath() {
-        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, null));
+        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(1L, null));
     }
 
     @Test
@@ -141,7 +141,7 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index b9a5928649da0bec6798582ebbfc52ff01cfbf0c..f4ba5b923952bf50eb7a3f0cfbebbf56c067986e 100644 (file)
@@ -135,7 +135,8 @@ abstract class AbstractLabeledUnicastRIBSupport
      * @param route DataContainer
      * @return LabeledUnicastDestination Object
      */
-    private CLabeledUnicastDestination extractCLabeledUnicastDestination(final DataContainerNode<? extends PathArgument> route) {
+    private CLabeledUnicastDestination extractCLabeledUnicastDestination(
+            final DataContainerNode<? extends PathArgument> route) {
         final CLabeledUnicastDestinationBuilder builder = new CLabeledUnicastDestinationBuilder();
         builder.setPrefix(extractPrefix(route, PREFIX_TYPE_NID));
         builder.setLabelStack(extractLabel(route, LABEL_STACK_NID, LV_NID));
@@ -143,10 +144,11 @@ abstract class AbstractLabeledUnicastRIBSupport
         return builder.build();
     }
 
-    protected abstract IpPrefix extractPrefix(final DataContainerNode<? extends PathArgument> route, final NodeIdentifier prefixTypeNid);
+    protected abstract IpPrefix extractPrefix(final DataContainerNode<? extends PathArgument> route,
+            final NodeIdentifier prefixTypeNid);
 
-    public static List<LabelStack> extractLabel(final DataContainerNode<? extends PathArgument> route, final NodeIdentifier labelStackNid,
-        final NodeIdentifier labelValueNid) {
+    public static List<LabelStack> extractLabel(final DataContainerNode<? extends PathArgument> route,
+            final NodeIdentifier labelStackNid, final NodeIdentifier labelValueNid) {
         final List<LabelStack> labels = new ArrayList<>();
         final Optional<DataContainerChild<? extends PathArgument, ?>> labelStacks = route.getChild(labelStackNid);
         if (labelStacks.isPresent()) {
@@ -163,21 +165,19 @@ abstract class AbstractLabeledUnicastRIBSupport
     }
 
     @Override
-    public final LabeledUnicastRouteKey createNewRouteKey(final PathId pathId, final LabeledUnicastRouteKey routeKey) {
-        return new LabeledUnicastRouteKey(pathId, routeKey.getRouteKey());
+    public final LabeledUnicastRouteKey createNewRouteKey(final long pathId, final LabeledUnicastRouteKey routeKey) {
+        return new LabeledUnicastRouteKey(new PathId(pathId), routeKey.getRouteKey());
     }
 
     @Override
-    public final LabeledUnicastRoute createRoute(final LabeledUnicastRoute route,
-            final LabeledUnicastRouteKey routeKey,
-            final PathId pathId,
-            final Attributes attributes) {
+    public final LabeledUnicastRoute createRoute(final LabeledUnicastRoute route, final LabeledUnicastRouteKey routeKey,
+            final long pathId, final Attributes attributes) {
         final LabeledUnicastRouteBuilder builder;
         if (route != null) {
             builder = new LabeledUnicastRouteBuilder(route);
         } else {
             builder = new LabeledUnicastRouteBuilder();
         }
-        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
+        return builder.setRouteKey(routeKey.getRouteKey()).setPathId(new PathId(pathId)).setAttributes(attributes).build();
     }
 }
index cc7669ba2a81657c4220126b82ea045290ebd578..5923c04d081f8594ce5a74d6a0f812f4c7ee31f0 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
@@ -150,7 +150,7 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest {
     public void testRouteIdAddPath() {
         final LabeledUnicastRouteKey oldKey
                 = new LabeledUnicastRouteKey(new PathId(100L), ROUTE_KEY.getRouteKey());
-        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldKey));
+        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(1L, oldKey));
     }
 
     @Test
@@ -161,7 +161,7 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        Assert.assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        Assert.assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index 3c19912669356853309fe25a4ed249200a600117..6f27355170b5ab714e8df82482a7b8c1cb316e67 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
@@ -151,7 +151,7 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest {
     public void testRouteIdAddPath() {
         final LabeledUnicastRouteKey oldKey
                 = new LabeledUnicastRouteKey(new PathId(100L), ROUTE_KEY.getRouteKey());
-        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, oldKey));
+        Assert.assertEquals(ROUTE_KEY, RIB_SUPPORT.createNewRouteKey(1L, oldKey));
     }
 
     @Test
@@ -162,7 +162,7 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        Assert.assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        Assert.assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index ca34c507fed9697332e2789c9fe1937258ca8659..667921f265a4e3bb8e986bcab7533bc831a162fa 100644 (file)
@@ -31,7 +31,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLinkstateCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.destination.DestinationType;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -64,6 +63,18 @@ public final class LinkstateRIBSupport extends AbstractRIBSupport<LinkstateRoute
         return SINGLETON;
     }
 
+    private static NodeIdentifierWithPredicates createRouteKey(final UnkeyedListEntryNode linkstate) {
+        final ByteBuf buffer = Unpooled.buffer();
+        final CLinkstateDestination cLinkstateDestination = LinkstateNlriParser.extractLinkstateDestination(linkstate);
+        SimpleNlriTypeRegistry.getInstance().serializeNlriType(cLinkstateDestination, buffer);
+
+        return new NodeIdentifierWithPredicates(LinkstateRoute.QNAME, ROUTE_KEY_QNAME, ByteArray.readAllBytes(buffer));
+    }
+
+    private static List<CLinkstateDestination> extractRoutes(final Collection<MapEntryNode> routes) {
+        return routes.stream().map(LinkstateNlriParser::extractLinkstateDestination).collect(Collectors.toList());
+    }
+
     @Override
     public ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
         return ImmutableSet.of();
@@ -81,7 +92,7 @@ public final class LinkstateRIBSupport extends AbstractRIBSupport<LinkstateRoute
 
     @Override
     protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
-        final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
+            final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
         if (destination != null) {
             final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes
                     = destination.getChild(this.nlriRoutesList);
@@ -91,7 +102,7 @@ public final class LinkstateRIBSupport extends AbstractRIBSupport<LinkstateRoute
 
     private void processRoute(final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes,
             final YangInstanceIdentifier routesPath,
-        final ContainerNode attributes, final ApplyRoute function, final DOMDataWriteTransaction tx) {
+            final ContainerNode attributes, final ApplyRoute function, final DOMDataWriteTransaction tx) {
         if (maybeRoutes.isPresent()) {
             final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
             if (routes instanceof UnkeyedListNode) {
@@ -106,18 +117,10 @@ public final class LinkstateRIBSupport extends AbstractRIBSupport<LinkstateRoute
         }
     }
 
-    private static NodeIdentifierWithPredicates createRouteKey(final UnkeyedListEntryNode linkstate) {
-        final ByteBuf buffer = Unpooled.buffer();
-        final CLinkstateDestination cLinkstateDestination = LinkstateNlriParser.extractLinkstateDestination(linkstate);
-        SimpleNlriTypeRegistry.getInstance().serializeNlriType(cLinkstateDestination, buffer);
-
-        return new NodeIdentifierWithPredicates(LinkstateRoute.QNAME, ROUTE_KEY_QNAME, ByteArray.readAllBytes(buffer));
-    }
-
     @Override
     protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
         return new DestinationLinkstateCaseBuilder().setDestinationLinkstate(
-            new DestinationLinkstateBuilder().setCLinkstateDestination(extractRoutes(routes)).build()).build();
+                new DestinationLinkstateBuilder().setCLinkstateDestination(extractRoutes(routes)).build()).build();
     }
 
     @Override
@@ -130,16 +133,9 @@ public final class LinkstateRIBSupport extends AbstractRIBSupport<LinkstateRoute
                         .setCLinkstateDestination(extractRoutes(routes)).build()).build();
     }
 
-    private static List<CLinkstateDestination> extractRoutes(final Collection<MapEntryNode> routes) {
-        return routes.stream().map(LinkstateNlriParser::extractLinkstateDestination).collect(Collectors.toList());
-    }
-
     @Override
-    public LinkstateRoute createRoute(
-            final LinkstateRoute route,
-            final LinkstateRouteKey routeKey,
-            final PathId pathId,
-            final Attributes attributes) {
+    public LinkstateRoute createRoute(final LinkstateRoute route, final LinkstateRouteKey routeKey,
+            final long pathId, final Attributes attributes) {
         final LinkstateRouteBuilder builder;
         if (route != null) {
             builder = new LinkstateRouteBuilder(route);
index ee6c08c96a2773e0c4ab1a9939d46da98f28c598..d907dfcc3c44441b857c72550b7790cf99cf0923 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.protocol.bgp.linkstate;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
@@ -171,7 +171,7 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testRouteIdAddPath() {
-        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(AbstractRIBSupportTest.PATH_ID, null));
+        Assert.assertNull(RIB_SUPPORT.createNewRouteKey(1L, null));
     }
 
     @Test
@@ -182,7 +182,7 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testExtractPathId() {
-        Assert.assertEquals(NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        Assert.assertEquals(NON_PATH_ID_VALUE, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
index 47e4814a3a72ab0f0555a9b3d28e3489cd6faabf..d63fd23d2155b0b027e4b930f9560a45bd3dadc6 100644 (file)
@@ -24,7 +24,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
 
 public final class PathIdUtil {
-    public static final long NON_PATH_ID = 0;
+    public static final long NON_PATH_ID_VALUE = 0;
+    public static final PathId NON_PATH_ID = new PathId(NON_PATH_ID_VALUE);
 
     private PathIdUtil() {
         throw new UnsupportedOperationException();
@@ -129,7 +130,7 @@ public final class PathIdUtil {
             final QName pathIdQname, final Object routeKeyValue,
             final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf) {
         // FIXME: a cache here would mean we instantiate the same identifier for each route making comparison quicker.
-        final Object pathId = maybePathIdLeaf.isPresent() ? maybePathIdLeaf.get().getValue() : NON_PATH_ID;
+        final Object pathId = maybePathIdLeaf.isPresent() ? maybePathIdLeaf.get().getValue() : NON_PATH_ID_VALUE;
         return createNodeIdentifierWithPredicates(routeQname, pathIdQname, pathId, routeKeyQname, routeKeyValue);
     }
 }
index 0f1f44641fe337107665ef5f9626b793553d5ac3..394a332a470647772d8800709f2a980ce5ec0613 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.protocol.bgp.parser.spi;
 
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Assert;
@@ -38,7 +40,7 @@ public class PathIdUtilTest {
 
     @Test
     public void testWritePathIdZero() {
-        PathIdUtil.writePathId(new PathId(0L), this.buffer);
+        PathIdUtil.writePathId(NON_PATH_ID, this.buffer);
         Assert.assertEquals(0, this.buffer.readableBytes());
     }
 
index c6f7830d517eff4f5b340a539ee9ff1bb9598a78..4fb755f91f3af0b474334da09609bc1d5334fd08 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.protocol.bgp.mode.impl.add;
 
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.Lists;
 import com.google.common.primitives.UnsignedInteger;
@@ -143,7 +143,7 @@ public abstract class AddPathAbstractRouteEntry extends AbstractRouteEntry<AddPa
         if (this.removedPaths != null) {
             this.removedPaths.forEach(removedPath -> {
                 final PathArgument routeIdAddPath = ribSupport.getRouteIdAddPath(removedPath.getPathId(), routeIdPA);
-                final PathArgument routeIdAddPathDefault = ribSupport.getRouteIdAddPath(NON_PATH_ID, routeIdPA);
+                final PathArgument routeIdAddPathDefault = ribSupport.getRouteIdAddPath(NON_PATH_ID_VALUE, routeIdPA);
                 fillAdjRibsOut(true, null, null, null,
                         routeIdAddPathDefault, routeIdAddPath,
                         RouterIds.createPeerId(removedPath.getRouteId()),
@@ -185,7 +185,7 @@ public abstract class AddPathAbstractRouteEntry extends AbstractRouteEntry<AddPa
         final ContainerNode effectiveAttributes
                 = peerGroup.effectiveAttributes(fromPeer.getRole(), path.getAttributes());
         final NodeIdentifierWithPredicates routeIdAddPath = ribSup
-                .getRouteIdAddPath(destPeerSupAddPath ? path.getPathId() : NON_PATH_ID, routeId);
+                .getRouteIdAddPath(destPeerSupAddPath ? path.getPathId() : NON_PATH_ID_VALUE, routeId);
 
         writeRoute(entryInfo.getToPeerId(), getAdjRibOutYII(ribSup, entryInfo.getRootPath(), routeIdAddPath, localTK),
                 effectiveAttributes, createValue(routeIdAddPath, path), ribSup, tx);
@@ -196,7 +196,8 @@ public abstract class AddPathAbstractRouteEntry extends AbstractRouteEntry<AddPa
             final ExportPolicyPeerTracker peerPT, final DOMDataWriteTransaction tx) {
         final RIBSupport ribSup = entryDependencies.getRibSupport();
         final NodeIdentifierWithPredicates routeIdAddPath = ribSup.getRouteIdAddPath(path.getPathId(), routeIdPA);
-        final NodeIdentifierWithPredicates routeIdAddPathDefault = ribSup.getRouteIdAddPath(NON_PATH_ID, routeIdPA);
+        final NodeIdentifierWithPredicates routeIdAddPathDefault
+                = ribSup.getRouteIdAddPath(NON_PATH_ID_VALUE, routeIdPA);
         final YangInstanceIdentifier pathAddPathTarget = ribSup.routePath(entryDependencies.getLocRibTableTarget()
                 .node(ROUTES_IDENTIFIER), routeIdAddPath);
         final MapEntryNode addPathValue = createValue(routeIdAddPath, path);
index 695ae676915ec00cae5d164468fe534fef0e832b..ee7abbea59a286ba8613b1e4b19d748439f15692 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.protocol.bgp.rib.spi;
 
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -30,7 +30,7 @@ interface AddPathRibSupport {
      * @return pathId  The path identifier value
      */
     default long extractPathId(@Nonnull NormalizedNode<?, ?> normalizedNode) {
-        return NON_PATH_ID;
+        return NON_PATH_ID_VALUE;
     }
 
     /**
index e9d1a1b2415c2e23c98380e525f529053b258a5d..f74030b39b2002eacaea58cbbfa54189fd8e5244 100644 (file)
@@ -72,7 +72,7 @@ public abstract class MultiPathAbstractRIBSupport<R extends Route, N extends Ide
     public final long extractPathId(final NormalizedNode<?, ?> data) {
         final Long pathId = PathIdUtil.extractPathId(data, this.routePathIdNid());
         if (pathId == null) {
-            return PathIdUtil.NON_PATH_ID;
+            return PathIdUtil.NON_PATH_ID_VALUE;
         }
         return pathId;
     }
index e403925f602784f122604a30d70470b65017c275..30f082b1d4a8288723428bfeeca45277be835f84 100644 (file)
@@ -211,7 +211,7 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
             @Nonnull N newRouteKey);
 
     @Nonnull
-    R createRoute(@Nullable R route, N routeKey, @Nullable PathId pathId, @Nonnull Attributes attributes);
+    R createRoute(@Nullable R route, N routeKey, long pathId, @Nonnull Attributes attributes);
 
     /**
      * Construct a PathArgument to an AddPathRoute.
@@ -221,7 +221,7 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
      * @return routeId PathArgument + pathId or Null in case Add-path is not supported
      */
     @Nullable
-    default Identifier createNewRouteKey(@Nonnull PathId pathId, @Nonnull N routeKey) {
+    default Identifier createNewRouteKey(long pathId, @Nonnull N routeKey) {
         return null;
     }
 
index 5fba884d75a8f0c2d05a57b7e1a3deb60721f861..c0e1f816f8afdf1280b5b793965667acd0cce607 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.protocol.bgp.rib.spi;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
+import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.collect.ImmutableMap;
 import org.junit.Test;
@@ -28,8 +28,8 @@ public class AddPathRibSupportTest {
     @Test
     public void defaultAddPathRibSupport() {
         final AddPathRibSupportLocalTest test = new AddPathRibSupportLocalTest();
-        assertEquals(NON_PATH_ID, test.extractPathId(null));
-        assertNull(test.getRouteIdAddPath(NON_PATH_ID, null));
+        assertEquals(NON_PATH_ID_VALUE, test.extractPathId(null));
+        assertNull(test.getRouteIdAddPath(NON_PATH_ID_VALUE, null));
         assertEquals(QNAME, test.createRouteKeyPathArgument(QNAME));
     }
 
index b824cb06b2d74340302531a2c8310032c55e6c90..87cab60689749f06f593fda6cf1d4b026306e3cc 100644 (file)
@@ -156,25 +156,7 @@ public class MultiPathAbstractRIBSupportTest {
 
     @Test
     public void pathIdQName() {
-        final MultiPathAbstractTest multiPath = MULTI_PATH_ABSTRACT_TEST;
-        assertEquals(PATH_ID_QNAME, multiPath.pathIdQName());
-    }
-
-    @Test
-    public void extractPathId() {
-        final NodeIdentifier nii = new NodeIdentifier(PATH_ID_QNAME);
-        final ContainerNode cont = ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(nii)
-                .addChild(new ImmutableLeafNodeBuilder<>().withNodeIdentifier(nii).withValue(PATH_ID).build()).build();
-        assertEquals(PATH_ID, MULTI_PATH_ABSTRACT_TEST.extractPathId(cont));
-    }
-
-    @Test
-    public void getRouteIdAddPath() {
-        final NodeIdentifierWithPredicates routeIdPa =
-            new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
-                    ImmutableMap.of(PATH_ID_QNAME, PATH_ID, PREFIX_QNAME, PREFIX));
-        assertEquals(routeIdPa, MULTI_PATH_ABSTRACT_TEST.getRouteIdAddPath(PATH_ID, PREFIX_NII));
-
+        assertEquals(PATH_ID_QNAME, MULTI_PATH_ABSTRACT_TEST.pathIdQName());
     }
 
     @Test
@@ -183,27 +165,27 @@ public class MultiPathAbstractRIBSupportTest {
     }
 
     @Test
-    public void routesCaseClass() throws Exception {
+    public void routesCaseClass() {
         assertEquals(Ipv4RoutesCase.class, MULTI_PATH_ABSTRACT_TEST.routesCaseClass());
     }
 
     @Test
-    public void routesContainerClass() throws Exception {
+    public void routesContainerClass() {
         assertEquals(Ipv4Routes.class, MULTI_PATH_ABSTRACT_TEST.routesContainerClass());
     }
 
     @Test
-    public void routesListClass() throws Exception {
+    public void routesListClass() {
         assertEquals(Ipv4Route.class, MULTI_PATH_ABSTRACT_TEST.routesListClass());
     }
 
     @Test
-    public void routeQName() throws Exception {
+    public void routeQName() {
         assertEquals(Ipv4Route.QNAME, MULTI_PATH_ABSTRACT_TEST.routeQName());
     }
 
     @Test
-    public void emptyRoutes() throws Exception {
+    public void emptyRoutes() {
         final ChoiceNode emptyRoutes = Builders.choiceBuilder().withNodeIdentifier(ROUTES_IDENTIFIER)
                 .addChild(Builders.containerBuilder().withNodeIdentifier(IPV4_ROUTES_IDENTIFIER)
                         .withChild(ImmutableNodes.mapNodeBuilder(MULTI_PATH_ABSTRACT_TEST.routeQName())
@@ -212,61 +194,61 @@ public class MultiPathAbstractRIBSupportTest {
     }
 
     @Test
-    public void routeNid() throws Exception {
+    public void routeNid() {
         assertEquals(new NodeIdentifier(Ipv4Route.QNAME), MULTI_PATH_ABSTRACT_TEST.routeNid());
     }
 
     @Test
-    public void getAfi() throws Exception {
+    public void getAfi() {
         assertEquals(Ipv4AddressFamily.class, MULTI_PATH_ABSTRACT_TEST.getAfi());
     }
 
     @Test
-    public void getSafi() throws Exception {
+    public void getSafi() {
         assertEquals(UnicastSubsequentAddressFamily.class, MULTI_PATH_ABSTRACT_TEST.getSafi());
     }
 
     @Test
-    public void routesContainerIdentifier() throws Exception {
+    public void routesContainerIdentifier() {
         assertEquals(IPV4_ROUTES_IDENTIFIER, MULTI_PATH_ABSTRACT_TEST.routesContainerIdentifier());
 
     }
 
     @Test
-    public void routeAttributesIdentifier() throws Exception {
+    public void routeAttributesIdentifier() {
         assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME,
                 Attributes.QNAME.getLocalName().intern())), MULTI_PATH_ABSTRACT_TEST.routeAttributesIdentifier());
     }
 
     @Test
-    public void routePath() throws Exception {
+    public void routePath() {
         Assert.assertEquals(LOC_RIB_TARGET.node(ROUTES_IDENTIFIER)
                         .node(Ipv4Routes.QNAME).node(Ipv4Route.QNAME).node(PREFIX_NII),
             MULTI_PATH_ABSTRACT_TEST.routePath(LOC_RIB_TARGET.node(Routes.QNAME), PREFIX_NII));
     }
 
     @Test
-    public void changedRoutes() throws Exception {
+    public void changedRoutes() {
         Assert.assertTrue(MULTI_PATH_ABSTRACT_TEST.changedDOMRoutes(this.emptyTree).isEmpty());
         Assert.assertTrue(MULTI_PATH_ABSTRACT_TEST.changedDOMRoutes(this.emptySubTree).isEmpty());
         Assert.assertNotNull(MULTI_PATH_ABSTRACT_TEST.changedDOMRoutes(this.subTree));
     }
 
     @Test
-    public void putRoutes() throws Exception {
+    public void putRoutes() {
         MULTI_PATH_ABSTRACT_TEST.putRoutes(this.tx, LOC_RIB_TARGET, this.nlri, this.attributes);
         assertFalse(this.routes.isEmpty());
     }
 
     @Test
-    public void deleteRoutes() throws Exception {
+    public void deleteRoutes() {
         MULTI_PATH_ABSTRACT_TEST.deleteRoutes(this.tx, LOC_RIB_TARGET, this.nlri);
         assertTrue(this.routes.isEmpty());
     }
 
 
     @Test
-    public void buildUpdate() throws Exception {
+    public void buildUpdate() {
         final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
                 .setGlobal(new Ipv4Address("10.0.0.2")).build()).build();
         final Attributes attr = new AttributesBuilder().setCNextHop(nextHop).build();
index cca22289600cb63cb0781f197a7bb8e45bb0b171..1dd239e4a432ee7f1b6a32e3f9ee10b0c5d5fb4a 100644 (file)
@@ -13,7 +13,6 @@ import com.google.common.collect.ImmutableMap;
 import java.util.Collection;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.protocol.bgp.rib.spi.MultiPathAbstractRIBSupport;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.destination.DestinationType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route;
@@ -78,7 +77,7 @@ public final class MultiPathAbstractTest extends MultiPathAbstractRIBSupport {
     }
 
     @Override
-    public Route createRoute(final Route route, final Identifier routeKey, final PathId pathId
+    public Route createRoute(final Route route, final Identifier routeKey, final long pathId
             , final Attributes attributes) {
         return null;
     }