diff options
Diffstat (limited to 'framework/src/onos/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/PathAttrNlriDetails.java')
-rwxr-xr-x | framework/src/onos/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/PathAttrNlriDetails.java | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/PathAttrNlriDetails.java b/framework/src/onos/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/PathAttrNlriDetails.java deleted file mode 100755 index 9578ccfe..00000000 --- a/framework/src/onos/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/PathAttrNlriDetails.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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.linkstate; - -import java.util.Iterator; -import java.util.List; -import java.util.Objects; - -import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType; -import org.onosproject.bgpio.types.BgpValueType; - -import com.google.common.base.MoreObjects; - -/** - * This Class stores path Attributes, protocol ID and Identifier of LinkState NLRI. - */ -public class PathAttrNlriDetails { - private List<BgpValueType> pathAttributes; - private ProtocolType protocolID; - private long identifier; - - /** - * Sets path attribute with specified path attribute. - * - * @param pathAttributes in update message - */ - public void setPathAttribute(List<BgpValueType> pathAttributes) { - this.pathAttributes = pathAttributes; - } - - /** - * Returns path attributes. - * - * @return path attributes - */ - public List<BgpValueType> pathAttributes() { - return this.pathAttributes; - } - - /** - * Sets protocolID with specified protocolID. - * - * @param protocolID in linkstate nlri - */ - public void setProtocolID(ProtocolType protocolID) { - this.protocolID = protocolID; - } - - /** - * Returns protocolID. - * - * @return protocolID - */ - public ProtocolType protocolID() { - return this.protocolID; - } - - /** - * Sets identifier with specified identifier. - * - * @param identifier in linkstate nlri - */ - public void setIdentifier(long identifier) { - this.identifier = identifier; - } - - /** - * Returns Identifier. - * - * @return Identifier - */ - public long identifier() { - return this.identifier; - } - - @Override - public int hashCode() { - return Objects.hash(pathAttributes, protocolID, identifier); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - - if (obj instanceof PathAttrNlriDetails) { - int countObjSubTlv = 0; - int countOtherSubTlv = 0; - boolean isCommonSubTlv = true; - PathAttrNlriDetails other = (PathAttrNlriDetails) obj; - Iterator<BgpValueType> objListIterator = other.pathAttributes.iterator(); - countOtherSubTlv = other.pathAttributes.size(); - countObjSubTlv = pathAttributes.size(); - if (countObjSubTlv != countOtherSubTlv) { - return false; - } else { - while (objListIterator.hasNext() && isCommonSubTlv) { - BgpValueType subTlv = objListIterator.next(); - if (pathAttributes.contains(subTlv) && other.pathAttributes.contains(subTlv)) { - isCommonSubTlv = Objects.equals(pathAttributes.get(pathAttributes.indexOf(subTlv)), - other.pathAttributes.get(other.pathAttributes.indexOf(subTlv))); - } else { - isCommonSubTlv = false; - } - } - return isCommonSubTlv && Objects.equals(identifier, other.identifier) - && Objects.equals(protocolID, other.protocolID); - } - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()) - .add("identifier", identifier) - .add("protocolID", protocolID) - .add("pathAttributes", pathAttributes) - .toString(); - } -} |