Search in sources :

Example 6 with Endpoint

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

the class LinkOperationsServiceTest method shouldPropagateBfdPropertiesUpdateOnFullUpdate.

@Test
public void shouldPropagateBfdPropertiesUpdateOnFullUpdate() throws IslNotFoundException {
    createIsl(IslStatus.ACTIVE);
    Endpoint source = Endpoint.of(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT);
    Endpoint destination = Endpoint.of(TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT);
    linkOperationsService.writeBfdProperties(source, destination, defaultBfdProperties);
    verifyBfdProperties(defaultBfdProperties);
    verify(carrier, times(1)).islBfdPropertiesChanged(eq(source), eq(destination));
    verifyNoMoreInteractions(carrier);
    reset(carrier);
    // no propagation on subsequent request
    linkOperationsService.writeBfdProperties(source, destination, defaultBfdProperties);
    verifyZeroInteractions(carrier);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 7 with Endpoint

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

the class LinkOperationsBolt method bfdPropertiesRead.

private BfdPropertiesResponse bfdPropertiesRead(BfdPropertiesReadRequest request) {
    Endpoint source = new Endpoint(request.getSource());
    Endpoint destination = new Endpoint(request.getDestination());
    try {
        return linkOperationsService.readBfdProperties(source, destination);
    } catch (IslNotFoundException e) {
        throw new MessageException(ErrorType.NOT_FOUND, e.getMessage(), "ISL was not found.");
    }
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) Endpoint(org.openkilda.wfm.share.model.Endpoint) MessageException(org.openkilda.messaging.error.MessageException) IslNotFoundException(org.openkilda.wfm.error.IslNotFoundException)

Example 8 with Endpoint

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

the class DiscoveryPollMonitor method actualUpdate.

@Override
public void actualUpdate(IslFsmEvent event, IslFsmContext context) {
    Endpoint endpoint = context.getEndpoint();
    IslEndpointPollStatus update = discoveryData.get(endpoint);
    switch(event) {
        case ISL_UP:
            update = new IslEndpointPollStatus(context.getIslData(), IslStatus.ACTIVE);
            log.info("ISL {} data update - bind:{} - {}", reference, endpoint, update.getIslData());
            break;
        case ISL_DOWN:
            update = new IslEndpointPollStatus(update.getIslData(), IslStatus.INACTIVE);
            break;
        case ISL_MOVE:
            // We must track MOVED state, because poll and moved monitor save it's status
            // inside same field {@link Isl.actualStatus}. In other case we will rewrite MOVED state
            // saved by {@link DiscoveryMovedMonitor} with our ovn "vision".
            update = new IslEndpointPollStatus(update.getIslData(), IslStatus.MOVED);
            break;
        default:
    }
    discoveryData.put(endpoint, update);
}
Also used : IslEndpointPollStatus(org.openkilda.wfm.topology.network.model.IslEndpointPollStatus) Endpoint(org.openkilda.wfm.share.model.Endpoint)

Example 9 with Endpoint

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

the class DiscoveryBfdMonitor method actualUpdate.

@Override
public void actualUpdate(IslFsmEvent event, IslFsmContext context) {
    final Endpoint endpoint = context.getEndpoint();
    IslEndpointBfdStatus update = null;
    switch(event) {
        case BFD_UP:
            update = new IslEndpointBfdStatus(true, BfdSessionStatus.UP);
            break;
        case BFD_DOWN:
            update = new IslEndpointBfdStatus(true, BfdSessionStatus.DOWN);
            break;
        case BFD_KILL:
            update = new IslEndpointBfdStatus(false, null);
            break;
        case BFD_FAIL:
            update = new IslEndpointBfdStatus(false, BfdSessionStatus.FAIL);
            break;
        default:
    }
    if (update != null) {
        discoveryData.put(endpoint, update);
    }
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) IslEndpointBfdStatus(org.openkilda.wfm.topology.network.model.IslEndpointBfdStatus)

Example 10 with Endpoint

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

the class IslFsm method handleRemovedRule.

// FIXME(surabujin): protect from stale responses
public void handleRemovedRule(IslFsmState from, IslFsmState to, IslFsmEvent event, IslFsmContext context) {
    Endpoint endpoint = context.getRemovedRulesEndpoint();
    if (endpoint == null) {
        throw new IllegalArgumentException(makeInvalidResourceManipulationResponseMessage());
    }
    log.info("Receive response on ISL resource release request for {} (from {})", reference, endpoint.getDatapath());
    endpointResourcesManagementCompleteStatus.put(endpoint, true);
    if (isResourcesManagementCompleted()) {
        fire(IslFsmEvent._RESOURCES_DONE, context);
    }
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint)

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