use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice in project bgpcep by opendaylight.
the class EthSegRParser method serializeBody.
@Override
public ByteBuf serializeBody(final EvpnChoice evpnInput) {
Preconditions.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 = serializeOrigRouteIp(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.rev171213.evpn.EvpnChoice in project bgpcep by opendaylight.
the class EthSegRParser method createRouteKey.
@Override
public EvpnChoice createRouteKey(final ContainerNode evpn) {
final EsRouteBuilder builder = new EsRouteBuilder();
builder.setEsi(serializeEsi(evpn));
builder.setOrigRouteIp(extractOrigRouteIp(evpn));
return new EsRouteCaseBuilder().setEsRoute(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice in project bgpcep by opendaylight.
the class EvpnNlriParser method extractDestination.
private static EvpnDestination extractDestination(final DataContainerNode<? extends PathArgument> evpnChoice, final ExtractionInterface extract) {
final EvpnRegistry reg = SimpleEvpnNlriRegistry.getInstance();
final ChoiceNode cont = (ChoiceNode) evpnChoice.getChild(EVPN_CHOICE_NID).get();
final EvpnChoice evpnValue = extract.check(reg, cont);
if (evpnValue == null) {
LOG.warn("Unrecognized Nlri {}", cont);
return null;
}
return new EvpnDestinationBuilder().setRouteDistinguisher(extractRouteDistinguisher(evpnChoice)).setEvpnChoice(evpnValue).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice 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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice in project bgpcep by opendaylight.
the class MACIpAdvRParser method parseEvpn.
@Override
public EvpnChoice parseEvpn(final ByteBuf buffer) {
final Esi esi = SimpleEsiTypeRegistry.getInstance().parseEsi(buffer.readSlice(ESI_SIZE));
final EthernetTagId eti = new EthernetTagIdBuilder().setVlanId(buffer.readUnsignedInt()).build();
buffer.skipBytes(1);
final MacAddress mac = IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH));
final IpAddress ip = parseIp(buffer);
final MplsLabel label1 = mplsLabelForByteBuf(buffer);
MplsLabel label2;
if (buffer.readableBytes() > 0) {
label2 = mplsLabelForByteBuf(buffer);
} else {
label2 = null;
}
final MacIpAdvRouteBuilder builder = new MacIpAdvRouteBuilder().setEsi(esi).setEthernetTagId(eti).setMacAddress(mac).setIpAddress(ip).setMplsLabel1(label1).setMplsLabel2(label2);
return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(builder.build()).build();
}
Aggregations