@Test public void testpopulateRouteRowAttributes() { RouteRowAttribute routeRowAttribute = RouteRowAttribute.builder() .setNextHopInterface("nhIface1") .setNextHop("nh1") .setMetric(1L) .setAdminDistance(1) .setTag(1L) .build(); Row.RowBuilder rowBuilder = Row.builder(); populateRouteAttributes(rowBuilder, routeRowAttribute, true); assertThat( rowBuilder.build(), equalTo( Row.builder() .put(COL_BASE_PREFIX + COL_NEXT_HOP_INTERFACE, "nhIface1") .put(COL_BASE_PREFIX + COL_NEXT_HOP, "nh1") .put(COL_BASE_PREFIX + COL_METRIC, 1L) .put(COL_BASE_PREFIX + COL_ADMIN_DISTANCE, 1) .put(COL_BASE_PREFIX + COL_TAG, 1L) .build())); }
static void populateRouteAttributes( RowBuilder rowBuilder, @Nullable RouteRowAttribute routeRowAttribute, boolean base) { rowBuilder .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP, routeRowAttribute != null ? routeRowAttribute.getNextHop() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP_INTERFACE, routeRowAttribute != null ? routeRowAttribute.getNextHopInterface() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_METRIC, routeRowAttribute != null ? routeRowAttribute.getMetric() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_ADMIN_DISTANCE, routeRowAttribute != null ? routeRowAttribute.getAdminDistance() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_TAG, routeRowAttribute != null ? routeRowAttribute.getTag() : null); }
RoutesAnswererUtil { static void populateRouteAttributes( RowBuilder rowBuilder, @Nullable RouteRowAttribute routeRowAttribute, boolean base) { rowBuilder .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP, routeRowAttribute != null ? routeRowAttribute.getNextHop() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP_INTERFACE, routeRowAttribute != null ? routeRowAttribute.getNextHopInterface() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_METRIC, routeRowAttribute != null ? routeRowAttribute.getMetric() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_ADMIN_DISTANCE, routeRowAttribute != null ? routeRowAttribute.getAdminDistance() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_TAG, routeRowAttribute != null ? routeRowAttribute.getTag() : null); } }
RoutesAnswererUtil { static void populateRouteAttributes( RowBuilder rowBuilder, @Nullable RouteRowAttribute routeRowAttribute, boolean base) { rowBuilder .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP, routeRowAttribute != null ? routeRowAttribute.getNextHop() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP_INTERFACE, routeRowAttribute != null ? routeRowAttribute.getNextHopInterface() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_METRIC, routeRowAttribute != null ? routeRowAttribute.getMetric() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_ADMIN_DISTANCE, routeRowAttribute != null ? routeRowAttribute.getAdminDistance() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_TAG, routeRowAttribute != null ? routeRowAttribute.getTag() : null); }  }
RoutesAnswererUtil { static void populateRouteAttributes( RowBuilder rowBuilder, @Nullable RouteRowAttribute routeRowAttribute, boolean base) { rowBuilder .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP, routeRowAttribute != null ? routeRowAttribute.getNextHop() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP_INTERFACE, routeRowAttribute != null ? routeRowAttribute.getNextHopInterface() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_METRIC, routeRowAttribute != null ? routeRowAttribute.getMetric() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_ADMIN_DISTANCE, routeRowAttribute != null ? routeRowAttribute.getAdminDistance() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_TAG, routeRowAttribute != null ? routeRowAttribute.getTag() : null); }  static Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> groupRoutes(
          SortedMap<String, SortedMap<String, GenericRib<T>>> ribs,
          Set<String> matchingNodes,
          @Nullable Prefix network,
          String vrfRegex,
          RoutingProtocolSpecifier protocolSpec,
          @Nullable Map<Ip, Set<String>> ipOwners); static List<DiffRoutesOutput> getRoutesDiff(
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInBase,
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInRef); }
RoutesAnswererUtil { static void populateRouteAttributes( RowBuilder rowBuilder, @Nullable RouteRowAttribute routeRowAttribute, boolean base) { rowBuilder .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP, routeRowAttribute != null ? routeRowAttribute.getNextHop() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_NEXT_HOP_INTERFACE, routeRowAttribute != null ? routeRowAttribute.getNextHopInterface() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_METRIC, routeRowAttribute != null ? routeRowAttribute.getMetric() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_ADMIN_DISTANCE, routeRowAttribute != null ? routeRowAttribute.getAdminDistance() : null) .put( (base ? COL_BASE_PREFIX : COL_DELTA_PREFIX) + COL_TAG, routeRowAttribute != null ? routeRowAttribute.getTag() : null); }  static Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> groupRoutes(
          SortedMap<String, SortedMap<String, GenericRib<T>>> ribs,
          Set<String> matchingNodes,
          @Nullable Prefix network,
          String vrfRegex,
          RoutingProtocolSpecifier protocolSpec,
          @Nullable Map<Ip, Set<String>> ipOwners); static List<DiffRoutesOutput> getRoutesDiff(
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInBase,
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInRef);  }