use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject in project bgpcep by opendaylight.
the class PCEPSessionImplTest method testAttemptSecondSession.
@Test
public void testAttemptSecondSession() {
this.session.handleMessage(this.openMsg);
Assert.assertEquals(1, this.session.getMessages().getReceivedMsgCount().intValue());
Assert.assertEquals(1, this.msgsSend.size());
Assert.assertTrue(this.msgsSend.get(0) instanceof Pcerr);
final Pcerr pcErr = (Pcerr) this.msgsSend.get(0);
final ErrorObject errorObj = pcErr.getPcerrMessage().getErrors().get(0).getErrorObject();
Assert.assertEquals(PCEPErrors.ATTEMPT_2ND_SESSION, PCEPErrors.forValue(errorObj.getType(), errorObj.getValue()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject in project bgpcep by opendaylight.
the class PCEPSessionImplTest method testCapabilityNotSupported.
@Test
public void testCapabilityNotSupported() {
this.session.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
Assert.assertEquals(2, this.msgsSend.size());
Assert.assertTrue(this.msgsSend.get(0) instanceof Pcerr);
final Pcerr pcErr = (Pcerr) this.msgsSend.get(0);
final ErrorObject errorObj = pcErr.getPcerrMessage().getErrors().get(0).getErrorObject();
Assert.assertEquals(PCEPErrors.CAPABILITY_NOT_SUPPORTED, PCEPErrors.forValue(errorObj.getType(), errorObj.getValue()));
Assert.assertEquals(1, this.session.getMessages().getUnknownMsgReceived().intValue());
// exceeded max. unknown messages count - terminate session
Assert.assertTrue(this.msgsSend.get(1) instanceof CloseMessage);
final CloseMessage closeMsg = (CloseMessage) this.msgsSend.get(1);
Assert.assertEquals(TerminationReason.TOO_MANY_UNKNOWN_MSGS, TerminationReason.forValue(closeMsg.getCCloseMessage().getCClose().getReason()));
Mockito.verify(this.channel, Mockito.times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject in project bgpcep by opendaylight.
the class PCEPSessionState method setLastSentError.
void setLastSentError(final Message msg) {
this.sentErrMsgCount++;
final ErrorObject errObj = getErrorObject(msg);
this.lastSentErrorBuilder.setErrorType(errObj.getType());
this.lastSentErrorBuilder.setErrorValue(errObj.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject in project bgpcep by opendaylight.
the class PCEPSessionState method setLastReceivedError.
void setLastReceivedError(final Message msg) {
final ErrorObject errObj = getErrorObject(msg);
this.receivedErrMsgCount++;
this.lastReceivedErrorBuilder.setErrorType(errObj.getType());
this.lastReceivedErrorBuilder.setErrorValue(errObj.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject in project bgpcep by opendaylight.
the class Util method createErrorMessage.
public static Message createErrorMessage(final PCEPErrors e, final Open t) {
final PcerrBuilder errMessageBuilder = new PcerrBuilder();
final ErrorObject err = new ErrorObjectBuilder().setType(e.getErrorType()).setValue(e.getErrorValue()).build();
if (t == null) {
return errMessageBuilder.setPcerrMessage(new PcerrMessageBuilder().setErrors(Collections.singletonList(new ErrorsBuilder().setErrorObject(err).build())).build()).build();
}
final ErrorType type = new SessionCaseBuilder().setSession(new SessionBuilder().setOpen(t).build()).build();
return errMessageBuilder.setPcerrMessage(new PcerrMessageBuilder().setErrors(Collections.singletonList(new ErrorsBuilder().setErrorObject(err).build())).setErrorType(type).build()).build();
}
Aggregations