/** * Creates {@link ColumnMetadata}s that the answer should have based on the {@code * propertySpecifier}. * * @param propertySpecifier {@link BgpProcessPropertySpecifier} that describes the set of * properties * @return The {@link List} of {@link ColumnMetadata}s */ public static List<ColumnMetadata> createColumnMetadata( BgpProcessPropertySpecifier propertySpecifier) { return ImmutableList.<ColumnMetadata>builder() .add(new ColumnMetadata(COL_NODE, Schema.NODE, "Node", true, false)) .add(new ColumnMetadata(COL_VRF, Schema.STRING, "VRF", true, false)) .add(new ColumnMetadata(COL_ROUTER_ID, Schema.IP, "Router ID", true, false)) .addAll( propertySpecifier.getMatchingProperties().stream() .map( prop -> new ColumnMetadata( getColumnName(prop), BgpProcessPropertySpecifier.JAVA_MAP.get(prop).getSchema(), "Property " + prop, false, true)) .collect(Collectors.toList())) .build(); }
String.format("A Batfish %s must be a JSON string", expectedType.getName())); new BgpProcessPropertySpecifier(value.textValue()); break; case BGP_SESSION_STATUS:
suggestions = BgpProcessPropertySpecifier.autoComplete(query); break;
@Test public void testIsRouteReflector() { BgpProcess emptyProcess = new BgpProcess(); assertFalse("no rr clients", isRouteReflector(emptyProcess)); assertTrue("has active rr client", isRouteReflector(hasActiveNeighbor)); assertTrue("has passive rr client", isRouteReflector(hasPassiveNeighbor)); hasNeighborMix.setPassiveNeighbors( ImmutableSortedMap.of(p30a, passivePeerWithoutRRC, p30b, passivePeerWithRRC)); assertTrue("has mix of active and inactive rr client", isRouteReflector(hasNeighborMix)); hasAllInactive.setNeighbors(ImmutableSortedMap.of(p32a, activePeerWithoutRRC)); hasAllInactive.setPassiveNeighbors(ImmutableSortedMap.of(p30a, passivePeerWithoutRRC)); assertFalse("has multiple inactive rr clients", isRouteReflector(hasAllInactive));
null, new BgpProcessPropertySpecifier(property1 + "|" + property2));
.put(COL_ROUTER_ID, bgpProcess.getRouterId()); for (String property : propertySpecifier.getMatchingProperties()) { PropertyDescriptor<BgpProcess> propertyDescriptor = BgpProcessPropertySpecifier.JAVA_MAP.get(property);