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.protocol.bgp.parser.BGPMessage;
17 * Representation of BGPNotification message.
19 * @see <a link="http://tools.ietf.org/html/rfc4271#section-4.5">BGP Notification Message</a>
21 public final class BGPNotificationMessage implements BGPMessage {
23 private static final long serialVersionUID = -5860147919167775673L;
25 private final BGPError error;
27 private final byte[] data;
30 * Creates a BGPNotification message with no data.
34 public BGPNotificationMessage(final BGPError error) {
39 * Creates a BGPNotification message with error cause and data.
42 * @param data associated with this message
44 public BGPNotificationMessage(final BGPError error, final byte[] data) {
51 * Returns BGPError contained in this message.
55 public BGPError getError() {
60 * Returns possible data associated with this message.
64 public byte[] getData() {
69 public String toString() {
70 final StringBuilder builder = new StringBuilder();
71 builder.append("BGPNotificationMessage [error=");
72 builder.append(this.error);
73 builder.append(", data=");
74 builder.append(Arrays.toString(this.data));
76 return builder.toString();