Search in sources :

Example 11 with RequestsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.RequestsBuilder 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());
}
Also used : PcinitiateMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.PcinitiateMessageBuilder) InitiatedPCInitiateMessageParser(org.opendaylight.protocol.pcep.ietf.initiated.InitiatedPCInitiateMessageParser) PcinitiateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.PcinitiateBuilder) InitiatedActivator(org.opendaylight.protocol.pcep.ietf.initiated.InitiatedActivator) RequestsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.RequestsBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)5 RequestsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.RequestsBuilder)5 RequestsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.RequestsBuilder)4 Collections (java.util.Collections)2 PcinitiateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.PcinitiateBuilder)2 Srp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder)2 PcinitiateMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.PcinitiateMessageBuilder)2 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)2 PcinitiateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.PcinitiateBuilder)2 Srp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder)2 PcinitiateMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.PcinitiateMessageBuilder)2 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)2 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder)2 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder)2 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder)2 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)2 Preconditions (com.google.common.base.Preconditions)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1