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.controller.networkconfig.neutron.NeutronFloatingIP;
14 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
15 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
16 import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
17 import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
18 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
19 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
20 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
21 import org.opendaylight.controller.networkconfig.neutron.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 [action=" + super.getAction()
114 + ", subnet=" + subnet
115 + ", router=" + router
116 + ", routerInterface=" + routerInterface
117 + ", floatingIP=" + neutronFloatingIP
118 + ", network=" + neutronNetwork
119 + ", loadBalancer=" + loadBalancer
120 + ", loadBalancerPool=" + loadBalancerPool
121 + ", loadBalancerPoolMember=" + loadBalancerPoolMember
126 public int hashCode() {
127 final int prime = 31;
128 int result = super.hashCode();
129 result = prime * result + ((port == null) ? 0 : port.hashCode());
130 result = prime * result + ((subnet == null) ? 0 : subnet.hashCode());
131 result = prime * result + ((router == null) ? 0 : router.hashCode());
132 result = prime * result + ((routerInterface == null) ? 0 : routerInterface.hashCode());
133 result = prime * result + ((neutronFloatingIP == null) ? 0 : neutronFloatingIP.hashCode());
134 result = prime * result + ((neutronNetwork == null) ? 0 : neutronNetwork.hashCode());
139 public boolean equals(Object obj) {
144 if (getClass() != obj.getClass())
146 if (!super.equals(obj))
148 NorthboundEvent other = (NorthboundEvent) obj;
150 if (other.port != null)
152 } else if (!port.equals(other.port))
154 if (subnet == null) {
155 if (other.subnet != null)
157 } else if (!subnet.equals(other.subnet))
159 if (router == null) {
160 if (other.router != null)
162 } else if (!router.equals(other.router))
164 if (routerInterface == null) {
165 if (other.routerInterface != null)
167 } else if (!routerInterface.equals(other.routerInterface))
169 if (neutronFloatingIP == null) {
170 if (other.neutronFloatingIP != null)
172 } else if (!neutronFloatingIP.equals(other.neutronFloatingIP))
174 if (neutronNetwork == null) {
175 if (other.neutronNetwork != null)
177 } else if (!neutronNetwork.equals(other.neutronNetwork))
179 if (loadBalancer == null) {
180 if (other.loadBalancer != null)
182 } else if (!loadBalancer.equals(other.loadBalancer))
184 if (loadBalancerPool == null) {
185 if (other.loadBalancerPool != null)
187 } else if (!loadBalancerPool.equals(other.loadBalancerPool))
189 if (loadBalancerPoolMember == null) {
190 if (other.loadBalancerPoolMember != null)
192 } else if (!loadBalancerPoolMember.equals(other.loadBalancerPoolMember))