Merge "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.NeutronSecurityRule;
20 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet;
21 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
22
23 public class NorthboundEvent extends AbstractEvent {
24
25     private NeutronPort port;
26     private NeutronSubnet subnet;
27     private NeutronRouter router;
28     private NeutronRouter_Interface routerInterface;
29     private NeutronFloatingIP neutronFloatingIP;
30     private NeutronNetwork neutronNetwork;
31     private NeutronLoadBalancer loadBalancer;
32     private NeutronLoadBalancerPool loadBalancerPool;
33     private NeutronLoadBalancerPoolMember loadBalancerPoolMember;
34     private NeutronSecurityRule neutronSecurityRule;
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     NorthboundEvent(NeutronSecurityRule neutronSecurityRule, Action action) {
83         super(HandlerType.NEUTRON_PORT_SECURITY, action);
84         this.neutronSecurityRule = neutronSecurityRule;
85     }
86
87     public NeutronPort getPort() {
88         return port;
89     }
90     public NeutronSubnet getSubnet() {
91         return subnet;
92     }
93     public NeutronRouter getRouter() {
94         return router;
95     }
96     public NeutronRouter_Interface getRouterInterface() {
97         return routerInterface;
98     }
99     public NeutronFloatingIP getNeutronFloatingIP() {
100         return neutronFloatingIP;
101     }
102     public NeutronNetwork getNeutronNetwork() {
103         return neutronNetwork;
104     }
105     public NeutronLoadBalancer getLoadBalancer() {
106         return loadBalancer;
107     }
108     public NeutronLoadBalancerPool getLoadBalancerPool() {
109         return loadBalancerPool;
110     }
111     public NeutronLoadBalancerPoolMember getLoadBalancerPoolMember() {
112         return loadBalancerPoolMember;
113     }
114     public NeutronSecurityRule getNeutronSecurityRule() {
115         return neutronSecurityRule;
116     }
117
118     @Override
119     public String toString() {
120         return "NorthboundEvent [handler=" + super.getHandlerType()
121                + ", action=" + super.getAction()
122                + ", port=" + port
123                + ", subnet=" + subnet
124                + ", router=" + router
125                + ", routerInterface=" + routerInterface
126                + ", floatingIP=" + neutronFloatingIP
127                + ", network=" + neutronNetwork
128                + ", loadBalancer=" + loadBalancer
129                + ", loadBalancerPool=" + loadBalancerPool
130                + ", loadBalancerPoolMember=" + loadBalancerPoolMember
131                + ", neutronsecurityRule=" + neutronSecurityRule
132                + "]";
133     }
134
135     @Override
136     public int hashCode() {
137         final int prime = 31;
138         int result = super.hashCode();
139         result = prime * result + ((port == null) ? 0 : port.hashCode());
140         result = prime * result + ((subnet == null) ? 0 : subnet.hashCode());
141         result = prime * result + ((router == null) ? 0 : router.hashCode());
142         result = prime * result + ((routerInterface == null) ? 0 : routerInterface.hashCode());
143         result = prime * result + ((neutronFloatingIP == null) ? 0 : neutronFloatingIP.hashCode());
144         result = prime * result + ((neutronNetwork == null) ? 0 : neutronNetwork.hashCode());
145         result = prime * result + ((neutronSecurityRule == null) ? 0 : neutronSecurityRule.hashCode());
146         return result;
147     }
148
149     @Override
150     public boolean equals(Object obj) {
151         if (this == obj) {
152             return true;
153         }
154         if (obj == null) {
155             return false;
156         }
157         if (getClass() != obj.getClass()) {
158             return false;
159         }
160         if (!super.equals(obj)) {
161             return false;
162         }
163         NorthboundEvent other = (NorthboundEvent) obj;
164         if (port == null) {
165             if (other.port != null) {
166                 return false;
167             }
168         } else if (!port.equals(other.port)) {
169             return false;
170         }
171         if (subnet == null) {
172             if (other.subnet != null) {
173                 return false;
174             }
175         } else if (!subnet.equals(other.subnet)) {
176             return false;
177         }
178         if (router == null) {
179             if (other.router != null) {
180                 return false;
181             }
182         } else if (!router.equals(other.router)) {
183             return false;
184         }
185         if (routerInterface == null) {
186             if (other.routerInterface != null) {
187                 return false;
188             }
189         } else if (!routerInterface.equals(other.routerInterface)) {
190             return false;
191         }
192         if (neutronFloatingIP == null) {
193             if (other.neutronFloatingIP != null) {
194                 return false;
195             }
196         } else if (!neutronFloatingIP.equals(other.neutronFloatingIP)) {
197             return false;
198         }
199         if (neutronNetwork == null) {
200             if (other.neutronNetwork != null) {
201                 return false;
202             }
203         } else if (!neutronNetwork.equals(other.neutronNetwork)) {
204             return false;
205         }
206         if (loadBalancer == null) {
207             if (other.loadBalancer != null) {
208                 return false;
209             }
210         } else if (!loadBalancer.equals(other.loadBalancer)) {
211             return false;
212         }
213         if (loadBalancerPool == null) {
214             if (other.loadBalancerPool != null) {
215                 return false;
216             }
217         } else if (!loadBalancerPool.equals(other.loadBalancerPool)) {
218             return false;
219         }
220         if (loadBalancerPoolMember == null) {
221             if (other.loadBalancerPoolMember != null) {
222                 return false;
223             }
224         } else if (!loadBalancerPoolMember.equals(other.loadBalancerPoolMember)) {
225             return false;
226         }
227         if (neutronSecurityRule == null) {
228             if (other.neutronSecurityRule != null) {
229                 return false;
230             }
231         } else if (!neutronSecurityRule.equals(other.neutronSecurityRule)) {
232             return false;
233         }
234         return true;
235     }
236 }