diff options
Diffstat (limited to 'framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol')
7 files changed, 517 insertions, 33 deletions
diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPFactories.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPFactories.java new file mode 100755 index 00000000..71b9cbff --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPFactories.java @@ -0,0 +1,82 @@ +/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.bgpio.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.protocol.ver4.BGPFactoryVer4;
+import org.onosproject.bgpio.types.BGPHeader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstraction to provide the version for BGP.
+ */
+public final class BGPFactories {
+
+ protected static final Logger log = LoggerFactory.getLogger(BGPFactories.class);
+
+ private static final GenericReader GENERIC_READER = new GenericReader();
+
+ private BGPFactories() {
+ }
+
+ /**
+ * Returns the instance of BGP Version.
+ *
+ * @param version BGP version
+ * @return BGP version
+ */
+ public static BGPFactory getFactory(BGPVersion version) {
+ switch (version) {
+ case BGP_4:
+ return BGPFactoryVer4.INSTANCE;
+ default:
+ throw new IllegalArgumentException("[BGPFactory:]Unknown version: " + version);
+ }
+ }
+
+ /**
+ * Reader class for reading BGP messages from channel buffer.
+ *
+ */
+ private static class GenericReader implements BGPMessageReader<BGPMessage> {
+
+ @Override
+ public BGPMessage readFrom(ChannelBuffer bb, BGPHeader bgpHeader)
+ throws BGPParseException {
+ BGPFactory factory;
+
+ if (!bb.readable()) {
+ log.error("Empty message received");
+ throw new BGPParseException("Empty message received");
+ }
+ // TODO: Currently only BGP version 4 is supported
+ factory = org.onosproject.bgpio.protocol.ver4.BGPFactoryVer4.INSTANCE;
+ return factory.getReader().readFrom(bb, bgpHeader);
+ }
+ }
+
+ /**
+ * Returns BGP messsage generic reader.
+ *
+ * @return bgp message generic reader
+ */
+ public static BGPMessageReader<BGPMessage> getGenericReader() {
+ return GENERIC_READER;
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPFactory.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPFactory.java new file mode 100755 index 00000000..cf6bf008 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPFactory.java @@ -0,0 +1,60 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.bgpio.protocol; + +/** + * Abstraction of an message factory providing builder functions to BGP messages + * and objects. + * + */ +public interface BGPFactory { + + /** + * Gets the builder object for a open message. + * + * @return builder object for open message + */ + BGPOpenMsg.Builder openMessageBuilder(); + + /** + * Gets the builder object for a keepalive message. + * + * @return builder object for keepalive message + */ + BGPKeepaliveMsg.Builder keepaliveMessageBuilder(); + + /** + * Gets the builder object for a notification message. + * + * @return builder object for notification message. + */ + BGPNotificationMsg.Builder notificationMessageBuilder(); + + /** + * Gets the BGP message reader. + * + * @return BGP message reader + */ + BGPMessageReader<BGPMessage> getReader(); + + /** + * Returns BGP version. + * + * @return BGP version + */ + BGPVersion getVersion(); +} diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPNotificationMsg.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPNotificationMsg.java index 56540dd3..a1d9d578 100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPNotificationMsg.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPNotificationMsg.java @@ -16,36 +16,34 @@ package org.onosproject.bgpio.protocol; import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPHeader; /** - * Abstraction of an entity providing BGP Notification Message. + * Abstraction of an entity providing BGP notification message. */ public interface BGPNotificationMsg extends BGPMessage { /** - * Returns errorCode in Notification message. + * Returns errorCode in notification message. * - * @return errorCode in Notification message + * @return errorCode in notification message */ byte getErrorCode(); /** - * Returns error SubCode in Notification message. + * Returns error subCode in notification message. * - * @return error SubCode in Notification message + * @return error subCode in notification message */ byte getErrorSubCode(); /** - * Returns error data in Notification message. + * Returns error data in notification message. * - * @return error data in Notification message + * @return error data in notification message */ byte[] getData(); /** - * Builder interface with get and set functions to build Notification - * message. + * Builder interface with get and set functions to build notification message. */ public interface Builder extends BGPMessage.Builder { @@ -53,26 +51,18 @@ public interface BGPNotificationMsg extends BGPMessage { BGPNotificationMsg build() throws BGPParseException; /** - * Sets notification message header and returns its builder. - * - * @param header of notification message - * @return Builder by setting notification message header - */ - Builder setNotificationMsgHeader(BGPHeader header); - - /** * Sets errorCode in notification message and return its builder. * * @param errorCode in notification message - * @return builder by setting ErrorCode in notification message + * @return builder by setting errorCode in notification message */ Builder setErrorCode(byte errorCode); /** - * Sets error SubCode in notification message and return its builder. + * Sets error subCode in notification message and return its builder. * - * @param errorSubCode in notification Message - * @return builder by setting ErrorSubCode in notification Message + * @param errorSubCode in notification message + * @return builder by setting error subCode in notification message */ Builder setErrorSubCode(byte errorSubCode); diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPFactoryVer4.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPFactoryVer4.java new file mode 100755 index 00000000..32af3854 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPFactoryVer4.java @@ -0,0 +1,58 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.bgpio.protocol.ver4; + +import org.onosproject.bgpio.protocol.BGPFactory; +import org.onosproject.bgpio.protocol.BGPKeepaliveMsg; +import org.onosproject.bgpio.protocol.BGPMessage; +import org.onosproject.bgpio.protocol.BGPMessageReader; +import org.onosproject.bgpio.protocol.BGPNotificationMsg; +import org.onosproject.bgpio.protocol.BGPOpenMsg; +import org.onosproject.bgpio.protocol.BGPVersion; + +/** + * Provides BGP Factory and returns builder classes for all objects and messages. + */ +public class BGPFactoryVer4 implements BGPFactory { + + public static final BGPFactoryVer4 INSTANCE = new BGPFactoryVer4(); + + @Override + public BGPOpenMsg.Builder openMessageBuilder() { + return new BGPOpenMsgVer4.Builder(); + } + + @Override + public BGPKeepaliveMsg.Builder keepaliveMessageBuilder() { + return new BGPKeepaliveMsgVer4.Builder(); + } + + @Override + public BGPNotificationMsg.Builder notificationMessageBuilder() { + return new BGPNotificationMsgVer4.Builder(); + } + + @Override + public BGPMessageReader<BGPMessage> getReader() { + return BGPMessageVer4.READER; + } + + @Override + public BGPVersion getVersion() { + return BGPVersion.BGP_4; + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPMessageVer4.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPMessageVer4.java new file mode 100755 index 00000000..d45e3de1 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPMessageVer4.java @@ -0,0 +1,109 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.bgpio.protocol.ver4; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BGPParseException; +import org.onosproject.bgpio.protocol.BGPFactories; +import org.onosproject.bgpio.protocol.BGPMessage; +import org.onosproject.bgpio.protocol.BGPMessageReader; +import org.onosproject.bgpio.types.BGPErrorType; +import org.onosproject.bgpio.types.BGPHeader; +import org.onosproject.bgpio.util.Validation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Provides BGP messages. + */ +public abstract class BGPMessageVer4 { + + protected static final Logger log = LoggerFactory.getLogger(BGPFactories.class); + + static final byte OPEN_MSG_TYPE = 0x1; + static final byte KEEPALIVE_MSG_TYPE = 0x4; + static final byte UPDATE_MSG_TYPE = 0x2; + static final byte NOTIFICATION_MSG_TYPE = 0x3; + static final int MINIMUM_COMMON_HEADER_LENGTH = 19; + static final int HEADER_AND_MSG_LEN = 18; + static final int MAXIMUM_PACKET_LENGTH = 4096; + + public static final BGPMessageVer4.Reader READER = new Reader(); + + /** + * Reader class for reading BGP messages from channel buffer. + * + */ + static class Reader implements BGPMessageReader<BGPMessage> { + @Override + public BGPMessage readFrom(ChannelBuffer cb, BGPHeader bgpHeader) + throws BGPParseException { + + if (cb.readableBytes() < MINIMUM_COMMON_HEADER_LENGTH) { + log.error("Packet should have minimum length."); + Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH, + cb.readableBytes()); + } + if (cb.readableBytes() > MAXIMUM_PACKET_LENGTH) { + log.error("Packet length should not exceed {}.", MAXIMUM_PACKET_LENGTH); + Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH, + cb.readableBytes()); + } + try { + // fixed value property version == 4 + byte[] marker = new byte[BGPHeader.MARKER_LENGTH]; + cb.readBytes(marker, 0, BGPHeader.MARKER_LENGTH); + bgpHeader.setMarker(marker); + for (int i = 0; i < BGPHeader.MARKER_LENGTH; i++) { + if (marker[i] != (byte) 0xff) { + throw new BGPParseException(BGPErrorType.MESSAGE_HEADER_ERROR, + BGPErrorType.CONNECTION_NOT_SYNCHRONIZED, null); + } + } + short length = cb.readShort(); + if (length != (cb.readableBytes() + HEADER_AND_MSG_LEN)) { + Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH, length); + } + bgpHeader.setLength(length); + byte type = cb.readByte(); + bgpHeader.setType(type); + log.debug("Reading update message of type " + type); + + int len = length - MINIMUM_COMMON_HEADER_LENGTH; + switch (type) { + case OPEN_MSG_TYPE: + log.debug("OPEN MESSAGE is received"); + return BGPOpenMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader); + case KEEPALIVE_MSG_TYPE: + log.debug("KEEPALIVE MESSAGE is received"); + return BGPKeepaliveMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader); + case UPDATE_MSG_TYPE: + log.debug("UPDATE MESSAGE is received"); + // TODO: Update message version 4 + case NOTIFICATION_MSG_TYPE: + log.debug("NOTIFICATION MESSAGE is received"); + return BGPNotificationMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader); + default: + Validation.validateType(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_TYPE, type); + return null; + } + } catch (IndexOutOfBoundsException e) { + throw new BGPParseException(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH, null); + } + } + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPNotificationMsgVer4.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPNotificationMsgVer4.java index 064deada..3bddd375 100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPNotificationMsgVer4.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BGPNotificationMsgVer4.java @@ -44,7 +44,7 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg { REFERENCE : RFC 4271 */ - protected static final Logger log = LoggerFactory.getLogger(BGPNotificationMsgVer4.class); + private static final Logger log = LoggerFactory.getLogger(BGPNotificationMsgVer4.class); static final byte PACKET_VERSION = 4; //BGPHeader(19) + Error code(1) + Error subcode(1) @@ -52,8 +52,10 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg { static final int PACKET_MINIMUM_LENGTH = 2; static final BGPType MSG_TYPE = BGPType.NOTIFICATION; static final byte DEFAULT_ERRORSUBCODE = 0; - static final byte[] MARKER = {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01}; + static final byte[] MARKER = {(byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff }; static final byte MESSAGE_TYPE = 3; static final BGPHeader DEFAULT_MESSAGE_HEADER = new BGPHeader(MARKER, BGPHeader.DEFAULT_HEADER_LENGTH, MESSAGE_TYPE); @@ -65,7 +67,7 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg { public static final BGPNotificationMsgVer4.Reader READER = new Reader(); /** - * Resets fields. + * Initialize fields. */ public BGPNotificationMsgVer4() { this.bgpHeader = null; @@ -154,13 +156,6 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg { } @Override - public Builder setNotificationMsgHeader(BGPHeader header) { - this.bgpHeader = header; - this.isBGPHeaderSet = true; - return this; - } - - @Override public Builder setHeader(BGPHeader bgpMsgHeader) { this.bgpHeader = bgpMsgHeader; return this; diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpPathAttributes.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpPathAttributes.java new file mode 100644 index 00000000..08fea4c6 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpPathAttributes.java @@ -0,0 +1,190 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.bgpio.protocol.ver4; + +import java.util.LinkedList; +import java.util.List; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BGPParseException; +import org.onosproject.bgpio.types.As4Path; +import org.onosproject.bgpio.types.AsPath; +import org.onosproject.bgpio.types.BGPErrorType; +import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.types.LocalPref; +import org.onosproject.bgpio.types.Med; +import org.onosproject.bgpio.types.NextHop; +import org.onosproject.bgpio.types.Origin; +import org.onosproject.bgpio.util.UnSupportedAttribute; +import org.onosproject.bgpio.util.Validation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.MoreObjects; + +/** + * Provides Implementation of BGP Path Attribute. + */ +public class BgpPathAttributes { + + /* Path attribute: + <attribute type, attribute length, attribute value> + + 0 1 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Attr. Flags |Attr. Type Code| + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + REFERENCE : RFC 4271 + */ + protected static final Logger log = LoggerFactory.getLogger(BgpPathAttributes.class); + + public static final int LINK_STATE_ATTRIBUTE_TYPE = 50; + public static final int MPREACHNLRI_TYPE = 14; + public static final int MPUNREACHNLRI_TYPE = 15; + + private final List<BGPValueType> pathAttribute; + + /** + * Initialize parameter. + */ + public BgpPathAttributes() { + this.pathAttribute = null; + } + + /** + * Constructor to initialize parameters for BGP path attributes. + * + * @param pathAttribute list of path attributes + */ + public BgpPathAttributes(List<BGPValueType> pathAttribute) { + this.pathAttribute = pathAttribute; + } + + /** + * Returns list of path attributes. + * + * @return list of path attributes + */ + public List<BGPValueType> pathAttributes() { + return this.pathAttribute; + } + + /** + * Reads from channelBuffer and parses BGP path attributes. + * + * @param cb channelBuffer + * @return object of BgpPathAttributes + * @throws BGPParseException while parsing BGP path attributes + */ + public static BgpPathAttributes read(ChannelBuffer cb) + throws BGPParseException { + + BGPValueType pathAttribute = null; + List<BGPValueType> pathAttributeList = new LinkedList<>(); + boolean isOrigin = false; + boolean isAsPath = false; + boolean isNextHop = false; + boolean isMpReach = false; + boolean isMpUnReach = false; + while (cb.readableBytes() > 0) { + cb.markReaderIndex(); + byte flags = cb.readByte(); + byte typeCode = cb.readByte(); + cb.resetReaderIndex(); + switch (typeCode) { + case Origin.ORIGIN_TYPE: + pathAttribute = Origin.read(cb); + isOrigin = ((Origin) pathAttribute).isOriginSet(); + break; + case AsPath.ASPATH_TYPE: + pathAttribute = AsPath.read(cb); + isAsPath = ((AsPath) pathAttribute).isaspathSet(); + break; + case As4Path.AS4PATH_TYPE: + pathAttribute = As4Path.read(cb); + break; + case NextHop.NEXTHOP_TYPE: + pathAttribute = NextHop.read(cb); + isNextHop = ((NextHop) pathAttribute).isNextHopSet(); + break; + case Med.MED_TYPE: + pathAttribute = Med.read(cb); + break; + case LocalPref.LOCAL_PREF_TYPE: + pathAttribute = LocalPref.read(cb); + break; + case MPREACHNLRI_TYPE: + //TODO: To be merged later + break; + case MPUNREACHNLRI_TYPE: + //TODO: To be merged later + break; + case LINK_STATE_ATTRIBUTE_TYPE: + //TODO: To be merged later + break; + default: + //skip bytes for unsupported attribute types + UnSupportedAttribute.read(cb); + } + pathAttributeList.add(pathAttribute); + } + + checkMandatoryAttr(isOrigin, isAsPath, isNextHop, isMpReach, isMpUnReach); + //TODO:if mp_reach or mp_unreach not present ignore the packet + return new BgpPathAttributes(pathAttributeList); + } + + /** + * Checks mandatory attributes are presents, if not present throws exception. + * + * @param isOrigin say whether origin attribute is present + * @param isAsPath say whether aspath attribute is present + * @param isNextHop say whether nexthop attribute is present + * @param isMpReach say whether mpreach attribute is present + * @param isMpUnReach say whether mpunreach attribute is present + * @throws BGPParseException if mandatory path attribute is not present + */ + public static void checkMandatoryAttr(boolean isOrigin, boolean isAsPath, + boolean isNextHop, boolean isMpReach, boolean isMpUnReach) + throws BGPParseException { + if (!isOrigin) { + log.debug("Mandatory Attributes not Present"); + Validation.validateType(BGPErrorType.UPDATE_MESSAGE_ERROR, + BGPErrorType.MISSING_WELLKNOWN_ATTRIBUTE, + Origin.ORIGIN_TYPE); + } + if (!isAsPath) { + log.debug("Mandatory Attributes not Present"); + Validation.validateType(BGPErrorType.UPDATE_MESSAGE_ERROR, + BGPErrorType.MISSING_WELLKNOWN_ATTRIBUTE, + AsPath.ASPATH_TYPE); + } + if (!isMpUnReach && !isMpReach && !isNextHop) { + log.debug("Mandatory Attributes not Present"); + Validation.validateType(BGPErrorType.UPDATE_MESSAGE_ERROR, + BGPErrorType.MISSING_WELLKNOWN_ATTRIBUTE, + NextHop.NEXTHOP_TYPE); + } + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()) + .add("pathAttribute", pathAttribute) + .toString(); + } +} |