use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.PcreqMessage in project bgpcep by opendaylight.
the class PCEPMonitoringRequestMessageParser method serializeMessage.
@Override
public void serializeMessage(final Message message, final ByteBuf out) {
Preconditions.checkArgument(message instanceof Pcmonreq, "Wrong instance of Message. Passed instance of %s. Need Pcmonreq.", message.getClass());
final PcreqMessage msg = ((Pcmonreq) message).getPcreqMessage();
Preconditions.checkArgument(msg.getMonitoringRequest() != null, "MONITORING object MUST be present.");
final ByteBuf buffer = Unpooled.buffer();
serializeMonitoringRequest(msg.getMonitoringRequest(), buffer);
if (msg.getSvec() != null) {
serializeSvec(msg, buffer);
}
if (msg.getRequests() != null) {
serializeRequest(msg, buffer);
}
MessageUtil.formatMessage(TYPE, buffer, out);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.PcreqMessage in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method serializeRequest.
protected void serializeRequest(final PcreqMessage msg, final ByteBuf buffer) {
for (final Requests req : msg.nonnullRequests()) {
serializeObject(req.getRp(), buffer);
serializeVendorInformationObjects(req.getVendorInformationObject(), buffer);
if (req.getPathKeyExpansion() != null) {
serializeObject(req.getPathKeyExpansion().getPathKey(), buffer);
}
if (req.getSegmentComputation() != null) {
final SegmentComputation sc = req.getSegmentComputation();
if (sc.getP2p() != null) {
serializeP2P(buffer, sc.getP2p());
}
if (sc.getP2mp() != null) {
serializeP2MP(buffer, sc.getP2mp());
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.PcreqMessage 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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.PcreqMessage in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method serializeSvec.
protected void serializeSvec(final PcreqMessage msg, final ByteBuf buffer) {
for (final Svec s : msg.nonnullSvec()) {
serializeObject(s.getSvec(), buffer);
serializeObject(s.getOf(), buffer);
serializeObject(s.getGc(), buffer);
serializeObject(s.getXro(), buffer);
if (s.getMetric() != null) {
for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.svec.Metric m : s.nonnullMetric()) {
serializeObject(m.getMetric(), buffer);
}
}
serializeVendorInformationObjects(s.getVendorInformationObject(), buffer);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.PcreqMessage in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method serializeMessage.
@Override
public void serializeMessage(final Message message, final ByteBuf out) {
checkArgument(message instanceof Pcreq, "Wrong instance of Message. Passed instance of %s. Need Pcreq.", message.getClass());
final PcreqMessage msg = ((Pcreq) message).getPcreqMessage();
checkArgument(!msg.nonnullRequests().isEmpty(), "Requests cannot be null or empty.");
final ByteBuf buffer = Unpooled.buffer();
if (msg.getMonitoringRequest() != null) {
serializeMonitoringRequest(msg.getMonitoringRequest(), buffer);
}
if (msg.getSvec() != null) {
serializeSvec(msg, buffer);
}
serializeRequest(msg, buffer);
MessageUtil.formatMessage(TYPE, buffer, out);
}
Aggregations