@Nonnull @Override protected Long featureValueOf(EigrpInterfaceSettings actual) { return actual.getAsn(); } }
@Override @Nonnull protected Boolean featureValueOf(EigrpInterfaceSettings actual) { return actual.getEnabled(); } }
@Override @Nonnull protected EigrpMetric featureValueOf(EigrpInterfaceSettings actual) { return actual.getMetric(); } }
/** Return an {@link EigrpEdge} if there is an EIGRP adjacency on {@code edge}. */ @Nonnull static Optional<EigrpEdge> edgeIfAdjacent(Edge edge, Map<String, Configuration> configurations) { // vertex1 Configuration c1 = configurations.get(edge.getNode1()); Interface iface1 = c1.getAllInterfaces().get(edge.getInt1()); EigrpInterfaceSettings eigrp1 = iface1.getEigrp(); // vertex2 Configuration c2 = configurations.get(edge.getNode2()); Interface iface2 = c2.getAllInterfaces().get(edge.getInt2()); EigrpInterfaceSettings eigrp2 = iface2.getEigrp(); if (eigrp1 == null || eigrp2 == null || !eigrp1.getEnabled() || !eigrp2.getEnabled() || eigrp1.getAsn() != eigrp2.getAsn() || eigrp1.getPassive() || eigrp2.getPassive()) { return empty(); } return Optional.of( new EigrpEdge( new EigrpInterface(c1.getHostname(), iface1), new EigrpInterface(c2.getHostname(), iface2))); }
if (iface.getActive() && iface.getEigrp() != null && iface.getEigrp().getAsn() == _asn && iface.getEigrp().getEnabled()) { _interfaces.add(new EigrpInterface(c.getHostname(), iface)); requireNonNull(iface.getEigrp()); RoutingProtocol.EIGRP.getDefaultAdministrativeCost( c.getConfigurationFormat())) .setEigrpMetric(iface.getEigrp().getMetric()) .setNetwork(prefix) .setNextHopInterface(iface.getName())
@Override @Nonnull protected Boolean featureValueOf(EigrpInterfaceSettings actual) { return actual.getPassive(); } }
@Nullable public EigrpInterfaceSettings build() { if (_asn == null || _metric == null) { return null; } return new EigrpInterfaceSettings(_asn, _enabled, _metric, _passive); }
EigrpInterfaceSettings.builder() .setAsn(eigrpProcess.getAsn()) .setEnabled(true)
@JsonCreator private static EigrpInterfaceSettings create( @JsonProperty(PROP_ASN) Long asn, @JsonProperty(PROP_ENABLED) boolean enabled, @JsonProperty(PROP_METRIC) EigrpMetric metric, @JsonProperty(PROP_PASSIVE) boolean passive) { return new EigrpInterfaceSettings(asn, enabled, metric, passive); }
/** * Propagate EIGRP internal routes from every valid EIGRP neighbors * * @param nodes mapping of node names to instances. * @param topology network topology * @param nc All network configurations * @return true if new routes have been added to the staging RIB */ boolean propagateInternalRoutes( Map<String, Node> nodes, Network<EigrpInterface, EigrpEdge> topology, NetworkConfigurations nc) { return _interfaces.stream() .filter(topology.nodes()::contains) .flatMap(n -> topology.inEdges(n).stream()) .map( edge -> propagateInternalRoutesFromNeighbor( nodes.get(edge.getNode1().getHostname()), edge.getNode2().getInterfaceSettings(nc).getMetric(), edge.getNode1().getInterface(nc))) .reduce(false, (a, b) -> a || b); }