Merge "BUG-2218: Keep existing link augmentations during discovery process"
[controller.git] / opendaylight / adsal / connectionmanager / implementation / src / main / java / org / opendaylight / controller / connectionmanager / scheme / ControllerConfig.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.connectionmanager.scheme;
9
10 import java.net.InetAddress;
11
12 /**
13  * Configuration object that can be used to prioritize or add weight to a given controller.
14  * This can be potentially used by the Connection management scheme algorithms.
15  *
16  * This is currently not used.
17  *
18  */
19 public class ControllerConfig {
20     private InetAddress controllerId;
21     private int priority;
22     private int weight;
23
24     public ControllerConfig(InetAddress controllerId, int priority, int weight) {
25         this.controllerId = controllerId;
26         this.priority = priority;
27         this.weight = weight;
28     }
29
30     public InetAddress getControllerId() {
31         return controllerId;
32     }
33     public int getPriority() {
34         return priority;
35     }
36     public int getWeight() {
37         return weight;
38     }
39
40     @Override
41     public int hashCode() {
42         final int prime = 31;
43         int result = 1;
44         result = prime * result
45                 + ((controllerId == null) ? 0 : controllerId.hashCode());
46         return result;
47     }
48     @Override
49     public boolean equals(Object obj) {
50         if (this == obj)
51             return true;
52         if (obj == null)
53             return false;
54         if (getClass() != obj.getClass())
55             return false;
56         ControllerConfig other = (ControllerConfig) obj;
57         if (controllerId == null) {
58             if (other.controllerId != null)
59                 return false;
60         } else if (!controllerId.equals(other.controllerId))
61             return false;
62         return true;
63     }
64     @Override
65     public String toString() {
66         return "ControllerConfig [controllerId=" + controllerId + ", priority="
67                 + priority + ", weight=" + weight + "]";
68     }
69 }