use of org.batfish.config.Settings.EnvironmentSettings in project batfish by batfish.
the class Batfish method loadEnvironmentRoutingTables.
@Override
public SortedMap<String, RoutesByVrf> loadEnvironmentRoutingTables() {
EnvironmentSettings envSettings = _testrigSettings.getEnvironmentSettings();
SortedMap<String, RoutesByVrf> environmentRoutingTables = _cachedEnvironmentRoutingTables.get(envSettings);
if (environmentRoutingTables == null) {
ParseEnvironmentRoutingTablesAnswerElement pertae = loadParseEnvironmentRoutingTablesAnswerElement();
if (!Version.isCompatibleVersion("Service", "Old processed environment routing tables", pertae.getVersion())) {
repairEnvironmentRoutingTables();
}
environmentRoutingTables = deserializeEnvironmentRoutingTables(envSettings.getSerializeEnvironmentRoutingTablesPath());
_cachedEnvironmentRoutingTables.put(envSettings, environmentRoutingTables);
}
return environmentRoutingTables;
}
use of org.batfish.config.Settings.EnvironmentSettings in project batfish by batfish.
the class Batfish method initQuestionEnvironment.
private void initQuestionEnvironment(Question question, boolean dp, boolean differentialContext) {
EnvironmentSettings envSettings = _testrigSettings.getEnvironmentSettings();
if (!environmentExists(_testrigSettings)) {
Path envPath = envSettings.getEnvPath();
// create environment required folders
CommonUtil.createDirectories(envPath);
}
if (!environmentBgpTablesExist(envSettings)) {
computeEnvironmentBgpTables();
}
if (!environmentRoutingTablesExist(envSettings)) {
computeEnvironmentRoutingTables();
}
if (dp) {
if (!dataPlaneDependenciesExist(_testrigSettings)) {
computeDataPlane(differentialContext);
}
if (!compressedDataPlaneDependenciesExist(_testrigSettings)) {
computeCompressedDataPlane();
}
}
}
use of org.batfish.config.Settings.EnvironmentSettings in project batfish by batfish.
the class Batfish method computeEnvironmentBgpTables.
private void computeEnvironmentBgpTables() {
EnvironmentSettings envSettings = _testrigSettings.getEnvironmentSettings();
Path outputPath = envSettings.getSerializeEnvironmentBgpTablesPath();
Path inputPath = envSettings.getEnvironmentBgpTablesPath();
serializeEnvironmentBgpTables(inputPath, outputPath);
}
use of org.batfish.config.Settings.EnvironmentSettings in project batfish by batfish.
the class Batfish method repairEnvironmentRoutingTables.
private void repairEnvironmentRoutingTables() {
EnvironmentSettings envSettings = _testrigSettings.getEnvironmentSettings();
Path answerPath = envSettings.getParseEnvironmentRoutingTablesAnswerPath();
Path rtOutputPath = envSettings.getSerializeEnvironmentRoutingTablesPath();
CommonUtil.deleteIfExists(answerPath);
CommonUtil.deleteDirectory(rtOutputPath);
computeEnvironmentRoutingTables();
}
use of org.batfish.config.Settings.EnvironmentSettings in project batfish by batfish.
the class Batfish method applyBaseDir.
public static void applyBaseDir(TestrigSettings settings, Path containerDir, String testrig, String envName) {
Path testrigDir = containerDir.resolve(Paths.get(BfConsts.RELPATH_TESTRIGS_DIR, testrig));
settings.setName(testrig);
settings.setBasePath(testrigDir);
EnvironmentSettings envSettings = settings.getEnvironmentSettings();
settings.setSerializeVendorPath(testrigDir.resolve(BfConsts.RELPATH_VENDOR_SPECIFIC_CONFIG_DIR));
settings.setTestRigPath(testrigDir.resolve(BfConsts.RELPATH_TEST_RIG_DIR));
settings.setParseAnswerPath(testrigDir.resolve(BfConsts.RELPATH_PARSE_ANSWER_PATH));
settings.setNodeRolesPath(testrigDir.resolve(Paths.get(BfConsts.RELPATH_TEST_RIG_DIR, BfConsts.RELPATH_NODE_ROLES_PATH)));
settings.setInferredNodeRolesPath(testrigDir.resolve(Paths.get(BfConsts.RELPATH_TEST_RIG_DIR, BfConsts.RELPATH_INFERRED_NODE_ROLES_PATH)));
settings.setTopologyPath(testrigDir.resolve(BfConsts.RELPATH_TESTRIG_TOPOLOGY_PATH));
settings.setPojoTopologyPath(testrigDir.resolve(BfConsts.RELPATH_TESTRIG_POJO_TOPOLOGY_PATH));
if (envName != null) {
envSettings.setName(envName);
Path envPath = testrigDir.resolve(BfConsts.RELPATH_ENVIRONMENTS_DIR).resolve(envName);
envSettings.setEnvironmentBasePath(envPath);
envSettings.setCompressedDataPlanePath(envPath.resolve(BfConsts.RELPATH_COMPRESSED_DATA_PLANE));
envSettings.setCompressedDataPlaneAnswerPath(envPath.resolve(BfConsts.RELPATH_COMPRESSED_DATA_PLANE_ANSWER));
envSettings.setDataPlanePath(envPath.resolve(BfConsts.RELPATH_DATA_PLANE));
envSettings.setDataPlaneAnswerPath(envPath.resolve(BfConsts.RELPATH_DATA_PLANE_ANSWER_PATH));
envSettings.setParseEnvironmentBgpTablesAnswerPath(envPath.resolve(BfConsts.RELPATH_ENVIRONMENT_BGP_TABLES_ANSWER));
envSettings.setParseEnvironmentRoutingTablesAnswerPath(envPath.resolve(BfConsts.RELPATH_ENVIRONMENT_ROUTING_TABLES_ANSWER));
envSettings.setSerializeEnvironmentBgpTablesPath(envPath.resolve(BfConsts.RELPATH_SERIALIZED_ENVIRONMENT_BGP_TABLES));
envSettings.setSerializeEnvironmentRoutingTablesPath(envPath.resolve(BfConsts.RELPATH_SERIALIZED_ENVIRONMENT_ROUTING_TABLES));
envSettings.setValidateEnvironmentAnswerPath(envPath.resolve(BfConsts.RELPATH_VALIDATE_ENVIRONMENT_ANSWER));
Path envDirPath = envPath.resolve(BfConsts.RELPATH_ENV_DIR);
envSettings.setEnvPath(envDirPath);
envSettings.setNodeBlacklistPath(envDirPath.resolve(BfConsts.RELPATH_NODE_BLACKLIST_FILE));
envSettings.setInterfaceBlacklistPath(envDirPath.resolve(BfConsts.RELPATH_INTERFACE_BLACKLIST_FILE));
envSettings.setEdgeBlacklistPath(envDirPath.resolve(BfConsts.RELPATH_EDGE_BLACKLIST_FILE));
envSettings.setSerializedTopologyPath(envDirPath.resolve(BfConsts.RELPATH_ENV_TOPOLOGY_FILE));
envSettings.setDeltaConfigurationsDir(envDirPath.resolve(BfConsts.RELPATH_CONFIGURATIONS_DIR));
envSettings.setExternalBgpAnnouncementsPath(envDirPath.resolve(BfConsts.RELPATH_EXTERNAL_BGP_ANNOUNCEMENTS));
envSettings.setEnvironmentBgpTablesPath(envDirPath.resolve(BfConsts.RELPATH_ENVIRONMENT_BGP_TABLES));
envSettings.setEnvironmentRoutingTablesPath(envDirPath.resolve(BfConsts.RELPATH_ENVIRONMENT_ROUTING_TABLES));
envSettings.setPrecomputedRoutesPath(envPath.resolve(BfConsts.RELPATH_PRECOMPUTED_ROUTES));
envSettings.setDeltaCompiledConfigurationsDir(envPath.resolve(BfConsts.RELPATH_VENDOR_INDEPENDENT_CONFIG_DIR));
envSettings.setDeltaVendorConfigurationsDir(envPath.resolve(BfConsts.RELPATH_VENDOR_SPECIFIC_CONFIG_DIR));
}
}
Aggregations