use of org.opendaylight.protocol.pcep.ietf.initiated.InitiatedPCInitiateMessageParser in project bgpcep by opendaylight.
the class PCEPValidatorTest method testPcinitMsg.
@Test
public void testPcinitMsg() throws IOException, PCEPDeserializerException {
new InitiatedActivator().start(ctx);
final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/Pcinit.bin"));
final InitiatedPCInitiateMessageParser parser = new InitiatedPCInitiateMessageParser(this.ctx.getObjectHandlerRegistry());
final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder().setRequests(List.of(new RequestsBuilder().setSrp(this.srp).setLsp(this.lspSrp).setEro(this.ero).setLspa(this.lspa).setMetrics(List.of(this.metrics)).setIro(this.iro).build()));
assertEquals(new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), List.of()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
}
Aggregations