VirtualRouter: inline unnecessary variables
It just makes the code harder to read.
@@ -47,7 +47,6 @@ import org.batfish.common.BatfishException;
import org.batfish.datamodel.AbstractRoute;
import org.batfish.datamodel.AbstractRouteBuilder;
import org.batfish.datamodel.AnnotatedRoute;
-import org.batfish.datamodel.AsPath;
import org.batfish.datamodel.BgpAdvertisement;
import org.batfish.datamodel.BgpAdvertisement.BgpAdvertisementType;
import org.batfish.datamodel.BgpPeerConfig;
@@ -71,7 +70,6 @@ import org.batfish.datamodel.Ip;
import org.batfish.datamodel.IsisRoute;
import org.batfish.datamodel.LocalRoute;
import org.batfish.datamodel.NetworkConfigurations;
-import org.batfish.datamodel.OriginType;
import org.batfish.datamodel.Prefix;
import org.batfish.datamodel.RipInternalRoute;
import org.batfish.datamodel.RipProcess;
@@ -84,7 +82,6 @@ import org.batfish.datamodel.Vrf;
import org.batfish.datamodel.bgp.AddressFamily.Type;
import org.batfish.datamodel.bgp.BgpTopology;
import org.batfish.datamodel.bgp.BgpTopology.EdgeId;
-import org.batfish.datamodel.bgp.community.Community;
import org.batfish.datamodel.dataplane.rib.RibGroup;
import org.batfish.datamodel.dataplane.rib.RibId;
import org.batfish.datamodel.isis.IsisEdge;
@@ -577,35 +574,24 @@ public class VirtualRouter implements Serializable {
int admin = _vrf.getBgpProcess().getAdminCost(targetProtocol);
if (received) {
- AsPath asPath = advert.getAsPath();
- SortedSet<Long> clusterList = advert.getClusterList();
- SortedSet<Community> communities = ImmutableSortedSet.copyOf(advert.getCommunities());
- long localPreference = advert.getLocalPreference();
- long metric = advert.getMed();
- Prefix network = advert.getNetwork();
- Ip nextHopIp = advert.getNextHopIp();
- Ip originatorIp = advert.getOriginatorIp();
- OriginType originType = advert.getOriginType();
- RoutingProtocol srcProtocol = advert.getSrcProtocol();
- int weight = advert.getWeight();
Bgpv4Route.Builder builder = new Bgpv4Route.Builder();
builder.setAdmin(admin);
- builder.setAsPath(asPath);
- builder.setClusterList(clusterList);
- builder.setCommunities(communities);
- builder.setLocalPreference(localPreference);
- builder.setMetric(metric);
- builder.setNetwork(network);
- builder.setNextHopIp(nextHopIp);
- builder.setOriginatorIp(originatorIp);
- builder.setOriginType(originType);
+ builder.setAsPath(advert.getAsPath());
+ builder.setClusterList(advert.getClusterList());
+ builder.setCommunities(advert.getCommunities());
+ builder.setLocalPreference(advert.getLocalPreference());
+ builder.setMetric(advert.getMed());
+ builder.setNetwork(advert.getNetwork());
+ builder.setNextHopIp(advert.getNextHopIp());
+ builder.setOriginatorIp(advert.getOriginatorIp());
+ builder.setOriginType(advert.getOriginType());
builder.setProtocol(targetProtocol);
// TODO: support external route reflector clients
builder.setReceivedFromIp(advert.getSrcIp());
builder.setReceivedFromRouteReflectorClient(false);
- builder.setSrcProtocol(srcProtocol);
+ builder.setSrcProtocol(advert.getSrcProtocol());
// TODO: possibly support setting tag
- builder.setWeight(weight);
+ builder.setWeight(advert.getWeight());
Bgpv4Route route = builder.build();
ribDeltas.get(targetRib).from(targetRib.mergeRouteGetDelta(route));
} else {
