Search in sources :

Example 31 with BitArray

use of org.opendaylight.protocol.util.BitArray 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(buffer.readUnsignedByte()));
    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();
}
Also used : SrBindingSidLabelsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.prefix.state.SrBindingSidLabelsBuilder) BitArray(org.opendaylight.protocol.util.BitArray) Weight(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight)

Example 32 with BitArray

use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.

the class RangeTlvParser method serializeSrRange.

public static void serializeSrRange(final SrRange srRange, final ByteBuf aggregator) {
    final BitArray flags = new BitArray(FLAGS_SIZE);
    flags.set(INNER_AREA, srRange.isInterArea());
    flags.toByteBuf(aggregator);
    aggregator.writeZero(RESERVED);
    aggregator.writeShort(srRange.getRangeSize());
    serializeSubTlvs(aggregator, srRange.getSubTlvs());
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray)

Example 33 with BitArray

use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.

the class UnnumberedEroParser method parseUnnumberedEroCase.

static UnnumberedInterfaceIdEroCase parseUnnumberedEroCase(final ByteBuf buffer) {
    final UnnumberedInterfaceIdEroCaseBuilder builder = new UnnumberedInterfaceIdEroCaseBuilder();
    final BitArray flags = BitArray.valueOf(buffer, Ipv4EroParser.FLAGS_SIZE);
    builder.setLoose(flags.get(Ipv4EroParser.LOOSE));
    buffer.skipBytes(Ipv4EroParser.RESERVED_ERO);
    builder.setRouterId(buffer.readUnsignedInt());
    builder.setInterfaceId(buffer.readUnsignedInt());
    return builder.build();
}
Also used : UnnumberedInterfaceIdEroCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.binding.sub.tlv.UnnumberedInterfaceIdEroCaseBuilder) BitArray(org.opendaylight.protocol.util.BitArray)

Example 34 with BitArray

use of org.opendaylight.protocol.util.BitArray 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(buffer.readUnsignedByte());
        buffer.skipBytes(RESERVED);
        sidValue = SidLabelIndexParser.parseSidLabelIndex(Size.forValue(buffer.readableBytes()), buffer);
    } else {
        adjFlags = null;
        weight = null;
        sidValue = null;
    }
    return new SrAdjIdsBuilder().setFlags(adjFlags).setSidLabelIndex(sidValue).setWeight(weight).build();
}
Also used : SidLabelIndex(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.sid.label.index.SidLabelIndex) SrAdjIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.attribute.SrAdjIdsBuilder) Flags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.Flags) BitArray(org.opendaylight.protocol.util.BitArray) Weight(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight)

Example 35 with BitArray

use of org.opendaylight.protocol.util.BitArray 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 OspfAdjFlagsCase ospfFlags = (OspfAdjFlagsCase) flags;
        bitFlags.set(BACKUP_OSPF, ospfFlags.isBackup());
        bitFlags.set(SET_OSPF, ospfFlags.isSet());
        SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_OSPF, LOCAL_OSPF);
    } else if (flags instanceof IsisAdjFlagsCase) {
        final IsisAdjFlagsCase isisFlags = (IsisAdjFlagsCase) flags;
        bitFlags.set(ADDRESS_FAMILY_FLAG, isisFlags.isAddressFamily());
        bitFlags.set(BACKUP_ISIS, isisFlags.isBackup());
        bitFlags.set(SET_ISIS, isisFlags.isSet());
        SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_ISIS, LOCAL_ISIS);
    } else if (flags == null) {
        SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_EPE, LOCAL_EPE);
    }
    return bitFlags;
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray) IsisAdjFlagsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.flags.IsisAdjFlagsCase) OspfAdjFlagsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.adj.flags.flags.OspfAdjFlagsCase)

Aggregations

BitArray (org.opendaylight.protocol.util.BitArray)100 ByteBuf (io.netty.buffer.ByteBuf)27 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)8 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)8 RSVPParsingException (org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException)6 IpPrefixSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.IpPrefixSubobject)4 IpPrefixCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCase)4 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)3 Weight (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight)3 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder)3 LabelType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType)3 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder)3 IpPrefixCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder)3 IpPrefixBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder)3 ArrayList (java.util.ArrayList)2 ByteBufWriteUtil.writeFloat32 (org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32)2 Stateful1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1)2 Nai (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.Nai)2 RequestId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId)2 Flags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring.Flags)2