use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.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);
}
Aggregations