Merge "l3 support (partial): move event dispatch from southBoundHandler"
[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.controller.networkconfig.neutron.NeutronPort;
14
15 public class NorthboundEvent extends AbstractEvent {
16
17     private NeutronPort port;
18
19     NorthboundEvent(NeutronPort port, Action action) {
20         super(HandlerType.NEUTRON_PORT, action);
21         this.port = port;
22     }
23
24     public NeutronPort getPort() {
25         return port;
26     }
27
28     @Override
29     public String toString() {
30         return "NorthboundEvent [action=" + super.getAction() + ", port=" + port + "]";
31     }
32
33     @Override
34     public int hashCode() {
35         final int prime = 31;
36         int result = super.hashCode();
37         result = prime * result + ((port == null) ? 0 : port.hashCode());
38         return result;
39     }
40
41     @Override
42     public boolean equals(Object obj) {
43         if (this == obj)
44             return true;
45         if (obj == null)
46             return false;
47         if (getClass() != obj.getClass())
48             return false;
49         if (!super.equals(obj))
50             return false;
51         NorthboundEvent other = (NorthboundEvent) obj;
52         if (port == null) {
53             if (other.port != null)
54                 return false;
55         } else if (!port.equals(other.port))
56             return false;
57         return true;
58     }
59 }