Search in sources :

Example 81 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.

the class SimpleBindingSubTlvsRegistry method serializeBindingSubTlvs.

public void serializeBindingSubTlvs(final List<BindingSubTlvs> bindingSubTlvs, final ByteBuf aggregator) {
    for (final BindingSubTlvs subTlv : bindingSubTlvs) {
        final BindingSubTlv bindingSubTlv = subTlv.getBindingSubTlv();
        final BindingSubTlvsSerializer serializer = this.handlers.getSerializer(bindingSubTlv.getImplementedInterface());
        if (serializer == null) {
            LOG.info("Unknown binding sub Tlv type {}", subTlv);
            return;
        }
        serializer.serializeSubTlv(bindingSubTlv, aggregator);
    }
}
Also used : BindingSubTlvsSerializer(org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsSerializer) BindingSubTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.BindingSubTlv) BindingSubTlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sid.tlv.BindingSubTlvs)

Example 82 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.

the class Stateful07TopologySessionListener method onSessionUp.

@Override
protected void onSessionUp(final PCEPSession session, final PathComputationClientBuilder pccBuilder) {
    final InetAddress peerAddress = session.getRemoteAddress();
    final Tlvs tlvs = session.getRemoteTlvs();
    if (tlvs != null && tlvs.getAugmentation(Tlvs1.class) != null) {
        final Stateful stateful = tlvs.getAugmentation(Tlvs1.class).getStateful();
        if (stateful != null) {
            setStatefulCapabilities(stateful);
            pccBuilder.setReportedLsp(Collections.emptyList());
            if (isSynchronized()) {
                pccBuilder.setStateSync(PccSyncState.Synchronized);
            } else if (isTriggeredInitialSynchro()) {
                pccBuilder.setStateSync(PccSyncState.TriggeredInitialSync);
            } else if (isIncrementalSynchro()) {
                pccBuilder.setStateSync(PccSyncState.IncrementalSync);
            } else {
                pccBuilder.setStateSync(PccSyncState.InitialResync);
            }
            pccBuilder.setStatefulTlv(new StatefulTlvBuilder().addAugmentation(StatefulTlv1.class, new StatefulTlv1Builder(tlvs.getAugmentation(Tlvs1.class)).build()).build());
        } else {
            LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
        }
    } else {
        LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
    }
}
Also used : Stateful(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.stateful.capability.tlv.Stateful) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs) StatefulTlv1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.StatefulTlv1Builder) InetAddress(java.net.InetAddress) Tlvs1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1) StatefulTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.StatefulTlvBuilder)

Example 83 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.

the class SrPceCapabilityTlvParser method serializeTlv.

@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
    Preconditions.checkArgument(tlv instanceof SrPceCapability, "SrPceCapability is mandatory.");
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    body.writerIndex(OFFSET);
    writeUnsignedByte(((SrPceCapability) tlv).getMsd(), body);
    TlvUtil.formatTlv(TYPE, body, buffer);
}
Also used : SrPceCapability(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.pce.capability.tlv.SrPceCapability) ByteBuf(io.netty.buffer.ByteBuf)

Example 84 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project jmulticard by ctt-gob-es.

the class DerBoolean method decodeValue.

@Override
protected void decodeValue() throws Asn1Exception, TlvException {
    final Tlv tmpTlv = new Tlv(this.getRawDerValue());
    checkTag(tmpTlv.getTag());
    this.booleanValue = Boolean.valueOf(tmpTlv.getValue()[0] == (byte) 0x00);
}
Also used : Tlv(es.gob.jmulticard.asn1.Tlv)

Example 85 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project jmulticard by ctt-gob-es.

the class OctectString method decodeValue.

@Override
protected void decodeValue() throws TlvException {
    final Tlv tlv = new Tlv(this.getRawDerValue());
    if (TAG_OCTECTSTRING != tlv.getTag()) {
        throw new TlvException(// $NON-NLS-1$
        "Se esperaba un TLV de tipo OctectString pero se ha encontrado uno de tipo " + HexUtils.hexify(new byte[] { tlv.getTag() }, false));
    }
    this.value = tlv.getValue();
}
Also used : TlvException(es.gob.jmulticard.asn1.TlvException) Tlv(es.gob.jmulticard.asn1.Tlv)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)53 Test (org.junit.Test)29 Tlv (es.gob.jmulticard.asn1.Tlv)11 ArrayList (java.util.ArrayList)8 TlvException (es.gob.jmulticard.asn1.TlvException)6 Asn1Exception (es.gob.jmulticard.asn1.Asn1Exception)4 DecoderObject (es.gob.jmulticard.asn1.DecoderObject)4 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)4 LspIdentifiersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder)4 Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.stateful.capability.tlv.Stateful)4 LspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId)4 TunnelId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId)4 EnterpriseNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber)3 LspIdentifiers (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiers)3 RsvpErrorSpec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.rsvp.error.spec.tlv.RsvpErrorSpec)3 VendorInformationTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.tlvs.VendorInformationTlv)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 BmpDeserializationException (org.opendaylight.protocol.bmp.spi.parser.BmpDeserializationException)2 Stateful07RSVPErrorSpecTlvParser (org.opendaylight.protocol.pcep.ietf.stateful07.Stateful07RSVPErrorSpecTlvParser)2 BitArray (org.opendaylight.protocol.util.BitArray)2