Search in sources :

Example 1 with AsGeneratedCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCaseBuilder in project bgpcep by opendaylight.

the class ASGenParserTest method parserTest.

@Test
public void parserTest() {
    final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
    final AsGeneratedCase asGen = new AsGeneratedCaseBuilder().setAsGenerated(new AsGeneratedBuilder().setAs(AS_NUMBER).setLocalDiscriminator(LD).build()).build();
    this.parser.serializeEsi(asGen, buff);
    assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
    final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
    assertEquals(asGen, acResult);
    final ContainerNode cont = createContBuilder(new NodeIdentifier(AsGenerated.QNAME)).addChild(createValueBuilder(AS_MODEL, AS_NID).build()).addChild(createValueBuilder(LD, LD_NID).build()).build();
    final Esi acmResult = this.parser.serializeEsi(cont);
    assertEquals(asGen, acmResult);
}
Also used : AsGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCase) AsGeneratedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.as.generated._case.AsGeneratedBuilder) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) AsGeneratedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCaseBuilder) Esi(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.Esi) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 2 with AsGeneratedCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCaseBuilder in project bgpcep by opendaylight.

the class ASGenParser method serializeEsi.

@Override
public Esi serializeEsi(final ContainerNode esi) {
    final AsGeneratedBuilder builder = new AsGeneratedBuilder();
    builder.setLocalDiscriminator(extractLD(esi));
    builder.setAs(extractAS(esi));
    return new AsGeneratedCaseBuilder().setAsGenerated(builder.build()).build();
}
Also used : AsGeneratedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.as.generated._case.AsGeneratedBuilder) AsGeneratedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCaseBuilder)

Aggregations

AsGeneratedCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCaseBuilder)2 AsGeneratedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.as.generated._case.AsGeneratedBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 Esi (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.Esi)1 AsGeneratedCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCase)1 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1