Search in sources :

Example 1 with IncMultiEthernetTagResCase

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

the class IncMultEthTagRParser method serializeBody.

@Override
public ByteBuf serializeBody(final EvpnChoice evpnChoice) {
    Preconditions.checkArgument(evpnChoice instanceof IncMultiEthernetTagResCase, "Unknown evpn instance. Passed %s. Needed IncMultiEthernetTagResCase.", evpnChoice.getClass());
    final IncMultiEthernetTagRes evpn = ((IncMultiEthernetTagResCase) evpnChoice).getIncMultiEthernetTagRes();
    final ByteBuf body = Unpooled.buffer();
    ByteBufUtils.writeOrZero(body, evpn.getEthernetTagId().getVlanId());
    final ByteBuf orig = IpAddressUtil.bytesFor(evpn.getOrigRouteIp());
    Preconditions.checkArgument(orig.readableBytes() > 0);
    body.writeBytes(orig);
    return body;
}
Also used : IncMultiEthernetTagRes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.inc.multi.ethernet.tag.res.IncMultiEthernetTagRes) IncMultiEthernetTagResCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.evpn.choice.IncMultiEthernetTagResCase) ByteBuf(io.netty.buffer.ByteBuf)

Example 2 with IncMultiEthernetTagResCase

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

the class IncMultEthTagRParserTest method parserTest.

@Test
public void parserTest() {
    final IncMultiEthernetTagResCase expected = IncMultEthTagRParserTest.createIncMultiCase();
    assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
    final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE));
    assertEquals(expected, result);
    final ContainerNode incMult = createContBuilder(IncMultEthTagRParser.INC_MULT_ROUTE_NID).addChild(createEti()).addChild(createValueBuilder(IP_MODEL, ORI_NID).build()).build();
    final EvpnChoice modelResult = this.parser.serializeEvpnModel(incMult);
    assertEquals(expected, modelResult);
    final EvpnChoice keyResult = this.parser.createRouteKey(incMult);
    assertEquals(expected, keyResult);
}
Also used : IncMultiEthernetTagResCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.evpn.choice.IncMultiEthernetTagResCase) EvpnChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.EvpnChoice) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) Test(org.junit.Test)

Aggregations

IncMultiEthernetTagResCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.evpn.choice.IncMultiEthernetTagResCase)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 EvpnChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.EvpnChoice)1 IncMultiEthernetTagRes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.inc.multi.ethernet.tag.res.IncMultiEthernetTagRes)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1