use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.MacAutoGeneratedCase in project bgpcep by opendaylight.
the class MacParserTest method parserTest.
@Test
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
final MacAutoGeneratedCase macAuto = new MacAutoGeneratedCaseBuilder().setMacAutoGenerated(new MacAutoGeneratedBuilder().setLocalDiscriminator(UINT24_LD).setSystemMacAddress(MAC).build()).build();
this.parser.serializeEsi(macAuto, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
assertEquals(macAuto, acResult);
final ContainerNode cont = createContBuilder(new NodeIdentifier(MacAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, SYSTEM_MAC_NID).build()).addChild(createValueBuilder(UINT24_LD_MODEL, LD_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
assertEquals(macAuto, acmResult);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.MacAutoGeneratedCase in project bgpcep by opendaylight.
the class MacParser method serializeBody.
@Override
public ByteBuf serializeBody(final Esi esi, final ByteBuf body) {
checkArgument(esi instanceof MacAutoGeneratedCase, "Unknown esi instance. Passed %s. Needed MacAutoGeneratedCase.", esi.getClass());
final MacAutoGenerated macAuto = ((MacAutoGeneratedCase) esi).getMacAutoGenerated();
body.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(macAuto.getSystemMacAddress()));
RFC8294ByteBufUtils.writeUint24(body, macAuto.getLocalDiscriminator());
return body;
}
Aggregations