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

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

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

origin: batfish/batfish

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

private @Nonnull Multiset<Row> getRows(String property) {
 InterfacePropertySpecifier propertySpecifier = new InterfacePropertySpecifier(property);
 return InterfacePropertiesAnswerer.getProperties(
   propertySpecifier,
   ImmutableMap.of(HOSTNAME, _c),
   ImmutableSet.of(HOSTNAME),
   new InterfacesSpecifier(INTERFACE_NAME),
   new TableMetadata(
       InterfacePropertiesAnswerer.createColumnMetadata(propertySpecifier), (String) null)
     .toColumnMap());
}
origin: batfish/batfish

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

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

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

    .put(COL_INTERFACE, new NodeInterfacePair(nodeName, iface.getName()));
for (String property : propertySpecifier.getMatchingProperties()) {
 PropertyDescriptor<Interface> propertyDescriptor =
   InterfacePropertySpecifier.JAVA_MAP.get(property);
origin: batfish/batfish

 @Test
 public void testMatchingPropertiesSet() {
  Iterator<String> i = InterfacePropertySpecifier.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 InterfacePropertySpecifier(firstTwoProperties).getMatchingProperties(), hasSize(2));

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

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

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

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

@Test
public void getPropertiesExcludeShutInterfaces() {
 Configuration conf = new Configuration("node", ConfigurationFormat.CISCO_IOS);
 Interface active = Interface.builder().setName("active").setOwner(conf).setActive(true).build();
 Interface shut = Interface.builder().setName("shut").setOwner(conf).setActive(false).build();
 conf.getAllInterfaces().putAll(ImmutableMap.of("active", active, "shut", shut));
 String property = InterfacePropertySpecifier.DESCRIPTION;
 InterfacePropertySpecifier propertySpecifier = new InterfacePropertySpecifier(property);
 Multiset<Row> propertyRows =
   InterfacePropertiesAnswerer.getProperties(
     propertySpecifier,
     ImmutableMap.of("node", conf),
     ImmutableSet.of("node"),
     InterfacesSpecifier.ALL,
     true,
     new TableMetadata(
         InterfacePropertiesAnswerer.createColumnMetadata(propertySpecifier),
         (String) null)
       .toColumnMap());
 // we should have exactly one row; iface1 should have been filtered out
 assertThat(propertyRows, hasSize(1));
 assertThat(
   propertyRows.iterator().next(),
   hasColumn(
     InterfacePropertiesAnswerer.COL_INTERFACE,
     equalTo(new NodeInterfacePair("node", "active")),
     Schema.INTERFACE));
}
origin: batfish/batfish

String property2 = InterfacePropertySpecifier.ACTIVE;
InterfacePropertySpecifier propertySpecifier =
  new InterfacePropertySpecifier(property1 + "|" + property2);
org.batfish.datamodel.questionsInterfacePropertySpecifier

Javadoc

Enables specification a set of interface properties.

Currently supported example specifiers:

  • channel-group -> gets the interface's channel groups using a configured Java function
  • channel.* gets all properties that start with 'channel'

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, based on PropertySpecifier#baseAutoComplete.

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • onRequestPermissionsResult (Fragment)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JFileChooser (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • 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