2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.parser.message;
10 import java.util.Arrays;
12 import org.opendaylight.protocol.bgp.parser.BGPError;
13 import org.opendaylight.yangtools.yang.binding.Notification;
16 * Representation of BGPNotification message.
18 * @see <a link="http://tools.ietf.org/html/rfc4271#section-4.5">BGP Notification Message</a>
20 public final class BGPNotificationMessage implements Notification {
22 private final BGPError error;
24 private final byte[] data;
27 * Creates a BGPNotification message with no data.
31 public BGPNotificationMessage(final BGPError error) {
36 * Creates a BGPNotification message with error cause and data.
39 * @param data associated with this message
41 public BGPNotificationMessage(final BGPError error, final byte[] data) {
48 * Returns BGPError contained in this message.
52 public BGPError getError() {
57 * Returns possible data associated with this message.
61 public byte[] getData() {
66 public String toString() {
67 final StringBuilder builder = new StringBuilder();
68 builder.append("BGPNotificationMessage [error=");
69 builder.append(this.error);
70 builder.append(", data=");
71 builder.append(Arrays.toString(this.data));
73 return builder.toString();