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);
}
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;
}
Aggregations