Merge ActualBestPathRoutes and AdvertizedRoute
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / entry / AdvertizedRoute.java
index ce612515f3eb1d9a04ffa0b770b905d1f5009806..71489d5a6eb50ceea6b4d2b712318ebeb798ceea 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.protocol.bgp.rib.spi.entry;
 
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
-
 import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
 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.PeerId;
@@ -28,62 +26,22 @@ import org.opendaylight.yangtools.yang.binding.Identifier;
  * @author Claudio D. Gasparini
  */
 public final class AdvertizedRoute<C extends Routes & DataObject & ChoiceIn<Tables>,
-        S extends ChildOf<? super C>,
-        R extends Route & ChildOf<? super S> & Identifiable<I>,
-        I extends Identifier<R>> implements RouteKeyIdentifier<R,I> {
-    private final R route;
-    private final PeerId peerId;
-    private final Attributes attributes;
+        S extends ChildOf<? super C>, R extends Route & ChildOf<? super S> & Identifiable<I>,
+        I extends Identifier<R>> extends AbstractAdvertizedRoute<C, S, R, I> {
     private final boolean isFirstBestPath;
-    private final I nonAddPathRouteKeyIdentifier;
-    private final I addPathRouteKeyIdentifier;
 
-    public AdvertizedRoute(
-            final RIBSupport<C, S, R, I> ribSupport,
-            final R route,
-            final Attributes attributes,
-            final PeerId peerId) {
-        this(ribSupport, true, route, attributes, peerId);
+    public AdvertizedRoute(final RIBSupport<C, S, R, I> ribSupport, final R route, final Attributes attributes,
+            final PeerId fromPeerId) {
+        this(ribSupport, true, route, attributes, fromPeerId);
     }
 
-    public AdvertizedRoute(
-            final RIBSupport<C, S, R, I> ribSupport,
-            final boolean isFirstBestPath,
-            final R route,
-            final Attributes attributes,
-            final PeerId peerId) {
+    public AdvertizedRoute(final RIBSupport<C, S, R, I> ribSupport, final boolean isFirstBestPath,
+            final R route, final Attributes attributes, final PeerId fromPeerId) {
+        super(ribSupport, route, fromPeerId, attributes);
         this.isFirstBestPath = isFirstBestPath;
-        this.route = route;
-        this.peerId = peerId;
-        this.attributes = attributes;
-        this.nonAddPathRouteKeyIdentifier
-                = ribSupport.createRouteListKey(NON_PATH_ID_VALUE, route.getRouteKey());
-        this.addPathRouteKeyIdentifier
-                = ribSupport.createRouteListKey(route.getPathId().getValue(), route.getRouteKey());
-
-    }
-
-    public R getRoute() {
-        return this.route;
-    }
-
-    public PeerId getFromPeerId() {
-        return this.peerId;
-    }
-
-    public Attributes getAttributes() {
-        return this.attributes;
     }
 
     public boolean isFirstBestPath() {
         return this.isFirstBestPath;
     }
-
-    public I getNonAddPathRouteKeyIdentifier() {
-        return this.nonAddPathRouteKeyIdentifier;
-    }
-
-    public I getAddPathRouteKeyIdentifier() {
-        return this.addPathRouteKeyIdentifier;
-    }
 }