use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project bgpcep by opendaylight.
the class Ipv4EroParser method parseIpv4EroBackupCase.
static Ipv4EroBackupCase parseIpv4EroBackupCase(final ByteBuf buffer) {
final Ipv4EroBackupBuilder builder = new Ipv4EroBackupBuilder();
final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
builder.setLoose(flags.get(LOOSE));
buffer.skipBytes(RESERVED_ERO);
builder.setAddress(Ipv4Util.addressForByteBuf(buffer));
return new Ipv4EroBackupCaseBuilder().setIpv4EroBackup(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project bgpcep by opendaylight.
the class BindingSidLabelParser method parseBindingSidLabel.
public static SrBindingSidLabels parseBindingSidLabel(final ByteBuf buffer, final ProtocolId protocolId) {
final SrBindingSidLabelsBuilder bindingSid = new SrBindingSidLabelsBuilder();
bindingSid.setWeight(new Weight(readUint8(buffer)));
final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
bindingSid.setFlags(parseBindingSidFlags(flags, protocolId));
buffer.skipBytes(RESERVED_BINDING_SID);
bindingSid.setBindingSubTlvs(SimpleBindingSubTlvsRegistry.getInstance().parseBindingSubTlvs(buffer, protocolId));
return bindingSid.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project bgpcep by opendaylight.
the class SrLinkAttributesParser method parseAdjacencySegmentIdentifier.
public static SrAdjIds parseAdjacencySegmentIdentifier(final ByteBuf buffer, final ProtocolId protocolId) {
final Flags adjFlags;
final Weight weight;
final SidLabelIndex sidValue;
if (buffer.isReadable()) {
final BitArray flags = BitArray.valueOf(buffer, FLAGS_BITS_SIZE);
adjFlags = parseFlags(flags, protocolId);
weight = new Weight(readUint8(buffer));
buffer.skipBytes(RESERVED);
final boolean isValue;
final boolean isLocal;
switch(protocolId) {
case IsisLevel1:
case IsisLevel2:
isValue = flags.get(VALUE_ISIS);
isLocal = flags.get(LOCAL_ISIS);
break;
case Ospf:
case OspfV3:
isValue = flags.get(VALUE_OSPF);
isLocal = flags.get(LOCAL_OSPF);
break;
default:
return null;
}
sidValue = SidLabelIndexParser.parseSidLabelIndexByFlags(Size.forValue(buffer.readableBytes()), buffer, isValue, isLocal);
} else {
adjFlags = null;
weight = null;
sidValue = null;
}
return new SrAdjIdsBuilder().setFlags(adjFlags).setSidLabelIndex(sidValue).setWeight(weight).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project bgpcep by opendaylight.
the class SrLinkAttributesParser method serializeAdjFlags.
private static BitArray serializeAdjFlags(final Flags flags, final SidLabelIndex sidLabelIndex) {
final BitArray bitFlags = new BitArray(FLAGS_BITS_SIZE);
if (flags instanceof OspfAdjFlagsCase) {
final OspfAdjFlags ospfFlags = ((OspfAdjFlagsCase) flags).getOspfAdjFlags();
bitFlags.set(BACKUP_OSPF, ospfFlags.getBackup());
bitFlags.set(SET_OSPF, ospfFlags.getSet());
SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_OSPF, LOCAL_OSPF);
} else if (flags instanceof IsisAdjFlagsCase) {
final IsisAdjFlags isisFlags = ((IsisAdjFlagsCase) flags).getIsisAdjFlags();
bitFlags.set(ADDRESS_FAMILY_FLAG, isisFlags.getAddressFamily());
bitFlags.set(BACKUP_ISIS, isisFlags.getBackup());
bitFlags.set(SET_ISIS, isisFlags.getSet());
SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_ISIS, LOCAL_ISIS);
} else if (flags == null) {
SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_EPE, LOCAL_EPE);
}
return bitFlags;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags in project bgpcep by opendaylight.
the class UnrecognizedAttributesSerializer method serializeAttribute.
@Override
public void serializeAttribute(final Attributes attributes, final ByteBuf byteAggregator) {
final Map<UnrecognizedAttributesKey, UnrecognizedAttributes> unrecognizedAttrs = attributes.getUnrecognizedAttributes();
if (unrecognizedAttrs == null) {
return;
}
for (final UnrecognizedAttributes unrecognizedAttr : unrecognizedAttrs.values()) {
LOG.trace("Serializing unrecognized attribute of type {}", unrecognizedAttr.getType());
int flags = AttributeUtil.OPTIONAL;
if (unrecognizedAttr.getPartial()) {
flags |= AttributeUtil.PARTIAL;
}
if (unrecognizedAttr.getTransitive()) {
flags |= AttributeUtil.TRANSITIVE;
}
AttributeUtil.formatAttribute(flags, unrecognizedAttr.getType().toJava(), Unpooled.wrappedBuffer(unrecognizedAttr.getValue()), byteAggregator);
}
}
Aggregations