import io.netty.buffer.ByteBuf;
+import java.util.List;
+
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder;
/**
* Parser for {@link KeepaliveMessage}
*/
public class PCEPKeepAliveMessageParser extends AbstractMessageParser {
-
+ private static final KeepaliveMessage MESSAGE = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
public static final int TYPE = 2;
public PCEPKeepAliveMessageParser(final ObjectHandlerRegistry registry) {
public void serializeMessage(final Message message, final ByteBuf buffer) {
if (!(message instanceof KeepaliveMessage)) {
throw new IllegalArgumentException("Wrong instance of Message. Passed instance of " + message.getClass()
- + ". Nedded KeepaliveMessage.");
+ + ". Need KeepaliveMessage.");
}
buffer.writeBytes(new byte[0]);
}
@Override
- public KeepaliveMessage parseMessage(final byte[] buffer) {
- return new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
+ public int getMessageType() {
+ return TYPE;
}
@Override
- public int getMessageType() {
- return TYPE;
+ protected KeepaliveMessage validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
+ // FIXME: keepalive shouldn't have objects
+
+ return MESSAGE;
}
}