Search in sources :

Example 1 with LacpAutoGeneratedCase

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

the class LacpParser method serializeBody.

@Override
public ByteBuf serializeBody(final Esi esi, final ByteBuf body) {
    checkArgument(esi instanceof LacpAutoGeneratedCase, "Unknown esi instance. Passed %s. Needed LacpAutoGeneratedCase.", esi);
    final LacpAutoGenerated lacp = ((LacpAutoGeneratedCase) esi).getLacpAutoGenerated();
    body.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(lacp.getCeLacpMacAddress()));
    ByteBufUtils.writeOrZero(body, lacp.getCeLacpPortKey());
    return body.writeByte(0);
}
Also used : LacpAutoGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.LacpAutoGeneratedCase) LacpAutoGenerated(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.lacp.auto.generated._case.LacpAutoGenerated)

Example 2 with LacpAutoGeneratedCase

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

the class LacpParserTest method parserTest.

@Test
public void parserTest() {
    final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
    final LacpAutoGeneratedCase lanAuto = new LacpAutoGeneratedCaseBuilder().setLacpAutoGenerated(new LacpAutoGeneratedBuilder().setCeLacpMacAddress(MAC).setCeLacpPortKey(PORT).build()).build();
    this.parser.serializeEsi(lanAuto, buff);
    assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
    final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
    assertEquals(lanAuto, acResult);
    final ContainerNode cont = createContBuilder(new NodeIdentifier(LacpAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, LACP_MAC_NID).build()).addChild(createValueBuilder(PORT, PK_NID).build()).build();
    final Esi acmResult = this.parser.serializeEsi(cont);
    assertEquals(lanAuto, acmResult);
}
Also used : LacpAutoGeneratedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.lacp.auto.generated._case.LacpAutoGeneratedBuilder) LacpAutoGeneratedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.LacpAutoGeneratedCaseBuilder) LacpAutoGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.LacpAutoGeneratedCase) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) Esi(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.Esi) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

LacpAutoGeneratedCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.LacpAutoGeneratedCase)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.rev200120.esi.Esi)1 LacpAutoGeneratedCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.LacpAutoGeneratedCaseBuilder)1 LacpAutoGenerated (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.lacp.auto.generated._case.LacpAutoGenerated)1 LacpAutoGeneratedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.lacp.auto.generated._case.LacpAutoGeneratedBuilder)1 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1