Java Code Examples for org.onosproject.net.behaviour.Pipeliner#next()

The following examples show how to use org.onosproject.net.behaviour.Pipeliner#next() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowObjectiveCompositionManager.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    try {
        Pipeliner pipeliner = getDevicePipeliner(deviceId);

        if (pipeliner != null) {
            if (objective instanceof NextObjective) {
                pipeliner.next((NextObjective) objective);
            } else if (objective instanceof ForwardingObjective) {
                pipeliner.forward((ForwardingObjective) objective);
            } else {
                pipeliner.filter((FilteringObjective) objective);
            }
        } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) {
            Thread.sleep(INSTALL_RETRY_INTERVAL);
            executorService.execute(new ObjectiveInstaller(deviceId, objective, numAttempts + 1));
        } else {
            // Otherwise we've tried a few times and failed, report an
            // error back to the user.
            objective.context().ifPresent(
                    c -> c.onError(objective, ObjectiveError.NOPIPELINER));
        }
    } catch (Exception e) {
        log.warn("Exception while installing flow objective", e);
    }
}
 
Example 2
Source File: VirtualNetworkFlowObjectiveManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    try {
        Pipeliner pipeliner = getDevicePipeliner(deviceId);

        if (pipeliner != null) {
            if (objective instanceof NextObjective) {
                nextToDevice.put(objective.id(), deviceId);
                pipeliner.next((NextObjective) objective);
            } else if (objective instanceof ForwardingObjective) {
                pipeliner.forward((ForwardingObjective) objective);
            } else {
                pipeliner.filter((FilteringObjective) objective);
            }
            //Attempts to check if pipeliner is null for retry attempts
        } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) {
            Thread.sleep(INSTALL_RETRY_INTERVAL);
            executorService.execute(new ObjectiveInstaller(deviceId, objective, numAttempts + 1));
        } else {
            // Otherwise we've tried a few times and failed, report an
            // error back to the user.
            objective.context().ifPresent(
                    c -> c.onError(objective, ObjectiveError.NOPIPELINER));
        }
        //Exception thrown
    } catch (Exception e) {
        log.warn("Exception while installing flow objective", e);
    }
}
 
Example 3
Source File: FlowObjectiveManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    try {
        Pipeliner pipeliner = getDevicePipeliner(deviceId);

        if (pipeliner != null) {
            if (objective instanceof NextObjective) {
                nextToDevice.put(objective.id(), deviceId);
                pipeliner.next((NextObjective) objective);
            } else if (objective instanceof ForwardingObjective) {
                pipeliner.forward((ForwardingObjective) objective);
            } else {
                pipeliner.filter((FilteringObjective) objective);
            }
            //Attempts to check if pipeliner is null for retry attempts
        } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) {
            Thread.sleep(INSTALL_RETRY_INTERVAL);
            executor.execute(new ObjectiveProcessor(deviceId, objective,
                                                    numAttempts + 1, executor));
        } else {
            // Otherwise we've tried a few times and failed, report an
            // error back to the user.
            objective.context().ifPresent(
                    c -> c.onError(objective, ObjectiveError.NOPIPELINER));
        }
        //Exception thrown
    } catch (Exception e) {
        log.warn("Exception while processing flow objective", e);
    }
}