This should be properly parameterized.
Change-Id: Ie4a366d7f2f23b89ddffe37aa84da5503cd0d89d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
private final ChannelOutputLimiter session;
private final Codecs codecs;
- private final RIBSupport support;
+ private final RIBSupport<?, ?, ?, ?> support;
private final boolean mpSupport;
private final ListenerRegistration<AdjRibOutListener> registerDataTreeChangeListener;
private final LongAdder prefixesSentCounter = new LongAdder();
private AdjRibOutListener(final PeerId peerId, final TablesKey tablesKey, final YangInstanceIdentifier ribId,
- final CodecsRegistry registry, final RIBSupport support, final DOMDataTreeChangeService service,
+ final CodecsRegistry registry, final RIBSupport<?, ?, ?, ?> support, final DOMDataTreeChangeService service,
final ChannelOutputLimiter session, final boolean mpSupport) {
this.session = requireNonNull(session);
this.support = requireNonNull(support);
@Nonnull final TablesKey tablesKey,
@Nonnull final YangInstanceIdentifier ribId,
@Nonnull final CodecsRegistry registry,
- @Nonnull final RIBSupport support,
+ @Nonnull final RIBSupport<?, ?, ?, ?> support,
@Nonnull final DOMDataTreeChangeService service,
@Nonnull final ChannelOutputLimiter session,
final boolean mpSupport) {
private synchronized void createAdjRibOutListener(final TablesKey key,
final boolean mpSupport) {
- final RIBSupport ribSupport = this.rib.getRibSupportContext().getRIBSupport(key);
+ final RIBSupport<?, ?, ?, ?> ribSupport = this.rib.getRibSupportContext().getRIBSupport(key);
// not particularly nice
if (ribSupport != null && this.session instanceof BGPSessionImpl) {
private BindingNormalizedNodeCachingCodec<MpReachNlri> reachNlriCodec;
private BindingNormalizedNodeCachingCodec<MpUnreachNlri> unreachNlriCodec;
- private final RIBSupport ribSupport;
+ private final RIBSupport<?, ?, ?, ?> ribSupport;
- public CodecsImpl(final RIBSupport ribSupport) {
+ public CodecsImpl(final RIBSupport<?, ?, ?, ?> ribSupport) {
this.ribSupport = requireNonNull(ribSupport);
final Builder<Class<? extends DataObject>> acb = ImmutableSet.builder();
acb.addAll(ATTRIBUTE_CACHEABLES);
private static final Logger LOG = LoggerFactory.getLogger(CodecsRegistryImpl.class);
- private final LoadingCache<RIBSupport, Codecs> contexts = CacheBuilder.newBuilder()
- .build(new CacheLoader<RIBSupport, Codecs>(){
+ private final LoadingCache<RIBSupport<?, ?, ?, ?>, Codecs> contexts = CacheBuilder.newBuilder()
+ .build(new CacheLoader<RIBSupport<?, ?, ?, ?>, Codecs>(){
@Override
- public Codecs load(final RIBSupport key) {
+ public Codecs load(final RIBSupport<?, ?, ?, ?> key) {
return createContext(key);
}
});
return new CodecsRegistryImpl(codecFactory, classStrategy);
}
- private Codecs createContext(final RIBSupport ribSupport) {
+ private Codecs createContext(final RIBSupport<?, ?, ?, ?> ribSupport) {
final Codecs codecs = new CodecsImpl(ribSupport);
if (this.latestCodecTree != null) {
// FIXME: Do we need to recalculate latestCodecTree? E.g. new rib support was added
}
@Override
- public Codecs getCodecs(final RIBSupport ribSupport) {
+ public Codecs getCodecs(final RIBSupport<?, ?, ?, ?> ribSupport) {
return this.contexts.getUnchecked(ribSupport);
}
}
@GuardedBy("this")
private ListenerRegistration<LocRibWriter> reg;
- private LocRibWriter(final RIBSupport ribSupport,
+ private LocRibWriter(final RIBSupport<?, ?, ?, ?> ribSupport,
final BindingTransactionChain chain,
final KeyedInstanceIdentifier<Rib, RibKey> ribIId,
final Long ourAs,
}
public static LocRibWriter create(
- @Nonnull final RIBSupport ribSupport,
+ @Nonnull final RIBSupport<?, ?, ?, ?> ribSupport,
@Nonnull final TablesKey tablesKey,
@Nonnull final Class<? extends AfiSafiType> afiSafiType,
@Nonnull final BindingTransactionChain chain,
updateRoutesEntries(routesChangesContainer.getModifiedChildren(), peerUuid, routes);
}
- @SuppressWarnings("unchecked")
private void updateRoutesEntries(
final Collection<DataObjectModification<? extends DataObject>> routeChanges,
final UnsignedInteger routerId,
}
private synchronized void createLocRibWriter(final TablesKey key) {
- final RIBSupport ribSupport = this.ribContextRegistry.getRIBSupport(key);
+ final RIBSupport<?, ?, ?, ?> ribSupport = this.ribContextRegistry.getRIBSupport(key);
if (ribSupport == null) {
return;
}
private static final ContainerNode EMPTY_TABLE_ATTRIBUTES = ImmutableNodes.containerNode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Attributes.QNAME);
- private final RIBSupport ribSupport;
+ private final RIBSupport<?, ?, ?, ?> ribSupport;
private final Codecs codecs;
- public RIBSupportContextImpl(final RIBSupport ribSupport, final CodecsRegistry codecs) {
+ public RIBSupportContextImpl(final RIBSupport<?, ?, ?, ?> ribSupport, final CodecsRegistry codecs) {
this.ribSupport = requireNonNull(ribSupport);
this.codecs = codecs.getCodecs(this.ribSupport);
}
import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.ChoiceIn;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
final class RIBSupportContextRegistryImpl implements RIBSupportContextRegistry {
private final RIBExtensionConsumerContext extensionContext;
private final CodecsRegistry codecs;
- private final LoadingCache<RIBSupport, RIBSupportContextImpl> contexts = CacheBuilder.newBuilder()
- .build(new CacheLoader<RIBSupport, RIBSupportContextImpl>() {
+ private final LoadingCache<RIBSupport<?, ?, ?, ?>, RIBSupportContextImpl> contexts = CacheBuilder.newBuilder()
+ .build(new CacheLoader<RIBSupport<?, ?, ?, ?>, RIBSupportContextImpl>() {
@Override
- public RIBSupportContextImpl load(final RIBSupport key) {
+ public RIBSupportContextImpl load(final RIBSupport<?, ?, ?, ?> key) {
return createRIBSupportContext(key);
}
});
return new RIBSupportContextRegistryImpl(extensions, codecs);
}
- private RIBSupportContextImpl createRIBSupportContext(final RIBSupport support) {
+ private RIBSupportContextImpl createRIBSupportContext(final RIBSupport<?, ?, ?, ?> support) {
return new RIBSupportContextImpl(support, this.codecs);
}
@Override
- public RIBSupport getRIBSupport(final TablesKey key) {
+ public <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
+ R extends Route & ChildOf<? super S> & Identifiable<I>, I extends Identifier<R>>
+ RIBSupport<C, S, R, I> getRIBSupport(final TablesKey key) {
final RIBSupportContext ribSupport = getRIBSupportContext(key);
if (ribSupport != null) {
return ribSupport.getRibSupport();
@Override
public RIBSupportContext getRIBSupportContext(final TablesKey key) {
- final RIBSupport ribSupport = this.extensionContext.getRIBSupport(key);
+ final RIBSupport<?, ?, ?, ?> ribSupport = this.extensionContext.getRIBSupport(key);
if (ribSupport != null) {
return this.contexts.getUnchecked(ribSupport);
}
import static java.util.Objects.requireNonNull;
-import javax.annotation.Nonnull;
import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
import org.opendaylight.protocol.bgp.rib.spi.entry.RouteEntryDependenciesContainer;
import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
public final class RouteEntryDependenciesContainerImpl implements RouteEntryDependenciesContainer {
- private final RIBSupport ribSupport;
+ private final RIBSupport<?, ?, ?, ?> ribSupport;
private final TablesKey tablesKey;
private final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget;
private final BGPRibRoutingPolicy routingPolicies;
private final Class<? extends AfiSafiType> afiSafiType;
public RouteEntryDependenciesContainerImpl(
- final RIBSupport ribSupport,
+ final RIBSupport<?, ?, ?, ?> ribSupport,
final BGPRibRoutingPolicy routingPolicies,
final TablesKey tablesKey,
final Class<? extends AfiSafiType> afiSafiType,
}
@Override
- public RIBSupport getRibSupport() {
+ public RIBSupport<?, ?, ?, ?> getRibSupport() {
return this.ribSupport;
}
* @param ribSupport associated with Codecs class
* @return Codecs
*/
- Codecs getCodecs(final RIBSupport ribSupport);
+ Codecs getCodecs(final RIBSupport<?, ?, ?, ?> ribSupport);
}
import javax.annotation.Nullable;
import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.ChoiceIn;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
public interface RIBSupportContextRegistry {
* not implemented.
*/
@Nullable
- RIBSupport getRIBSupport(TablesKey key);
+ <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
+ R extends Route & ChildOf<? super S> & Identifiable<I>,
+ I extends Identifier<R>> RIBSupport<C, S, R, I> getRIBSupport(TablesKey key);
/**
* Acquire a RIB Support Context for a AFI/SAFI combination.
private RIBImpl rib;
private BindingCodecTreeFactory codecFactory;
private RIBActivator a1;
- private RIBSupport ribSupport;
+ private RIBSupport<?, ?, ?, ?> ribSupport;
@Mock
private BGPDispatcher dispatcher;
return codec;
}
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
return this.domTransWrite;
}
+ @Override
@After
public void tearDown() {
this.a1.close();
@Mock
private ListenerRegistration<?> dataTreeRegistration;
@Mock
- private RIBSupport ribSupport;
+ private RIBSupport<?, ?, ?, ?> ribSupport;
@Mock
private ServiceRegistration<?> serviceRegistration;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-public abstract class AbstractRIBSupportRegistration<T extends RIBSupport>
+public abstract class AbstractRIBSupportRegistration<T extends RIBSupport<?, ?, ?, ?>>
extends AbstractObjectRegistration<T> implements RIBSupportRegistration<T> {
protected AbstractRIBSupportRegistration(final T instance) {
super(instance);
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+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.AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.ChoiceIn;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
/**
* @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
*/
@Nullable
- RIBSupport getRIBSupport(@Nonnull TablesKey key);
+ <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
+ R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> RIBSupport<C, S, R, I> getRIBSupport(
+ @Nonnull TablesKey key);
/**
* Acquire a RIB implementation factory for a AFI/SAFI combination.
* @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
*/
@Nullable
- RIBSupport getRIBSupport(@Nonnull Class<? extends AddressFamily> afi,
- @Nonnull Class<? extends SubsequentAddressFamily> safi);
+ <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
+ R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> RIBSupport<C, S, R, I> getRIBSupport(
+ @Nonnull Class<? extends AddressFamily> afi, @Nonnull Class<? extends SubsequentAddressFamily> safi);
/**
* Acquire a RIB implementation factory for a AFI/SAFI combination.
*
* @param key Tables key with AFI/SAFI
- * @return RIBSupport instance, or null if the AFI/SAFI is
- * not implemented.
+ * @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
*/
@Nullable
- RIBSupport getRIBSupport(@Nonnull NodeIdentifierWithPredicates key);
+ <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
+ R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> RIBSupport<C, S, R, I> getRIBSupport(
+ @Nonnull NodeIdentifierWithPredicates key);
/**
*/
@Nonnull
GeneratedClassLoadingStrategy getClassLoadingStrategy();
-}
\ No newline at end of file
+}
* @return Registration handle. Call {@link RIBSupportRegistration#close()} method to remove it.
* @throws NullPointerException if any of the arguments is null
*/
- <T extends RIBSupport> RIBSupportRegistration<T> registerRIBSupport(
+ <T extends RIBSupport<?, ?, ?, ?>> RIBSupportRegistration<T> registerRIBSupport(
@Nonnull Class<? extends AddressFamily> afi,
@Nonnull Class<? extends SubsequentAddressFamily> safi, T support);
}
*
* @param <T> {@link RIBSupport} type
*/
-public interface RIBSupportRegistration<T extends RIBSupport> extends ObjectRegistration<T> {
- @Override
- void close();
+public interface RIBSupportRegistration<T extends RIBSupport<?, ?, ?, ?>> extends ObjectRegistration<T> {
+
}
import java.util.concurrent.ConcurrentMap;
import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+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.AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.ChoiceIn;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
private static final Logger LOG = LoggerFactory.getLogger(SimpleRIBExtensionProviderContext.class);
- private final ConcurrentMap<TablesKey, RIBSupport> supports = new ConcurrentHashMap<>();
- private final ConcurrentMap<NodeIdentifierWithPredicates, RIBSupport> domSupports = new ConcurrentHashMap<>();
+ private final ConcurrentMap<TablesKey, RIBSupport<?, ?, ?, ?>> supports = new ConcurrentHashMap<>();
+ private final ConcurrentMap<NodeIdentifierWithPredicates, RIBSupport<?, ?, ?, ?>> domSupports =
+ new ConcurrentHashMap<>();
private final ModuleInfoBackedContext classLoadingStrategy = ModuleInfoBackedContext.create();
@Override
- public <T extends RIBSupport> RIBSupportRegistration<T> registerRIBSupport(final Class<? extends AddressFamily> afi,
- final Class<? extends SubsequentAddressFamily> safi, final T support) {
+ public <T extends RIBSupport<?, ?, ?, ?>> RIBSupportRegistration<T> registerRIBSupport(
+ final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi,
+ final T support) {
final TablesKey key = new TablesKey(afi, safi);
- final RIBSupport prev = this.supports.putIfAbsent(key, support);
+ final RIBSupport<?, ?, ?, ?> prev = this.supports.putIfAbsent(key, support);
Preconditions.checkArgument(prev == null, "AFI %s SAFI %s is already registered with %s",
afi, safi, prev);
this.domSupports.put(RibSupportUtils.toYangTablesKey(afi, safi), support);
};
}
- private void addClassLoadingSupport(final Class<?> afi, final Class<?> safi, final RIBSupport support) {
+ private void addClassLoadingSupport(final Class<?> afi, final Class<?> safi, final RIBSupport<?, ?, ?, ?> support) {
final Set<YangModuleInfo> moduleInfos = getModuleInfos(afi, safi, support.routesListClass(),
support.routesContainerClass(), support.routesCaseClass());
if (!moduleInfos.isEmpty()) {
}
@Override
- public RIBSupport getRIBSupport(final Class<? extends AddressFamily> afi,
- final Class<? extends SubsequentAddressFamily> safi) {
+ public <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
+ R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> RIBSupport<C, S, R, I> getRIBSupport(
+ final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
return getRIBSupport(new TablesKey(afi, safi));
}
@Override
- public RIBSupport getRIBSupport(final TablesKey key) {
- return this.supports.get(requireNonNull(key));
+ @SuppressWarnings("unchecked")
+ public <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
+ R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> RIBSupport<C, S, R, I> getRIBSupport(
+ final TablesKey key) {
+ return (RIBSupport<C, S, R, I>) this.supports.get(requireNonNull(key));
}
@Override
- public GeneratedClassLoadingStrategy getClassLoadingStrategy() {
- return this.classLoadingStrategy;
+ @SuppressWarnings("unchecked")
+ public <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
+ R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> RIBSupport<C, S, R, I> getRIBSupport(
+ final NodeIdentifierWithPredicates key) {
+ return (RIBSupport<C, S, R, I>) this.domSupports.get(key);
}
@Override
- @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
- public RIBSupport getRIBSupport(final NodeIdentifierWithPredicates key) {
- return this.domSupports.get(key);
+ public GeneratedClassLoadingStrategy getClassLoadingStrategy() {
+ return this.classLoadingStrategy;
}
}
import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.ChoiceIn;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
/**
* @return RIBSupport
*/
@Nonnull
- RIBSupport getRibSupport();
-
+ <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
+ R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>>
+ RIBSupport<C, S, R, I> getRibSupport();
/**
* Returns the table key(AFI/SAFI) corresponding to the Route Entry.
@Nonnull
Class<? extends AfiSafiType> getAfiSafType();
-
/**
* Returns the loc-rib table to be updated and to which corresponds this Route Entry.
*
private AbstractRIBSupport abstractRIBSupport;
private ModuleInfoBackedContext moduleInfoBackedContext;
- protected final void setUpTestCustomizer(final AbstractRIBSupport ribSupport) throws Exception {
+ protected final void setUpTestCustomizer(final AbstractRIBSupport<?, ?, ?, ?> ribSupport) throws Exception {
this.abstractRIBSupport = ribSupport;
this.moduleInfoBackedContext
.registerModuleInfo(BindingReflections.getModuleInfo(this.abstractRIBSupport.routesContainerClass()));
.getChild(new NodeIdentifier(BindingReflections.findQName(Routes.class))).get();
}
+ protected final Collection<MapEntryNode> createRoutes(final DataObject routes) {
+ Preconditions.checkArgument(routes.getImplementedInterface()
+ .equals(this.abstractRIBSupport.routesContainerClass()));
+ final InstanceIdentifier<DataObject> routesIId = routesIId();
+ final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNode = this.mappingService
+ .toNormalizedNode(routesIId, routes);
+ final ContainerNode container = (ContainerNode) normalizedNode.getValue();
+ final NodeIdentifier routeNid = new NodeIdentifier(getRouteListQname());
+ return ((MapNode) container.getChild(routeNid).get()).getValue();
+ }
+
private TablesKey getTablesKey() {
return new TablesKey(this.abstractRIBSupport.getAfi(), this.abstractRIBSupport.getSafi());
}
return this.mappingService.toYangInstanceIdentifier(routesIId).node(getRouteListQname());
}
- @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
- protected final Collection<MapEntryNode> createRoutes(final DataObject routes) {
- Preconditions.checkArgument(routes.getImplementedInterface()
- .equals(this.abstractRIBSupport.routesContainerClass()));
- final InstanceIdentifier<DataObject> routesIId = routesIId();
- final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNode = this.mappingService
- .toNormalizedNode(routesIId, routes);
- final ContainerNode container = (ContainerNode) normalizedNode.getValue();
- final NodeIdentifier routeNid = new NodeIdentifier(getRouteListQname());
- return ((MapNode) container.getChild(routeNid).get()).getValue();
- }
-
private QName getRouteListQname() {
return BindingReflections.findQName(this.abstractRIBSupport.routesListClass())
.withModule(BindingReflections.getQNameModule(this.abstractRIBSupport.routesCaseClass()));
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
public final class RIBSupportTestImp extends AbstractRIBSupport<Ipv4RoutesCase, Ipv4Routes, Ipv4Route, Ipv4RouteKey> {
private static final String ROUTE_KEY = "prefix";
}
@Override
- protected DestinationType buildDestination(final Collection routes) {
+ protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
return null;
}
@Override
- protected DestinationType buildWithdrawnDestination(final Collection routes) {
+ protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
return null;
}
protected List<AutoCloseable> startRIBExtensionProviderImpl(
final RIBExtensionProviderContext context,
final BindingNormalizedNodeSerializer mappingService) {
- final RIBSupport support = Mockito.mock(RIBSupport.class);
+ final RIBSupport<?, ?, ?, ?> support = Mockito.mock(RIBSupport.class);
Mockito.doReturn(Route.class).when(support).routesListClass();
Mockito.doReturn(DataObject.class).when(support).routesContainerClass();
Mockito.doReturn(DataObject.class).when(support).routesCaseClass();