Search in sources :

Example 1 with FsmEventCode

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.FsmEventCode in project bgpcep by opendaylight.

the class PeerDownHandler method serializeMessageBody.

@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
    super.serializeMessageBody(message, buffer);
    Preconditions.checkArgument(message instanceof PeerDownNotification, "An instance of PeerDownNotification is required");
    final PeerDownNotification peerDown = (PeerDownNotification) message;
    if (peerDown.isLocalSystemClosed()) {
        if (peerDown.getData() instanceof FsmEventCode) {
            ByteBufWriteUtil.writeUnsignedByte(REASON_TWO.getValue(), buffer);
            ByteBufWriteUtil.writeUnsignedShort(((FsmEventCode) peerDown.getData()).getFsmEventCode(), buffer);
        } else if (peerDown.getData() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) {
            ByteBufWriteUtil.writeUnsignedByte(REASON_ONE.getValue(), buffer);
            serializePDU(peerDown.getData(), buffer);
        }
    } else {
        if (peerDown.getData() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) {
            ByteBufWriteUtil.writeUnsignedByte(REASON_THREE.getValue(), buffer);
            serializePDU(peerDown.getData(), buffer);
        } else {
            ByteBufWriteUtil.writeUnsignedByte(REASON_FOUR.getValue(), buffer);
        }
    }
}
Also used : PeerDownNotification(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.PeerDownNotification) Preconditions(com.google.common.base.Preconditions) PeerDownNotification(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.PeerDownNotification) Notification(org.opendaylight.yangtools.yang.binding.Notification) FsmEventCode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.FsmEventCode)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 PeerDownNotification (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.PeerDownNotification)1 FsmEventCode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.FsmEventCode)1 Notification (org.opendaylight.yangtools.yang.binding.Notification)1