BGPCEP-781: Provide Add Path support for all AFI/SAFI
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / LocRibWriter.java
index ce3c7b9c8068142577b89e472dac8af3dd24979c..13246d3b3f359a5a63c94eef83e1f7f2266dd327 100644 (file)
@@ -32,9 +32,11 @@ import org.opendaylight.protocol.bgp.rib.impl.state.rib.TotalPathsCounter;
 import org.opendaylight.protocol.bgp.rib.impl.state.rib.TotalPrefixesCounter;
 import org.opendaylight.protocol.bgp.rib.spi.BGPPeerTracker;
 import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
+import org.opendaylight.protocol.bgp.rib.spi.RibSupportUtils;
 import org.opendaylight.protocol.bgp.rib.spi.RouterIds;
 import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathIdGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey;
@@ -250,12 +252,13 @@ final class LocRibWriter implements AutoCloseable, TotalPrefixesCounter, TotalPa
                 if (entry == null) {
                     entry = createEntry(routeKey);
                 }
-                final long pathId = this.ribSupport.extractPathId(newRoute);
+
+                final long pathId = ((PathIdGrouping) newRoute).getPathId().getValue();
                 entry.addRoute(routerId, pathId, newRoute);
                 this.totalPathsCounter.increment();
             } else if (oldRoute != null && entry != null) {
                 this.totalPathsCounter.decrement();
-                final long pathId = this.ribSupport.extractPathId(oldRoute);
+                final long pathId = ((PathIdGrouping) oldRoute).getPathId().getValue();
                 if (entry.removeRoute(routerId, pathId)) {
                     this.routeEntries.remove(routeKey);
                     this.totalPrefixesCounter.decrement();