use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel in project bgpcep by opendaylight.
the class ESILabelExtCom method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final boolean singleActive = buffer.readBoolean();
buffer.skipBytes(RESERVED);
final MplsLabel label = mplsLabelForByteBuf(buffer);
return new EsiLabelExtendedCommunityCaseBuilder().setEsiLabelExtendedCommunity(new EsiLabelExtendedCommunityBuilder().setEsiLabel(label).setSingleActiveMode(singleActive).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel in project openflowplugin by opendaylight.
the class OfToSalMplsLabelCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull MplsLabelCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
MplsLabel mplsLabel = source.getMplsLabel();
if (mplsLabel != null) {
protocolMatchFieldsBuilder.setMplsLabel(mplsLabel.getMplsLabel());
matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel in project bgpcep by opendaylight.
the class AbstractLabeledUnicastRIBSupport method extractLabel.
public static List<LabelStack> extractLabel(final DataContainerNode<? extends PathArgument> route, final NodeIdentifier labelStackNid, final NodeIdentifier labelValueNid) {
final List<LabelStack> labels = new ArrayList<>();
final Optional<DataContainerChild<? extends PathArgument, ?>> labelStacks = route.getChild(labelStackNid);
if (labelStacks.isPresent()) {
for (final UnkeyedListEntryNode label : ((UnkeyedListNode) labelStacks.get()).getValue()) {
final Optional<DataContainerChild<? extends PathArgument, ?>> labelStack = label.getChild(labelValueNid);
if (labelStack.isPresent()) {
final LabelStackBuilder labelStackbuilder = new LabelStackBuilder();
labelStackbuilder.setLabelValue(new MplsLabel((Long) labelStack.get().getValue()));
labels.add(labelStackbuilder.build());
}
}
}
return labels;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel in project bgpcep by opendaylight.
the class LUNlriParser method parseLabel.
public static List<LabelStack> parseLabel(final ByteBuf nlri) {
if (!nlri.isReadable()) {
return null;
}
final List<LabelStack> labels = new ArrayList<>();
boolean bottomBit;
do {
final ByteBuf slice = nlri.readSlice(LABEL_LENGTH);
bottomBit = MplsLabelUtil.getBottomBit(slice);
final MplsLabel mplsLabel = MplsLabelUtil.mplsLabelForByteBuf(slice);
if (MplsLabelUtil.intForMplsLabel(mplsLabel) == WITHDRAW_LABEL_INT_VALUE) {
return null;
}
labels.add(new LabelStackBuilder().setLabelValue(mplsLabel).build());
} while (!bottomBit);
return labels;
}
Aggregations