2 * Copyright (C) 2014 Red Hat, Inc.
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
8 * Authors : Dave Tucker, Flavio Fernandes
11 package org.opendaylight.ovsdb.openstack.netvirt;
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;
24 public class NorthboundEvent extends AbstractEvent {
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;
36 NorthboundEvent(NeutronPort port, Action action) {
37 super(HandlerType.NEUTRON_PORT, action);
41 NorthboundEvent(NeutronSubnet subnet, Action action) {
42 super(HandlerType.NEUTRON_SUBNET, action);
46 NorthboundEvent(NeutronRouter router, Action action) {
47 super(HandlerType.NEUTRON_ROUTER, action);
51 NorthboundEvent(NeutronRouter router, NeutronRouter_Interface routerInterface, Action action) {
52 super(HandlerType.NEUTRON_ROUTER, action);
54 this.routerInterface = routerInterface;
57 NorthboundEvent(NeutronFloatingIP neutronFloatingIP, Action action) {
58 super(HandlerType.NEUTRON_FLOATING_IP, action);
59 this.neutronFloatingIP = neutronFloatingIP;
62 NorthboundEvent(NeutronNetwork neutronNetwork, Action action) {
63 super(HandlerType.NEUTRON_NETWORK, action);
64 this.neutronNetwork = neutronNetwork;
67 NorthboundEvent(NeutronLoadBalancer loadBalancer, Action action) {
68 super(HandlerType.NEUTRON_LOAD_BALANCER, action);
69 this.loadBalancer = loadBalancer;
72 NorthboundEvent(NeutronLoadBalancerPool loadBalancerPool, Action action) {
73 super(HandlerType.NEUTRON_LOAD_BALANCER_POOL, action);
74 this.loadBalancerPool = loadBalancerPool;
77 NorthboundEvent(NeutronLoadBalancerPoolMember loadBalancerPoolMember, Action action) {
78 super(HandlerType.NEUTRON_LOAD_BALANCER_POOL_MEMBER, action);
79 this.loadBalancerPoolMember = loadBalancerPoolMember;
82 public NeutronPort getPort() {
85 public NeutronSubnet getSubnet() {
88 public NeutronRouter getRouter() {
91 public NeutronRouter_Interface getRouterInterface() {
92 return routerInterface;
94 public NeutronFloatingIP getNeutronFloatingIP() {
95 return neutronFloatingIP;
97 public NeutronNetwork getNeutronNetwork() {
98 return neutronNetwork;
100 public NeutronLoadBalancer getLoadBalancer() {
103 public NeutronLoadBalancerPool getLoadBalancerPool() {
104 return loadBalancerPool;
106 public NeutronLoadBalancerPoolMember getLoadBalancerPoolMember() {
107 return loadBalancerPoolMember;
111 public String toString() {
112 return "NorthboundEvent [handler=" + super.getHandlerType()
113 + ", action=" + super.getAction()
115 + ", subnet=" + subnet
116 + ", router=" + router
117 + ", routerInterface=" + routerInterface
118 + ", floatingIP=" + neutronFloatingIP
119 + ", network=" + neutronNetwork
120 + ", loadBalancer=" + loadBalancer
121 + ", loadBalancerPool=" + loadBalancerPool
122 + ", loadBalancerPoolMember=" + loadBalancerPoolMember
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());
140 public boolean equals(Object obj) {
147 if (getClass() != obj.getClass()) {
150 if (!super.equals(obj)) {
153 NorthboundEvent other = (NorthboundEvent) obj;
155 if (other.port != null) {
158 } else if (!port.equals(other.port)) {
161 if (subnet == null) {
162 if (other.subnet != null) {
165 } else if (!subnet.equals(other.subnet)) {
168 if (router == null) {
169 if (other.router != null) {
172 } else if (!router.equals(other.router)) {
175 if (routerInterface == null) {
176 if (other.routerInterface != null) {
179 } else if (!routerInterface.equals(other.routerInterface)) {
182 if (neutronFloatingIP == null) {
183 if (other.neutronFloatingIP != null) {
186 } else if (!neutronFloatingIP.equals(other.neutronFloatingIP)) {
189 if (neutronNetwork == null) {
190 if (other.neutronNetwork != null) {
193 } else if (!neutronNetwork.equals(other.neutronNetwork)) {
196 if (loadBalancer == null) {
197 if (other.loadBalancer != null) {
200 } else if (!loadBalancer.equals(other.loadBalancer)) {
203 if (loadBalancerPool == null) {
204 if (other.loadBalancerPool != null) {
207 } else if (!loadBalancerPool.equals(other.loadBalancerPool)) {
210 if (loadBalancerPoolMember == null) {
211 if (other.loadBalancerPoolMember != null) {
214 } else if (!loadBalancerPoolMember.equals(other.loadBalancerPoolMember)) {