use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr in project bgpcep by opendaylight.
the class FiniteStateMachineTest method testErrorOneSeven.
/**
* KeepWaitTimer expired.
*
* @throws Exception exception
*/
@Test
public void testErrorOneSeven() throws Exception {
this.serverSession.channelActive(null);
assertEquals(1, this.msgsSend.size());
assertTrue(this.msgsSend.get(0) instanceof Open);
this.serverSession.handleMessage(this.openMsg);
checkEquals(() -> {
for (final Notification m : this.msgsSend) {
if (m instanceof Pcerr) {
final Errors obj = ((Pcerr) m).getPcerrMessage().getErrors().get(0);
assertEquals(Uint8.ONE, obj.getErrorObject().getType());
assertEquals(Uint8.valueOf(7), obj.getErrorObject().getValue());
}
}
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr in project bgpcep by opendaylight.
the class FiniteStateMachineTest method testErrorOneOne.
/**
* Sending different PCEP Message than Open in session establishment phase.
*
* @throws Exception exception
*/
@Test
public void testErrorOneOne() throws Exception {
this.serverSession.channelActive(null);
assertEquals(1, this.msgsSend.size());
assertTrue(this.msgsSend.get(0) instanceof Open);
this.serverSession.handleMessage(this.kaMsg);
checkEquals(() -> {
for (final Notification m : this.msgsSend) {
if (m instanceof Pcerr) {
final Errors obj = ((Pcerr) m).getPcerrMessage().getErrors().get(0);
assertEquals(Uint8.ONE, obj.getErrorObject().getType());
assertEquals(Uint8.ONE, obj.getErrorObject().getValue());
}
}
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr in project bgpcep by opendaylight.
the class AbstractPCEPSessionNegotiator method handleMessageStartTlsWait.
private boolean handleMessageStartTlsWait(final Message msg) {
if (msg instanceof Starttls) {
final SslContextFactory sslFactory = new SslContextFactory(this.tlsConfiguration);
final SSLContext sslContext = sslFactory.getServerContext();
if (sslContext == null) {
this.sendErrorMessage(PCEPErrors.NOT_POSSIBLE_WITHOUT_TLS);
negotiationFailed(new IllegalStateException("Failed to establish a TLS connection."));
this.state = State.FINISHED;
return true;
}
final SSLEngine engine = sslContext.createSSLEngine();
engine.setNeedClientAuth(true);
engine.setUseClientMode(false);
this.channel.pipeline().addFirst(new SslHandler(engine));
LOG.info("PCEPS TLS connection with peer: {} established succesfully.", this.channel);
startNegotiationWithOpen();
return true;
} else if (!(msg instanceof Pcerr)) {
this.sendErrorMessage(PCEPErrors.NON_STARTTLS_MSG_RCVD);
negotiationFailed(new IllegalStateException("Unexpected message recieved."));
this.state = State.FINISHED;
return true;
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr in project bgpcep by opendaylight.
the class UtilTest method testCreateErrorMessage.
@Test
public void testCreateErrorMessage() {
final Pcerr errMsg = Util.createErrorMessage(PCEPErrors.BAD_LABEL_VALUE, null);
assertNull(errMsg.getPcerrMessage().getErrorType());
final ErrorObject errorObject = errMsg.getPcerrMessage().getErrors().get(0).getErrorObject();
assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorType(), errorObject.getType());
assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorValue(), errorObject.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr in project bgpcep by opendaylight.
the class AbstractMessageParserTest method testParseObjects.
@Test
public void testParseObjects() throws PCEPDeserializerException {
final Abs a = new Abs(this.registry);
final ByteBuf buffer = Unpooled.buffer();
a.serializeObject(this.object, buffer);
verify(this.registry, only()).serializeObject(any(Object.class), any(ByteBuf.class));
final Message b = a.parseMessage(Unpooled.wrappedBuffer(new byte[] { 0x0D, 0x13, 0, 0x08, 0, 0, 1, 1 }), Collections.emptyList());
assertEquals(this.object, ((Pcerr) b).getPcerrMessage().getErrors().get(0).getErrorObject());
}
Aggregations