Search in sources :

Example 1 with Metrics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.

the class PCEPReplyMessageParser method serializeFailure.

private void serializeFailure(final FailureCase f, final ByteBuf buffer) {
    if (f == null) {
        return;
    }
    serializeObject(f.getNoPath(), buffer);
    serializeObject(f.getLspa(), buffer);
    serializeObject(f.getBandwidth(), buffer);
    if (f.getMetrics() != null) {
        for (final Metrics m : f.getMetrics()) {
            serializeObject(m.getMetric(), buffer);
        }
    }
    serializeObject(f.getIro(), buffer);
}
Also used : Metrics(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics)

Example 2 with Metrics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.

the class PCEPRequestMessageParser method getValidSvec.

private static Svec getValidSvec(final SvecBuilder builder, final List<Object> objects) {
    Preconditions.checkArgument(objects != null && !objects.isEmpty(), "Passed list can't be null or empty.");
    if (objects.get(0) instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.Svec) {
        builder.setSvec((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.Svec) objects.get(0));
        objects.remove(0);
    } else {
        return null;
    }
    final List<Metrics> metrics = new ArrayList<>();
    final List<VendorInformationObject> viObjects = new ArrayList<>();
    Object obj = null;
    SvecState state = SvecState.INIT;
    while (!objects.isEmpty() && !state.equals(SvecState.END)) {
        obj = objects.get(0);
        state = insertObject(state, obj, builder, metrics, viObjects);
        if (!state.equals(SvecState.END)) {
            objects.remove(0);
        }
    }
    if (!viObjects.isEmpty()) {
        builder.setVendorInformationObject(viObjects);
    }
    return builder.build();
}
Also used : Preconditions(com.google.common.base.Preconditions) Svec(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Svec) ArrayList(java.util.ArrayList) Metrics(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) Object(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)

Example 3 with Metrics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.

the class PCEPRequestMessageParser method insertObject.

private static State insertObject(final State state, final List<Object> objects, final List<VendorInformationObject> viObjects, final P2pBuilder builder, final List<Metrics> metrics, final List<Message> errors, final Rp rp) {
    final Object obj = objects.get(0);
    switch(state) {
        case INIT:
            if (obj instanceof Rro) {
                builder.setRro((Rro) obj);
                objects.remove(0);
                final Object nextObj = objects.get(0);
                if (nextObj instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidth) {
                    builder.setReoptimizationBandwidth((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidth) nextObj);
                }
                return State.REPORTED_IN;
            }
        case REPORTED_IN:
            if (obj instanceof VendorInformationObject) {
                viObjects.add((VendorInformationObject) obj);
                return State.REPORTED_IN;
            }
        case VENDOR_INFO_LIST:
            if (obj instanceof LoadBalancing) {
                builder.setLoadBalancing((LoadBalancing) obj);
                return State.LOAD_BIN;
            }
        case LOAD_BIN:
            if (obj instanceof Lspa) {
                builder.setLspa((Lspa) obj);
                return State.LSPA_IN;
            }
        case LSPA_IN:
            if (obj instanceof Bandwidth) {
                builder.setBandwidth((Bandwidth) obj);
                return State.BANDWIDTH_IN;
            }
        case BANDWIDTH_IN:
            if (obj instanceof Metric) {
                metrics.add(new MetricsBuilder().setMetric((Metric) obj).build());
                return State.BANDWIDTH_IN;
            }
        case METRIC_IN:
            if (obj instanceof Iro) {
                builder.setIro((Iro) obj);
                return State.IRO_IN;
            }
        case IRO_IN:
            if (obj instanceof Rro) {
                builder.setRro((Rro) obj);
                return State.RRO_IN;
            }
        case RRO_IN:
            if (obj instanceof Xro) {
                builder.setXro((Xro) obj);
                return State.XRO_IN;
            }
        case XRO_IN:
            if (obj instanceof Of) {
                builder.setOf((Of) obj);
                return State.OF_IN;
            }
        case OF_IN:
            if (obj instanceof ClassType) {
                final ClassType classType = (ClassType) obj;
                if (!classType.isProcessingRule()) {
                    errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.of(rp)));
                } else {
                    builder.setClassType(classType);
                }
                return State.CT_IN;
            }
        case CT_IN:
        case END:
            return State.END;
        default:
            return state;
    }
}
Also used : Preconditions(com.google.common.base.Preconditions) Iro(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.Iro) Rro(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.Rro) MetricsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.MetricsBuilder) Xro(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.Xro) Bandwidth(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.Bandwidth) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) ClassType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.classtype.object.ClassType) LoadBalancing(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.load.balancing.object.LoadBalancing) Of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) Object(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object) Metric(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.metric.object.Metric) Lspa(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.Lspa)

Example 4 with Metrics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.

the class Stateful07PCReportMessageParser method serializeReport.

private void serializeReport(final Reports report, final ByteBuf buffer) {
    if (report.getSrp() != null) {
        serializeObject(report.getSrp(), buffer);
    }
    serializeObject(report.getLsp(), buffer);
    final Path p = report.getPath();
    if (p != null) {
        serializeObject(p.getEro(), buffer);
        serializeObject(p.getLspa(), buffer);
        serializeObject(p.getBandwidth(), buffer);
        serializeObject(p.getReoptimizationBandwidth(), buffer);
        if (p.getMetrics() != null) {
            for (final Metrics m : p.getMetrics()) {
                serializeObject(m.getMetric(), buffer);
            }
        }
        serializeObject(p.getIro(), buffer);
        serializeObject(p.getRro(), buffer);
    }
}
Also used : Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path) Metrics(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics)

Example 5 with Metrics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics in project bgpcep by opendaylight.

the class Stateful07PCUpdateRequestMessageParser method serializeUpdate.

protected void serializeUpdate(final Updates update, final ByteBuf buffer) {
    serializeObject(update.getSrp(), buffer);
    serializeObject(update.getLsp(), buffer);
    final Path p = update.getPath();
    if (p != null) {
        serializeObject(p.getEro(), buffer);
        serializeObject(p.getLspa(), buffer);
        serializeObject(p.getBandwidth(), buffer);
        serializeObject(p.getReoptimizationBandwidth(), buffer);
        if (p.getMetrics() != null) {
            for (final Metrics m : p.getMetrics()) {
                serializeObject(m.getMetric(), buffer);
            }
        }
        serializeObject(p.getIro(), buffer);
    }
}
Also used : Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.updates.Path) Metrics(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics)

Aggregations

Metrics (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics)12 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)7 VendorInformationObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject)4 ArrayList (java.util.ArrayList)3 Preconditions (com.google.common.base.Preconditions)2 List (java.util.List)2 Counter (org.opendaylight.infrautils.metrics.Counter)2 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)2 Optional (com.google.common.base.Optional)1 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Futures (com.google.common.util.concurrent.Futures)1 JdkFutureAdapters (com.google.common.util.concurrent.JdkFutureAdapters)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 BigInteger (java.math.BigInteger)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1