use of org.batfish.main.Batfish in project batfish by batfish.
the class CiscoGrammarTest method testNxosOspfAreaParameters.
@Test
public void testNxosOspfAreaParameters() throws IOException {
String testrigName = "nxos-ospf";
String hostname = "nxos-ospf-area";
String ifaceName = "Ethernet1";
long areaNum = 1L;
List<String> configurationNames = ImmutableList.of(hostname);
Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText(TestrigText.builder().setConfigurationText(TESTRIGS_PREFIX + testrigName, configurationNames).build(), _folder);
Map<String, Configuration> configurations = batfish.loadConfigurations();
/* Ensure bidirectional references between OSPF area and interface */
assertThat(configurations, hasKey(hostname));
Configuration c = configurations.get(hostname);
assertThat(c, hasDefaultVrf(hasOspfProcess(hasAreas(hasKey(areaNum)))));
OspfArea area = c.getDefaultVrf().getOspfProcess().getAreas().get(areaNum);
assertThat(area, OspfAreaMatchers.hasInterfaces(hasItem(ifaceName)));
assertThat(c, hasInterface(ifaceName, hasOspfArea(sameInstance(area))));
assertThat(c, hasInterface(ifaceName, isOspfPassive(equalTo(false))));
assertThat(c, hasInterface(ifaceName, isOspfPointToPoint()));
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class FlatJuniperGrammarTest method testEthernetSwitchingFilterReference.
@Test
public void testEthernetSwitchingFilterReference() throws IOException {
String hostname = "ethernet-switching-filter";
Batfish batfish = getBatfishForConfigurationNames(hostname);
SortedMap<String, SortedMap<String, SortedMap<String, SortedSet<Integer>>>> unusedStructures = batfish.loadConvertConfigurationAnswerElementOrReparse().getUnusedStructures();
/* esfilter should not be unused, whuile esfilter2 should be unused */
assertThat(unusedStructures, hasKey(hostname));
SortedMap<String, SortedMap<String, SortedSet<Integer>>> byType = unusedStructures.get(hostname);
assertThat(byType, hasKey(JuniperStructureType.FIREWALL_FILTER.getDescription()));
SortedMap<String, SortedSet<Integer>> byName = byType.get(JuniperStructureType.FIREWALL_FILTER.getDescription());
assertThat(byName, hasKey("esfilter2"));
assertThat(byName, not(hasKey("esfilter")));
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class HostTest method testNatIpsecVpnsHelper.
public Map<String, Configuration> testNatIpsecVpnsHelper(String hostFilename) throws IOException {
String testrigResourcePrefix = TESTRIG_PREFIX + "ipsec-vpn-host-aws-cisco";
List<String> awsFilenames = ImmutableList.of("AvailabilityZones-us-west-2.json", "CustomerGateways-us-west-2.json", "InternetGateways-us-west-2.json", "NetworkAcls-us-west-2.json", "NetworkInterfaces-us-west-2.json", "RouteTables-us-west-2.json", "SecurityGroups-us-west-2.json", "Subnets-us-west-2.json", "VpcEndpoints-us-west-2.json", "Vpcs-us-west-2.json", "VpnConnections-us-west-2.json", "VpnGateways-us-west-2.json");
List<String> configurationFilenames = ImmutableList.of("cisco_host");
List<String> hostFilenames = ImmutableList.of(hostFilename);
Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText(TestrigText.builder().setAwsText(testrigResourcePrefix, awsFilenames).setConfigurationText(testrigResourcePrefix, configurationFilenames).setHostsText(testrigResourcePrefix, hostFilenames).build(), _folder);
return batfish.loadConfigurations();
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class RdsInstanceTest method loadAwsConfigurations.
public Map<String, Configuration> loadAwsConfigurations() throws IOException {
List<String> awsFilenames = ImmutableList.of("RdsInstances.json", "SecurityGroups.json", "Subnets.json", "Vpcs.json", "NetworkAcls.json", "NetworkInterfaces.json", "Reservations.json");
Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText(TestrigText.builder().setAwsText("org/batfish/representation/aws/test", awsFilenames).build(), _folder);
return batfish.loadConfigurations();
}
use of org.batfish.main.Batfish in project batfish by batfish.
the class NodJobChunkingTest method setupDataPlane.
private void setupDataPlane() throws IOException {
TemporaryFolder tmp = new TemporaryFolder();
tmp.create();
Batfish batfish = BatfishTestUtils.getBatfish(_configs, tmp);
BdpDataPlanePlugin bdpDataPlanePlugin = new BdpDataPlanePlugin();
bdpDataPlanePlugin.initialize(batfish);
batfish.registerDataPlanePlugin(bdpDataPlanePlugin, "bdp");
batfish.computeDataPlane(false);
_dataPlane = batfish.loadDataPlane();
}
Aggregations