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 {
- private static final EvpnRibSupport RIB_SUPPORT = EvpnRibSupport.getInstance();
+public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoute> {
+ private EvpnRibSupport ribSupport;
private static final EvpnRoute ROUTE;
private static final EvpnRouteKey ROUTE_KEY;
private static final EvpnDestination EVPN_DESTINATION = new EvpnDestinationBuilder()
@Override
public void setUp() throws Exception {
super.setUp();
- setUpTestCustomizer(RIB_SUPPORT);
+ this.ribSupport = EvpnRibSupport.getInstance(this.mappingService);
+ setUpTestCustomizer(this.ribSupport);
}
@Test
public void testDeleteRoutes() {
- RIB_SUPPORT.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
- @SuppressWarnings("unchecked") final InstanceIdentifier<EvpnRoute> instanceIdentifier =
- (InstanceIdentifier<EvpnRoute>) this.deletedRoutes.get(0);
+ this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+ final InstanceIdentifier<EvpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(EvpnRoute.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 EvpnRoute route = (EvpnRoute) this.insertedRoutes.get(0).getValue();
assertEquals(ROUTE, route);
}
public void testEmptyRoute() {
final Routes empty = new EvpnRoutesCaseBuilder().setEvpnRoutes(
new EvpnRoutesBuilder().setEvpnRoute(Collections.emptyList()).build()).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(EVPN_ROUTES), ATTRIBUTES);
+ final Update update = this.ribSupport.buildUpdate(Collections.emptyList(),
+ createRoutes(EVPN_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(EVPN_ROUTES), Collections.emptyList(), ATTRIBUTES);
+ final Update update = this.ribSupport.buildUpdate(
+ createRoutes(EVPN_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(), RIB_SUPPORT.cacheableNlriObjects());
+ assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
}
@Test
public void testCacheableAttributeObjects() {
- assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
+ assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
}
@Test
public void testRouteIdAddPath() {
- assertEquals(ROUTE_KEY, RIB_SUPPORT.createRouteListKey(ROUTE_KEY.getPathId().getValue(),
+ assertEquals(ROUTE_KEY, this.ribSupport.createRouteListKey(ROUTE_KEY.getPathId().getValue(),
ROUTE_KEY.getRouteKey()));
}
public void testRoutePath() {
final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(EVPN_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(EvpnRoutes.QNAME,
- Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT.routeAttributesIdentifier());
+ Attributes.QNAME.getLocalName().intern())), this.ribSupport.routeAttributesIdentifier());
}
@Test
public void testRoutesCaseClass() {
- assertEquals(EvpnRoutesCase.class, RIB_SUPPORT.routesCaseClass());
+ assertEquals(EvpnRoutesCase.class, this.ribSupport.routesCaseClass());
}
@Test
public void testRoutesContainerClass() {
- assertEquals(EvpnRoutes.class, RIB_SUPPORT.routesContainerClass());
+ assertEquals(EvpnRoutes.class, this.ribSupport.routesContainerClass());
}
@Test
public void testRoutesListClass() {
- assertEquals(EvpnRoute.class, RIB_SUPPORT.routesListClass());
+ assertEquals(EvpnRoute.class, this.ribSupport.routesListClass());
}
@Test
final Routes emptyCase = new EvpnRoutesCaseBuilder().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 EvpnRoutesCaseBuilder().setEvpnRoutes(new EvpnRoutesBuilder().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 EvpnRoutesCaseBuilder().setEvpnRoutes(EVPN_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());
}
}
\ No newline at end of file