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 {
- private static final IPv6RIBSupport RIB_SUPPORT = IPv6RIBSupport.getInstance();
+public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6Route> {
+ private IPv6RIBSupport ribSupport;
private static final PathId PATH_ID = new PathId(1L);
private static final Ipv6Prefix PREFIX = new Ipv6Prefix("2001:db8:1:2::/64");
private static final Ipv6RouteKey ROUTE_KEY = new Ipv6RouteKey(PATH_ID, PREFIX.getValue());
@Override
public void setUp() throws Exception {
super.setUp();
- setUpTestCustomizer(RIB_SUPPORT);
+ this.ribSupport = IPv6RIBSupport.getInstance(this.mappingService);
+ setUpTestCustomizer(this.ribSupport);
}
@Test
public void testDeleteRoutes() {
- RIB_SUPPORT.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
- @SuppressWarnings("unchecked") final InstanceIdentifier<Ipv6Route> instanceIdentifier =
- (InstanceIdentifier<Ipv6Route>) this.deletedRoutes.get(0);
+ this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+ final InstanceIdentifier<Ipv6Route> instanceIdentifier =
+ this.deletedRoutes.get(0);
assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(Ipv6Route.class));
}
@Test
public void testPutRoutes() {
- RIB_SUPPORT.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+ this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
final Ipv6Route route = (Ipv6Route) this.insertedRoutes.get(0).getValue();
assertEquals(ROUTE, route);
}
@Test
public void testEmptyRoute() {
final Routes empty = new Ipv6RoutesCaseBuilder().setIpv6Routes(EMPTY_ROUTES).build();
- final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
+ final ChoiceNode emptyRoutes = this.ribSupport.emptyRoutes();
assertEquals(createRoutes(empty), emptyRoutes);
}
@Test
public void testBuildMpUnreachNlriUpdate() {
- final Update update = RIB_SUPPORT.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+ final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
assertNull(update.getAttributes().getAugmentation(Attributes1.class));
@Test
public void testBuildMpReachNlriUpdate() {
- final Update update = RIB_SUPPORT.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+ final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class)
.getMpReachNlri().getAdvertizedRoutes().getDestinationType());
assertNull(update.getAttributes().getAugmentation(Attributes2.class));
@Test
public void testCacheableNlriObjects() {
assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet
- .rev180329.Ipv6Prefix.class), RIB_SUPPORT.cacheableNlriObjects());
+ .rev180329.Ipv6Prefix.class), this.ribSupport.cacheableNlriObjects());
}
@Test
public void testCacheableAttributeObjects() {
- assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
+ assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
}
@Test
public void testRouteIdAddPath() {
final Ipv6RouteKey expected = new Ipv6RouteKey(new PathId(1L), PREFIX.getValue());
- assertEquals(expected, RIB_SUPPORT.createRouteListKey(expected.getPathId().getValue(), PREFIX.getValue()));
+ assertEquals(expected, this.ribSupport.createRouteListKey(expected.getPathId().getValue(), PREFIX.getValue()));
}
@Test
public void testRoutePath() {
final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
assertEquals(getRoutePath().node(prefixNii),
- RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
+ this.ribSupport.routePath(getTablePath().node(Routes.QNAME), prefixNii));
}
@Test
public void testRouteAttributesIdentifier() {
assertEquals(new NodeIdentifier(QName.create(Ipv6Routes.QNAME,
- Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT.routeAttributesIdentifier());
+ Attributes.QNAME.getLocalName().intern())), this.ribSupport.routeAttributesIdentifier());
}
@Test
public void testRoutesCaseClass() {
- assertEquals(Ipv6RoutesCase.class, RIB_SUPPORT.routesCaseClass());
+ assertEquals(Ipv6RoutesCase.class, this.ribSupport.routesCaseClass());
}
@Test
public void testRoutesContainerClass() {
- assertEquals(Ipv6Routes.class, RIB_SUPPORT.routesContainerClass());
+ assertEquals(Ipv6Routes.class, this.ribSupport.routesContainerClass());
}
@Test
public void testRoutesListClass() {
- assertEquals(Ipv6Route.class, RIB_SUPPORT.routesListClass());
+ assertEquals(Ipv6Route.class, this.ribSupport.routesListClass());
}
@Test
final Routes emptyCase = new Ipv6RoutesCaseBuilder().build();
DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
createRoutes(emptyCase)).getRootNode();
- Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
+ Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
final Routes emptyRoutes = new Ipv6RoutesCaseBuilder().setIpv6Routes(new Ipv6RoutesBuilder().build()).build();
tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
- Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
+ Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
final Routes routes = new Ipv6RoutesCaseBuilder().setIpv6Routes(ROUTES).build();
tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
- final Collection<DataTreeCandidateNode> result = RIB_SUPPORT.changedRoutes(tree);
+ final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
}