Search in sources :

Example 11 with Endpoint

use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.

the class IslFsm method createIsl.

private Isl createIsl(Anchor source, Anchor dest, Instant timeNow) {
    final Endpoint sourceEndpoint = source.getEndpoint();
    final Endpoint destEndpoint = dest.getEndpoint();
    IslBuilder islBuilder = Isl.builder().srcSwitch(source.getSw()).srcPort(sourceEndpoint.getPortNumber()).destSwitch(dest.getSw()).destPort(destEndpoint.getPortNumber()).underMaintenance(source.getSw().isUnderMaintenance() || dest.getSw().isUnderMaintenance());
    initializeFromLinkProps(sourceEndpoint, destEndpoint, islBuilder);
    Isl link = islBuilder.build();
    log.info("Create new DB object (prefilled): {}", link);
    islRepository.add(link);
    return link;
}
Also used : IslBuilder(org.openkilda.model.Isl.IslBuilder) Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint)

Example 12 with Endpoint

use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.

the class IslFsm method sendInstallResources.

private void sendInstallResources(IIslCarrier carrier) {
    final Endpoint source = reference.getSource();
    final Endpoint dest = reference.getDest();
    sendInstallResources(carrier, source, dest);
    sendInstallResources(carrier, dest, source);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint)

Example 13 with Endpoint

use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.

the class NetworkTopologyDashboardLogger method onIslUpDownMoved.

private void onIslUpDownMoved(IslReference reference, String event, String statusDetails) {
    Map<String, String> context = makeContextTemplate("isl");
    populateEvent(context, event);
    Endpoint source = reference.getSource();
    context.put("src_switch", source.getDatapath().toString());
    context.put("src_port", String.valueOf(source.getPortNumber()));
    context.put("src_switch_port", source.toString());
    Endpoint dest = reference.getDest();
    context.put("dst_switch", dest.getDatapath().toString());
    context.put("dst_port", String.valueOf(dest.getPortNumber()));
    context.put("dst_switch_port", dest.toString());
    String message = String.format("ISL %s changed status to: %s [%s]", reference, event, statusDetails);
    invokeLogger(Level.INFO, message, context);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint)

Example 14 with Endpoint

use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.

the class NetworkRoundTripDecisionMakerService method tick.

/**
 * Process time tick - locate expired entries and emit round trip INACTIVE events for them.
 */
public void tick() {
    Instant now = clock.instant();
    SortedMap<Instant, Set<Endpoint>> range = timeouts.headMap(now);
    Set<Endpoint> processed = new HashSet<>();
    for (Set<Endpoint> batch : range.values()) {
        for (Endpoint endpoint : batch) {
            if (processed.contains(endpoint)) {
                continue;
            }
            processed.add(endpoint);
            checkExpiration(now, endpoint);
        }
    }
    range.clear();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Endpoint(org.openkilda.wfm.share.model.Endpoint) Instant(java.time.Instant) HashSet(java.util.HashSet)

Example 15 with Endpoint

use of org.openkilda.wfm.share.model.Endpoint in project open-kilda by telstra.

the class NetworkRoundTripDecisionMakerService method discovered.

/**
 * Register/update round trip tracking data for specific endpoint.
 */
public void discovered(Endpoint endpoint, long packetId) {
    Entry entry = entries.get(endpoint);
    if (entry != null && packetId < entry.getLastSeenPacketId()) {
        log.debug("Ignore staled round trip discovery on {} (packet_id: {})", endpoint, packetId);
        return;
    }
    Instant expireAt = clock.instant().plus(expireDelay);
    entries.put(endpoint, new Entry(packetId, expireAt));
    timeouts.computeIfAbsent(expireAt, key -> new HashSet<>()).add(endpoint);
    if (entry == null) {
        log.info("Register round trip status entry for {}", endpoint);
    }
    // Emits each registered round trip event. Some ISLs monitor can ignore some round trip ACTIVATE events as part
    // of race conditions prevention fight.
    carrier.linkRoundTripActive(endpoint);
}
Also used : HashSet(java.util.HashSet) Slf4j(lombok.extern.slf4j.Slf4j) TreeMap(java.util.TreeMap) Duration(java.time.Duration) Map(java.util.Map) Endpoint(org.openkilda.wfm.share.model.Endpoint) Clock(java.time.Clock) Set(java.util.Set) HashMap(java.util.HashMap) Instant(java.time.Instant) SortedMap(java.util.SortedMap) Value(lombok.Value) Instant(java.time.Instant) HashSet(java.util.HashSet)

Aggregations

Endpoint (org.openkilda.wfm.share.model.Endpoint)72 Test (org.junit.Test)33 Isl (org.openkilda.model.Isl)17 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)13 SwitchId (org.openkilda.model.SwitchId)10 Switch (org.openkilda.model.Switch)8 IslReference (org.openkilda.wfm.share.model.IslReference)8 PathNode (org.openkilda.messaging.info.event.PathNode)7 Instant (java.time.Instant)6 IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)6 HashSet (java.util.HashSet)4 Set (java.util.Set)4 DiscoverIslCommandData (org.openkilda.messaging.command.discovery.DiscoverIslCommandData)4 IslNotFoundException (org.openkilda.wfm.error.IslNotFoundException)4 Values (org.apache.storm.tuple.Values)3 IslRoundTripLatency (org.openkilda.messaging.info.event.IslRoundTripLatency)3 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)3 CommandContext (org.openkilda.wfm.CommandContext)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HashMap (java.util.HashMap)2