2 * Copyright (C) 2013 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 : Madhu Venugopal, Brent Salisbury
10 package org.opendaylight.ovsdb.openstack.netvirt;
12 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
18 public class SouthboundEvent extends AbstractEvent {
19 public enum Type { NODE, OPENVSWITCH, BRIDGE, CONTROLLER, PORT }
22 private String tableName;
24 private Object context;
25 private DataObject augmentationData;
26 private OvsdbBridgeAugmentation bridge;
27 private OvsdbTerminationPointAugmentation port;
28 private String portName;
29 public SouthboundEvent(Node node, Action action) {
30 super(HandlerType.SOUTHBOUND, action);
31 this.type = Type.NODE;
34 public SouthboundEvent(Node node, OvsdbBridgeAugmentation bridge, Action action) {
35 super(HandlerType.SOUTHBOUND, action);
36 this.type = Type.BRIDGE;
40 public SouthboundEvent(Node node, OvsdbTerminationPointAugmentation port, String portName, Action action) {
41 super(HandlerType.SOUTHBOUND, action);
42 this.type = Type.PORT;
45 this.portName = portName;
48 public SouthboundEvent(Node node, Type type, Action action) {
49 super(HandlerType.SOUTHBOUND, action);
54 public SouthboundEvent(Node node, DataObject resourceAugmentationData, Type type, Action action) {
55 super(HandlerType.SOUTHBOUND, action);
58 this.augmentationData = resourceAugmentationData;
62 public Type getType() {
65 public Node getNode() {
68 public String getTableName() {
71 public String getUuid() {
74 public Object getContext() {
77 public OvsdbBridgeAugmentation getBridge() {
80 public OvsdbTerminationPointAugmentation getPort() {
83 public String getPortName() {
87 public DataObject getAugmentationData() {
88 return augmentationData;
92 public String toString() {
93 //if (type == Type.NODE) {
94 return "SouthboundEvent [type=" + type
95 + ", action=" + super.getAction()
96 + ", augmentationData=" + augmentationData
97 + ", node=" + node + "]";
99 // return "SouthboundEvent [type=" + type + "]";
104 public int hashCode() {
105 final int prime = 31;
106 int result = super.hashCode();
107 result = prime * result + ((node == null) ? 0 : node.hashCode());
108 result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
109 result = prime * result + ((type == null) ? 0 : type.hashCode());
110 result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
111 result = prime * result + ((augmentationData == null) ? 0 : augmentationData.hashCode());
115 public boolean equals(Object obj) {
122 if (getClass() != obj.getClass()) {
125 if (!super.equals(obj)) {
128 SouthboundEvent other = (SouthboundEvent) obj;
130 if (other.node != null) {
133 } else if (!node.equals(other.node)) {
136 if (tableName == null) {
137 if (other.tableName != null) {
140 } else if (!tableName.equals(other.tableName)) {
144 if (other.type != null) {
147 } else if (!type.equals(other.type)) {
151 if (other.uuid != null) {
154 } else if (!uuid.equals(other.uuid)) {