use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.response.monitoring.metrics.list.SpecificMetricsList in project bgpcep by opendaylight.
the class PCEPMonitoringReplyMessageParser method serializeMessage.
@Override
public void serializeMessage(final Message message, final ByteBuf buffer) {
Preconditions.checkArgument(message instanceof Pcmonrep, "Wrong instance of Message. Passed instance of %s. Need Pcmonrep.", message.getClass());
final PcmonrepMessage monRepMsg = ((Pcmonrep) message).getPcmonrepMessage();
Preconditions.checkArgument(monRepMsg.getMonitoring() != null, "MONITORING object is mandatory.");
final ByteBuf body = Unpooled.buffer();
serializeObject(monRepMsg.getMonitoring(), body);
serializeObject(monRepMsg.getPccIdReq(), body);
if (monRepMsg.getMonitoringMetricsList() instanceof GeneralMetricsList) {
final GeneralMetricsList gml = (GeneralMetricsList) monRepMsg.getMonitoringMetricsList();
if (gml.getMetricPce() != null) {
for (final MetricPce metricPce : gml.getMetricPce()) {
serializeMetricPce(metricPce, body);
}
}
} else if (monRepMsg.getMonitoringMetricsList() instanceof SpecificMetricsList) {
final SpecificMetricsList sml = (SpecificMetricsList) monRepMsg.getMonitoringMetricsList();
if (sml.getSpecificMetrics() != null) {
for (final SpecificMetrics specificMetrics : sml.getSpecificMetrics()) {
serializeObject(specificMetrics.getRp(), body);
if (specificMetrics.getMetricPce() != null) {
for (final MetricPce metricPce : specificMetrics.getMetricPce()) {
serializeMetricPce(metricPce, body);
}
}
}
}
}
MessageUtil.formatMessage(TYPE, body, buffer);
}
Aggregations