mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-23 21:31:00 +02:00
Added normalization of HostToHost id fingerprint to allow host one/two to come in either order.
This commit is contained in:
parent
4926c1b06f
commit
d03a56e02d
@ -17,26 +17,33 @@ public final class HostToHostIntent extends ConnectivityIntent {
|
||||
private final HostId two;
|
||||
|
||||
/**
|
||||
* Creates a new point-to-point intent with the supplied ingress/egress
|
||||
* ports.
|
||||
* Creates a new host-to-host intent with the supplied host pair.
|
||||
*
|
||||
* @param appId application identifier
|
||||
* @param one first host
|
||||
* @param two second host
|
||||
* @param selector action
|
||||
* @param treatment ingress port
|
||||
* @throws NullPointerException if {@code ingressPort} or {@code egressPort}
|
||||
* is null.
|
||||
* @throws NullPointerException if {@code one} or {@code two} is null.
|
||||
*/
|
||||
public HostToHostIntent(ApplicationId appId, HostId one, HostId two,
|
||||
TrafficSelector selector,
|
||||
TrafficTreatment treatment) {
|
||||
super(id(HostToHostIntent.class, one, two, selector, treatment),
|
||||
super(id(HostToHostIntent.class, min(one, two), max(one, two),
|
||||
selector, treatment),
|
||||
appId, null, selector, treatment);
|
||||
this.one = checkNotNull(one);
|
||||
this.two = checkNotNull(two);
|
||||
}
|
||||
|
||||
private static HostId min(HostId one, HostId two) {
|
||||
return one.hashCode() < two.hashCode() ? one : two;
|
||||
}
|
||||
|
||||
private static HostId max(HostId one, HostId two) {
|
||||
return one.hashCode() > two.hashCode() ? one : two;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns identifier of the first host.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user