Add generic arguments to bind types which the test needs.
Change-Id: Ie3c874dbcd30a8366ec342edb4e0ff24353e42cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoute> {
+public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesCase, EvpnRoutes, EvpnRoute,
+ EvpnRouteKey> {
private EvpnRibSupport ribSupport;
private static final EvpnRoute ROUTE;
private static final EvpnRouteKey ROUTE_KEY;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecRoute> {
+public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecRoutesCase, FlowspecRoutes,
+ FlowspecRoute, FlowspecRouteKey> {
private FlowspecIpv4RIBSupport ribSupport;
private FlowspecRoute route;
= Collections.singletonList(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
private static final DestinationFlowspec DEST_FLOW = new DestinationFlowspecBuilder()
.setFlowspec(FLOW_LIST).setPathId(PATH_ID).build();
- private static final DestinationFlowspecCase REACH_NLRI
+ private static final DestinationFlowspecCase REACH_NLRI
= new DestinationFlowspecCaseBuilder().setDestinationFlowspec(DEST_FLOW).build();
private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase UNREACH_NLRI
this.ribSupport = FlowspecIpv4RIBSupport.getInstance(fsContext, this.mappingService);
final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- fsContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ fsContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
@Test
public void testChangedRoutes() {
final Routes emptyCase = new FlowspecRoutesCaseBuilder().build();
- DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
+ DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
createRoutes(emptyCase)).getRootNode();
Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
- final Routes emptyRoutes
+ final Routes emptyRoutes
= new FlowspecRoutesCaseBuilder().setFlowspecRoutes(new FlowspecRoutesBuilder().build()).build();
tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecRoute> {
+public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecIpv6RoutesCase, FlowspecIpv6Routes,
+ FlowspecRoute, FlowspecRouteKey> {
private static final PathId PATH_ID = new PathId(1L);
private static final DestinationIpv6PrefixCase DEST_PREFIX = new DestinationIpv6PrefixCaseBuilder()
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecL3vpnRoute> {
+public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecL3vpnIpv4RoutesCase,
+ FlowspecL3vpnIpv4Routes, FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
private static final FlowspecL3vpnRoute ROUTE;
private static final FlowspecL3vpnRouteKey ROUTE_KEY;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecL3vpnRoute> {
+public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecL3vpnIpv6RoutesCase,
+ FlowspecL3vpnIpv6Routes, FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
private static final FlowspecL3vpnRoute ROUTE;
private static final FlowspecL3vpnRouteKey ROUTE_KEY;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4Route> {
+public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4RoutesCase, Ipv4Routes, Ipv4Route,
+ Ipv4RouteKey> {
private IPv4RIBSupport ribSupport;
private static final PathId PATH_ID = new PathId(1L);
private static final Ipv4Prefix PREFIX = new Ipv4Prefix("1.2.3.4/32");
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6Route> {
+public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6RoutesCase, Ipv6Routes, Ipv6Route,
+ Ipv6RouteKey> {
private IPv6RIBSupport ribSupport;
private static final PathId PATH_ID = new PathId(1L);
private static final Ipv6Prefix PREFIX = new Ipv6Prefix("2001:db8:1:2::/64");
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnRoute> {
+public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnIpv4RoutesCase, VpnIpv4Routes, VpnRoute,
+ VpnRouteKey> {
private VpnIpv4RIBSupport ribSupport;
private static final DestinationVpnIpv4Case REACH_NLRI = new DestinationVpnIpv4CaseBuilder().setVpnIpv4Destination(
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest<VpnRoute> {
+public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest<VpnIpv6RoutesCase, VpnIpv6Routes, VpnRoute,
+ VpnRouteKey> {
private VpnIpv6RIBSupport ribSupport;
private static final DestinationVpnIpv6Case REACH_NLRI = new DestinationVpnIpv6CaseBuilder()
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastRoute> {
+public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastRoutesCase,
+ LabeledUnicastRoutes, LabeledUnicastRoute, LabeledUnicastRouteKey> {
private static final IpPrefix IPv4_PREFIX = new IpPrefix(new Ipv4Prefix("34.1.22.0/24"));
private static final LabeledUnicastRoute ROUTE;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastRoute> {
+public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastIpv6RoutesCase,
+ LabeledUnicastIpv6Routes, LabeledUnicastRoute, LabeledUnicastRouteKey> {
private static final IpPrefix IPv6_PREFIX = new IpPrefix(new Ipv6Prefix("102:304:500::/40"));
private static final LabeledUnicastRoute ROUTE;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<LinkstateRoute> {
+public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<LinkstateRoutesCase, LinkstateRoutes,
+ LinkstateRoute, LinkstateRouteKey> {
private LinkstateRIBSupport ribSupport;
private static final LinkstateRoute ROUTE;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoute> {
+public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv4Case, MvpnRoutesIpv4, MvpnRoute,
+ MvpnRouteKey> {
private static final PathId PATH_ID = new PathId(0L);
private static final MvpnChoice MVPN = new InterAsIPmsiADCaseBuilder().setInterAsIPmsiAD(
new InterAsIPmsiADBuilder()
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
-public final class MvpnIpv6RIBSupportTest extends AbstractRIBSupportTest<MvpnRoute> {
+public final class MvpnIpv6RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv6Case, MvpnRoutesIpv6, MvpnRoute,
+ MvpnRouteKey> {
private static final PathId PATH_ID = new PathId(0L);
private static final MvpnChoice MVPN = new InterAsIPmsiADCaseBuilder().setInterAsIPmsiAD(
new InterAsIPmsiADBuilder()
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesBuilder;
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.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public abstract class AbstractRIBSupportTest<R extends Route> extends AbstractConcurrentDataBrokerTest {
+public abstract class AbstractRIBSupportTest<C extends Routes & DataObject & ChoiceIn<Tables>,
+ S extends ChildOf<? super C>,
+ R extends Route & ChildOf<? super S> & Identifiable<I>,
+ I extends Identifier<R>> extends AbstractConcurrentDataBrokerTest {
protected static final PathId PATH_ID = new PathId(1L);
protected static final Attributes ATTRIBUTES = new AttributesBuilder().build();
private static final InstanceIdentifier<LocRib> RIB = InstanceIdentifier.builder(BgpRib.class)
protected List<Map.Entry<InstanceIdentifier<?>, DataObject>> insertedRoutes;
protected BindingNormalizedNodeSerializer mappingService;
- private AbstractRIBSupport abstractRIBSupport;
+ private AbstractRIBSupport<C, S, R, I> abstractRIBSupport;
private ModuleInfoBackedContext moduleInfoBackedContext;
- protected final void setUpTestCustomizer(final AbstractRIBSupport<?, ?, ?, ?> ribSupport) throws Exception {
+ protected final void setUpTestCustomizer(final AbstractRIBSupport<C, S, R, I> 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) {
+ protected final Collection<MapEntryNode> createRoutes(final S routes) {
Preconditions.checkArgument(routes.getImplementedInterface()
.equals(this.abstractRIBSupport.routesContainerClass()));
- final InstanceIdentifier<DataObject> routesIId = routesIId();
+ final InstanceIdentifier<S> routesIId = routesIId();
final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNode = this.mappingService
.toNormalizedNode(routesIId, routes);
final ContainerNode container = (ContainerNode) normalizedNode.getValue();
return RIB.child(Tables.class, getTablesKey());
}
- private InstanceIdentifier<DataObject> routesIId() {
+ private InstanceIdentifier<S> routesIId() {
final InstanceIdentifier<Tables> tables = tablesIId();
- return tables.child(this.abstractRIBSupport.routesContainerClass());
+ return tables.child(this.abstractRIBSupport.routesCaseClass(), this.abstractRIBSupport.routesContainerClass());
}
protected final YangInstanceIdentifier getTablePath() {
}
protected final YangInstanceIdentifier getRoutePath() {
- final InstanceIdentifier<DataObject> routesIId = routesIId();
+ final InstanceIdentifier<S> routesIId = routesIId();
return this.mappingService.toYangInstanceIdentifier(routesIId).node(getRouteListQname());
}
.withModule(BindingReflections.getQNameModule(this.abstractRIBSupport.routesCaseClass()));
}
- protected final NodeIdentifierWithPredicates createRouteNIWP(final DataObject routes) {
+ protected final NodeIdentifierWithPredicates createRouteNIWP(final S routes) {
final Collection<MapEntryNode> map = createRoutes(routes);
return Iterables.getOnlyElement(map).getIdentifier();
}