use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.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.rev131005.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.getRequests()) {
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());
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.PcreqMessage in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method serializeMessage.
@Override
public void serializeMessage(final Message message, final ByteBuf out) {
Preconditions.checkArgument(message instanceof Pcreq, "Wrong instance of Message. Passed instance of %s. Need Pcreq.", message.getClass());
final PcreqMessage msg = ((Pcreq) message).getPcreqMessage();
Preconditions.checkArgument(msg.getRequests() != null && !msg.getRequests().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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.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.getSvec()) {
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.rev131005.pcreq.message.pcreq.message.svec.Metric m : s.getMetric()) {
serializeObject(m.getMetric(), buffer);
}
}
serializeVendorInformationObjects(s.getVendorInformationObject(), buffer);
}
}
Aggregations