Search in sources :

Example 26 with Reports

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

the class PCEPTopologySessionListener method onMessage.

@Override
protected synchronized boolean onMessage(final MessageContext ctx, final Message message) {
    if (message instanceof PcerrMessage) {
        return handleErrorMessage((PcerrMessage) message);
    }
    if (message instanceof Pcreq) {
        LOG.info("PcReq detected. Start Request Message handler");
        return handlePcreqMessage(((Pcreq) message).getPcreqMessage());
    }
    if (!(message instanceof PcrptMessage)) {
        return true;
    }
    listenerState.updateLastReceivedRptMsg();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.PcrptMessage rpt = ((PcrptMessage) message).getPcrptMessage();
    for (final Reports report : rpt.getReports()) {
        if (!manageNextReport(report, ctx)) {
            return false;
        }
    }
    return false;
}
Also used : PcrptMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcrptMessage) PcerrMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.PcerrMessage) Reports(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.pcrpt.message.Reports) Pcreq(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcreq)

Example 27 with Reports

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

the class StatefulPCReportMessageParser method validate.

@Override
public Message validate(final Queue<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
    checkArgument(objects != null, "Passed list can't be null.");
    if (objects.isEmpty()) {
        throw new PCEPDeserializerException("Pcrpt message cannot be empty.");
    }
    final List<Reports> reports = new ArrayList<>();
    while (!objects.isEmpty()) {
        final Reports report = getValidReports(objects, errors);
        if (report != null) {
            reports.add(report);
        }
    }
    return new PcrptBuilder().setPcrptMessage(new PcrptMessageBuilder().setReports(reports).build()).build();
}
Also used : PcrptBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcrptBuilder) ArrayList(java.util.ArrayList) Reports(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.pcrpt.message.Reports) PcrptMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.PcrptMessageBuilder) PCEPDeserializerException(org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)

Example 28 with Reports

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

the class StatefulPCReportMessageParser method serializeMessage.

@Override
public void serializeMessage(final Message message, final ByteBuf out) {
    checkArgument(message instanceof Pcrpt, "Wrong instance of Message. Passed instance of %s. Need Pcrpt.", message.getClass());
    final Pcrpt msg = (Pcrpt) message;
    final List<Reports> reports = msg.getPcrptMessage().getReports();
    final ByteBuf buffer = Unpooled.buffer();
    for (final Reports report : reports) {
        serializeReport(report, buffer);
    }
    MessageUtil.formatMessage(TYPE, buffer, out);
}
Also used : Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt) Reports(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.pcrpt.message.Reports) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

Reports (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.pcrpt.message.Reports)9 Reports (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports)6 Test (org.junit.Test)5 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)5 ArrayList (java.util.ArrayList)4 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)4 ByteBuf (io.netty.buffer.ByteBuf)3 Collections (java.util.Collections)3 BandwidthUsage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.bandwidth.usage.object.BandwidthUsage)3 ReportsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.ReportsBuilder)3 PcrptBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcrptBuilder)3 Lsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.Lsp)3 ReportsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.pcrpt.message.ReportsBuilder)3 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 ArrayDeque (java.util.ArrayDeque)2 List (java.util.List)2 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)2 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)2 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)2 ListenableFutures (org.opendaylight.infrautils.utils.concurrent.ListenableFutures)2