Skip to content

Commit

Permalink
Remove unused BGP advertisement code (batfish#2883)
Browse files Browse the repository at this point in the history
* Remove unused BGP advertisement code
  • Loading branch information
progwriter authored Jan 1, 2019
1 parent d5f7883 commit ec7a9f0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class IncrementalDataPlanePlugin extends DataPlanePlugin {
public static final String PLUGIN_NAME = "ibdp";

private final Map<IncrementalDataPlane, Map<Flow, Set<FlowTrace>>> _flowTraces;

private IncrementalBdpEngine _engine;

public IncrementalDataPlanePlugin() {
Expand Down
49 changes: 0 additions & 49 deletions projects/batfish/src/main/java/org/batfish/main/Batfish.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -239,7 +238,6 @@
import org.batfish.z3.SynthesizerInputImpl;
import org.batfish.z3.expr.BooleanExpr;
import org.batfish.z3.expr.OrExpr;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.jgrapht.Graph;
Expand Down Expand Up @@ -2564,53 +2562,6 @@ public Set<BgpAdvertisement> loadExternalBgpAnnouncements(
return advertSet;
}

/**
* Reads the external bgp announcement specified in the environment, and populates the
* vendor-independent configurations with data about those announcements
*
* @param configurations The vendor-independent configurations to be modified
*/
public Set<BgpAdvertisement> processExternalBgpAnnouncements(
Map<String, Configuration> configurations, SortedSet<Long> allCommunities) {
Set<BgpAdvertisement> advertSet = new LinkedHashSet<>();
Path externalBgpAnnouncementsPath = _testrigSettings.getExternalBgpAnnouncementsPath();
if (Files.exists(externalBgpAnnouncementsPath)) {
String externalBgpAnnouncementsFileContents =
CommonUtil.readFile(externalBgpAnnouncementsPath);
// Populate advertSet with BgpAdvertisements that
// gets passed to populatePrecomputedBgpAdvertisements.
// See populatePrecomputedBgpAdvertisements for the things that get
// extracted from these advertisements.

try {
JSONObject jsonObj = new JSONObject(externalBgpAnnouncementsFileContents);

JSONArray announcements = jsonObj.getJSONArray(BfConsts.PROP_BGP_ANNOUNCEMENTS);

for (int index = 0; index < announcements.length(); index++) {
JSONObject announcement = new JSONObject();
announcement.put("@id", index);
JSONObject announcementSrc = announcements.getJSONObject(index);
for (Iterator<?> i = announcementSrc.keys(); i.hasNext(); ) {
String key = (String) i.next();
if (!key.equals("@id")) {
announcement.put(key, announcementSrc.get(key));
}
}
BgpAdvertisement bgpAdvertisement =
BatfishObjectMapper.mapper()
.readValue(announcement.toString(), BgpAdvertisement.class);
allCommunities.addAll(bgpAdvertisement.getCommunities());
advertSet.add(bgpAdvertisement);
}

} catch (JSONException | IOException e) {
throw new BatfishException("Problems parsing JSON in " + externalBgpAnnouncementsPath, e);
}
}
return advertSet;
}

@Override
public void processFlows(Set<Flow> flows, boolean ignoreFilters) {
DataPlane dp = loadDataPlane();
Expand Down

0 comments on commit ec7a9f0

Please sign in to comment.