@Override public String toString() { return getClass().getSimpleName() + "<" + _protocol.protocolName() + ">"; } }
private static Map<String, RoutingProtocol> buildMap() { ImmutableMap.Builder<String, RoutingProtocol> map = ImmutableMap.builder(); for (RoutingProtocol protocol : RoutingProtocol.values()) { String protocolName = protocol._protocolName.toLowerCase(); map.put(protocolName, protocol); } return map.build(); }
return result; result = _protocol.compareTo(rhs._protocol); if (result != 0) { return result;
private int defaultAdminDistance(Configuration conf, Protocol proto) { RoutingProtocol rp = Protocol.toRoutingProtocol(proto); return rp.getDefaultAdministrativeCost(conf.getConfigurationFormat()); }
@Override public Result evaluate(Environment environment) { Result result = new Result(); // Workaround: Treat ISIS_ANY as a special value if (_protocol == RoutingProtocol.ISIS_ANY) { result.setBooleanValue(ISIS_EXPANSION.contains(environment.getOriginalRoute().getProtocol())); } else { result.setBooleanValue(environment.getOriginalRoute().getProtocol().equals(_protocol)); } return result; }
@Override public int hashCode() { return Objects.hash(_protocol.ordinal()); }
@Override public BooleanExpr toBooleanExpr(Configuration c, CiscoConfiguration cc, Warnings w) { Disjunction d = new Disjunction(); List<BooleanExpr> disjuncts = d.getDisjuncts(); for (String protocol : _protocols) { disjuncts.add(new MatchProtocol(RoutingProtocol.fromProtocolName(protocol))); } return d.simplify(); } }
int admin = RoutingProtocol.OSPF_IA.getSummaryAdministrativeCost(_c.getConfigurationFormat());
/** Initialize RIP routes from the interface prefixes */ @VisibleForTesting void initBaseRipRoutes() { if (_vrf.getRipProcess() == null) { return; // nothing to do } // init internal routes from connected routes for (String ifaceName : _vrf.getRipProcess().getInterfaces()) { Interface iface = _vrf.getInterfaces().get(ifaceName); if (iface.getActive()) { Set<Prefix> allNetworkPrefixes = iface.getAllAddresses().stream() .map(InterfaceAddress::getPrefix) .collect(Collectors.toSet()); long cost = RipProcess.DEFAULT_RIP_COST; for (Prefix prefix : allNetworkPrefixes) { RipInternalRoute route = new RipInternalRoute( prefix, Route.UNSET_ROUTE_NEXT_HOP_IP, RoutingProtocol.RIP.getDefaultAdministrativeCost(_c.getConfigurationFormat()), cost); _ripInternalRib.mergeRouteGetDelta(route); } } } }
@Override public int hashCode() { if (_hashCode != 0) { return _hashCode; } _hashCode = Objects.hash( _admin, _asPath, _clusterList, _communities, _discard, _localPreference, _med, _network, _nextHopIp, _originatorIp, _originType.ordinal(), _protocol.ordinal(), _receivedFromIp, _receivedFromRouteReflectorClient, _srcProtocol == null ? 0 : _srcProtocol.ordinal(), _weight); return _hashCode; }
public String prettyPrint(String prefix) { String net = getNetwork().toString(); String prot = _srcProtocol.protocolName(); String routeStr = String.format( "%s%s dstNode:%s dstVrf:%s dstIp:%s srcNode:%s srcVrf:%s srcIp:%s net:%s nhip:%s " + "origin:%s lp:%s med:%s weight:%s asPath:%s communities:%s orIp:%s clst:%s " + "srcProt:%s\n", prefix, _type, _dstNode, _dstVrf, _dstIp, _srcNode, _srcVrf, _srcIp, net, _nextHopIp, _originType, _localPreference, _med, _weight, _asPath, _communities, _originatorIp, _clusterList, prot); return routeStr; }
int adminCost = RoutingProtocol.OSPF.getDefaultAdministrativeCost(_c.getConfigurationFormat()); SortedSet<Edge> edges = topology.getNodeEdges().get(node); if (edges == null) {
@Test public void testAll() { assertThat( RoutingProtocolSpecifier.create("all").getProtocols(), equalTo(Stream.of(RoutingProtocol.values()).collect(Collectors.toSet()))); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _administrativeCost; result = prime * result + Long.hashCode(_metric); result = prime * result + _nextHopIp.hashCode(); result = prime * result + _node.hashCode(); result = prime * result + _network.hashCode(); result = prime * result + _protocol.ordinal(); result = prime * result + _tag; result = prime * result + _vrf.hashCode(); return result; }
return result; result = _protocol.compareTo(rhs._protocol); if (result != 0) { return result;
break; default: throw new BatfishException("Unrecognized protocol: " + other.protocolName());
> RoutingProtocol.BGP.getDefaultAdministrativeCost(ConfigurationFormat.CISCO_IOS)) { protocol = RoutingProtocol.IBGP;
@Test public void testCreationDefault() { assertThat( RoutingProtocolSpecifier.create(null).getProtocols(), equalTo(Stream.of(RoutingProtocol.values()).collect(Collectors.toSet()))); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _administrativeCost; result = prime * result + _metric; result = prime * result + _nextHopIp.hashCode(); result = prime * result + _node.hashCode(); result = prime * result + _network.hashCode(); result = prime * result + _protocol.ordinal(); result = prime * result + _tag; result = prime * result + _vrf.hashCode(); return result; }