Search in sources :

Example 76 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring.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();
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray) Ipv4EroBackupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.Ipv4EroBackupCaseBuilder) Ipv4EroBackupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.ipv4.ero.backup._case.Ipv4EroBackupBuilder)

Example 77 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring.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();
}
Also used : SrBindingSidLabelsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.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.rev200120.Weight)

Example 78 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring.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();
}
Also used : SidLabelIndex(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.SidLabelIndex) SrAdjIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.attribute.SrAdjIdsBuilder) OspfAdjFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.ospf.adj.flags._case.OspfAdjFlags) Flags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.Flags) IsisAdjFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.isis.adj.flags._case.IsisAdjFlags) BitArray(org.opendaylight.protocol.util.BitArray) Weight(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.Weight)

Example 79 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring.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;
}
Also used : OspfAdjFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.ospf.adj.flags._case.OspfAdjFlags) BitArray(org.opendaylight.protocol.util.BitArray) IsisAdjFlagsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.IsisAdjFlagsCase) OspfAdjFlagsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.OspfAdjFlagsCase) IsisAdjFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.isis.adj.flags._case.IsisAdjFlags)

Example 80 with Flags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.object.Monitoring.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);
    }
}
Also used : UnrecognizedAttributesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.UnrecognizedAttributesKey) UnrecognizedAttributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.UnrecognizedAttributes)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)120 Test (org.junit.Test)106 BitArray (org.opendaylight.protocol.util.BitArray)77 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)61 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)40 ArrayList (java.util.ArrayList)29 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)25 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)23 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)20 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)12 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)12 BigInteger (java.math.BigInteger)11 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)9 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)9 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)8 BundleFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags)8 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)8 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)7 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)7 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.UpdateBuilder)7