use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.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(ByteBufUtils.readUint32(buffer)).build();
buffer.skipBytes(1);
final MacAddress mac = IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH));
final IpAddressNoZone 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.EvpnChoice in project bgpcep by opendaylight.
the class MACIpAdvRParser method serializeEvpnModel.
@Override
public EvpnChoice serializeEvpnModel(final ContainerNode evpn) {
final MacIpAdvRouteBuilder builder = serializeKeyModel(evpn);
builder.setEsi(serializeEsi(evpn));
builder.setMplsLabel1(extractMplsLabel(evpn, MPLS1_NID));
builder.setMplsLabel2(extractMplsLabel(evpn, MPLS2_NID));
return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.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.rev200120.evpn.EvpnChoice 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.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();
ByteBufUtils.writeOrZero(body, evpn.getEthernetTagId().getVlanId());
final ByteBuf orig = IpAddressUtil.bytesFor(evpn.getOrigRouteIp());
Preconditions.checkArgument(orig.readableBytes() > 0);
body.writeBytes(orig);
return body;
}
Aggregations