2 * Copyright 2015 Open Networking Laboratory
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onosproject.vtnrsc.event;
18 import java.util.Objects;
20 import org.onosproject.vtnrsc.FloatingIp;
21 import org.onosproject.vtnrsc.Router;
22 import org.onosproject.vtnrsc.RouterInterface;
24 import static com.google.common.base.MoreObjects.toStringHelper;
25 import static com.google.common.base.Preconditions.checkNotNull;
28 * Representation of a VtnRsc event feedback.
30 public class VtnRscEventFeedback {
31 private final FloatingIp floaingtIp;
32 private final Router router;
33 private final RouterInterface routerInterface;
36 * Creates VtnRscEventFeedback object.
38 * @param floatingIp the floating Ip
40 public VtnRscEventFeedback(FloatingIp floatingIp) {
41 this.floaingtIp = checkNotNull(floatingIp, "floaintIp cannot be null");
43 this.routerInterface = null;
47 * Creates VtnRscEventFeedback object.
49 * @param router the router
51 public VtnRscEventFeedback(Router router) {
52 this.floaingtIp = null;
53 this.router = checkNotNull(router, "router cannot be null");
54 this.routerInterface = null;
58 * Creates VtnRscEventFeedback object.
60 * @param routerInterface the router interface
62 public VtnRscEventFeedback(RouterInterface routerInterface) {
63 this.floaingtIp = null;
65 this.routerInterface = checkNotNull(routerInterface,
66 "routerInterface cannot be null");
70 * Returns floating IP.
72 * @return floaingtIp the floating IP
74 public FloatingIp floatingIp() {
81 * @return router the router
83 public Router router() {
88 * Returns router interface.
90 * @return routerInterface the router interface
92 public RouterInterface routerInterface() {
93 return routerInterface;
97 public int hashCode() {
98 return Objects.hash(floaingtIp, router, routerInterface);
102 public boolean equals(Object obj) {
106 if (obj instanceof VtnRscEventFeedback) {
107 final VtnRscEventFeedback that = (VtnRscEventFeedback) obj;
108 return Objects.equals(this.floaingtIp, that.floaingtIp)
109 && Objects.equals(this.router, that.router)
110 && Objects.equals(this.routerInterface, that.routerInterface);
116 public String toString() {
117 return toStringHelper(this)
118 .add("router", router)
119 .add("floaingtIp", floaingtIp)
120 .add("routerInterface", routerInterface)