Tabnine Logo
NodePropertySpecifier
Code IndexAdd Tabnine to your IDE (free)

How to use
NodePropertySpecifier
in
org.batfish.datamodel.questions

Best Java code snippets using org.batfish.datamodel.questions.NodePropertySpecifier (Showing top 8 results out of 315)

origin: batfish/batfish

@Test
public void getMatchingProperties() {
 // match everything
 assertThat(
   new NodePropertySpecifier(".*").getMatchingProperties().size(),
   equalTo(NodePropertySpecifier.JAVA_MAP.size()));
 // match the ntp properties
 assertThat(new NodePropertySpecifier("ntp.*").getMatchingProperties().size(), equalTo(2));
 // match nothing: ntp
 assertTrue(new NodePropertySpecifier("ntp").getMatchingProperties().isEmpty());
}
origin: batfish/batfish

 @Deprecated // backwards compatibility for older questions
 @JsonProperty("properties")
 void setProperties(List<String> properties) {
  _properties = new NodePropertySpecifier(StringUtils.join(properties, "|"));
 }
}
origin: batfish/batfish

/**
 * Creates {@link ColumnMetadata}s that the answer should have based on the {@code
 * propertySpecifier}.
 *
 * @param propertySpecifier The {@link NodePropertySpecifier} that describes the set of properties
 * @return The {@link List} of {@link ColumnMetadata}s
 */
public static List<ColumnMetadata> createColumnMetadata(NodePropertySpecifier propertySpecifier) {
 return new ImmutableList.Builder<ColumnMetadata>()
   .add(new ColumnMetadata(COL_NODE, Schema.NODE, "Node", true, false))
   .addAll(
     propertySpecifier.getMatchingProperties().stream()
       .map(
         prop ->
           new ColumnMetadata(
             getColumnName(prop),
             NodePropertySpecifier.JAVA_MAP.get(prop).getSchema(),
             "Property " + prop,
             false,
             true))
       .collect(Collectors.toList()))
   .build();
}
origin: batfish/batfish

suggestions = NodePropertySpecifier.autoComplete(query);
break;
origin: batfish/batfish

    String.format("A Batfish %s must be a JSON string", expectedType.getName()));
 new NodePropertySpecifier(value.textValue());
 break;
case NODE_ROLE_DIMENSION:
origin: batfish/batfish

/**
 * Gets properties of nodes.
 *
 * @param propertySpecifier Specifies which properties to get
 * @param configurations configuration to use in extractions
 * @param nodes the set of nodes to focus on
 * @param columns a map from column name to {@link ColumnMetadata}
 * @return A multiset of {@link Row}s where each row corresponds to a node and columns correspond
 *     to property values.
 */
public static Multiset<Row> getProperties(
  NodePropertySpecifier propertySpecifier,
  Map<String, Configuration> configurations,
  Set<String> nodes,
  Map<String, ColumnMetadata> columns) {
 Multiset<Row> rows = HashMultiset.create();
 for (String nodeName : nodes) {
  RowBuilder row = Row.builder(columns).put(COL_NODE, new Node(nodeName));
  for (String property : propertySpecifier.getMatchingProperties()) {
   PropertySpecifier.fillProperty(
     NodePropertySpecifier.JAVA_MAP.get(property),
     configurations.get(nodeName),
     property,
     row);
  }
  rows.add(row.build());
 }
 return rows;
}
origin: batfish/batfish

 @Test
 public void testMatchingPropertiesSet() {
  Iterator<String> i = NodePropertySpecifier.JAVA_MAP.keySet().iterator();
  String prop1 = i.next();
  String prop2 = i.next();
  Collection<String> firstTwoProperties = ImmutableList.of(prop1, prop2);

  // should match the two properties passed to constructor
  assertThat(new NodePropertySpecifier(firstTwoProperties).getMatchingProperties(), hasSize(2));

  Collection<String> longer = ImmutableList.of(prop1 + prop1);

  // should not match longer
  assertThat(new NodePropertySpecifier(longer).getMatchingProperties(), emptyIterable());

  Collection<String> shorter = ImmutableList.of(prop1.substring(0, 1));

  // should not match shorter
  assertThat(new NodePropertySpecifier(shorter).getMatchingProperties(), emptyIterable());
 }
}
origin: batfish/batfish

String property1 = NodePropertySpecifier.CONFIGURATION_FORMAT;
String property2 = NodePropertySpecifier.NTP_SERVERS;
NodePropertySpecifier propertySpec = new NodePropertySpecifier(property1 + "|" + property2);
org.batfish.datamodel.questionsNodePropertySpecifier

Javadoc

Enables specification a set of node properties.

Currently supported example specifier:

  • ntp-servers -> gets NTP servers using a configured Java function
  • ntp.* gets all properties that start with 'ntp'

In the future, we might add other specifier types, e.g., those based on Json Path

Most used methods

  • <init>
  • getMatchingProperties
  • autoComplete
    Returns a list of suggestions based on the query. The current implementation treats the query as a p

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now