@Test public void testGenerateRow() { String node = "n"; int vni = 100001; Layer3VniConfig vniConfig = Layer3VniConfig.builder() .setVni(vni) .setVrf("vrf") .setRouteDistinguisher(RouteDistinguisher.from(Ip.ZERO, 2)) .setRouteTarget(ExtendedCommunity.target(65500, vni)) .setImportRouteTarget(ExtendedCommunity.target(65500, vni).matchString()) .setAdvertiseV4Unicast(false) .build(); Map<String, ColumnMetadata> columnMap = createTableMetadata(new EvpnL3VniPropertiesQuestion(null)).toColumnMap(); assertThat( generateRow(vniConfig, node, columnMap), equalTo( Row.builder(columnMap) .put(COL_NODE, node) .put(COL_VRF, vniConfig.getVrf()) .put(COL_VNI, vniConfig.getVni()) .put(COL_EXPORT_ROUTE_TARGET, vniConfig.getRouteTarget().matchString()) .put(COL_IMPORT_ROUTE_TARGET, vniConfig.getImportRouteTarget()) .put(COL_ROUTE_DISTINGUISHER, vniConfig.getRouteDistinguisher()) .build())); }
@VisibleForTesting @Nonnull static Row generateRow( Layer3VniConfig vniConfig, String nodeName, Map<String, ColumnMetadata> columns) { return Row.builder(columns) .put(COL_NODE, nodeName) .put(COL_VRF, vniConfig.getVrf()) .put(COL_VNI, vniConfig.getVni()) .put(COL_EXPORT_ROUTE_TARGET, vniConfig.getRouteTarget().matchString()) .put(COL_IMPORT_ROUTE_TARGET, vniConfig.getImportRouteTarget()) .put(COL_ROUTE_DISTINGUISHER, vniConfig.getRouteDistinguisher()) .build(); }
EvpnL3VniPropertiesAnswerer extends Answerer { @VisibleForTesting @Nonnull static Row generateRow( Layer3VniConfig vniConfig, String nodeName, Map<String, ColumnMetadata> columns) { return Row.builder(columns) .put(COL_NODE, nodeName) .put(COL_VRF, vniConfig.getVrf()) .put(COL_VNI, vniConfig.getVni()) .put(COL_EXPORT_ROUTE_TARGET, vniConfig.getRouteTarget().matchString()) .put(COL_IMPORT_ROUTE_TARGET, vniConfig.getImportRouteTarget()) .put(COL_ROUTE_DISTINGUISHER, vniConfig.getRouteDistinguisher()) .build(); } }
EvpnL3VniPropertiesAnswerer extends Answerer { @VisibleForTesting @Nonnull static Row generateRow( Layer3VniConfig vniConfig, String nodeName, Map<String, ColumnMetadata> columns) { return Row.builder(columns) .put(COL_NODE, nodeName) .put(COL_VRF, vniConfig.getVrf()) .put(COL_VNI, vniConfig.getVni()) .put(COL_EXPORT_ROUTE_TARGET, vniConfig.getRouteTarget().matchString()) .put(COL_IMPORT_ROUTE_TARGET, vniConfig.getImportRouteTarget()) .put(COL_ROUTE_DISTINGUISHER, vniConfig.getRouteDistinguisher()) .build(); } EvpnL3VniPropertiesAnswerer(EvpnL3VniPropertiesQuestion question, IBatfish batfish); }
EvpnL3VniPropertiesAnswerer extends Answerer { @VisibleForTesting @Nonnull static Row generateRow( Layer3VniConfig vniConfig, String nodeName, Map<String, ColumnMetadata> columns) { return Row.builder(columns) .put(COL_NODE, nodeName) .put(COL_VRF, vniConfig.getVrf()) .put(COL_VNI, vniConfig.getVni()) .put(COL_EXPORT_ROUTE_TARGET, vniConfig.getRouteTarget().matchString()) .put(COL_IMPORT_ROUTE_TARGET, vniConfig.getImportRouteTarget()) .put(COL_ROUTE_DISTINGUISHER, vniConfig.getRouteDistinguisher()) .build(); } EvpnL3VniPropertiesAnswerer(EvpnL3VniPropertiesQuestion question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot); @Nonnull static Set<Row> getRows(
      Set<String> nodes, NetworkConfigurations nc, Map<String, ColumnMetadata> columns); }
EvpnL3VniPropertiesAnswerer extends Answerer { @VisibleForTesting @Nonnull static Row generateRow( Layer3VniConfig vniConfig, String nodeName, Map<String, ColumnMetadata> columns) { return Row.builder(columns) .put(COL_NODE, nodeName) .put(COL_VRF, vniConfig.getVrf()) .put(COL_VNI, vniConfig.getVni()) .put(COL_EXPORT_ROUTE_TARGET, vniConfig.getRouteTarget().matchString()) .put(COL_IMPORT_ROUTE_TARGET, vniConfig.getImportRouteTarget()) .put(COL_ROUTE_DISTINGUISHER, vniConfig.getRouteDistinguisher()) .build(); } EvpnL3VniPropertiesAnswerer(EvpnL3VniPropertiesQuestion question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot); @Nonnull static Set<Row> getRows(
      Set<String> nodes, NetworkConfigurations nc, Map<String, ColumnMetadata> columns); static final String COL_NODE; static final String COL_VRF; static final String COL_VNI; static final String COL_ROUTE_DISTINGUISHER; static final String COL_IMPORT_ROUTE_TARGET; static final String COL_EXPORT_ROUTE_TARGET; static final List<ColumnMetadata> COLUMN_METADATA; }