2 * Copyright (c) 2014, 2015 Red Hat, Inc. and others. All rights reserved.
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
9 package org.opendaylight.ovsdb.openstack.netvirt;
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;
22 public class NorthboundEvent extends AbstractEvent {
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;
34 NorthboundEvent(NeutronPort port, Action action) {
35 super(HandlerType.NEUTRON_PORT, action);
39 NorthboundEvent(NeutronSubnet subnet, Action action) {
40 super(HandlerType.NEUTRON_SUBNET, action);
44 NorthboundEvent(NeutronRouter router, Action action) {
45 super(HandlerType.NEUTRON_ROUTER, action);
49 NorthboundEvent(NeutronRouter router, NeutronRouter_Interface routerInterface, Action action) {
50 super(HandlerType.NEUTRON_ROUTER, action);
52 this.routerInterface = routerInterface;
55 NorthboundEvent(NeutronFloatingIP neutronFloatingIP, Action action) {
56 super(HandlerType.NEUTRON_FLOATING_IP, action);
57 this.neutronFloatingIP = neutronFloatingIP;
60 NorthboundEvent(NeutronNetwork neutronNetwork, Action action) {
61 super(HandlerType.NEUTRON_NETWORK, action);
62 this.neutronNetwork = neutronNetwork;
65 NorthboundEvent(NeutronLoadBalancer loadBalancer, Action action) {
66 super(HandlerType.NEUTRON_LOAD_BALANCER, action);
67 this.loadBalancer = loadBalancer;
70 NorthboundEvent(NeutronLoadBalancerPool loadBalancerPool, Action action) {
71 super(HandlerType.NEUTRON_LOAD_BALANCER_POOL, action);
72 this.loadBalancerPool = loadBalancerPool;
75 NorthboundEvent(NeutronLoadBalancerPoolMember loadBalancerPoolMember, Action action) {
76 super(HandlerType.NEUTRON_LOAD_BALANCER_POOL_MEMBER, action);
77 this.loadBalancerPoolMember = loadBalancerPoolMember;
80 public NeutronPort getPort() {
83 public NeutronSubnet getSubnet() {
86 public NeutronRouter getRouter() {
89 public NeutronRouter_Interface getRouterInterface() {
90 return routerInterface;
92 public NeutronFloatingIP getNeutronFloatingIP() {
93 return neutronFloatingIP;
95 public NeutronNetwork getNeutronNetwork() {
96 return neutronNetwork;
98 public NeutronLoadBalancer getLoadBalancer() {
101 public NeutronLoadBalancerPool getLoadBalancerPool() {
102 return loadBalancerPool;
104 public NeutronLoadBalancerPoolMember getLoadBalancerPoolMember() {
105 return loadBalancerPoolMember;
109 public String toString() {
110 return "NorthboundEvent [handler=" + super.getHandlerType()
111 + ", action=" + super.getAction()
113 + ", subnet=" + subnet
114 + ", router=" + router
115 + ", routerInterface=" + routerInterface
116 + ", floatingIP=" + neutronFloatingIP
117 + ", network=" + neutronNetwork
118 + ", loadBalancer=" + loadBalancer
119 + ", loadBalancerPool=" + loadBalancerPool
120 + ", loadBalancerPoolMember=" + loadBalancerPoolMember
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());
138 public boolean equals(Object obj) {
145 if (getClass() != obj.getClass()) {
148 if (!super.equals(obj)) {
151 NorthboundEvent other = (NorthboundEvent) obj;
153 if (other.port != null) {
156 } else if (!port.equals(other.port)) {
159 if (subnet == null) {
160 if (other.subnet != null) {
163 } else if (!subnet.equals(other.subnet)) {
166 if (router == null) {
167 if (other.router != null) {
170 } else if (!router.equals(other.router)) {
173 if (routerInterface == null) {
174 if (other.routerInterface != null) {
177 } else if (!routerInterface.equals(other.routerInterface)) {
180 if (neutronFloatingIP == null) {
181 if (other.neutronFloatingIP != null) {
184 } else if (!neutronFloatingIP.equals(other.neutronFloatingIP)) {
187 if (neutronNetwork == null) {
188 if (other.neutronNetwork != null) {
191 } else if (!neutronNetwork.equals(other.neutronNetwork)) {
194 if (loadBalancer == null) {
195 if (other.loadBalancer != null) {
198 } else if (!loadBalancer.equals(other.loadBalancer)) {
201 if (loadBalancerPool == null) {
202 if (other.loadBalancerPool != null) {
205 } else if (!loadBalancerPool.equals(other.loadBalancerPool)) {
208 if (loadBalancerPoolMember == null) {
209 if (other.loadBalancerPoolMember != null) {
212 } else if (!loadBalancerPoolMember.equals(other.loadBalancerPoolMember)) {