Search in sources :

Example 16 with Endpoint

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

the class NetworkWatcherService method discovery.

/**
 * Consume discovery event.
 */
public void discovery(IslInfoData discoveryEvent) {
    Endpoint source = new Endpoint(discoveryEvent.getSource());
    Long packetId = discoveryEvent.getPacketId();
    if (packetId == null) {
        log.error("Got corrupted discovery packet into {} - packetId field is empty", source);
    } else {
        discovery(discoveryEvent, Packet.of(source, packetId));
    }
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint)

Example 17 with Endpoint

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

the class NetworkWatchListService method tick.

/**
 * Consume timer tick.
 */
@VisibleForTesting
void tick(long tickTime) {
    SortedMap<Long, Set<Endpoint>> range = timeouts.subMap(0L, tickTime + 1);
    if (!range.isEmpty()) {
        Map<Endpoint, WatchListEntry> renew = new HashMap<>();
        for (Set<Endpoint> endpointSet : range.values()) {
            for (Endpoint endpoint : endpointSet) {
                WatchListEntry watchListEntry = endpoints.get(endpoint);
                if (watchListEntry != null && renew.put(endpoint, watchListEntry) == null) {
                    carrier.discoveryRequest(endpoint, tickTime);
                }
            }
        }
        range.clear();
        renew.forEach((endpoint, watchListEntry) -> addTimeout(endpoint, tickTime + calculateTimeout(endpoint)));
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Endpoint(org.openkilda.wfm.share.model.Endpoint) HashMap(java.util.HashMap) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 18 with Endpoint

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

the class NetworkWatchListService method activate.

/**
 * Handles topology activation event.
 */
public void activate() {
    long currentTime = now();
    for (Endpoint entry : endpoints.keySet()) {
        carrier.discoveryRequest(entry, currentTime);
        addTimeout(entry, currentTime + genericTickPeriod);
    }
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint)

Example 19 with Endpoint

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

the class DecisionMakerHandler method makeDefaultTuple.

// Private
private Values makeDefaultTuple(PortCommand command) {
    Endpoint endpoint = command.getEndpoint();
    CommandContext context = forkContext("DM", endpoint.toString());
    return new Values(endpoint.getDatapath(), endpoint.getPortNumber(), command, context);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) CommandContext(org.openkilda.wfm.CommandContext) Values(org.apache.storm.tuple.Values)

Example 20 with Endpoint

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

the class NetworkIslServiceTest method setupIslStorageStub.

private void setupIslStorageStub() {
    doAnswer(invocation -> {
        Endpoint ingress = Endpoint.of(invocation.getArgument(0), invocation.getArgument(1));
        Endpoint egress = Endpoint.of(invocation.getArgument(2), invocation.getArgument(3));
        return islStorage.lookup(ingress, egress);
    }).when(islRepository).findByEndpoints(any(SwitchId.class), anyInt(), any(SwitchId.class), anyInt());
    doAnswer(invocation -> {
        Isl payload = invocation.getArgument(0);
        islStorage.save(payload);
        return null;
    }).when(islRepository).add(any(Isl.class));
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint) SwitchId(org.openkilda.model.SwitchId)

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