Search in sources :

Example 1 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.Tlvs in project bgpcep by opendaylight.

the class InitiationHandler method serializeTlvs.

private void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
    serializeTlv(tlvs.getNameTlv(), output);
    serializeTlv(tlvs.getDescriptionTlv(), output);
    if (tlvs.getStringInformation() != null) {
        for (final StringInformation stringInfo : tlvs.getStringInformation()) {
            if (stringInfo.getStringTlv() != null) {
                serializeTlv(stringInfo.getStringTlv(), output);
            }
        }
    }
}
Also used : StringInformation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.string.informations.StringInformation)

Example 2 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.Tlvs in project bgpcep by opendaylight.

the class RouteMirroringMessageHandler method serializeTlvs.

protected void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
    final ByteBuf tlvsBuffer = Unpooled.buffer();
    if (tlvs.getMirrorInformationTlv() != null) {
        serializeTlv(tlvs.getMirrorInformationTlv(), tlvsBuffer);
    }
    if (tlvs.getPduUpdateTlv() != null) {
        getBgpMessageRegistry().serializeMessage(new UpdateBuilder(tlvs.getPduUpdateTlv()).build(), tlvsBuffer);
    }
    if (tlvs.getPduOpenTlv() != null) {
        getBgpMessageRegistry().serializeMessage(new OpenBuilder(tlvs.getPduOpenTlv()).build(), tlvsBuffer);
    }
    output.writeBytes(tlvsBuffer);
}
Also used : OpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.OpenBuilder) UpdateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder) ByteBuf(io.netty.buffer.ByteBuf)

Example 3 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.Tlvs in project bgpcep by opendaylight.

the class AbstractObjectWithTlvsParser method serializeVendorInformationTlvs.

protected final void serializeVendorInformationTlvs(final List<VendorInformationTlv> tlvs, final ByteBuf buffer) {
    if (tlvs != null) {
        for (final VendorInformationTlv tlv : tlvs) {
            LOG.trace("Serializing VENDOR-INFORMATION TLV {}", tlv);
            this.viTlvReg.serializeVendorInformationTlv(tlv, buffer);
            LOG.trace("Serialized VENDOR-INFORMATION TLV : {}.", ByteBufUtil.hexDump(buffer));
        }
    }
}
Also used : VendorInformationTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.tlvs.VendorInformationTlv)

Example 4 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.Tlvs in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method sendEndOfSynchronization.

private void sendEndOfSynchronization(final PCCSession session, final Optional<SrpIdNumber> operationId) {
    Srp srp = null;
    if (operationId.isPresent()) {
        srp = new SrpBuilder().setOperationId(operationId.get()).build();
    }
    Optional<Tlvs> tlv = Optional.absent();
    if (this.syncOptimization.isSyncAvoidanceEnabled()) {
        tlv = createLspTlvsEndofSync(this.syncOptimization.incrementLspDBVersion().get());
    }
    final Pcrpt pcrtp = createPcRtpMessage(createLsp(0, false, tlv, true, false), Optional.fromNullable(srp), createPath(Collections.emptyList()));
    session.sendReport(pcrtp);
}
Also used : MsgBuilderUtil.createSrp(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createSrp) Srp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.Srp) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs) MsgBuilderUtil.createLspTlvs(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs) SrpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)

Example 5 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.Tlvs in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method takeDelegation.

protected void takeDelegation(final Requests request, final PCCSession session) {
    final PlspId plspId = request.getLsp().getPlspId();
    final PCCTunnel tunnel = this.tunnels.get(plspId);
    final long srpId = request.getSrp().getOperationId().getValue();
    if (tunnel != null) {
        // check if tunnel has no delegation
        if ((tunnel.getType() == LspType.PCE_LSP) && ((tunnel.getDelegationHolder() == -1) || (tunnel.getDelegationHolder() == session.getId()))) {
            // set delegation
            tunnel.cancelTimeouts();
            setDelegation(plspId, session);
            // send report
            final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.absent());
            session.sendReport(createPcRtpMessage(new LspBuilder(request.getLsp()).setSync(true).setOperational(OperationalStatus.Up).setDelegate(true).setTlvs(tlvs).build(), Optional.of(createSrp(srpId)), tunnel.getLspState()));
        } else {
            session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.LSP_NOT_PCE_INITIATED, srpId));
        }
    } else {
        session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UNKNOWN_PLSP_ID, srpId));
    }
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs) MsgBuilderUtil.createLspTlvs(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Aggregations

Test (org.junit.Test)21 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)13 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)13 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)11 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)11 BgpParameters (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters)9 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs)9 BgpParametersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParametersBuilder)8 OptionalCapabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities)8 OptionalCapabilitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilitiesBuilder)8 CParametersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder)8 CParameters1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder)8 OpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.OpenBuilder)7 As4BytesCapabilityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapabilityBuilder)7 MultiprotocolCapabilityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapabilityBuilder)7 Pcinitiate (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Pcinitiate)7 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)7 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)7 ProtocolVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.ProtocolVersion)6 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)5