2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.parser.impl;
12 import org.opendaylight.protocol.bgp.linkstate.LinkIdentifier;
13 import org.opendaylight.protocol.bgp.linkstate.SourceProtocol;
17 * Link State MP_(UN)REACH_NLRI (contains BGP Link inf.)
20 public class BGPLinkMP extends AbstractLinkstateMP<LinkIdentifier> {
22 private final Set<LinkIdentifier> link;
25 * Creates BGP LINK MP Reach.
27 * @param identifier long
28 * @param sourceProtocol {@link SourceProtocol}
29 * @param prefixes set of prefix descriptors
30 * @param reachable true if the attribute is MPReach, false if the attribute is MPUnreach
32 public BGPLinkMP(final long identifier, final SourceProtocol sourceProtocol, final boolean reachable, final Set<LinkIdentifier> link) {
33 super(identifier, sourceProtocol, reachable);
38 public Set<LinkIdentifier> getNlri() {
43 * @see java.lang.Object#hashCode()
46 public int hashCode() {
48 int result = super.hashCode();
49 result = prime * result + ((this.link == null) ? 0 : this.link.hashCode());
54 * @see java.lang.Object#equals(java.lang.Object)
57 public boolean equals(final Object obj) {
60 if (!super.equals(obj))
62 if (this.getClass() != obj.getClass())
64 final BGPLinkMP other = (BGPLinkMP) obj;
65 if (this.link == null) {
66 if (other.link != null)
68 } else if (!this.link.equals(other.link))
74 * @see java.lang.Object#toString()
77 public String toString() {
78 final StringBuilder builder = new StringBuilder();
79 builder.append("BGPLinkMP [link=");
80 builder.append(this.link);
82 return builder.toString();