use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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) {
checkArgument(message instanceof Pcmonrep, "Wrong instance of Message. Passed instance of %s. Need Pcmonrep.", message.getClass());
final PcmonrepMessage monRepMsg = ((Pcmonrep) message).getPcmonrepMessage();
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();
for (final MetricPce metricPce : gml.nonnullMetricPce()) {
serializeMetricPce(metricPce, body);
}
} else if (monRepMsg.getMonitoringMetricsList() instanceof SpecificMetricsList) {
final SpecificMetricsList sml = (SpecificMetricsList) monRepMsg.getMonitoringMetricsList();
for (final SpecificMetrics specificMetrics : sml.nonnullSpecificMetrics()) {
serializeObject(specificMetrics.getRp(), body);
for (final MetricPce metricPce : specificMetrics.nonnullMetricPce()) {
serializeMetricPce(metricPce, body);
}
}
}
MessageUtil.formatMessage(TYPE, body, buffer);
}
Aggregations