mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 02:11:38 +02:00
Handle null secondary path properly
Change-Id: Ie537c9fc7b6751ca071b3c7bf1e465bafe7913d3
This commit is contained in:
parent
8552b178e5
commit
df97013b13
@ -20,7 +20,6 @@ import org.onosproject.net.provider.ProviderId;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import static com.google.common.collect.ImmutableSet.of;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation of a network disjoint path pair.
|
* Default implementation of a network disjoint path pair.
|
||||||
@ -40,7 +39,8 @@ public class DefaultDisjointPath extends DefaultPath implements DisjointPath {
|
|||||||
* @param path2 backup path
|
* @param path2 backup path
|
||||||
*/
|
*/
|
||||||
public DefaultDisjointPath(ProviderId providerId, DefaultPath path1, DefaultPath path2) {
|
public DefaultDisjointPath(ProviderId providerId, DefaultPath path1, DefaultPath path2) {
|
||||||
super(providerId, path1.links(), path1.cost() + path2.cost());
|
// Note: cost passed to super will never be used
|
||||||
|
super(providerId, path1.links(), path1.cost());
|
||||||
this.path1 = path1;
|
this.path1 = path1;
|
||||||
this.path2 = path2;
|
this.path2 = path2;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,9 @@ public class DefaultDisjointPath extends DefaultPath implements DisjointPath {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(of(path1, path2), src(), dst());
|
// Note: DisjointPath with primary and secondary swapped
|
||||||
|
// must result in same hashCode
|
||||||
|
return Objects.hash(Objects.hashCode(path1) + Objects.hashCode(path2), src(), dst());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,7 +86,8 @@ public class DefaultDisjointPath extends DefaultPath implements DisjointPath {
|
|||||||
}
|
}
|
||||||
if (obj instanceof DefaultDisjointPath) {
|
if (obj instanceof DefaultDisjointPath) {
|
||||||
final DefaultDisjointPath other = (DefaultDisjointPath) obj;
|
final DefaultDisjointPath other = (DefaultDisjointPath) obj;
|
||||||
return Objects.equals(this.path1, other.path1) && Objects.equals(this.path2, other.path2);
|
return (Objects.equals(this.path1, other.path1) && Objects.equals(this.path2, other.path2)) ||
|
||||||
|
(Objects.equals(this.path1, other.path2) && Objects.equals(this.path2, other.path1));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user