Search in sources :

Example 1 with IncMultiEthernetTagResCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.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 DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
    choice.withNodeIdentifier(IncMultEthTagRParser.INC_MULT_ROUTE_NID);
    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.rev171213.evpn.evpn.choice.IncMultiEthernetTagResCase) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) EvpnChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) Test(org.junit.Test)

Example 2 with IncMultiEthernetTagResCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.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();
    ByteBufWriteUtil.writeUnsignedInt(evpn.getEthernetTagId().getVlanId(), body);
    final ByteBuf orig = EthSegRParser.serializeOrigRouteIp(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.rev171213.inc.multi.ethernet.tag.res.IncMultiEthernetTagRes) IncMultiEthernetTagResCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.evpn.choice.IncMultiEthernetTagResCase) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

IncMultiEthernetTagResCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.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.rev171213.evpn.EvpnChoice)1 IncMultiEthernetTagRes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.inc.multi.ethernet.tag.res.IncMultiEthernetTagRes)1 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)1 ChoiceNode (org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1