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;
}
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;
}
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();
}
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);
}
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;
}
Aggregations