Fix EffectiveRibInWriter.writeTable() 85/78885/4
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 20 Dec 2018 06:40:07 +0000 (07:40 +0100)
committerRobert Varga <nite@hq.sk>
Sat, 22 Dec 2018 18:37:07 +0000 (18:37 +0000)
This patch fixes the case where the entire adj-rib-in table
is overwritten, so that such case leads to eff-rib-in table
being re-creeated from scratch.

This requires RIBSupport to be updated to allow extraction
on routes from data rather than just from DataObjectModification.

JIRA: BGPCEP-857
Change-Id: I6f88c4e30acb8498964cc9295f42c2ecbcab7251
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
24 files changed:
bgp/extensions/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnRibSupport.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv4RIBSupport.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv6RIBSupport.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/l3vpn/ipv4/FlowspecL3vpnIpv4RIBSupport.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/l3vpn/ipv6/FlowspecL3vpnIpv6RIBSupport.java
bgp/extensions/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupport.java
bgp/extensions/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupport.java
bgp/extensions/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/mcast/AbstractL3vpnMcastIpRIBSupport.java
bgp/extensions/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/mcast/L3VpnMcastIpv4RIBSupport.java
bgp/extensions/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/mcast/L3VpnMcastIpv6RIBSupport.java
bgp/extensions/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/unicast/AbstractVpnRIBSupport.java
bgp/extensions/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/unicast/ipv4/VpnIpv4RIBSupport.java
bgp/extensions/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/unicast/ipv6/VpnIpv6RIBSupport.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/AbstractLabeledUnicastRIBSupport.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupport.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupport.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/LinkstateRIBSupport.java
bgp/extensions/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/AbstractMvpnRIBSupport.java
bgp/extensions/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/MvpnIpv4RIBSupport.java
bgp/extensions/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/MvpnIpv6RIBSupport.java
bgp/extensions/route-target/src/main/java/org/opendaylight/protocol/bgp/route/targetcontrain/impl/RouteTargetConstrainRIBSupport.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.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/RIBSupportTestImp.java

index 651d56d2e7253bc83dce13ff8ee5f488d730ecc6..308ad0fd0529dd06fac41cd422cbb8ecf939d290 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.evpn.impl;
 
+import static com.google.common.base.Verify.verify;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
@@ -37,6 +39,7 @@ 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.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -160,11 +163,6 @@ final class EvpnRibSupport extends AbstractRIBSupport<EvpnRoutesCase, EvpnRoutes
         return new EvpnRouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<EvpnRoute> routesFromContainer(final EvpnRoutes container) {
-        return container.getEvpnRoute();
-    }
-
     @Override
     public PathId extractPathId(final EvpnRouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -174,4 +172,12 @@ final class EvpnRibSupport extends AbstractRIBSupport<EvpnRoutesCase, EvpnRoutes
     public String extractRouteKey(final EvpnRouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<EvpnRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.EvpnRoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.EvpnRoutesCase) routes).getEvpnRoutes().nonnullEvpnRoute();
+    }
 }
index fd1bae9963bf46670e528c63f4fc2610d9965c46..64051fa0a18f587291c03bfadbbceb6e453994eb 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.flowspec;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
@@ -21,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.routes.FlowspecRoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 
 public final class FlowspecIpv4RIBSupport
@@ -87,11 +90,6 @@ public final class FlowspecIpv4RIBSupport
         return new FlowspecRouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<FlowspecRoute> routesFromContainer(final FlowspecRoutes container) {
-        return container.getFlowspecRoute();
-    }
-
     @Override
     public PathId extractPathId(final FlowspecRouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -101,4 +99,13 @@ public final class FlowspecIpv4RIBSupport
     public String extractRouteKey(final FlowspecRouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<FlowspecRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecRoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecRoutesCase) routes).getFlowspecRoutes()
+                .nonnullFlowspecRoute();
+    }
 }
index ca7242e8b2c5fee60796e4598d0957c4795a19ad..ff45761d84688dfbce0e7a950355e941bc4b0cc7 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.flowspec;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
@@ -21,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.ipv6.routes.FlowspecIpv6RoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
 
 public final class FlowspecIpv6RIBSupport
@@ -87,11 +90,6 @@ public final class FlowspecIpv6RIBSupport
         return new FlowspecRouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<FlowspecRoute> routesFromContainer(final FlowspecIpv6Routes container) {
-        return container.getFlowspecRoute();
-    }
-
     @Override
     public PathId extractPathId(final FlowspecRouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -101,4 +99,13 @@ public final class FlowspecIpv6RIBSupport
     public String extractRouteKey(final FlowspecRouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<FlowspecRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecIpv6RoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecIpv6RoutesCase) routes).getFlowspecIpv6Routes()
+                .nonnullFlowspecRoute();
+    }
 }
index 56b7ed2b97b2fe509ff55131f24fd1f417cec8dc..828f0c6d84f5f008a9a89775f579a16520d08f31 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
@@ -22,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv4.routes.FlowspecL3vpnIpv4RoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 
 public final class FlowspecL3vpnIpv4RIBSupport
@@ -88,11 +91,6 @@ public final class FlowspecL3vpnIpv4RIBSupport
         return EMPTY_CONTAINER;
     }
 
-    @Override
-    public List<FlowspecL3vpnRoute> routesFromContainer(final FlowspecL3vpnIpv4Routes container) {
-        return container.getFlowspecL3vpnRoute();
-    }
-
     @Override
     public PathId extractPathId(final FlowspecL3vpnRouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -102,4 +100,13 @@ public final class FlowspecL3vpnIpv4RIBSupport
     public String extractRouteKey(final FlowspecL3vpnRouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<FlowspecL3vpnRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecL3vpnIpv4RoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecL3vpnIpv4RoutesCase) routes)
+                .getFlowspecL3vpnIpv4Routes().nonnullFlowspecL3vpnRoute();
+    }
 }
index 6838a6a05768b0a7eb320209fc8745f78f774d1b..b823f90a20d7bdbcc09162100f9705a83de37c00 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
@@ -22,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv6.routes.FlowspecL3vpnIpv6RoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
 
 public final class FlowspecL3vpnIpv6RIBSupport
@@ -88,11 +91,6 @@ public final class FlowspecL3vpnIpv6RIBSupport
         return EMPTY_CONTAINER;
     }
 
-    @Override
-    public List<FlowspecL3vpnRoute> routesFromContainer(final FlowspecL3vpnIpv6Routes container) {
-        return container.getFlowspecL3vpnRoute();
-    }
-
     @Override
     public PathId extractPathId(final FlowspecL3vpnRouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -102,4 +100,13 @@ public final class FlowspecL3vpnIpv6RIBSupport
     public String extractRouteKey(final FlowspecL3vpnRouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<FlowspecL3vpnRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecL3vpnIpv6RoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecL3vpnIpv6RoutesCase) routes)
+                .getFlowspecL3vpnIpv6Routes().nonnullFlowspecL3vpnRoute();
+    }
 }
index a73a5a83773ffd6a04d01563d5c12c934100f488..e7d660ddb62392b315329b4de44f4ec59f9bbf5e 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.inet;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -30,6 +32,7 @@ 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.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
@@ -115,11 +118,6 @@ final class IPv4RIBSupport extends AbstractIPRibSupport<Ipv4RoutesCase, Ipv4Rout
         return new Ipv4RouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<Ipv4Route> routesFromContainer(final Ipv4Routes container) {
-        return container.getIpv4Route();
-    }
-
     @Override
     public PathId extractPathId(final Ipv4RouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -129,4 +127,12 @@ final class IPv4RIBSupport extends AbstractIPRibSupport<Ipv4RoutesCase, Ipv4Rout
     public String extractRouteKey(final Ipv4RouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<Ipv4Route> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.Ipv4RoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.bgp.rib.rib.peer
+                .adj.rib.in.tables.routes.Ipv4RoutesCase) routes).getIpv4Routes().nonnullIpv4Route();
+    }
 }
index 8187849cd00e7cc8bcd578997bde06ef39a7c549..8683166181fb60e540d0edbb7e178522c71667c8 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.inet;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -29,6 +31,7 @@ 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.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
@@ -111,11 +114,6 @@ final class IPv6RIBSupport extends AbstractIPRibSupport<Ipv6RoutesCase, Ipv6Rout
         return new Ipv6RouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<Ipv6Route> routesFromContainer(final Ipv6Routes container) {
-        return container.getIpv6Route();
-    }
-
     @Override
     public PathId extractPathId(final Ipv6RouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -125,4 +123,12 @@ final class IPv6RIBSupport extends AbstractIPRibSupport<Ipv6RoutesCase, Ipv6Rout
     public String extractRouteKey(final Ipv6RouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<Ipv6Route> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.Ipv6RoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.bgp.rib.rib.peer
+                .adj.rib.in.tables.routes.Ipv6RoutesCase) routes).getIpv6Routes().nonnullIpv6Route();
+    }
 }
index 9cb58c88f5fc5ab054f008fc3ca11baf1ed90d8b..b18bd32447779485b99f42ecaa7b58cbdbb4a0e9 100644 (file)
@@ -148,7 +148,6 @@ abstract class AbstractL3vpnMcastIpRIBSupport<
         return Collections.emptyList();
     }
 
-
     final List<L3vpnMcastDestination> extractRoutes(final Collection<MapEntryNode> routes) {
         return routes.stream().map(this::extractDestinations).collect(Collectors.toList());
     }
@@ -162,13 +161,6 @@ abstract class AbstractL3vpnMcastIpRIBSupport<
                 .build();
     }
 
-
-    @Override
-    public final List<L3vpnMcastRoute> routesFromContainer(final S container) {
-        return container.getL3vpnMcastRoute();
-    }
-
-
     @Override
     public final PathId extractPathId(final L3vpnMcastRouteKey routeListKey) {
         return routeListKey.getPathId();
index 5c321c081c328c1b98e8976c903c6c0b5e550899..926ad44d6a0776db851564ef4e3a1403bc6c8371 100644 (file)
@@ -5,13 +5,15 @@
  * 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.l3vpn.mcast;
 
+import static com.google.common.base.Verify.verify;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import java.util.Optional;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.protocol.bgp.l3vpn.mcast.nlri.L3vpnMcastNlriSerializer;
@@ -22,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.bgp.rib.rib.loc.rib.tables.routes.L3vpnMcastRoutesIpv4Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.bgp.rib.rib.loc.rib.tables.routes.L3vpnMcastRoutesIpv4CaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestination;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.routes.L3vpnMcastRoute;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.routes.ipv4.L3vpnMcastRoutesIpv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.routes.ipv4.L3vpnMcastRoutesIpv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationL3vpnMcastIpv4AdvertizedCase;
@@ -30,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vp
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.l3vpn.mcast.ipv4.advertized._case.DestinationIpv4L3vpnMcastBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationL3vpnMcastIpv4WithdrawnCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationL3vpnMcastIpv4WithdrawnCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -109,4 +113,14 @@ public final class L3VpnMcastIpv4RIBSupport
         return PathIdUtil.createNidKey(routeQName(), routeKeyQName(),
                 pathIdQName(), ByteArray.encodeBase64(buffer), maybePathIdLeaf);
     }
+
+    @Override
+    public List<L3vpnMcastRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast
+            .rev180417.bgp.rib.rib.peer.adj.rib.in.tables.routes.L3vpnMcastRoutesIpv4Case, "Unrecognized routes %s",
+            routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.L3vpnMcastRoutesIpv4Case) routes).getL3vpnMcastRoutesIpv4()
+                .nonnullL3vpnMcastRoute();
+    }
 }
index 142de74b9378560971813d671bb6f8befde34ddb..5ad8cc26b8a9fcc46975f3760570ce11a6183de2 100644 (file)
@@ -5,13 +5,15 @@
  * 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.l3vpn.mcast;
 
+import static com.google.common.base.Verify.verify;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import java.util.Optional;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.protocol.bgp.l3vpn.mcast.nlri.L3vpnMcastNlriSerializer;
@@ -22,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.bgp.rib.rib.loc.rib.tables.routes.L3vpnMcastRoutesIpv6Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.bgp.rib.rib.loc.rib.tables.routes.L3vpnMcastRoutesIpv6CaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestination;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.routes.L3vpnMcastRoute;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.routes.ipv6.L3vpnMcastRoutesIpv6;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.routes.ipv6.L3vpnMcastRoutesIpv6Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationL3vpnMcastIpv6AdvertizedCase;
@@ -30,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vp
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.l3vpn.mcast.ipv6.advertized._case.DestinationIpv6L3vpnMcastBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationL3vpnMcastIpv6WithdrawnCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationL3vpnMcastIpv6WithdrawnCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -109,4 +113,14 @@ public final class L3VpnMcastIpv6RIBSupport
         return PathIdUtil.createNidKey(routeQName(), routeKeyQName(),
                 pathIdQName(), ByteArray.encodeBase64(buffer), maybePathIdLeaf);
     }
+
+    @Override
+    public List<L3vpnMcastRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast
+            .rev180417.bgp.rib.rib.peer.adj.rib.in.tables.routes.L3vpnMcastRoutesIpv6Case, "Unrecognized routes %s",
+            routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.L3vpnMcastRoutesIpv6Case) routes).getL3vpnMcastRoutesIpv6()
+                .nonnullL3vpnMcastRoute();
+    }
 }
index 8b97b7602a5c9c84a3f4644e0a43fcaed2731bfc..44b1daf96ad189bde567152304cac5821f7026b8 100644 (file)
@@ -187,12 +187,6 @@ public abstract class AbstractVpnRIBSupport<C extends Routes & DataObject, S ext
         return new VpnRouteKey(pathId, vpnRouteKey);
     }
 
-    @Override
-    public final List<VpnRoute> routesFromContainer(final S container) {
-        return container.getVpnRoute();
-    }
-
-
     @Override
     public PathId extractPathId(final VpnRouteKey routeListKey) {
         return routeListKey.getPathId();
index 25ff6525d3c502ef154503c830f765d1c95a811a..7477a28ab9c8510c3007c10685403157973e333a 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.l3vpn.unicast.ipv4;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
@@ -14,6 +16,7 @@ import org.opendaylight.protocol.bgp.l3vpn.unicast.AbstractVpnRIBSupport;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
 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.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.bgp.rib.rib.loc.rib.tables.routes.VpnIpv4RoutesCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.bgp.rib.rib.loc.rib.tables.routes.VpnIpv4RoutesCaseBuilder;
@@ -22,6 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.l3vpn.ipv4.routes.VpnIpv4Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.l3vpn.ipv4.routes.VpnIpv4RoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.rev180329.l3vpn.ip.destination.type.VpnDestination;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.rev180329.l3vpn.ip.route.VpnRoute;
 
 public final class VpnIpv4RIBSupport extends AbstractVpnRIBSupport<VpnIpv4RoutesCase, VpnIpv4Routes> {
     private static final VpnIpv4Routes EMPTY_CONTAINER
@@ -79,4 +83,13 @@ public final class VpnIpv4RIBSupport extends AbstractVpnRIBSupport<VpnIpv4Routes
     public VpnIpv4Routes emptyRoutesContainer() {
         return EMPTY_CONTAINER;
     }
+
+    @Override
+    public List<VpnRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv4RoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv4RoutesCase) routes).getVpnIpv4Routes()
+                .nonnullVpnRoute();
+    }
 }
index fe88aefe67d66e82d1ccb665c40b4e8be1be8d46..d69514694d979a9cc0e3c5854fa4ab054b6d6eb2 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.l3vpn.unicast.ipv6;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
@@ -14,6 +16,7 @@ import org.opendaylight.protocol.bgp.l3vpn.unicast.AbstractVpnRIBSupport;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
 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.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.bgp.rib.rib.loc.rib.tables.routes.VpnIpv6RoutesCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.bgp.rib.rib.loc.rib.tables.routes.VpnIpv6RoutesCaseBuilder;
@@ -22,6 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.l3vpn.ipv6.routes.VpnIpv6Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.l3vpn.ipv6.routes.VpnIpv6RoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.rev180329.l3vpn.ip.destination.type.VpnDestination;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.rev180329.l3vpn.ip.route.VpnRoute;
 
 public final class VpnIpv6RIBSupport extends AbstractVpnRIBSupport<VpnIpv6RoutesCase, VpnIpv6Routes> {
     private static final VpnIpv6Routes EMPTY_CONTAINER
@@ -79,4 +83,13 @@ public final class VpnIpv6RIBSupport extends AbstractVpnRIBSupport<VpnIpv6Routes
     public VpnIpv6Routes emptyRoutesContainer() {
         return EMPTY_CONTAINER;
     }
+
+    @Override
+    public List<VpnRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329
+            .bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv6RoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv6RoutesCase) routes).getVpnIpv6Routes()
+                .nonnullVpnRoute();
+    }
 }
index 457bdc42ae37d7bb468e547c9b8a4c9949ff8d88..847bf49290554e12fd4051046f446074eebe3481 100644 (file)
@@ -186,12 +186,6 @@ abstract class AbstractLabeledUnicastRIBSupport<
         return builder.withKey(key).setAttributes(attributes).build();
     }
 
-    @Override
-    public final List<LabeledUnicastRoute> routesFromContainer(final S container) {
-        return container.getLabeledUnicastRoute();
-    }
-
-
     @Override
     public final PathId extractPathId(final LabeledUnicastRouteKey routeListKey) {
         return routeListKey.getPathId();
index acc98b595099906be5237175020d0a905bcd6432..433e859c98ee77b56393bda31fc2515dacf04ffd 100644 (file)
@@ -7,8 +7,11 @@
  */
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
@@ -16,10 +19,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labe
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.bgp.rib.rib.loc.rib.tables.routes.LabeledUnicastRoutesCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.routes.LabeledUnicastRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.routes.LabeledUnicastRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.routes.list.LabeledUnicastRoute;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.labeled.unicast._case.DestinationLabeledUnicast;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -86,4 +91,14 @@ public final class LabeledUnicastIpv4RIBSupport
     public LabeledUnicastRoutes emptyRoutesContainer() {
         return EMPTY_CONTAINER;
     }
+
+    @Override
+    public List<LabeledUnicastRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast
+            .rev180329.bgp.rib.rib.peer.adj.rib.in.tables.routes.LabeledUnicastRoutesCase, "Unrecognized routes %s",
+            routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.LabeledUnicastRoutesCase) routes).getLabeledUnicastRoutes()
+                .nonnullLabeledUnicastRoute();
+    }
 }
index 63efd9fd2f6fda6139cb44f211c5c89b54dc4345..ff3b5a76ffe8c3e70c227ce286486412c5dd8a4c 100644 (file)
@@ -8,8 +8,11 @@
 
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
+import static com.google.common.base.Verify.verify;
+
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
@@ -17,10 +20,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labe
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.bgp.rib.rib.loc.rib.tables.routes.LabeledUnicastIpv6RoutesCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.ipv6.routes.LabeledUnicastIpv6Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.ipv6.routes.LabeledUnicastIpv6RoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.routes.list.LabeledUnicastRoute;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicast;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
@@ -87,4 +92,14 @@ final class LabeledUnicastIpv6RIBSupport
     public LabeledUnicastIpv6Routes emptyRoutesContainer() {
         return EMPTY_CONTAINER;
     }
+
+    @Override
+    public List<LabeledUnicastRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast
+            .rev180329.bgp.rib.rib.peer.adj.rib.in.tables.routes.LabeledUnicastIpv6RoutesCase, "Unrecognized routes %s",
+            routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.LabeledUnicastIpv6RoutesCase) routes)
+                .getLabeledUnicastIpv6Routes().nonnullLabeledUnicastRoute();
+    }
 }
index 41c611cf11c690327cfdfdff405fa0b71ffc5abc..71bf22c3058b532f7790fc2843ea9ca4aeeb4600 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.linkstate.impl;
 
+import static com.google.common.base.Verify.verify;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
@@ -38,6 +40,7 @@ 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.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -173,11 +176,6 @@ public final class LinkstateRIBSupport
         return new LinkstateRouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<LinkstateRoute> routesFromContainer(final LinkstateRoutes container) {
-        return container.getLinkstateRoute();
-    }
-
     @Override
     public PathId extractPathId(final LinkstateRouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -187,4 +185,13 @@ public final class LinkstateRIBSupport
     public String extractRouteKey(final LinkstateRouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<LinkstateRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate
+            .rev180329.bgp.rib.rib.peer.adj.rib.in.tables.routes.LinkstateRoutesCase, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.LinkstateRoutesCase) routes).getLinkstateRoutes()
+                .nonnullLinkstateRoute();
+    }
 }
index 8ed3a84caa89371ed92daf486e7e3f6573428fc6..e9060805ec7dd214129dd6b7da52accff26ac0cc 100644 (file)
@@ -103,11 +103,6 @@ abstract class AbstractMvpnRIBSupport<C extends Routes & DataObject & ChoiceIn<T
         return new MvpnRouteKey(pathId, routeKey);
     }
 
-    @Override
-    public final List<MvpnRoute> routesFromContainer(final S container) {
-        return container.getMvpnRoute();
-    }
-
     final MvpnChoice extractMvpnChoice(final DataContainerNode<? extends PathArgument> route) {
         final DataObject nn = this.mappingService.fromNormalizedNode(this.routeDefaultYii, route).getValue();
         return ((MvpnRoute) nn).getMvpnChoice();
index 538e50df492074f0d5d5a6352cb9760708a26681..7e681ef76d856e1211a96927a89821b52515da32 100644 (file)
@@ -5,9 +5,10 @@
  * 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.mvpn.impl;
 
+import static com.google.common.base.Verify.verify;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
@@ -30,6 +31,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv4.advertized._case.DestinationMvpn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv4.advertized._case.DestinationMvpnBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationMvpnIpv4WithdrawnCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.mvpn.routes.MvpnRoute;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -114,4 +117,13 @@ final class MvpnIpv4RIBSupport extends AbstractMvpnRIBSupport<MvpnRoutesIpv4Case
         return PathIdUtil.createNidKey(routeQName(), routeKeyQName(),
                 pathIdQName(), ByteArray.encodeBase64(buffer), maybePathIdLeaf);
     }
+
+    @Override
+    public List<MvpnRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4
+            .rev180417.bgp.rib.rib.peer.adj.rib.in.tables.routes.MvpnRoutesIpv4Case, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.MvpnRoutesIpv4Case) routes).getMvpnRoutesIpv4()
+                .nonnullMvpnRoute();
+    }
 }
index e7766a319c782a9df2b25ee5faf3be76c7ae34de..32bee63b3a4447575589a7fad44735cf850dd564 100644 (file)
@@ -5,9 +5,10 @@
  * 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.mvpn.impl;
 
+import static com.google.common.base.Verify.verify;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
@@ -30,6 +31,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv6.advertized._case.DestinationMvpn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv6.advertized._case.DestinationMvpnBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationMvpnIpv6WithdrawnCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.mvpn.routes.MvpnRoute;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -115,4 +118,13 @@ final class MvpnIpv6RIBSupport extends AbstractMvpnRIBSupport<MvpnRoutesIpv6Case
         return PathIdUtil.createNidKey(routeQName(), routeKeyQName(),
                 pathIdQName(), ByteArray.encodeBase64(buffer), maybePathIdLeaf);
     }
+
+    @Override
+    public List<MvpnRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6
+            .rev180417.bgp.rib.rib.peer.adj.rib.in.tables.routes.MvpnRoutesIpv6Case, "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.MvpnRoutesIpv6Case) routes).getMvpnRoutesIpv6()
+                .nonnullMvpnRoute();
+    }
 }
index d432f3a74d8306e94f2fde7c2b52e5fde4e503b1..f0b1deab7cafc57c4aa11a0ab0a6983543a5a781 100644 (file)
@@ -5,9 +5,10 @@
  * 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.route.targetcontrain.impl;
 
+import static com.google.common.base.Verify.verify;
+
 import com.google.common.collect.ImmutableCollection;
 import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
@@ -28,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.RouteTargetConstrainSubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.bgp.rib.rib.loc.rib.tables.routes.RouteTargetConstrainRoutesCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.bgp.rib.rib.loc.rib.tables.routes.RouteTargetConstrainRoutesCaseBuilder;
@@ -219,11 +221,6 @@ public final class RouteTargetConstrainRIBSupport
         return new RouteTargetConstrainRouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<RouteTargetConstrainRoute> routesFromContainer(final RouteTargetConstrainRoutes container) {
-        return container.getRouteTargetConstrainRoute();
-    }
-
     @Override
     public PathId extractPathId(final RouteTargetConstrainRouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -233,4 +230,14 @@ public final class RouteTargetConstrainRIBSupport
     public String extractRouteKey(final RouteTargetConstrainRouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<RouteTargetConstrainRoute> extractAdjRibInRoutes(Routes routes) {
+        verify(routes instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target
+            .constrain.rev180618.bgp.rib.rib.peer.adj.rib.in.tables.routes.RouteTargetConstrainRoutesCase,
+            "Unrecognized routes %s", routes);
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618
+                .bgp.rib.rib.peer.adj.rib.in.tables.routes.RouteTargetConstrainRoutesCase) routes)
+                .getRouteTargetConstrainRoutes().nonnullRouteTargetConstrainRoute();
+    }
 }
index 95c40129dcf41dbba6c97c40e0c65db90ff9e34e..68c8c453a452042135268ea65f61a3e50c723b12 100644 (file)
@@ -353,48 +353,70 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
 
     private <R extends Route> void deleteRoutes(final InstanceIdentifier<R> routeIID,
             final R route, final WriteTransaction tx) {
-        final Optional<RouteTarget> rtMembership = RouteTargetMembeshipUtil.getRT(route);
-        if (rtMembership.isPresent()) {
-            if (PeerRole.Ebgp != this.peerImportParameters.getFromPeerRole()) {
-                this.rtCache.uncacheRoute(route);
-            }
-            this.rtMemberships.remove(rtMembership.get());
-            this.rtMembershipsUpdated = true;
-        }
+        deleteRT(route);
         tx.delete(LogicalDatastoreType.OPERATIONAL, routeIID);
     }
 
-    @SuppressWarnings("unchecked")
-    private void writeTable(final WriteTransaction tx, final DataObjectModification<Tables> table) {
+    private <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
+            R extends Route & ChildOf<? super S> & Identifiable<I>, I extends Identifier<R>> void writeTable(
+                    final WriteTransaction tx, final DataObjectModification<Tables> table) {
+
         final Tables newTable = table.getDataAfter();
         if (newTable == null) {
+            final Tables oldTable = table.getDataBefore();
+            if (oldTable != null) {
+                final TablesKey tableKey = oldTable.key();
+                final KeyedInstanceIdentifier<Tables, TablesKey> tablePath = tablePath(tableKey);
+                LOG.trace("Delete table at {}", tablePath);
+                tx.delete(LogicalDatastoreType.OPERATIONAL, tablePath);
+
+                final RIBSupport<C, S, R, I> ribSupport = this.registry.getRIBSupport(tableKey);
+                if (ribSupport != null) {
+                    final Routes oldRoutes = oldTable.getRoutes();
+                    if (oldRoutes != null) {
+                        for (R route : ribSupport.extractAdjRibInRoutes(oldRoutes)) {
+                            deleteRT(route);
+                        }
+                    }
+                }
+            }
             return;
         }
+
         final TablesKey tableKey = newTable.key();
-        final KeyedInstanceIdentifier<Tables, TablesKey> tablePath
-                = this.effRibTables.child(Tables.class, tableKey);
+        final KeyedInstanceIdentifier<Tables, TablesKey> tablePath = tablePath(tableKey);
 
         // Create an empty table
         LOG.trace("Create Empty table at {}", tablePath);
-        if (table.getDataBefore() == null) {
-            tx.put(LogicalDatastoreType.OPERATIONAL, tablePath, new TablesBuilder()
-                    .withKey(tableKey).setAfi(tableKey.getAfi()).setSafi(tableKey.getSafi())
-                    .setAttributes(newTable.getAttributes()).build());
-        }
+        tx.put(LogicalDatastoreType.OPERATIONAL, tablePath, new TablesBuilder()
+            .withKey(tableKey).setAfi(tableKey.getAfi()).setSafi(tableKey.getSafi())
+            .setAttributes(newTable.getAttributes()).build());
 
-        final RIBSupport ribSupport = this.registry.getRIBSupport(tableKey);
-        final Routes routes = newTable.getRoutes();
-        if (ribSupport == null || routes == null) {
+        final RIBSupport<C, S, R, I> ribSupport = this.registry.getRIBSupport(tableKey);
+        if (ribSupport == null) {
+            LOG.trace("No RIB support for {}", tableKey);
             return;
         }
 
-        final DataObjectModification routesChangesContainer =
-                table.getModifiedChildContainer(ribSupport.routesCaseClass(), ribSupport.routesContainerClass());
+        writeTableRoutes(tx, tableKey, ribSupport, tablePath, newTable);
+    }
 
-        if (routesChangesContainer == null) {
-            return;
+    private <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
+            R extends Route & ChildOf<? super S> & Identifiable<I>, I extends Identifier<R>> void writeTableRoutes(
+                    final WriteTransaction tx, final TablesKey tableKey, final RIBSupport<C, S, R, I> ribSupport,
+                    final KeyedInstanceIdentifier<Tables, TablesKey> tablePath, final Tables newTable) {
+        final Routes routes = newTable.getRoutes();
+        if (routes != null) {
+            final Class<? extends AfiSafiType> afiSafiType = tableTypeRegistry.getAfiSafiType(ribSupport.getTablesKey())
+                    .get();
+            for (R route : ribSupport.extractAdjRibInRoutes(routes)) {
+                writeRoutes(tx, tableKey, afiSafiType, ribSupport, tablePath, route.key(), route, false);
+            }
         }
-        updateRoutes(tx, tableKey, ribSupport, tablePath, routesChangesContainer.getModifiedChildren());
+    }
+
+    private KeyedInstanceIdentifier<Tables, TablesKey> tablePath(TablesKey tableKey) {
+        return this.effRibTables.child(Tables.class, tableKey);
     }
 
     @Override
@@ -450,4 +472,15 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
     public long getTotalPrefixesInstalled() {
         return this.prefixesInstalled.values().stream().mapToLong(LongAdder::longValue).sum();
     }
+
+    private void deleteRT(final Route route) {
+        final Optional<RouteTarget> rtMembership = RouteTargetMembeshipUtil.getRT(route);
+        if (rtMembership.isPresent()) {
+            if (PeerRole.Ebgp != this.peerImportParameters.getFromPeerRole()) {
+                this.rtCache.uncacheRoute(route);
+            }
+            this.rtMemberships.remove(rtMembership.get());
+            this.rtMembershipsUpdated = true;
+        }
+    }
 }
index 40a89873270c11bce456f615188418ed12821f08..d38532bf9c6f99be2bb71572b365d2b81b06e762 100644 (file)
@@ -94,8 +94,6 @@ public interface RIBSupport<
     @Nonnull
     Class<R> routesListClass();
 
-    @Nullable List<R> routesFromContainer(@Nonnull S container);
-
     @Nonnull
     default ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
         return ImmutableSet.of();
@@ -317,4 +315,13 @@ public interface RIBSupport<
      */
     @Nonnull
     String extractRouteKey(@Nonnull I routeListKey);
+
+    /**
+     * Extract a route list from the adj-rib-in instantiation of table routes.
+     *
+     * @param routes Table route choice
+     * @return A potentially empty list of routes
+     */
+    @Nonnull
+    List<R> extractAdjRibInRoutes(Routes routes);
 }
index 3c76f8a72a538f74815914865973df599cb5decf..ca0a49f217af729bd11aed5d09671a6b983f0e34 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSeriali
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.Ipv4Prefixes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCaseBuilder;
@@ -84,11 +85,6 @@ public final class RIBSupportTestImp extends AbstractRIBSupport<Ipv4RoutesCase,
         return new Ipv4RouteKey(pathId, routeKey);
     }
 
-    @Override
-    public List<Ipv4Route> routesFromContainer(final Ipv4Routes container) {
-        return container.getIpv4Route();
-    }
-
     @Override
     public PathId extractPathId(final Ipv4RouteKey routeListKey) {
         return routeListKey.getPathId();
@@ -98,4 +94,10 @@ public final class RIBSupportTestImp extends AbstractRIBSupport<Ipv4RoutesCase,
     public String extractRouteKey(final Ipv4RouteKey routeListKey) {
         return routeListKey.getRouteKey();
     }
+
+    @Override
+    public List<Ipv4Route> extractAdjRibInRoutes(Routes routes) {
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.test.rev180515.bgp.rib.rib.peer
+                .adj.rib.in.tables.routes.Ipv4RoutesCase) routes).getIpv4Routes().nonnullIpv4Route();
+    }
 }
\ No newline at end of file