X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=bgp%2Frib-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fspi%2FAbstractAdjRIBs.java;h=8e2002c41cff575e0dcf767654485408b3e7ccab;hb=3c135df98a164d4207775de96a5217a392d1949e;hp=9cc2728179cb2ccc31038b5ae58335fcecc3c263;hpb=139f912b0fa4885db7c2d47b18a00141be5eceb3;p=bgpcep.git diff --git a/bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractAdjRIBs.java b/bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractAdjRIBs.java index 9cc2728179..8e2002c41c 100644 --- a/bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractAdjRIBs.java +++ b/bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractAdjRIBs.java @@ -7,8 +7,8 @@ */ package org.opendaylight.protocol.bgp.rib.spi; -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; import com.google.common.base.Preconditions; import java.util.HashMap; import java.util.Iterator; @@ -18,17 +18,17 @@ import javax.annotation.Nullable; import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.ThreadSafe; import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathAttributes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.UpdateBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.PathAttributesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.AttributesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.PathAttributes1; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.PathAttributes1Builder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.PathAttributes2; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.PathAttributes2Builder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.path.attributes.MpReachNlriBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.path.attributes.MpUnreachNlriBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlriBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlriBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey; @@ -39,18 +39,19 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@Deprecated @ThreadSafe public abstract class AbstractAdjRIBs & Route, K extends Identifier> implements AdjRIBsIn, RouteEncoder { protected abstract static class RIBEntryData & Route, K extends Identifier> { - private final PathAttributes attributes; + private final Attributes attributes; private final Peer peer; - protected RIBEntryData(final Peer peer, final PathAttributes attributes) { + protected RIBEntryData(final Peer peer, final Attributes attributes) { this.attributes = Preconditions.checkNotNull(attributes); this.peer = Preconditions.checkNotNull(peer); } - public PathAttributes getPathAttributes() { + public Attributes getAttributes() { return this.attributes; } @@ -69,7 +70,7 @@ public abstract class AbstractAdjRIBs & Route, K ex @Override public final String toString() { - return addToStringAttributes(Objects.toStringHelper(this)).toString(); + return addToStringAttributes(MoreObjects.toStringHelper(this)).toString(); } protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) { @@ -91,8 +92,8 @@ public abstract class AbstractAdjRIBs & Route, K ex protected AbstractAdjRIBs(final KeyedInstanceIdentifier basePath) { this.basePath = Preconditions.checkNotNull(basePath); this.tableType = new BgpTableTypeImpl(basePath.getKey().getAfi(), basePath.getKey().getSafi()); - this.eor = new UpdateBuilder().setPathAttributes(new PathAttributesBuilder().addAugmentation( - PathAttributes1.class, new PathAttributes1Builder().setMpReachNlri(new MpReachNlriBuilder(this.tableType) + this.eor = new UpdateBuilder().setAttributes(new AttributesBuilder().addAugmentation( + Attributes1.class, new Attributes1Builder().setMpReachNlri(new MpReachNlriBuilder(this.tableType) .build()).build()).build()).build(); } @@ -139,7 +140,7 @@ public abstract class AbstractAdjRIBs & Route, K ex * @return Base path. */ protected final KeyedInstanceIdentifier getBasePath() { - return basePath; + return this.basePath; } /** @@ -158,7 +159,7 @@ public abstract class AbstractAdjRIBs & Route, K ex /** * Transform a withdrawn identifier into a the corresponding NLRI in MP_UNREACH attribute. - * + * @param builder MpUnreachNlriBuilder * @param id Route key */ protected abstract void addWithdrawal(MpUnreachNlriBuilder builder, I id); @@ -179,7 +180,7 @@ public abstract class AbstractAdjRIBs & Route, K ex public abstract I keyForIdentifier(KeyedInstanceIdentifier id); /** - * Common backend for {@link AdjRIBsIn#addRoutes()} implementations. + * Common backend for {@link AdjRIBsIn#addRoutes(AdjRIBsTransaction, Peer, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlri, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.Attributes)} implementations. * If a new route is added, check first for its existence in Map of entries. * If the route is already there, change it's state. Then check for peer in * Map of peers, if it's not there, add it. @@ -206,7 +207,7 @@ public abstract class AbstractAdjRIBs & Route, K ex } /** - * Common backend for {@link AdjRIBsIn#removeRoutes()} implementations. + * Common backend for {@link AdjRIBsIn#removeRoutes(AdjRIBsTransaction, Peer, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlri)} implementations. * * @param trans Transaction context * @param peer Originating peer @@ -234,21 +235,21 @@ public abstract class AbstractAdjRIBs & Route, K ex @Override public Update updateMessageFor(final Object key, final Route route) { final UpdateBuilder ub = new UpdateBuilder(); - final PathAttributesBuilder pab = new PathAttributesBuilder(); + final AttributesBuilder pab = new AttributesBuilder(); if (route != null) { final MpReachNlriBuilder reach = new MpReachNlriBuilder(this.tableType); addAdvertisement(reach, (D)route); pab.fieldsFrom(route.getAttributes()); - pab.addAugmentation(PathAttributes1.class, new PathAttributes1Builder().setMpReachNlri(reach.build()).build()).build(); + pab.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(reach.build()).build()).build(); } else { final MpUnreachNlriBuilder unreach = new MpUnreachNlriBuilder(this.tableType); addWithdrawal(unreach, (I)key); - pab.addAugmentation(PathAttributes2.class, new PathAttributes2Builder().setMpUnreachNlri(unreach.build()).build()).build(); + pab.addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(unreach.build()).build()).build(); } - ub.setPathAttributes(pab.build()); + ub.setAttributes(pab.build()); return ub.build(); }