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