Search in sources :

Example 31 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method createLspAndSendReport.

private void createLspAndSendReport(final long plspId, final PCCTunnel tunnel, final PCCSession session, final Optional<Boolean> isSync, final Optional<Srp> srp) {
    final boolean delegation = hasDelegation(tunnel, session);
    if (delegation) {
        tunnel.cancelTimeouts();
    }
    final String destinationAddress = getDestinationAddress(tunnel.getLspState().getEro().getSubobject(), this.address);
    final Tlvs tlvs = createLspTlvs(plspId, true, destinationAddress, this.address, this.address, Optional.of(tunnel.getPathName()), this.syncOptimization.incrementLspDBVersion());
    final boolean sync = isSync.isPresent() ? isSync.get() : this.syncOptimization.isSyncNeedIt();
    final Lsp lsp = createLsp(plspId, sync, Optional.fromNullable(tlvs), delegation, false);
    final Pcrpt pcrtp = createPcRtpMessage(lsp, srp, tunnel.getLspState());
    session.sendReport(pcrtp);
}
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) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) MsgBuilderUtil.createLsp(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLsp) Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp)

Example 32 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs 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 33 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.

the class Stateful07TopologySessionListener method buildPath.

private Path buildPath(final Reports report, final Srp srp, final Lsp lsp) {
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder pb = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder();
    if (report.getPath() != null) {
        pb.fieldsFrom(report.getPath());
    }
    // LSP is mandatory (if there is none, parser will throw an exception)
    // this is to ensure a path will be created at any rate
    final Path1Builder p1Builder = new Path1Builder();
    p1Builder.setLsp(report.getLsp());
    final PathSetupType pst;
    if (srp != null && srp.getTlvs() != null && srp.getTlvs().getPathSetupType() != null) {
        pst = srp.getTlvs().getPathSetupType();
        p1Builder.setPathSetupType(pst);
    } else {
        pst = null;
    }
    pb.addAugmentation(Path1.class, p1Builder.build());
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs tlvs = report.getLsp().getTlvs();
    if (tlvs != null) {
        if (tlvs.getLspIdentifiers() != null) {
            pb.setLspId(tlvs.getLspIdentifiers().getLspId());
        } else if (!PSTUtil.isDefaultPST(pst)) {
            pb.setLspId(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId(lsp.getPlspId().getValue()));
        }
    }
    return pb.build();
}
Also used : LspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.LspId) Preconditions(com.google.common.base.Preconditions) Collections(java.util.Collections) PathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.updates.PathBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) Path1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Path1Builder) StatefulTlv1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.StatefulTlv1)

Example 34 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.

the class SegmentRoutingActivator method startImpl.

@Override
protected List<AutoCloseable> startImpl(final PCEPExtensionProviderContext context) {
    final List<AutoCloseable> regs = Lists.newArrayList();
    /* Tlvs */
    regs.add(context.registerTlvParser(SrPceCapabilityTlvParser.TYPE, new SrPceCapabilityTlvParser()));
    regs.add(context.registerTlvParser(SrPathSetupTypeTlvParser.TYPE, new SrPathSetupTypeTlvParser()));
    regs.add(context.registerTlvSerializer(PathSetupType.class, new SrPathSetupTypeTlvParser()));
    regs.add(context.registerTlvSerializer(SrPceCapability.class, new SrPceCapabilityTlvParser()));
    /* Subobjects */
    final SrEroSubobjectParser srEroSubobjectParser = new SrEroSubobjectParser(this.ianaSrSubobjectsType);
    regs.add(context.registerEROSubobjectParser(srEroSubobjectParser.getCodePoint(), srEroSubobjectParser));
    regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.network.topology.topology.node.path.computation.client.reported.lsp.path.ero.subobject.subobject.type.SrEroType.class, srEroSubobjectParser));
    regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcinitiate.pcinitiate.message.requests.ero.subobject.subobject.type.SrEroType.class, srEroSubobjectParser));
    regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcrep.pcrep.message.replies.result.success._case.success.paths.ero.subobject.subobject.type.SrEroType.class, srEroSubobjectParser));
    regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcrpt.pcrpt.message.reports.path.ero.subobject.subobject.type.SrEroType.class, srEroSubobjectParser));
    regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcupd.pcupd.message.updates.path.ero.subobject.subobject.type.SrEroType.class, srEroSubobjectParser));
    regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroType.class, srEroSubobjectParser));
    regs.add(context.registerEROSubobjectSerializer(SrEroType.class, srEroSubobjectParser));
    final SrRroSubobjectParser srRroSubobjectParser = new SrRroSubobjectParser(this.ianaSrSubobjectsType);
    regs.add(context.registerRROSubobjectParser(srRroSubobjectParser.getCodePoint(), srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.network.topology.topology.node.path.computation.client.reported.lsp.path.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcinitiate.pcinitiate.message.requests.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcrep.pcrep.message.replies.result.failure._case.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcreq.pcreq.message.requests.segment.computation.p2p.reported.route.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcrpt.pcrpt.message.reports.path.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcupd.pcupd.message.updates.path.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.update.lsp.input.arguments.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcrep.pcrep.message.replies.result.success._case.success.paths.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.pcreq.pcreq.message.requests.segment.computation.p2p.rro.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
    regs.add(context.registerRROSubobjectSerializer(SrRroType.class, srRroSubobjectParser));
    /* Objects */
    final TlvRegistry tlvReg = context.getTlvHandlerRegistry();
    final VendorInformationTlvRegistry viTlvRegistry = context.getVendorInformationTlvRegistry();
    regs.add(context.registerObjectParser(PcepOpenObjectWithSpcTlvParser.CLASS, PcepOpenObjectWithSpcTlvParser.TYPE, new PcepOpenObjectWithSpcTlvParser(tlvReg, viTlvRegistry)));
    regs.add(context.registerObjectSerializer(Open.class, new PcepOpenObjectWithSpcTlvParser(tlvReg, viTlvRegistry)));
    return regs;
}
Also used : SrRroType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroType) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) SrPceCapability(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.pce.capability.tlv.SrPceCapability) Open(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open) VendorInformationTlvRegistry(org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry) SrEroType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroType) VendorInformationTlvRegistry(org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry) TlvRegistry(org.opendaylight.protocol.pcep.spi.TlvRegistry)

Example 35 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.

the class MsgBuilderUtil method createLsp.

public static Lsp createLsp(final long plspId, final boolean sync, final Optional<Tlvs> tlvs, final boolean isDelegatedLsp, final boolean remove) {
    final LspBuilder lspBuilder = new LspBuilder();
    lspBuilder.setAdministrative(true);
    lspBuilder.setDelegate(isDelegatedLsp);
    lspBuilder.setIgnore(false);
    lspBuilder.setOperational(OperationalStatus.Up);
    lspBuilder.setPlspId(new PlspId(plspId));
    lspBuilder.setProcessingRule(false);
    lspBuilder.setRemove(remove);
    lspBuilder.setSync(sync);
    lspBuilder.setTlvs(tlvs.orNull());
    return lspBuilder.build();
}
Also used : 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)27 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)21 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs)13 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt)11 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder)10 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs)9 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)9 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)8 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)8 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)8 ArrayList (java.util.ArrayList)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 Pcinitiate (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Pcinitiate)7 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.Requests)7 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)6 BgpParameters (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.BgpParameters)5 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)5 Collections (java.util.Collections)4 BGPSessionPreferences (org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences)4