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.lib.notation.Row;
13 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
14 //import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
17 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
19 public class SouthboundEvent extends AbstractEvent {
20 public enum Type { NODE, ROW, OPENVSWITCH, BRIDGE, PORT }
23 private String tableName;
26 private Object context;
27 private OvsdbBridgeAugmentation bridge;
28 private OvsdbTerminationPointAugmentation port;
29 private String portName;
30 public SouthboundEvent(Node node, Action action) {
31 super(HandlerType.SOUTHBOUND, action);
32 this.type = Type.NODE;
35 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Action action) {
36 super(HandlerType.SOUTHBOUND, action);
39 this.tableName = tableName;
43 public SouthboundEvent(Node node, String tableName, String uuid, Row row, Object context, Action action) {
44 super(HandlerType.SOUTHBOUND, action);
47 this.tableName = tableName;
50 this.context = context;
52 public SouthboundEvent(Node node, OvsdbBridgeAugmentation bridge, Action action) {
53 super(HandlerType.SOUTHBOUND, action);
54 this.type = Type.BRIDGE;
58 public SouthboundEvent(Node node, OvsdbTerminationPointAugmentation port, String portName, Action action) {
59 super(HandlerType.SOUTHBOUND, action);
60 this.type = Type.PORT;
63 this.portName = portName;
66 public Type getType() {
69 public Node getNode() {
72 public String getTableName() {
75 public String getUuid() {
81 public Object getContext() {
84 public OvsdbBridgeAugmentation getBridge() {
87 public OvsdbTerminationPointAugmentation getPort() {
90 public String getPortName() {
94 public String toString() {
95 if (type == Type.NODE) {
96 return "SouthboundEvent [type=" + type
97 + ", action=" + super.getAction()
98 + ", node=" + node + "]";
99 } else if (type == Type.ROW) {
100 return "SouthboundEvent [type=" + type
101 + ", action=" + super.getAction()
103 + ", tableName=" + tableName
106 + ", context=" + context + "]";
108 return "SouthboundEvent [type=" + type + "]";
113 public int hashCode() {
114 final int prime = 31;
115 int result = super.hashCode();
116 result = prime * result + ((node == null) ? 0 : node.hashCode());
117 result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
118 result = prime * result + ((type == null) ? 0 : type.hashCode());
119 result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
123 public boolean equals(Object obj) {
130 if (getClass() != obj.getClass()) {
133 if (!super.equals(obj)) {
136 SouthboundEvent other = (SouthboundEvent) obj;
138 if (other.node != null) {
141 } else if (!node.equals(other.node)) {
144 if (tableName == null) {
145 if (other.tableName != null) {
148 } else if (!tableName.equals(other.tableName)) {
152 if (other.type != null) {
155 } else if (!type.equals(other.type)) {
159 if (other.uuid != null) {
162 } else if (!uuid.equals(other.uuid)) {