blob: 5555565cdbf3254137cafb134450c4abf26d44a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
package org.onosproject.segmentrouting.grouphandler;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.TrafficTreatment;
import java.util.Objects;
/**
* Class definition of Key for Device/Port to NextObjective store. Since there
* can be multiple next objectives to the same physical port, we differentiate
* between them by including the treatment in the key.
*/
public class PortNextObjectiveStoreKey {
private final DeviceId deviceId;
private final PortNumber portNum;
private final TrafficTreatment treatment;
public PortNextObjectiveStoreKey(DeviceId deviceId, PortNumber portNum,
TrafficTreatment treatment) {
this.deviceId = deviceId;
this.portNum = portNum;
this.treatment = treatment;
}
/**
* Gets device id in this PortNextObjectiveStoreKey.
*
* @return device id
*/
public DeviceId deviceId() {
return deviceId;
}
/**
* Gets port information in this PortNextObjectiveStoreKey.
*
* @return port information
*/
public PortNumber portNumber() {
return portNum;
}
/**
* Gets treatment information in this PortNextObjectiveStoreKey.
*
* @return treatment information
*/
public TrafficTreatment treatment() {
return treatment;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PortNextObjectiveStoreKey)) {
return false;
}
PortNextObjectiveStoreKey that =
(PortNextObjectiveStoreKey) o;
return (Objects.equals(this.deviceId, that.deviceId) &&
Objects.equals(this.portNum, that.portNum) &&
Objects.equals(this.treatment, that.treatment));
}
@Override
public int hashCode() {
return Objects.hash(deviceId, portNum, treatment);
}
@Override
public String toString() {
return "Device: " + deviceId + " Port: " + portNum + " Treatment: " + treatment;
}
}
|