@Test public void findSxpNodesOnVirtualIp() throws Exception { final Collection<SxpNode> sxpNodes = Lists.newArrayList(createSxpNode("5.6.7.8"), createSxpNode(DUMMY_ADDRESS_IPV4)); final IpAddress virtualIp = IpAddressBuilder.getDefaultInstance(DUMMY_ADDRESS_IPV4); final Collection<SxpNode> actual = RouteUtil.findSxpNodesOnVirtualIp(virtualIp, sxpNodes); Assert.assertEquals(1, actual.size()); Assert.assertEquals("node-name-1.2.3.4", actual.iterator().next().getName()); }
public static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp, final Collection<SxpNode> sxpNodes) { final Collection<SxpNode> affectedNodes; if (Objects.isNull(virtualIp)) { affectedNodes = Collections.emptyList(); } else { affectedNodes = sxpNodes.stream() .filter(node -> Objects.nonNull(node) && Objects.nonNull(node.getSourceIp()) && addressToString(virtualIp).equals(node.getSourceIp().getHostAddress())) .collect(Collectors.toList()); } return affectedNodes; }
RouteUtil { public static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp, final Collection<SxpNode> sxpNodes) { final Collection<SxpNode> affectedNodes; if (Objects.isNull(virtualIp)) { affectedNodes = Collections.emptyList(); } else { affectedNodes = sxpNodes.stream() .filter(node -> Objects.nonNull(node) && Objects.nonNull(node.getSourceIp()) && addressToString(virtualIp).equals(node.getSourceIp().getHostAddress())) .collect(Collectors.toList()); } return affectedNodes; } }
RouteUtil { public static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp, final Collection<SxpNode> sxpNodes) { final Collection<SxpNode> affectedNodes; if (Objects.isNull(virtualIp)) { affectedNodes = Collections.emptyList(); } else { affectedNodes = sxpNodes.stream() .filter(node -> Objects.nonNull(node) && Objects.nonNull(node.getSourceIp()) && addressToString(virtualIp).equals(node.getSourceIp().getHostAddress())) .collect(Collectors.toList()); } return affectedNodes; }  }
RouteUtil { public static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp, final Collection<SxpNode> sxpNodes) { final Collection<SxpNode> affectedNodes; if (Objects.isNull(virtualIp)) { affectedNodes = Collections.emptyList(); } else { affectedNodes = sxpNodes.stream() .filter(node -> Objects.nonNull(node) && Objects.nonNull(node.getSourceIp()) && addressToString(virtualIp).equals(node.getSourceIp().getHostAddress())) .collect(Collectors.toList()); } return affectedNodes; }  static String addressToString(IpAddress address); static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp,
            final Collection<SxpNode> sxpNodes); static RoutingDefinition createOperationalRouteDefinition(
            @Nonnull final RoutingDefinition originalDefinition, final boolean consistent, final String info); static RoutingDefinition extractRoutingDefinition(final Routing existingRouting); }
RouteUtil { public static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp, final Collection<SxpNode> sxpNodes) { final Collection<SxpNode> affectedNodes; if (Objects.isNull(virtualIp)) { affectedNodes = Collections.emptyList(); } else { affectedNodes = sxpNodes.stream() .filter(node -> Objects.nonNull(node) && Objects.nonNull(node.getSourceIp()) && addressToString(virtualIp).equals(node.getSourceIp().getHostAddress())) .collect(Collectors.toList()); } return affectedNodes; }  static String addressToString(IpAddress address); static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp,
            final Collection<SxpNode> sxpNodes); static RoutingDefinition createOperationalRouteDefinition(
            @Nonnull final RoutingDefinition originalDefinition, final boolean consistent, final String info); static RoutingDefinition extractRoutingDefinition(final Routing existingRouting);  }