Search in sources :

Example 6 with SrpIdNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber in project bgpcep by opendaylight.

the class StatefulSrpObjectParser method serializeObject.

@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
    checkArgument(object instanceof Srp, "Wrong instance of PCEPObject. Passed %s . Needed SrpObject.", object.getClass());
    final Srp srp = (Srp) object;
    final ByteBuf body = Unpooled.buffer();
    serializeFlags(srp, body);
    final SrpIdNumber srpId = srp.getOperationId();
    checkArgument(srpId != null, "SrpId is mandatory.");
    ByteBufUtils.write(body, srpId.getValue());
    serializeTlvs(srp.getTlvs(), body);
    ObjectUtil.formatSubobject(TYPE, CLASS, object.getProcessingRule(), object.getIgnore(), body, buffer);
}
Also used : Srp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp) SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber) ByteBuf(io.netty.buffer.ByteBuf)

Example 7 with SrpIdNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber 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.empty();
    if (this.syncOptimization.isSyncAvoidanceEnabled()) {
        tlv = createLspTlvsEndofSync(this.syncOptimization.incrementLspDBVersion().get());
    }
    final Pcrpt pcrtp = createPcRtpMessage(createLsp(Uint32.ZERO, false, tlv, true, false), Optional.ofNullable(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.rev200720.srp.object.Srp) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.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.rev200720.srp.object.SrpBuilder) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt)

Example 8 with SrpIdNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method reportAllKnownLsp.

private void reportAllKnownLsp(final Optional<SrpIdNumber> operationId, final PCCSession session) {
    Srp srp = null;
    if (operationId.isPresent()) {
        srp = new SrpBuilder().setOperationId(operationId.get()).build();
    }
    for (final Entry<PlspId, PCCTunnel> entry : this.tunnels.entrySet()) {
        final PCCTunnel tunnel = entry.getValue();
        final Uint32 plspId = entry.getKey().getValue();
        createLspAndSendReport(plspId, tunnel, session, Optional.empty(), Optional.ofNullable(srp));
    }
}
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.rev200720.srp.object.Srp) SrpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder) Uint32(org.opendaylight.yangtools.yang.common.Uint32) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)

Example 9 with SrpIdNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber in project bgpcep by opendaylight.

the class PCCTunnelManagerImplTest method createRequests.

private static Requests createRequests(final long plspId, final Optional<Boolean> remove, final Optional<Boolean> delegate) {
    final LspBuilder lsp = new LspBuilder().setTlvs(new TlvsBuilder().setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(SYMBOLIC_NAME)).build()).build()).setPlspId(new PlspId(Uint32.valueOf(plspId)));
    if (delegate.isPresent()) {
        lsp.setDelegate(Boolean.TRUE);
    }
    final SrpBuilder srpBuilder = new SrpBuilder();
    if (remove.isPresent()) {
        srpBuilder.addAugmentation(new Srp1Builder().setRemove(Boolean.TRUE).build());
    }
    return new RequestsBuilder().setEro(ERO).setLsp(lsp.build()).setSrp(srpBuilder.setOperationId(new SrpIdNumber(Uint32.ZERO)).build()).build();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder) SrpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder) SymbolicPathNameBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.symbolic.path.name.tlv.SymbolicPathNameBuilder) SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder) SymbolicPathName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SymbolicPathName) Srp1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder) RequestsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.RequestsBuilder) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)

Example 10 with SrpIdNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method handledDbTriggeredResync.

private void handledDbTriggeredResync(final Updates update, final PCCSession session) {
    this.syncOptimization.setResynchronizingState(true);
    final SrpIdNumber operationId = update.getSrp().getOperationId();
    if (update.getLsp().getPlspId().getValue().toJava() == 0) {
        reportAllKnownLsp(Optional.of(operationId), session);
    } else {
        reportLsp(update.getLsp().getPlspId(), operationId, session);
    }
    sendEndOfSynchronization(session, Optional.of(operationId));
    this.syncOptimization.setResynchronizingState(false);
}
Also used : SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber)

Aggregations

SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber)17 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder)14 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber)9 Srp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.Srp)9 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)7 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder)6 ByteBuf (io.netty.buffer.ByteBuf)5 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder)5 PcupdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcupdBuilder)5 PcupdMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.PcupdMessageBuilder)5 Collections (java.util.Collections)4 Srp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder)4 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)4 Lsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.Lsp)4 Test (org.junit.Test)3 MsgBuilderUtil.createSrp (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createSrp)3 PcupdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcupdBuilder)3 PcupdMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.PcupdMessageBuilder)3 PcrptMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcrptMessage)3 UpdatesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.UpdatesBuilder)3