use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction in project openflowplugin by opendaylight.
the class FlowConvertor method isSetVlanIdActionCasePresent.
// check if set vlanid action is present in the flow
private static boolean isSetVlanIdActionCasePresent(Flow flow) {
// If yes,then we would need to two flows
if (flow.getInstructions() != null && flow.getInstructions().getInstruction() != null) {
for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : flow.getInstructions().getInstruction()) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction.getInstruction();
if (curInstruction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase applyActionscase = (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) curInstruction;
ApplyActions applyActions = applyActionscase.getApplyActions();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : applyActions.getAction()) {
if (action.getAction() instanceof SetVlanIdActionCase) {
return true;
}
}
}
}
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction in project openflowplugin by opendaylight.
the class FlowConvertor method toInstructions.
private List<Instruction> toInstructions(Flow flow, short version, BigInteger datapathid) {
final List<Instruction> instructionsList = new ArrayList<>();
final ActionConvertorData data = new ActionConvertorData(version);
data.setDatapathId(datapathid);
data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));
Instructions instructions = flow.getInstructions();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : instructions.getInstruction()) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction.getInstruction();
Optional<Instruction> result = PROCESSOR.process(curInstruction, data, getConvertorExecutor());
if (result.isPresent()) {
instructionsList.add(result.get());
}
}
return instructionsList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction in project bgpcep by opendaylight.
the class AbstractInstructionExecutor method schedule.
public static FailureCase schedule(final InstructionScheduler scheduler, final AbstractInstructionExecutor fwd) {
final ListenableFuture<Instruction> listenableFuture;
try {
listenableFuture = scheduler.scheduleInstruction(fwd.getInput());
} catch (final SchedulerException e) {
LOG.info("Instuction {} failed to schedule", e.getMessage(), e);
return new FailureCaseBuilder().setFailure(e.getFailure()).build();
}
Futures.addCallback(listenableFuture, fwd, MoreExecutors.directExecutor());
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction in project bgpcep by opendaylight.
the class InstructionImpl method cancelInstrunction.
private synchronized void cancelInstrunction() {
final List<InstructionId> ids = new ArrayList<>();
for (final InstructionImpl instruction : this.dependencies) {
if (instruction.getStatus() != InstructionStatus.Successful) {
ids.add(instruction.getId());
}
}
cancel(new DetailsBuilder().setUnmetDependencies(ids).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction in project bgpcep by opendaylight.
the class InstructionImpl method checkDependencies.
private Boolean checkDependencies() {
boolean ready = true;
final List<InstructionId> unmet = new ArrayList<>();
for (final InstructionImpl instruction : this.dependencies) {
switch(instruction.getStatus()) {
case Cancelled:
case Failed:
case Unknown:
unmet.add(instruction.getId());
break;
case Executing:
case Queued:
case Scheduled:
ready = false;
break;
case Successful:
// No-op
break;
default:
break;
}
}
if (!unmet.isEmpty()) {
LOG.warn("Instruction {} was Queued, while some dependencies were resolved unsuccessfully, cancelling it", this.id);
cancel(new DetailsBuilder().setUnmetDependencies(unmet).build());
return false;
}
return ready;
}
Aggregations