Search in sources :

Example 1 with Pipeliner

use of org.onosproject.net.behaviour.Pipeliner in project onos by opennetworkinglab.

the class VirtualNetworkFlowObjectiveManager method getNextMappings.

@Override
public List<String> getNextMappings() {
    List<String> mappings = new ArrayList<>();
    Map<Integer, NextGroup> allnexts = flowObjectiveStore.getAllGroups();
    for (Map.Entry<Integer, NextGroup> e : allnexts.entrySet()) {
        // get the device this next Objective was sent to
        DeviceId deviceId = nextToDevice.get(e.getKey());
        mappings.add("NextId " + e.getKey() + ": " + ((deviceId != null) ? deviceId : "nextId not in this onos instance"));
        if (deviceId != null) {
            // this instance of the controller sent the nextObj to a driver
            Pipeliner pipeliner = getDevicePipeliner(deviceId);
            List<String> nextMappings = pipeliner.getNextMappings(e.getValue());
            if (nextMappings != null) {
                mappings.addAll(nextMappings);
            }
        }
    }
    return mappings;
}
Also used : NextGroup(org.onosproject.net.behaviour.NextGroup) Pipeliner(org.onosproject.net.behaviour.Pipeliner) DeviceId(org.onosproject.net.DeviceId) ArrayList(java.util.ArrayList) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 2 with Pipeliner

use of org.onosproject.net.behaviour.Pipeliner in project onos by opennetworkinglab.

the class VirtualNetworkFlowObjectiveManager method initPipelineHandler.

/**
 * Creates and initialize {@link Pipeliner}.
 * <p>
 * Note: Expected to be called under per-Device lock.
 *      e.g., {@code pipeliners}' Map#compute family methods
 *
 * @param deviceId Device to initialize pipeliner
 * @return {@link Pipeliner} instance or null
 */
private Pipeliner initPipelineHandler(DeviceId deviceId) {
    // FIXME: do we need a standard pipeline for virtual device?
    Pipeliner pipeliner = new DefaultVirtualDevicePipeline();
    pipeliner.init(deviceId, context);
    return pipeliner;
}
Also used : Pipeliner(org.onosproject.net.behaviour.Pipeliner)

Example 3 with Pipeliner

use of org.onosproject.net.behaviour.Pipeliner in project onos by opennetworkinglab.

the class PipeconfLoader method buildIntPipeconf.

private static PiPipeconf buildIntPipeconf() {
    final URL jsonUrl = PipeconfLoader.class.getResource(INT_JSON_PATH);
    final URL p4InfoUrl = PipeconfLoader.class.getResource(INT_P4INFO);
    // not using flow objectives, so we just borrow pipeliner to basic pipeconf.
    return DefaultPiPipeconf.builder().withId(INT_PIPECONF_ID).withPipelineModel(parseP4Info(p4InfoUrl)).addBehaviour(PiPipelineInterpreter.class, BasicInterpreterImpl.class).addBehaviour(Pipeliner.class, BasicPipelinerImpl.class).addBehaviour(PortStatisticsDiscovery.class, PortStatisticsDiscoveryImpl.class).addBehaviour(IntProgrammable.class, IntProgrammableImpl.class).addExtension(P4_INFO_TEXT, p4InfoUrl).addExtension(BMV2_JSON, jsonUrl).build();
}
Also used : Pipeliner(org.onosproject.net.behaviour.Pipeliner) IntProgrammable(org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable) URL(java.net.URL)

Example 4 with Pipeliner

use of org.onosproject.net.behaviour.Pipeliner in project onos by opennetworkinglab.

the class FlowObjectiveCompositionManager method setupPipelineHandler.

private void setupPipelineHandler(DeviceId deviceId) {
    // Attempt to lookup the handler in the cache
    DriverHandler handler = driverHandlers.get(deviceId);
    if (handler == null) {
        try {
            // Otherwise create it and if it has pipeline behaviour, cache it
            handler = driverService.createHandler(deviceId);
            if (!handler.driver().hasBehaviour(Pipeliner.class)) {
                log.warn("Pipeline behaviour not supported for device {}", deviceId);
                return;
            }
        } catch (ItemNotFoundException e) {
            log.warn("No applicable driver for device {}", deviceId);
            return;
        }
        driverHandlers.put(deviceId, handler);
    }
    // Always (re)initialize the pipeline behaviour
    log.info("Driver {} bound to device {} ... initializing driver", handler.driver().name(), deviceId);
    Pipeliner pipeliner = handler.behaviour(Pipeliner.class);
    pipeliner.init(deviceId, context);
    pipeliners.putIfAbsent(deviceId, pipeliner);
}
Also used : Pipeliner(org.onosproject.net.behaviour.Pipeliner) DriverHandler(org.onosproject.net.driver.DriverHandler) ItemNotFoundException(org.onlab.util.ItemNotFoundException)

Example 5 with Pipeliner

use of org.onosproject.net.behaviour.Pipeliner in project onos by opennetworkinglab.

the class FlowObjectiveManager method getNextMappingsChain.

@Override
public Map<Pair<Integer, DeviceId>, List<String>> getNextMappingsChain() {
    Map<Pair<Integer, DeviceId>, List<String>> nextObjGroupMap = new HashMap<>();
    Map<Integer, NextGroup> allnexts = flowObjectiveStore.getAllGroups();
    for (Map.Entry<Integer, NextGroup> e : allnexts.entrySet()) {
        // get the device this next Objective was sent to
        DeviceId deviceId = nextToDevice.get(e.getKey());
        if (deviceId != null) {
            // this instance of the controller sent the nextObj to a driver
            Pipeliner pipeliner = getDevicePipeliner(deviceId);
            List<String> nextMappings = pipeliner.getNextMappings(e.getValue());
            if (nextMappings != null) {
                // mappings.addAll(nextMappings);
                nextObjGroupMap.put(Pair.of(e.getKey(), deviceId), nextMappings);
            }
        } else {
            nextObjGroupMap.put(Pair.of(e.getKey(), deviceId), ImmutableList.of("nextId not in this onos instance"));
        }
    }
    return nextObjGroupMap;
}
Also used : NextGroup(org.onosproject.net.behaviour.NextGroup) Pipeliner(org.onosproject.net.behaviour.Pipeliner) HashMap(java.util.HashMap) DeviceId(org.onosproject.net.DeviceId) List(java.util.List) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) HashMap(java.util.HashMap) Pair(org.apache.commons.lang3.tuple.Pair)

Aggregations

Pipeliner (org.onosproject.net.behaviour.Pipeliner)8 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 DeviceId (org.onosproject.net.DeviceId)3 NextGroup (org.onosproject.net.behaviour.NextGroup)3 HashMap (java.util.HashMap)2 ItemNotFoundException (org.onlab.util.ItemNotFoundException)2 DriverHandler (org.onosproject.net.driver.DriverHandler)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 URL (java.net.URL)1 List (java.util.List)1 Pair (org.apache.commons.lang3.tuple.Pair)1 IntProgrammable (org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable)1