diff options
Diffstat (limited to 'framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr')
23 files changed, 1111 insertions, 136 deletions
diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlv.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlv.java index e7f4a4c0..e0fef7c8 100755 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlv.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlv.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP attribute node flag. */ -public final class BgpAttrNodeFlagBitTlv implements BGPValueType { +public final class BgpAttrNodeFlagBitTlv implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpAttrNodeFlagBitTlv.class); @@ -86,10 +86,10 @@ public final class BgpAttrNodeFlagBitTlv implements BGPValueType { * * @param cb ChannelBuffer * @return attribute node flag bit tlv - * @throws BGPParseException while parsing BgpAttrNodeFlagBitTlv + * @throws BgpParseException while parsing BgpAttrNodeFlagBitTlv */ public static BgpAttrNodeFlagBitTlv read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { boolean bOverloadBit = false; boolean bAttachedBit = false; boolean bExternalBit = false; @@ -98,8 +98,8 @@ public final class BgpAttrNodeFlagBitTlv implements BGPValueType { short lsAttrLength = cb.readShort(); if ((lsAttrLength != 1) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -190,4 +190,10 @@ public final class BgpAttrNodeFlagBitTlv implements BGPValueType { .add("bExternalBit", bExternalBit).add("bAbrBit", bAbrBit) .toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeIsIsAreaId.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeIsIsAreaId.java new file mode 100644 index 00000000..0435a65f --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeIsIsAreaId.java @@ -0,0 +1,136 @@ +/* + * 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.types.attr; + +import java.util.Arrays; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; +import org.onosproject.bgpio.util.Validation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.MoreObjects; + +/** + * Implements BGP attribute ISIS Area Identifier. + */ +public class BgpAttrNodeIsIsAreaId implements BgpValueType { + + protected static final Logger log = LoggerFactory + .getLogger(BgpAttrNodeIsIsAreaId.class); + + public static final int ATTRNODE_ISISAREAID = 1027; + + /* IS-IS Area Identifier TLV */ + private byte[] isisAreaId; + + /** + * Constructor to initialize value. + * + * @param isisAreaId ISIS area Identifier + */ + public BgpAttrNodeIsIsAreaId(byte[] isisAreaId) { + this.isisAreaId = Arrays.copyOf(isisAreaId, isisAreaId.length); + } + + /** + * Returns object of this class with specified values. + * + * @param isisAreaId ISIS area Identifier + * @return object of BgpAttrNodeIsIsAreaId + */ + public static BgpAttrNodeIsIsAreaId of(final byte[] isisAreaId) { + return new BgpAttrNodeIsIsAreaId(isisAreaId); + } + + /** + * Reads the IS-IS Area Identifier. + * + * @param cb ChannelBuffer + * @return object of BgpAttrNodeIsIsAreaId + * @throws BgpParseException while parsing BgpAttrNodeIsIsAreaId + */ + public static BgpAttrNodeIsIsAreaId read(ChannelBuffer cb) + throws BgpParseException { + byte[] isisAreaId; + + short lsAttrLength = cb.readShort(); + + if (cb.readableBytes() < lsAttrLength) { + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, + lsAttrLength); + } + + isisAreaId = new byte[lsAttrLength]; + cb.readBytes(isisAreaId); + + return BgpAttrNodeIsIsAreaId.of(isisAreaId); + } + + /** + * Returns ISIS area Identifier. + * + * @return Area ID + */ + public byte[] attrNodeIsIsAreaId() { + return isisAreaId; + } + + @Override + public short getType() { + return ATTRNODE_ISISAREAID; + } + + @Override + public int hashCode() { + return Arrays.hashCode(isisAreaId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj instanceof BgpAttrNodeIsIsAreaId) { + BgpAttrNodeIsIsAreaId other = (BgpAttrNodeIsIsAreaId) obj; + return Arrays.equals(isisAreaId, other.isisAreaId); + } + return false; + } + + @Override + public int write(ChannelBuffer cb) { + // TODO This will be implemented in the next version + return 0; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).omitNullValues() + .add("isisAreaId", isisAreaId).toString(); + } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeMultiTopologyId.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeMultiTopologyId.java index 4b704fb0..31d855db 100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeMultiTopologyId.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeMultiTopologyId.java @@ -17,12 +17,13 @@ package org.onosproject.bgpio.types.attr; import java.util.ArrayList; import java.util.List; +import java.util.ListIterator; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +33,7 @@ import com.google.common.base.MoreObjects; /** * BGP Multi-Topology ID of the LS attribute. */ -public class BgpAttrNodeMultiTopologyId implements BGPValueType { +public class BgpAttrNodeMultiTopologyId implements BgpValueType { private static final Logger log = LoggerFactory .getLogger(BgpAttrNodeMultiTopologyId.class); @@ -66,18 +67,18 @@ public class BgpAttrNodeMultiTopologyId implements BGPValueType { * * @param cb ChannelBuffer * @return Constructor of BgpAttrNodeMultiTopologyId - * @throws BGPParseException while parsing BgpAttrNodeMultiTopologyId + * @throws BgpParseException while parsing BgpAttrNodeMultiTopologyId */ public static BgpAttrNodeMultiTopologyId read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { ArrayList<Short> multiTopologyId = new ArrayList<Short>(); short tempMultiTopologyId; short lsAttrLength = cb.readShort(); int len = lsAttrLength / 2; // Length is 2*n and n is the number of MT-IDs if (cb.readableBytes() < lsAttrLength) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -134,4 +135,30 @@ public class BgpAttrNodeMultiTopologyId implements BGPValueType { .add("multiTopologyId", multiTopologyId) .toString(); } + + @Override + public int compareTo(Object o) { + if (this.equals(o)) { + return 0; + } + int countOtherSubTlv = ((BgpAttrNodeMultiTopologyId) o).multiTopologyId.size(); + int countObjSubTlv = multiTopologyId.size(); + if (countOtherSubTlv != countObjSubTlv) { + if (countOtherSubTlv > countObjSubTlv) { + return 1; + } else { + return -1; + } + } + ListIterator<Short> listIterator = multiTopologyId.listIterator(); + ListIterator<Short> listIteratorOther = ((BgpAttrNodeMultiTopologyId) o).multiTopologyId.listIterator(); + while (listIterator.hasNext()) { + short id = listIterator.next(); + short id1 = listIteratorOther.next(); + if (((Short) id).compareTo((Short) id1) != 0) { + return ((Short) id).compareTo((Short) id1); + } + } + return 0; + } }
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeName.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeName.java new file mode 100644 index 00000000..2e1c7a05 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeName.java @@ -0,0 +1,135 @@ +/* + * 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.types.attr; + +import java.util.Arrays; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; +import org.onosproject.bgpio.util.Validation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.MoreObjects; + +/** + * Implements BGP attribute node name. + */ +public class BgpAttrNodeName implements BgpValueType { + + protected static final Logger log = LoggerFactory + .getLogger(BgpAttrNodeName.class); + + public static final int ATTRNODE_NAME = 1026; + + /* Node Name */ + private byte[] nodeName; + + /** + * Constructor to initialize value. + * + * @param nodeName node name + */ + public BgpAttrNodeName(byte[] nodeName) { + this.nodeName = Arrays.copyOf(nodeName, nodeName.length); + } + + /** + * Returns object of this class with specified values. + * + * @param nodeName node name + * @return object of BgpAttrNodeName + */ + public static BgpAttrNodeName of(final byte[] nodeName) { + return new BgpAttrNodeName(nodeName); + } + + /** + * Reads the LS attribute node name. + * + * @param cb ChannelBuffer + * @return object of BgpAttrNodeName + * @throws BgpParseException while parsing BgpAttrNodeName + */ + public static BgpAttrNodeName read(ChannelBuffer cb) + throws BgpParseException { + byte[] nodeName; + + short lsAttrLength = cb.readShort(); + + if (cb.readableBytes() < lsAttrLength) { + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, + lsAttrLength); + } + + nodeName = new byte[lsAttrLength]; + cb.readBytes(nodeName); + return BgpAttrNodeName.of(nodeName); + } + + /** + * Returns LS attribute node name. + * + * @return node name + */ + public byte[] attrNodeName() { + return nodeName; + } + + @Override + public short getType() { + return ATTRNODE_NAME; + } + + @Override + public int hashCode() { + return Arrays.hashCode(nodeName); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj instanceof BgpAttrNodeName) { + BgpAttrNodeName other = (BgpAttrNodeName) obj; + return Arrays.equals(nodeName, other.nodeName); + } + return false; + } + + @Override + public int write(ChannelBuffer cb) { + // TODO This will be implemented in the next version + return 0; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).omitNullValues() + .add("nodeName", nodeName).toString(); + } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrOpaqueNode.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrOpaqueNode.java new file mode 100644 index 00000000..545755a7 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrOpaqueNode.java @@ -0,0 +1,138 @@ +/* + * 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.types.attr; + +import java.util.Arrays; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; +import org.onosproject.bgpio.util.Validation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.MoreObjects; + +/** + * Implements BGP attribute opaque node. + */ +public class BgpAttrOpaqueNode implements BgpValueType { + + protected static final Logger log = LoggerFactory + .getLogger(BgpAttrOpaqueNode.class); + + public static final int ATTRNODE_OPAQUEDATA = 1025; + + /* Opaque Node Attribute */ + private byte[] opaqueNodeAttribute; + + /** + * Constructor to initialize parameter. + * + * @param opaqueNodeAttribute opaque node attribute + */ + public BgpAttrOpaqueNode(byte[] opaqueNodeAttribute) { + this.opaqueNodeAttribute = Arrays.copyOf(opaqueNodeAttribute, opaqueNodeAttribute.length); + } + + /** + * Returns object of this class with specified values. + * + * @param opaqueNodeAttribute Prefix Metric + * @return object of BgpAttrOpaqueNode + */ + public static BgpAttrOpaqueNode of(byte[] opaqueNodeAttribute) { + return new BgpAttrOpaqueNode(opaqueNodeAttribute); + } + + /** + * Reads the Opaque Node Properties. + * + * @param cb ChannelBuffer + * @return object of BgpAttrOpaqueNode + * @throws BgpParseException while parsing BgpAttrOpaqueNode + */ + public static BgpAttrOpaqueNode read(ChannelBuffer cb) + throws BgpParseException { + + byte[] opaqueNodeAttribute; + + short lsAttrLength = cb.readShort(); + + if (cb.readableBytes() < lsAttrLength) { + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, + lsAttrLength); + } + + opaqueNodeAttribute = new byte[lsAttrLength]; + cb.readBytes(opaqueNodeAttribute); + + return BgpAttrOpaqueNode.of(opaqueNodeAttribute); + } + + /** + * Returns opaque node attribute. + * + * @return LS node attribute value + */ + public byte[] attrOpaqueNode() { + return opaqueNodeAttribute; + } + + @Override + public short getType() { + return ATTRNODE_OPAQUEDATA; + } + + @Override + public int hashCode() { + return Arrays.hashCode(opaqueNodeAttribute); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj instanceof BgpAttrOpaqueNode) { + BgpAttrOpaqueNode other = (BgpAttrOpaqueNode) obj; + return Arrays + .equals(opaqueNodeAttribute, other.opaqueNodeAttribute); + } + return false; + } + + @Override + public int write(ChannelBuffer cb) { + // TODO This will be implemented in the next version + return 0; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).omitNullValues() + .add("opaqueNodeAttribute", opaqueNodeAttribute).toString(); + } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV4.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV4.java index a10d167a..f3c0d17b 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV4.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV4.java @@ -19,9 +19,9 @@ import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; import org.onlab.packet.Ip4Address; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,7 +31,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP attribute node router ID. */ -public final class BgpAttrRouterIdV4 implements BGPValueType { +public final class BgpAttrRouterIdV4 implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpAttrRouterIdV4.class); @@ -70,15 +70,15 @@ public final class BgpAttrRouterIdV4 implements BGPValueType { * @param cb ChannelBuffer * @param sType tag type * @return object of BgpAttrRouterIdV4 - * @throws BGPParseException while parsing BgpAttrRouterIdV4 + * @throws BgpParseException while parsing BgpAttrRouterIdV4 */ public static BgpAttrRouterIdV4 read(ChannelBuffer cb, short sType) - throws BGPParseException { + throws BgpParseException { short lsAttrLength = cb.readShort(); if ((lsAttrLength != 4) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -131,4 +131,10 @@ public final class BgpAttrRouterIdV4 implements BGPValueType { return MoreObjects.toStringHelper(getClass()).omitNullValues() .add("ip4RouterId", ip4RouterId).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6.java index ea63c379..648fd56e 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6.java @@ -19,9 +19,9 @@ import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; import org.onlab.packet.Ip6Address; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,7 +31,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP attribute IPv6 router ID. */ -public final class BgpAttrRouterIdV6 implements BGPValueType { +public final class BgpAttrRouterIdV6 implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpAttrRouterIdV6.class); @@ -70,18 +70,18 @@ public final class BgpAttrRouterIdV6 implements BGPValueType { * @param cb ChannelBuffer * @param sType TLV type * @return object of BgpAttrRouterIdV6 - * @throws BGPParseException while parsing BgpAttrRouterIdV6 + * @throws BgpParseException while parsing BgpAttrRouterIdV6 */ public static BgpAttrRouterIdV6 read(ChannelBuffer cb, short sType) - throws BGPParseException { + throws BgpParseException { byte[] ipBytes; Ip6Address ip6RouterId; short lsAttrLength = cb.readShort(); if ((lsAttrLength != 16) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -134,4 +134,10 @@ public final class BgpAttrRouterIdV6 implements BGPValueType { return MoreObjects.toStringHelper(getClass()).omitNullValues() .add("ip6RouterId", ip6RouterId).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetric.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetric.java index c1cb299c..5721cf6c 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetric.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetric.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP link IGP metric attribute. */ -public class BgpLinkAttrIgpMetric implements BGPValueType { +public class BgpLinkAttrIgpMetric implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrIgpMetric.class); @@ -75,10 +75,10 @@ public class BgpLinkAttrIgpMetric implements BGPValueType { * * @param cb Channel buffer * @return object of type BgpLinkAttrIgpMetric - * @throws BGPParseException while parsing BgpLinkAttrIgpMetric + * @throws BgpParseException while parsing BgpLinkAttrIgpMetric */ public static BgpLinkAttrIgpMetric read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { short linkigp; int igpMetric = 0; @@ -88,8 +88,8 @@ public class BgpLinkAttrIgpMetric implements BGPValueType { if (cb.readableBytes() < lsAttrLength || lsAttrLength > ATTRLINK_MAX_LEN) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -169,4 +169,10 @@ public class BgpLinkAttrIgpMetric implements BGPValueType { .add("igpMetric", igpMetric).add("igpMetricLen", igpMetricLen) .toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIsIsAdminstGrp.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIsIsAdminstGrp.java index 086e8b06..448f1e58 100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIsIsAdminstGrp.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIsIsAdminstGrp.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP attribute Is Is Administrative area. */ -public final class BgpLinkAttrIsIsAdminstGrp implements BGPValueType { +public final class BgpLinkAttrIsIsAdminstGrp implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrIsIsAdminstGrp.class); @@ -65,17 +65,17 @@ public final class BgpLinkAttrIsIsAdminstGrp implements BGPValueType { * * @param cb Channel buffer * @return object of type BgpLinkAttrIsIsAdminstGrp - * @throws BGPParseException while parsing BgpLinkAttrIsIsAdminstGrp + * @throws BgpParseException while parsing BgpLinkAttrIsIsAdminstGrp */ public static BgpLinkAttrIsIsAdminstGrp read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { long isisAdminGrp; short lsAttrLength = cb.readShort(); if ((lsAttrLength != ISIS_ADMIN_DATA_LEN) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -127,4 +127,10 @@ public final class BgpLinkAttrIsIsAdminstGrp implements BGPValueType { return MoreObjects.toStringHelper(getClass()) .add("isisAdminGrp", isisAdminGrp).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidth.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidth.java index a1f0198b..2711ca94 100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidth.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidth.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP attribute Max Link bandwidth. */ -public final class BgpLinkAttrMaxLinkBandwidth implements BGPValueType { +public final class BgpLinkAttrMaxLinkBandwidth implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrMaxLinkBandwidth.class); @@ -72,17 +72,17 @@ public final class BgpLinkAttrMaxLinkBandwidth implements BGPValueType { * @param cb Channel buffer * @param type type of this tlv * @return object of type BgpLinkAttrMaxLinkBandwidth - * @throws BGPParseException while parsing BgpLinkAttrMaxLinkBandwidth + * @throws BgpParseException while parsing BgpLinkAttrMaxLinkBandwidth */ public static BgpLinkAttrMaxLinkBandwidth read(ChannelBuffer cb, short type) - throws BGPParseException { + throws BgpParseException { float maxBandwidth; short lsAttrLength = cb.readShort(); if ((lsAttrLength != MAX_BANDWIDTH_LEN) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -147,4 +147,10 @@ public final class BgpLinkAttrMaxLinkBandwidth implements BGPValueType { return MoreObjects.toStringHelper(getClass()) .add("maxBandwidth", maxBandwidth).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMask.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMask.java index 61143fae..2bf1a59d 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMask.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMask.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP MPLS protocol mask attribute. */ -public class BgpLinkAttrMplsProtocolMask implements BGPValueType { +public class BgpLinkAttrMplsProtocolMask implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrMplsProtocolMask.class); @@ -72,10 +72,10 @@ public class BgpLinkAttrMplsProtocolMask implements BGPValueType { * * @param cb Channel buffer * @return object of type BgpLinkAttrMPLSProtocolMask - * @throws BGPParseException while parsing BgpLinkAttrMplsProtocolMask + * @throws BgpParseException while parsing BgpLinkAttrMplsProtocolMask */ public static BgpLinkAttrMplsProtocolMask read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { boolean bLdp = false; boolean bRsvpTe = false; @@ -83,8 +83,8 @@ public class BgpLinkAttrMplsProtocolMask implements BGPValueType { if ((lsAttrLength != MASK_BYTE_LEN) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -149,4 +149,10 @@ public class BgpLinkAttrMplsProtocolMask implements BGPValueType { return MoreObjects.toStringHelper(getClass()) .add("bLdp", bLdp).add("bRsvpTe", bRsvpTe).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrName.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrName.java index e44ba7e1..856ffc36 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrName.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrName.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Arrays; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP link name attribute. */ -public class BgpLinkAttrName implements BGPValueType { +public class BgpLinkAttrName implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrName.class); @@ -64,16 +64,16 @@ public class BgpLinkAttrName implements BGPValueType { * * @param cb Channel buffer * @return object of type BgpLinkAttrName - * @throws BGPParseException while parsing BgpLinkAttrName + * @throws BgpParseException while parsing BgpLinkAttrName */ public static BgpLinkAttrName read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { byte[] linkName; short lsAttrLength = cb.readShort(); if (cb.readableBytes() < lsAttrLength) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -125,4 +125,10 @@ public class BgpLinkAttrName implements BGPValueType { return MoreObjects.toStringHelper(getClass()).omitNullValues() .add("linkName", linkName).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttrib.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttrib.java index 258598be..275b85be 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttrib.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttrib.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Arrays; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP link opaque attribute. */ -public final class BgpLinkAttrOpaqLnkAttrib implements BGPValueType { +public final class BgpLinkAttrOpaqLnkAttrib implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrOpaqLnkAttrib.class); @@ -65,18 +65,18 @@ public final class BgpLinkAttrOpaqLnkAttrib implements BGPValueType { * * @param cb Channel buffer * @return object of type BgpLinkAttrOpaqLnkAttrib - * @throws BGPParseException while parsing BgpLinkAttrOpaqLnkAttrib + * @throws BgpParseException while parsing BgpLinkAttrOpaqLnkAttrib */ public static BgpLinkAttrOpaqLnkAttrib read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { byte[] opaqueLinkAttribute; short lsAttrLength = cb.readShort(); if (cb.readableBytes() < lsAttrLength) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -130,4 +130,10 @@ public final class BgpLinkAttrOpaqLnkAttrib implements BGPValueType { return MoreObjects.toStringHelper(getClass()).omitNullValues() .add("opaqueLinkAttribute", opaqueLinkAttribute).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionType.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionType.java index b45d95b8..59011d97 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionType.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionType.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP link protection type attribute. */ -public final class BgpLinkAttrProtectionType implements BGPValueType { +public final class BgpLinkAttrProtectionType implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrProtectionType.class); @@ -102,10 +102,10 @@ public final class BgpLinkAttrProtectionType implements BGPValueType { * * @param cb Channel buffer * @return object of type BgpLinkAttrProtectionType - * @throws BGPParseException while parsing BgpLinkAttrProtectionType + * @throws BgpParseException while parsing BgpLinkAttrProtectionType */ public static BgpLinkAttrProtectionType read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { short linkProtectionType; byte higherByte; short lsAttrLength = cb.readShort(); @@ -119,8 +119,8 @@ public final class BgpLinkAttrProtectionType implements BGPValueType { if ((lsAttrLength != LINK_PROTECTION_LEN) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -237,4 +237,10 @@ public final class BgpLinkAttrProtectionType implements BGPValueType { .add("bDedOnePlusOne", bDedOnePlusOne) .add("bEnhanced", bEnhanced).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrSrlg.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrSrlg.java new file mode 100644 index 00000000..4a6f23f9 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrSrlg.java @@ -0,0 +1,136 @@ +/* + * 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.types.attr; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; +import org.onosproject.bgpio.util.Validation; + +import com.google.common.base.MoreObjects; + +/** + * Implements BGP link Shared Risk Link Group attribute. + */ +public class BgpLinkAttrSrlg implements BgpValueType { + + public static final short ATTRNODE_SRLG = 1097; + + /* Shared Risk Link Group */ + private List<Integer> sRlg = new ArrayList<Integer>(); + + /** + * Constructor to initialize the date. + * + * @param sRlg Shared Risk link group data + */ + public BgpLinkAttrSrlg(List<Integer> sRlg) { + this.sRlg = sRlg; + } + + /** + * Returns object of this class with specified values. + * + * @param sRlg Shared Risk link group data + * @return object of BgpLinkAttrSrlg + */ + public static BgpLinkAttrSrlg of(ArrayList<Integer> sRlg) { + return new BgpLinkAttrSrlg(sRlg); + } + + /** + * Reads the BGP link attributes Shared Risk link group data. + * + * @param cb Channel buffer + * @return object of type BgpLinkAttrSrlg + * @throws BgpParseException while parsing BgpLinkAttrSrlg + */ + public static BgpLinkAttrSrlg read(ChannelBuffer cb) + throws BgpParseException { + int tempSrlg; + ArrayList<Integer> sRlg = new ArrayList<Integer>(); + + short lsAttrLength = cb.readShort(); + int len = lsAttrLength / Integer.SIZE; // each element is of 4 octets + + if (cb.readableBytes() < lsAttrLength) { + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, + lsAttrLength); + } + + for (int i = 0; i < len; i++) { + tempSrlg = cb.readInt(); + sRlg.add(new Integer(tempSrlg)); + } + + return BgpLinkAttrSrlg.of(sRlg); + } + + /** + * Returns the Shared Risk link group data. + * + * @return array of Shared Risk link group data + */ + public List<Integer> attrSrlg() { + return sRlg; + } + + @Override + public short getType() { + return ATTRNODE_SRLG; + } + + @Override + public int hashCode() { + return Objects.hash(sRlg); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj instanceof BgpLinkAttrSrlg) { + BgpLinkAttrSrlg other = (BgpLinkAttrSrlg) obj; + return Objects.equals(sRlg, other.sRlg); + } + return false; + } + + @Override + public int write(ChannelBuffer cb) { + // TODO This will be implemented in the next version + return 0; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).omitNullValues().add("sRlg", sRlg).toString(); + } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetric.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetric.java index 7febe3c3..1ae7ecc5 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetric.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetric.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP link state Default TE metric link attribute. */ -public class BgpLinkAttrTeDefaultMetric implements BGPValueType { +public class BgpLinkAttrTeDefaultMetric implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrTeDefaultMetric.class); @@ -66,18 +66,18 @@ public class BgpLinkAttrTeDefaultMetric implements BGPValueType { * * @param cb Channel buffer * @return object of type BgpLinkAttrTeDefaultMetric - * @throws BGPParseException while parsing BgpLinkAttrTeDefaultMetric + * @throws BgpParseException while parsing BgpLinkAttrTeDefaultMetric */ public static BgpLinkAttrTeDefaultMetric read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { int linkTeMetric; short lsAttrLength = cb.readShort(); if ((lsAttrLength != TE_DATA_LEN) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -129,4 +129,10 @@ public class BgpLinkAttrTeDefaultMetric implements BGPValueType { return MoreObjects.toStringHelper(getClass()) .add("linkTEMetric", linkTeMetric).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidth.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidth.java new file mode 100644 index 00000000..c927eea5 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidth.java @@ -0,0 +1,163 @@ +/* + * 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.types.attr; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; +import org.onosproject.bgpio.util.Validation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.MoreObjects; + +/** + * Implements BGP unreserved bandwidth attribute. + */ +public class BgpLinkAttrUnRsrvdLinkBandwidth implements BgpValueType { + + protected static final Logger log = LoggerFactory + .getLogger(BgpLinkAttrUnRsrvdLinkBandwidth.class); + + public static final int MAX_BANDWIDTH_LEN = 4; + public static final int NO_OF_BITS = 8; + public static final int NO_OF_PRIORITY = 8; + + public short sType; + + /* ISIS administrative group */ + private List<Float> maxUnResBandwidth = new ArrayList<Float>(); + + /** + * Constructor to initialize the values. + * + * @param maxUnResBandwidth Maximum Unreserved bandwidth + * @param sType returns the tag value + */ + public BgpLinkAttrUnRsrvdLinkBandwidth(List<Float> maxUnResBandwidth, + short sType) { + this.maxUnResBandwidth = maxUnResBandwidth; + this.sType = sType; + } + + /** + * Returns object of this class with specified values. + * + * @param linkPfxMetric Prefix Metric + * @param sType returns the tag value + * @return object of BgpLinkAttrUnRsrvdLinkBandwidth + */ + public static BgpLinkAttrUnRsrvdLinkBandwidth of(List<Float> linkPfxMetric, short sType) { + return new BgpLinkAttrUnRsrvdLinkBandwidth(linkPfxMetric, sType); + } + + /** + * Reads the BGP link attributes of Maximum link bandwidth. + * + * @param cb Channel buffer + * @return object of type BgpLinkAttrMaxLinkBandwidth + * @throws BgpParseException while parsing BgpLinkAttrMaxLinkBandwidth + */ + public static BgpLinkAttrUnRsrvdLinkBandwidth read(ChannelBuffer cb, + short sType) + throws BgpParseException { + ArrayList<Float> maxUnResBandwidth = new ArrayList<Float>(); + float tmp; + short lsAttrLength = cb.readShort(); + + if ((lsAttrLength != MAX_BANDWIDTH_LEN * NO_OF_PRIORITY) + || (cb.readableBytes() < lsAttrLength)) { + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, + lsAttrLength); + } + + for (int i = 0; i < NO_OF_PRIORITY; i++) { + tmp = ieeeToFloatRead(cb.readInt()) * NO_OF_BITS; + maxUnResBandwidth.add(new Float(tmp)); + } + + return BgpLinkAttrUnRsrvdLinkBandwidth.of(maxUnResBandwidth, sType); + } + + /** + * Returns maximum unreserved bandwidth. + * + * @return unreserved bandwidth. + */ + public List<Float> getLinkAttrUnRsrvdLinkBandwidth() { + return maxUnResBandwidth; + } + + /** + * Parse the IEEE floating point notation and returns it in normal float. + * + * @param iVal IEEE floating point number + * @return normal float + */ + static float ieeeToFloatRead(int iVal) { + iVal = (((iVal & 0xFF) << 24) | ((iVal & 0xFF00) << 8) + | ((iVal & 0xFF0000) >> 8) | ((iVal >> 24) & 0xFF)); + + return Float.intBitsToFloat(iVal); + } + + @Override + public short getType() { + return this.sType; + } + + @Override + public int hashCode() { + return Objects.hash(maxUnResBandwidth); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj instanceof BgpLinkAttrUnRsrvdLinkBandwidth) { + BgpLinkAttrUnRsrvdLinkBandwidth other = (BgpLinkAttrUnRsrvdLinkBandwidth) obj; + return Objects.equals(maxUnResBandwidth, other.maxUnResBandwidth); + } + return false; + } + + @Override + public int write(ChannelBuffer cb) { + // TODO This will be implemented in the next version + return 0; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).omitNullValues() + .add("maxUnResBandwidth", maxUnResBandwidth).toString(); + } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrExtRouteTag.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrExtRouteTag.java new file mode 100644 index 00000000..a2d7c57e --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrExtRouteTag.java @@ -0,0 +1,145 @@ +/* + * 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.types.attr; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; +import org.onosproject.bgpio.util.Validation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.MoreObjects; + +/** + * Implements BGP prefix route Extended tag attribute. + */ +public class BgpPrefixAttrExtRouteTag implements BgpValueType { + + protected static final Logger log = LoggerFactory + .getLogger(BgpPrefixAttrExtRouteTag.class); + + public static final int ATTR_PREFIX_EXTROUTETAG = 1154; + public static final int ATTR_PREFIX_EXT_LEN = 8; + + /* Prefix Route Tag */ + private List<Long> pfxExtRouteTag = new ArrayList<Long>(); + + /** + * Constructor to initialize the values. + * + * @param pfxExtRouteTag Extended route tag + */ + public BgpPrefixAttrExtRouteTag(List<Long> pfxExtRouteTag) { + this.pfxExtRouteTag = checkNotNull(pfxExtRouteTag); + } + + /** + * Returns object of this class with specified values. + * + * @param pfxExtRouteTag Prefix Metric + * @return object of BgpPrefixAttrMetric + */ + public static BgpPrefixAttrExtRouteTag of(ArrayList<Long> pfxExtRouteTag) { + return new BgpPrefixAttrExtRouteTag(pfxExtRouteTag); + } + + /** + * Reads the Extended Tag. + * + * @param cb ChannelBuffer + * @return object of BgpPrefixAttrExtRouteTag + * @throws BgpParseException while parsing BgpPrefixAttrExtRouteTag + */ + public static BgpPrefixAttrExtRouteTag read(ChannelBuffer cb) + throws BgpParseException { + ArrayList<Long> pfxExtRouteTag = new ArrayList<Long>(); + long temp; + + short lsAttrLength = cb.readShort(); + int len = lsAttrLength / ATTR_PREFIX_EXT_LEN; + + if (cb.readableBytes() < lsAttrLength) { + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, + lsAttrLength); + } + + for (int i = 0; i < len; i++) { + temp = cb.readLong(); + pfxExtRouteTag.add(new Long(temp)); + } + + return new BgpPrefixAttrExtRouteTag(pfxExtRouteTag); + } + + /** + * Returns Extended route tag. + * + * @return route tag + */ + public List<Long> pfxExtRouteTag() { + return pfxExtRouteTag; + } + + @Override + public short getType() { + return ATTR_PREFIX_EXTROUTETAG; + } + + @Override + public int hashCode() { + return Objects.hash(pfxExtRouteTag); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj instanceof BgpPrefixAttrExtRouteTag) { + BgpPrefixAttrExtRouteTag other = (BgpPrefixAttrExtRouteTag) obj; + return Objects.equals(pfxExtRouteTag, other.pfxExtRouteTag); + } + return false; + } + + @Override + public int write(ChannelBuffer cb) { + // TODO This will be implemented in the next version + return 0; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).omitNullValues() + .add("pfxExtRouteTag", pfxExtRouteTag).toString(); + } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlags.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlags.java index a215e6f1..4e84191a 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlags.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlags.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP prefix IGP Flag attribute. */ -public final class BgpPrefixAttrIgpFlags implements BGPValueType { +public final class BgpPrefixAttrIgpFlags implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpPrefixAttrIgpFlags.class); @@ -88,10 +88,10 @@ public final class BgpPrefixAttrIgpFlags implements BGPValueType { * * @param cb ChannelBuffer * @return object of BgpPrefixAttrIGPFlags - * @throws BGPParseException while parsing BgpPrefixAttrIGPFlags + * @throws BgpParseException while parsing BgpPrefixAttrIGPFlags */ public static BgpPrefixAttrIgpFlags read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { boolean bisisUpDownBit = false; boolean bOspfNoUnicastBit = false; boolean bOspfLclAddrBit = false; @@ -101,8 +101,8 @@ public final class BgpPrefixAttrIgpFlags implements BGPValueType { if ((lsAttrLength != ATTR_PREFIX_FLAG_LEN) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -195,4 +195,10 @@ public final class BgpPrefixAttrIgpFlags implements BGPValueType { .add("bOspfLclAddrBit", bOspfLclAddrBit) .add("bOspfNSSABit", bOspfNSSABit).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetric.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetric.java index 0678b81f..1886102c 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetric.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetric.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP prefix metric attribute. */ -public class BgpPrefixAttrMetric implements BGPValueType { +public class BgpPrefixAttrMetric implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpPrefixAttrMetric.class); @@ -65,18 +65,18 @@ public class BgpPrefixAttrMetric implements BGPValueType { * * @param cb ChannelBuffer * @return object of BgpPrefixAttrMetric - * @throws BGPParseException while parsing BgpPrefixAttrMetric + * @throws BgpParseException while parsing BgpPrefixAttrMetric */ public static BgpPrefixAttrMetric read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { int linkPfxMetric; short lsAttrLength = cb.readShort(); // 4 Bytes if ((lsAttrLength != ATTR_PREFIX_LEN) || (cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -128,4 +128,10 @@ public class BgpPrefixAttrMetric implements BGPValueType { return MoreObjects.toStringHelper(getClass()) .add("linkPfxMetric", linkPfxMetric).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueData.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueData.java index c7008ca1..6f7a74bb 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueData.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueData.java @@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr; import java.util.Arrays; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP prefix opaque data attribute. */ -public final class BgpPrefixAttrOpaqueData implements BGPValueType { +public final class BgpPrefixAttrOpaqueData implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpPrefixAttrOpaqueData.class); @@ -65,18 +65,18 @@ public final class BgpPrefixAttrOpaqueData implements BGPValueType { * * @param cb ChannelBuffer * @return object of BgpPrefixAttrOpaqueData - * @throws BGPParseException while parsing BgpPrefixAttrOpaqueData + * @throws BgpParseException while parsing BgpPrefixAttrOpaqueData */ public static BgpPrefixAttrOpaqueData read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { byte[] opaquePrefixAttribute; short lsAttrLength = cb.readShort(); opaquePrefixAttribute = new byte[lsAttrLength]; if (cb.readableBytes() < lsAttrLength) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -131,4 +131,9 @@ public final class BgpPrefixAttrOpaqueData implements BGPValueType { .toString(); } + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddr.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddr.java index cf043046..4e9db1ee 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddr.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddr.java @@ -20,9 +20,9 @@ import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; import org.onlab.packet.Ip4Address; import org.onlab.packet.Ip6Address; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +32,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP prefix OSPF Forwarding address attribute. */ -public class BgpPrefixAttrOspfFwdAddr implements BGPValueType { +public class BgpPrefixAttrOspfFwdAddr implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpPrefixAttrOspfFwdAddr.class); @@ -80,10 +80,10 @@ public class BgpPrefixAttrOspfFwdAddr implements BGPValueType { * * @param cb ChannelBuffer * @return object of BgpPrefixAttrOSPFFwdAddr - * @throws BGPParseException while parsing BgpPrefixAttrOspfFwdAddr + * @throws BgpParseException while parsing BgpPrefixAttrOspfFwdAddr */ public static BgpPrefixAttrOspfFwdAddr read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { short lsAttrLength; byte[] ipBytes; Ip4Address ip4RouterId = null; @@ -93,8 +93,8 @@ public class BgpPrefixAttrOspfFwdAddr implements BGPValueType { ipBytes = new byte[lsAttrLength]; if ((cb.readableBytes() < lsAttrLength)) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -184,4 +184,10 @@ public class BgpPrefixAttrOspfFwdAddr implements BGPValueType { .add("ip6RouterId", ip6RouterId).toString(); } } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } diff --git a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTag.java b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTag.java index 426eb274..3894c003 100755..100644 --- a/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTag.java +++ b/framework/src/onos/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTag.java @@ -20,9 +20,9 @@ import java.util.List; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPErrorType; -import org.onosproject.bgpio.types.BGPValueType; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpErrorType; +import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +32,7 @@ import com.google.common.base.MoreObjects; /** * Implements BGP prefix route tag attribute. */ -public class BgpPrefixAttrRouteTag implements BGPValueType { +public class BgpPrefixAttrRouteTag implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpPrefixAttrRouteTag.class); @@ -66,10 +66,10 @@ public class BgpPrefixAttrRouteTag implements BGPValueType { * * @param cb ChannelBuffer * @return object of BgpPrefixAttrRouteTag - * @throws BGPParseException while parsing BgpPrefixAttrRouteTag + * @throws BgpParseException while parsing BgpPrefixAttrRouteTag */ public static BgpPrefixAttrRouteTag read(ChannelBuffer cb) - throws BGPParseException { + throws BgpParseException { int tmp; ArrayList<Integer> pfxRouteTag = new ArrayList<Integer>(); @@ -77,8 +77,8 @@ public class BgpPrefixAttrRouteTag implements BGPValueType { int len = lsAttrLength / Integer.SIZE; if (cb.readableBytes() < lsAttrLength) { - Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, - BGPErrorType.ATTRIBUTE_LENGTH_ERROR, + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } @@ -133,4 +133,10 @@ public class BgpPrefixAttrRouteTag implements BGPValueType { return MoreObjects.toStringHelper(getClass()).omitNullValues() .add("pfxRouteTag", pfxRouteTag).toString(); } + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + return 0; + } } |