use of org.batfish.main.Batfish in project batfish by batfish.
the class CiscoGrammarTest method testInterfaceNames.
@Test
public void testInterfaceNames() throws IOException {
String testrigName = "interface-names";
String iosHostname = "ios";
String i1Name = "Ethernet0/0";
List<String> configurationNames = ImmutableList.of(iosHostname);
Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText(TestrigText.builder().setConfigurationText(TESTRIGS_PREFIX + testrigName, configurationNames).build(), _folder);
Map<String, Configuration> configurations = batfish.loadConfigurations();
Interface i1 = configurations.get(iosHostname).getInterfaces().get(i1Name);
assertThat(i1, hasDeclaredNames("Ethernet0/0", "e0/0", "Eth0/0", "ether0/0-1"));
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class FlatJuniperGrammarTest method testAutonomousSystem.
@Test
public void testAutonomousSystem() throws IOException {
String testrigName = "autonomous-system";
String c1Name = "as1";
String c2Name = "as2";
String c3Name = "as3";
Prefix neighborPrefix = Prefix.parse("1.0.0.1/32");
List<String> configurationNames = ImmutableList.of(c1Name, c2Name, c3Name);
Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText(TestrigText.builder().setConfigurationText(TESTRIGS_PREFIX + testrigName, configurationNames).build(), _folder);
Map<String, Configuration> configurations = batfish.loadConfigurations();
Configuration c1 = configurations.get(c1Name);
Configuration c2 = configurations.get(c2Name);
Configuration c3 = configurations.get(c3Name);
assertThat(c1, hasDefaultVrf(hasBgpProcess(hasNeighbor(neighborPrefix, hasLocalAs(1)))));
assertThat(c2, hasDefaultVrf(hasBgpProcess(hasNeighbor(neighborPrefix, hasLocalAs(1)))));
assertThat(c3, hasDefaultVrf(hasBgpProcess(hasNeighbor(neighborPrefix, hasLocalAs(1)))));
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class FlatJuniperGrammarTest method testBgpMultipathMultipleAs.
@Test
public void testBgpMultipathMultipleAs() throws IOException {
String testrigName = "multipath-multiple-as";
List<String> configurationNames = ImmutableList.of("multiple_as_disabled", "multiple_as_enabled", "multiple_as_mixed");
Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText(TestrigText.builder().setConfigurationText(TESTRIGS_PREFIX + testrigName, configurationNames).build(), _folder);
Map<String, Configuration> configurations = batfish.loadConfigurations();
MultipathEquivalentAsPathMatchMode multipleAsDisabled = configurations.get("multiple_as_disabled").getDefaultVrf().getBgpProcess().getMultipathEquivalentAsPathMatchMode();
MultipathEquivalentAsPathMatchMode multipleAsEnabled = configurations.get("multiple_as_enabled").getDefaultVrf().getBgpProcess().getMultipathEquivalentAsPathMatchMode();
MultipathEquivalentAsPathMatchMode multipleAsMixed = configurations.get("multiple_as_mixed").getDefaultVrf().getBgpProcess().getMultipathEquivalentAsPathMatchMode();
assertThat(multipleAsDisabled, equalTo(MultipathEquivalentAsPathMatchMode.FIRST_AS));
assertThat(multipleAsEnabled, equalTo(MultipathEquivalentAsPathMatchMode.PATH_LENGTH));
assertThat(multipleAsMixed, equalTo(MultipathEquivalentAsPathMatchMode.FIRST_AS));
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class FlatJuniperGrammarTest method testBgpClusterId.
@Test
public void testBgpClusterId() throws IOException {
String testrigName = "rr";
String configName = "rr";
Ip neighbor1Ip = new Ip("2.2.2.2");
Ip neighbor2Ip = new Ip("4.4.4.4");
List<String> configurationNames = ImmutableList.of(configName);
Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText(TestrigText.builder().setConfigurationText(TESTRIGS_PREFIX + testrigName, configurationNames).build(), _folder);
Map<String, Configuration> configurations = batfish.loadConfigurations();
Configuration rr = configurations.get(configName);
BgpProcess proc = rr.getDefaultVrf().getBgpProcess();
BgpNeighbor neighbor1 = proc.getNeighbors().get(new Prefix(neighbor1Ip, Prefix.MAX_PREFIX_LENGTH));
BgpNeighbor neighbor2 = proc.getNeighbors().get(new Prefix(neighbor2Ip, Prefix.MAX_PREFIX_LENGTH));
assertThat(neighbor1, hasClusterId(new Ip("3.3.3.3").asLong()));
assertThat(neighbor2, hasClusterId(new Ip("1.1.1.1").asLong()));
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class NodJobTest method setupDataPlane.
private void setupDataPlane() throws IOException {
TemporaryFolder tmp = new TemporaryFolder();
tmp.create();
Batfish batfish = BatfishTestUtils.getBatfish(_configs, tmp);
_bdpDataPlanePlugin = new BdpDataPlanePlugin();
_bdpDataPlanePlugin.initialize(batfish);
batfish.registerDataPlanePlugin(_bdpDataPlanePlugin, "bdp");
batfish.computeDataPlane(false);
_dataPlane = batfish.loadDataPlane();
}
Aggregations