Search in sources :

Example 1 with PathComputation

use of org.opendaylight.bgpcep.pcep.server.PathComputation in project bgpcep by opendaylight.

the class PCEPTopologySessionListener method handlePcreqMessage.

private boolean handlePcreqMessage(final PcreqMessage message) {
    LOG.info("Start PcRequest Message handler");
    /* Get a Path Computation to compute the Path from the Request */
    PathComputation pathComputation = pceServerProvider.getPathComputation();
    Message rep = null;
    /* Reply with Error Message if no valid Path Computation is available */
    if (pathComputation == null) {
        rep = createErrorMsg(PCEPErrors.RESOURCE_LIMIT_EXCEEDED, Uint32.ZERO);
        sendMessage(rep, new SrpIdNumber(Uint32.ZERO), null);
        return false;
    }
    for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.Requests req : message.getRequests()) {
        LOG.debug("Process request {}", req);
        rep = pathComputation.computePath(req);
        SrpIdNumber repId = null;
        if (req.getRp() != null) {
            repId = new SrpIdNumber(req.getRp().getRequestId().getValue());
        } else {
            repId = new SrpIdNumber(Uint32.ZERO);
        }
        sendMessage(rep, repId, null);
    }
    return false;
}
Also used : PathComputation(org.opendaylight.bgpcep.pcep.server.PathComputation) PcerrMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.PcerrMessage) PcreqMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.PcreqMessage) PcrptMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcrptMessage) Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message) Collections(java.util.Collections) SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber)

Aggregations

Collections (java.util.Collections)1 PathComputation (org.opendaylight.bgpcep.pcep.server.PathComputation)1 PcrptMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcrptMessage)1 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber)1 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message)1 PcerrMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.PcerrMessage)1 PcreqMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.PcreqMessage)1