use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method ensureLspOperational.
@Override
public synchronized ListenableFuture<OperationResult> ensureLspOperational(@Nonnull final EnsureLspOperationalInput input) {
Preconditions.checkArgument(input != null && input.getName() != null && input.getNode() != null && input.getArguments() != null, MISSING_XML_TAG);
final OperationalStatus op;
final Arguments1 aa = input.getArguments().getAugmentation(Arguments1.class);
if (aa != null) {
op = aa.getOperational();
} else {
op = null;
}
// Make sure the LSP exists
final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
if (f == null) {
return OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future();
}
return listenableFuture(f, input, op);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project bgpcep by opendaylight.
the class ProgrammingServiceImplTest method testScheduleDependingInstruction.
@Test
public void testScheduleDependingInstruction() throws Exception {
this.testedProgrammingService.scheduleInstruction(getMockedSubmitInstructionInput("mockedSubmit1"));
final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2", "mockedSubmit1");
this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
this.mockedExecutorWrapper.assertSubmittedTasksSize(2);
// First is in state scheduled, so second could not be scheduled yet
this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project bgpcep by opendaylight.
the class ProgrammingServiceImplTest method testSuccessExecutingWithDependenciesTransaction.
// TODO test deadline with state Queued
@Test
public void testSuccessExecutingWithDependenciesTransaction() throws Exception {
final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1");
final ListenableFuture<Instruction> future = this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2", "mockedSubmit1");
final ListenableFuture<Instruction> future2 = this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
Instruction instruction = future.get();
instruction.checkedExecutionStart();
instruction.executionCompleted(InstructionStatus.Successful, getDetails());
this.mockedNotificationServiceWrapper.assertNotificationsCount(4);
this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(), InstructionStatus.Executing);
this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit1.getId(), InstructionStatus.Successful);
this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(3, mockedSubmit2.getId(), InstructionStatus.Scheduled);
instruction = future2.get();
instruction.checkedExecutionStart();
instruction.executionCompleted(InstructionStatus.Successful, getDetails());
this.mockedNotificationServiceWrapper.assertNotificationsCount(6);
this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(4, mockedSubmit2.getId(), InstructionStatus.Executing);
this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(5, mockedSubmit2.getId(), InstructionStatus.Successful);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project bgpcep by opendaylight.
the class NeighborUtil method buildCapabilityState.
/**
* Builds Neighbor State containing Capabilities State, session State.
*
* @return Neighbor State
*/
public static NeighborStateAugmentation buildCapabilityState(@Nonnull final BGPSessionState neighbor) {
final List<Class<? extends BgpCapability>> supportedCapabilities = buildSupportedCapabilities(neighbor);
SessionState sessionState = null;
switch(neighbor.getSessionState()) {
case IDLE:
sessionState = SessionState.IDLE;
break;
case UP:
sessionState = SessionState.ESTABLISHED;
break;
case OPEN_CONFIRM:
sessionState = SessionState.OPENCONFIRM;
break;
default:
}
return new NeighborStateAugmentationBuilder().setSupportedCapabilities(supportedCapabilities).setSessionState(sessionState).build();
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project bgpcep by opendaylight.
the class Stateful07ErrorMessageParser method insertObject.
private static State insertObject(final State state, final Object obj, final List<Errors> errorObjects, final List<Rps> requestParameters, final List<Srps> srps, final PcerrMessageBuilder b) {
switch(state) {
case ERROR_IN:
if (obj instanceof ErrorObject) {
final ErrorObject o = (ErrorObject) obj;
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR_IN;
}
case RP_IN:
if (obj instanceof Rp) {
final Rp o = (Rp) obj;
requestParameters.add(new RpsBuilder().setRp(o).build());
return State.RP_IN;
}
case SRP_IN:
if (obj instanceof Srp) {
final Srp o = (Srp) obj;
srps.add(new SrpsBuilder().setSrp(o).build());
return State.SRP_IN;
}
case OPEN:
if (obj instanceof Open) {
b.setErrorType(new SessionCaseBuilder().setSession(new SessionBuilder().setOpen((Open) obj).build()).build());
return State.OPEN_IN;
}
case ERROR:
if (obj instanceof ErrorObject) {
final ErrorObject o = (ErrorObject) obj;
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR;
}
case OPEN_IN:
case END:
return State.END;
default:
return state;
}
}
Aggregations