import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
private static final Ipv4RouteKey ROUTE_KEY = new Ipv4RouteKey(PATH_ID, PREFIX);
private static final Ipv4Prefixes IPV4_PREFIXES = new Ipv4PrefixesBuilder().setPathId(PATH_ID)
.setPrefix(PREFIX).build();
- private static final DestinationIpv4Case REACH_NLRI = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
- .setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
+ private static final DestinationIpv4Case REACH_NLRI = new DestinationIpv4CaseBuilder()
+ .setDestinationIpv4(new DestinationIpv4Builder()
+ .setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
- .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case UNREACH_NLRI =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
- .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
- new DestinationIpv4Builder().setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case UNREACH_NLRI =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
+ .setDestinationIpv4(new DestinationIpv4Builder()
+ .setIpv4Prefixes(Collections.singletonList(IPV4_PREFIXES)).build()).build();
- private static final Ipv4Route ROUTE = new Ipv4RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID).setPrefix(PREFIX).build();
- private static final Ipv4Routes ROUTES = new Ipv4RoutesBuilder().setIpv4Route(Collections.singletonList(ROUTE)).build();
- private static final Ipv4Routes EMPTY_ROUTES = new Ipv4RoutesBuilder().setIpv4Route(Collections.emptyList()).build();
+ private static final Ipv4Route ROUTE = new Ipv4RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID)
+ .setPrefix(PREFIX).build();
+ private static final Ipv4Routes ROUTES = new Ipv4RoutesBuilder()
+ .setIpv4Route(Collections.singletonList(ROUTE)).build();
+ private static final Ipv4Routes EMPTY_ROUTES = new Ipv4RoutesBuilder()
+ .setIpv4Route(Collections.emptyList()).build();
@Override
public void setUp() throws Exception {
@Test
public void testDeleteRoutes() {
RIB_SUPPORT.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
- final InstanceIdentifier<Ipv4Route> instanceIdentifier = (InstanceIdentifier<Ipv4Route>) this.deletedRoutes.get(0);
+ @SuppressWarnings("unchecked") final InstanceIdentifier<Ipv4Route> instanceIdentifier =
+ (InstanceIdentifier<Ipv4Route>) this.deletedRoutes.get(0);
assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(Ipv4Route.class));
}
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = RIB_SUPPORT.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
+ 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);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes().getDestinationType());
+ assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ .getAdvertizedRoutes().getDestinationType());
assertNull(update.getAttributes().getAugmentation(Attributes2.class));
}
@Test
public void testCacheableNlriObjects() {
- Assert.assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Ipv4PrefixAndPathId.class), RIB_SUPPORT.cacheableNlriObjects());
+ assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ .message.rev171207.Ipv4PrefixAndPathId.class), RIB_SUPPORT.cacheableNlriObjects());
}
@Test
public void testCacheableAttributeObjects() {
- Assert.assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
+ assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
}
@Test
public void testRouteIdAddPath() {
final NodeIdentifierWithPredicates expected = createRouteNIWP(ROUTES);
- final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(), ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
- Assert.assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
+ final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(),
+ ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
+ assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
}
@Test
public void testRoutePath() {
final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
- Assert.assertEquals(getRoutePath().node(prefixNii), RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
+ assertEquals(getRoutePath().node(prefixNii), RIB_SUPPORT.routePath(getTablePath()
+ .node(Routes.QNAME), prefixNii));
}
@Test
public void testExtractPathId() {
final NormalizedNode<?, ?> route = Iterables.getOnlyElement(createRoutes(ROUTES));
- Assert.assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
+ assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
}
@Test
public void testRouteAttributesIdentifier() {
- Assert.assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT
- .routeAttributesIdentifier());
+ assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME.getLocalName().intern())),
+ RIB_SUPPORT.routeAttributesIdentifier());
}
@Test
public void testRoutesCaseClass() {
- Assert.assertEquals(Ipv4RoutesCase.class, RIB_SUPPORT.routesCaseClass());
+ assertEquals(Ipv4RoutesCase.class, RIB_SUPPORT.routesCaseClass());
}
@Test
public void testRoutesContainerClass() {
- Assert.assertEquals(Ipv4Routes.class, RIB_SUPPORT.routesContainerClass());
+ assertEquals(Ipv4Routes.class, RIB_SUPPORT.routesContainerClass());
}
@Test
public void testRoutesListClass() {
- Assert.assertEquals(Ipv4Route.class, RIB_SUPPORT.routesListClass());
+ assertEquals(Ipv4Route.class, RIB_SUPPORT.routesListClass());
}
@Test
public void testChangedRoutes() {
final Routes emptyCase = new Ipv4RoutesCaseBuilder().build();
- DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
+ DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
+ createRoutes(emptyCase)).getRootNode();
Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
final Routes emptyRoutes = new Ipv4RoutesCaseBuilder().setIpv4Routes(new Ipv4RoutesBuilder().build()).build();