4257c53907b789fd404c6ab2f6a78e9a50595619
[msb/apigateway.git] / apiroute / apiroute-service / src / main / java / org / onap / msb / apiroute / api / Node.java
1 /*******************************************************************************
2  * Copyright 2016-2017 ZTE, Inc. and others.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  * 
7  * http://www.apache.org/licenses/LICENSE-2.0
8  * 
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  ******************************************************************************/
14 package org.onap.msb.apiroute.api;
15
16 import java.io.Serializable;
17 import java.util.Objects;
18
19 import io.swagger.annotations.ApiModelProperty;
20
21 public class Node implements Serializable {
22     private static final long serialVersionUID = 1L;
23
24     @ApiModelProperty(required = true)
25     private String ip;
26
27     @ApiModelProperty(required = true)
28     private String port;
29
30     private String status = "passing"; // 实例健康检查状态
31
32     private int ttl = -1;
33
34     public String getStatus() {
35         return status;
36     }
37
38     public void setStatus(String status) {
39         this.status = status;
40     }
41
42     public String getIp() {
43         return ip;
44     }
45
46     public void setIp(String ip) {
47         this.ip = ip;
48     }
49
50     public String getPort() {
51         return port;
52     }
53
54     public void setPort(String port) {
55         this.port = port;
56     }
57
58     public int getTtl() {
59         return ttl;
60     }
61
62     public void setTtl(int ttl) {
63         this.ttl = ttl;
64     }
65
66     public Node() {
67
68     }
69
70     public Node(String ip, String port, int ttl) {
71         this.ip = ip;
72         this.port = port;
73         this.ttl = ttl;
74     }
75
76     public Node(String ip, String port) {
77         this.ip = ip;
78         this.port = port;
79     }
80
81     @Override
82     public boolean equals(Object o) {
83         if (this == o)
84             return true;
85         if (o == null || getClass() != o.getClass())
86             return false;
87         Node node = (Node) o;
88         return Objects.equals(ttl, node.ttl) && Objects.equals(ip, node.ip) && Objects.equals(port, node.port)
89                         && Objects.equals(status, node.status);
90     }
91
92     @Override
93     public int hashCode() {
94         return Objects.hash(ip, port, status, ttl);
95     }
96 }