Search in sources :

Example 1 with MacAutoGeneratedCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.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);
}
Also used : MacAutoGeneratedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.MacAutoGeneratedCaseBuilder) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) 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) MacAutoGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.MacAutoGeneratedCase) MacAutoGeneratedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.mac.auto.generated._case.MacAutoGeneratedBuilder) Test(org.junit.Test)

Example 2 with MacAutoGeneratedCase

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

the class MacParser method serializeBody.

@Override
public void serializeBody(final Esi esi, final ByteBuf body) {
    Preconditions.checkArgument(esi instanceof MacAutoGeneratedCase, "Unknown esi instance. Passed %s. Needed MacAutoGeneratedCase.", esi.getClass());
    final MacAutoGenerated macAuto = ((MacAutoGeneratedCase) esi).getMacAutoGenerated();
    body.writeBytes(IetfYangUtil.INSTANCE.bytesFor(macAuto.getSystemMacAddress()));
    ByteBufWriteUtil.writeMedium(macAuto.getLocalDiscriminator().getValue().intValue(), body);
}
Also used : MacAutoGenerated(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.mac.auto.generated._case.MacAutoGenerated) MacAutoGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.MacAutoGeneratedCase)

Aggregations

MacAutoGeneratedCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.MacAutoGeneratedCase)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 MacAutoGeneratedCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.MacAutoGeneratedCaseBuilder)1 MacAutoGenerated (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.mac.auto.generated._case.MacAutoGenerated)1 MacAutoGeneratedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.mac.auto.generated._case.MacAutoGeneratedBuilder)1 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1