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