Added code for PhysicalPort, LogicalSwitch
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / NorthboundEvent.java
1 /*
2  * Copyright (c) 2014, 2015 Red Hat, 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
9 package org.opendaylight.ovsdb.openstack.netvirt;
10
11 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP;
12 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer;
13 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool;
14 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember;
15 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork;
16 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort;
17 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter;
18 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface;
19 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet;
20 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
21
22 public class NorthboundEvent extends AbstractEvent {
23
24     private NeutronPort port;
25     private NeutronSubnet subnet;
26     private NeutronRouter router;
27     private NeutronRouter_Interface routerInterface;
28     private NeutronFloatingIP neutronFloatingIP;
29     private NeutronNetwork neutronNetwork;
30     private NeutronLoadBalancer loadBalancer;
31     private NeutronLoadBalancerPool loadBalancerPool;
32     private NeutronLoadBalancerPoolMember loadBalancerPoolMember;
33
34     NorthboundEvent(NeutronPort port, Action action) {
35         super(HandlerType.NEUTRON_PORT, action);
36         this.port = port;
37     }
38
39     NorthboundEvent(NeutronSubnet subnet, Action action) {
40         super(HandlerType.NEUTRON_SUBNET, action);
41         this.subnet = subnet;
42     }
43
44     NorthboundEvent(NeutronRouter router, Action action) {
45         super(HandlerType.NEUTRON_ROUTER, action);
46         this.router = router;
47     }
48
49     NorthboundEvent(NeutronRouter router, NeutronRouter_Interface routerInterface, Action action) {
50         super(HandlerType.NEUTRON_ROUTER, action);
51         this.router = router;
52         this.routerInterface = routerInterface;
53     }
54
55     NorthboundEvent(NeutronFloatingIP neutronFloatingIP, Action action) {
56         super(HandlerType.NEUTRON_FLOATING_IP, action);
57         this.neutronFloatingIP = neutronFloatingIP;
58     }
59
60     NorthboundEvent(NeutronNetwork neutronNetwork, Action action) {
61         super(HandlerType.NEUTRON_NETWORK, action);
62         this.neutronNetwork = neutronNetwork;
63     }
64
65     NorthboundEvent(NeutronLoadBalancer loadBalancer, Action action) {
66         super(HandlerType.NEUTRON_LOAD_BALANCER, action);
67         this.loadBalancer = loadBalancer;
68     }
69
70     NorthboundEvent(NeutronLoadBalancerPool loadBalancerPool, Action action) {
71         super(HandlerType.NEUTRON_LOAD_BALANCER_POOL, action);
72         this.loadBalancerPool = loadBalancerPool;
73     }
74
75     NorthboundEvent(NeutronLoadBalancerPoolMember loadBalancerPoolMember, Action action) {
76         super(HandlerType.NEUTRON_LOAD_BALANCER_POOL_MEMBER, action);
77         this.loadBalancerPoolMember = loadBalancerPoolMember;
78     }
79
80     public NeutronPort getPort() {
81         return port;
82     }
83     public NeutronSubnet getSubnet() {
84         return subnet;
85     }
86     public NeutronRouter getRouter() {
87         return router;
88     }
89     public NeutronRouter_Interface getRouterInterface() {
90         return routerInterface;
91     }
92     public NeutronFloatingIP getNeutronFloatingIP() {
93         return neutronFloatingIP;
94     }
95     public NeutronNetwork getNeutronNetwork() {
96         return neutronNetwork;
97     }
98     public NeutronLoadBalancer getLoadBalancer() {
99         return loadBalancer;
100     }
101     public NeutronLoadBalancerPool getLoadBalancerPool() {
102         return loadBalancerPool;
103     }
104     public NeutronLoadBalancerPoolMember getLoadBalancerPoolMember() {
105         return loadBalancerPoolMember;
106     }
107
108     @Override
109     public String toString() {
110         return "NorthboundEvent [handler=" + super.getHandlerType()
111                + ", action=" + super.getAction()
112                + ", port=" + port
113                + ", subnet=" + subnet
114                + ", router=" + router
115                + ", routerInterface=" + routerInterface
116                + ", floatingIP=" + neutronFloatingIP
117                + ", network=" + neutronNetwork
118                + ", loadBalancer=" + loadBalancer
119                + ", loadBalancerPool=" + loadBalancerPool
120                + ", loadBalancerPoolMember=" + loadBalancerPoolMember
121                + "]";
122     }
123
124     @Override
125     public int hashCode() {
126         final int prime = 31;
127         int result = super.hashCode();
128         result = prime * result + ((port == null) ? 0 : port.hashCode());
129         result = prime * result + ((subnet == null) ? 0 : subnet.hashCode());
130         result = prime * result + ((router == null) ? 0 : router.hashCode());
131         result = prime * result + ((routerInterface == null) ? 0 : routerInterface.hashCode());
132         result = prime * result + ((neutronFloatingIP == null) ? 0 : neutronFloatingIP.hashCode());
133         result = prime * result + ((neutronNetwork == null) ? 0 : neutronNetwork.hashCode());
134         return result;
135     }
136
137     @Override
138     public boolean equals(Object obj) {
139         if (this == obj) {
140             return true;
141         }
142         if (obj == null) {
143             return false;
144         }
145         if (getClass() != obj.getClass()) {
146             return false;
147         }
148         if (!super.equals(obj)) {
149             return false;
150         }
151         NorthboundEvent other = (NorthboundEvent) obj;
152         if (port == null) {
153             if (other.port != null) {
154                 return false;
155             }
156         } else if (!port.equals(other.port)) {
157             return false;
158         }
159         if (subnet == null) {
160             if (other.subnet != null) {
161                 return false;
162             }
163         } else if (!subnet.equals(other.subnet)) {
164             return false;
165         }
166         if (router == null) {
167             if (other.router != null) {
168                 return false;
169             }
170         } else if (!router.equals(other.router)) {
171             return false;
172         }
173         if (routerInterface == null) {
174             if (other.routerInterface != null) {
175                 return false;
176             }
177         } else if (!routerInterface.equals(other.routerInterface)) {
178             return false;
179         }
180         if (neutronFloatingIP == null) {
181             if (other.neutronFloatingIP != null) {
182                 return false;
183             }
184         } else if (!neutronFloatingIP.equals(other.neutronFloatingIP)) {
185             return false;
186         }
187         if (neutronNetwork == null) {
188             if (other.neutronNetwork != null) {
189                 return false;
190             }
191         } else if (!neutronNetwork.equals(other.neutronNetwork)) {
192             return false;
193         }
194         if (loadBalancer == null) {
195             if (other.loadBalancer != null) {
196                 return false;
197             }
198         } else if (!loadBalancer.equals(other.loadBalancer)) {
199             return false;
200         }
201         if (loadBalancerPool == null) {
202             if (other.loadBalancerPool != null) {
203                 return false;
204             }
205         } else if (!loadBalancerPool.equals(other.loadBalancerPool)) {
206             return false;
207         }
208         if (loadBalancerPoolMember == null) {
209             if (other.loadBalancerPoolMember != null) {
210                 return false;
211             }
212         } else if (!loadBalancerPoolMember.equals(other.loadBalancerPoolMember)) {
213             return false;
214         }
215         return true;
216     }
217 }