use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.evpn.choice.EsRouteCase in project bgpcep by opendaylight.
the class EthSegRParserTest method parser2Test.
@Test
public void parser2Test() {
final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IPV6).build()).build();
assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE2));
assertEquals(expected, result);
final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
choice.withNodeIdentifier(EthSegRParser.ES_ROUTE_NID);
final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID).addChild(LanParserTest.createLanChoice()).addChild(createValueBuilder(IPV6_MODEL, ORI_NID).build()).build();
final EvpnChoice modelResult = this.parser.serializeEvpnModel(arbitraryC);
assertEquals(expected, modelResult);
final EvpnChoice keyResult = this.parser.createRouteKey(arbitraryC);
assertEquals(expected, keyResult);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.evpn.choice.EsRouteCase in project bgpcep by opendaylight.
the class EthSegRParser method serializeBody.
@Override
public ByteBuf serializeBody(final EvpnChoice evpnInput) {
checkArgument(evpnInput instanceof EsRouteCase, "Unknown evpn instance. Passed %s. Needed EsRouteCase.", evpnInput.getClass());
final EsRoute evpn = ((EsRouteCase) evpnInput).getEsRoute();
final ByteBuf body = Unpooled.buffer();
SimpleEsiTypeRegistry.getInstance().serializeEsi(evpn.getEsi(), body);
final ByteBuf orig = IpAddressUtil.bytesFor(evpn.getOrigRouteIp());
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.EsRouteCase in project bgpcep by opendaylight.
the class EthSegRParserTest method parserTest.
@Test
public void parserTest() {
final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IP).build()).build();
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 arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID).addChild(LanParserTest.createLanChoice()).addChild(createValueBuilder(IP_MODEL, ORI_NID).build()).build();
final EvpnChoice modelResult = this.parser.serializeEvpnModel(arbitraryC);
assertEquals(expected, modelResult);
final EvpnChoice keyResult = this.parser.createRouteKey(arbitraryC);
assertEquals(expected, keyResult);
}
Aggregations