Connection Manager infrastructure supporting the Clustering Active-Active requirement.
[controller.git] / opendaylight / connectionmanager / implementation / src / main / java / org / opendaylight / controller / connectionmanager / scheme / ControllerConfig.java
1 package org.opendaylight.controller.connectionmanager.scheme;
2
3 import java.net.InetAddress;
4
5 /**
6  * Configuration object that can be used to prioritize or add weight to a given controller.
7  * This can be potentially used by the Connection management scheme algorithms.
8  *
9  * This is currently not used.
10  *
11  */
12 public class ControllerConfig {
13     private InetAddress controllerId;
14     private int priority;
15     private int weight;
16
17     public ControllerConfig(InetAddress controllerId, int priority, int weight) {
18         this.controllerId = controllerId;
19         this.priority = priority;
20         this.weight = weight;
21     }
22
23     public InetAddress getControllerId() {
24         return controllerId;
25     }
26     public int getPriority() {
27         return priority;
28     }
29     public int getWeight() {
30         return weight;
31     }
32
33     @Override
34     public int hashCode() {
35         final int prime = 31;
36         int result = 1;
37         result = prime * result
38                 + ((controllerId == null) ? 0 : controllerId.hashCode());
39         return result;
40     }
41     @Override
42     public boolean equals(Object obj) {
43         if (this == obj)
44             return true;
45         if (obj == null)
46             return false;
47         if (getClass() != obj.getClass())
48             return false;
49         ControllerConfig other = (ControllerConfig) obj;
50         if (controllerId == null) {
51             if (other.controllerId != null)
52                 return false;
53         } else if (!controllerId.equals(other.controllerId))
54             return false;
55         return true;
56     }
57     @Override
58     public String toString() {
59         return "ControllerConfig [controllerId=" + controllerId + ", priority="
60                 + priority + ", weight=" + weight + "]";
61     }
62 }