Search in sources :

Example 1 with FsmEventCodeBuilder

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

the class PeerDownHandler method parseMessageBody.

@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
    final PeerDownNotificationBuilder peerDown = new PeerDownNotificationBuilder().setPeerHeader(parsePerPeerHeader(bytes));
    final Reason reason = Reason.forValue(bytes.readUnsignedByte());
    if (reason != null) {
        switch(reason) {
            case REASON_ONE:
                peerDown.setLocalSystemClosed(true);
                peerDown.setData(parseBgpNotificationMessage(bytes));
                break;
            case REASON_TWO:
                peerDown.setLocalSystemClosed(true);
                peerDown.setData(new FsmEventCodeBuilder().setFsmEventCode(bytes.readUnsignedShort()).build());
                break;
            case REASON_THREE:
            case REASON_FOUR:
                peerDown.setLocalSystemClosed(false);
                peerDown.setData(parseBgpNotificationMessage(bytes));
                break;
            case REASON_FIVE:
                peerDown.setLocalSystemClosed(false);
                break;
            default:
                break;
        }
    }
    return peerDown.build();
}
Also used : FsmEventCodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.FsmEventCodeBuilder) PeerDownNotificationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.PeerDownNotificationBuilder)

Aggregations

PeerDownNotificationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.PeerDownNotificationBuilder)1 FsmEventCodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.FsmEventCodeBuilder)1