2 * Copyright (c) 2013, 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.api.Action;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
14 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
17 public class SouthboundEvent extends AbstractEvent {
18 public enum Type { NODE, OPENVSWITCH, BRIDGE, CONTROLLER, PORT }
21 private String tableName;
23 private Object context;
24 private DataObject augmentationData;
25 private OvsdbBridgeAugmentation bridge;
26 private OvsdbTerminationPointAugmentation port;
27 private String portName;
28 public SouthboundEvent(Node node, Action action) {
29 super(HandlerType.SOUTHBOUND, action);
30 this.type = Type.NODE;
33 public SouthboundEvent(Node node, OvsdbBridgeAugmentation bridge, Action action) {
34 super(HandlerType.SOUTHBOUND, action);
35 this.type = Type.BRIDGE;
39 public SouthboundEvent(Node node, OvsdbTerminationPointAugmentation port, String portName, Action action) {
40 super(HandlerType.SOUTHBOUND, action);
41 this.type = Type.PORT;
44 this.portName = portName;
47 public SouthboundEvent(Node node, Type type, Action action) {
48 super(HandlerType.SOUTHBOUND, action);
53 public SouthboundEvent(Node node, DataObject resourceAugmentationData, Type type, Action action) {
54 super(HandlerType.SOUTHBOUND, action);
57 this.augmentationData = resourceAugmentationData;
61 public Type getType() {
64 public Node getNode() {
67 public String getTableName() {
70 public String getUuid() {
73 public Object getContext() {
76 public OvsdbBridgeAugmentation getBridge() {
79 public OvsdbTerminationPointAugmentation getPort() {
82 public String getPortName() {
86 public DataObject getAugmentationData() {
87 return augmentationData;
91 public String toString() {
92 //if (type == Type.NODE) {
93 return "SouthboundEvent [type=" + type
94 + ", action=" + super.getAction()
95 + ", augmentationData=" + augmentationData
96 + ", node=" + node + "]";
98 // return "SouthboundEvent [type=" + type + "]";
103 public int hashCode() {
104 final int prime = 31;
105 int result = super.hashCode();
106 result = prime * result + ((node == null) ? 0 : node.hashCode());
107 result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
108 result = prime * result + ((type == null) ? 0 : type.hashCode());
109 result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
110 result = prime * result + ((augmentationData == null) ? 0 : augmentationData.hashCode());
114 public boolean equals(Object obj) {
121 if (getClass() != obj.getClass()) {
124 if (!super.equals(obj)) {
127 SouthboundEvent other = (SouthboundEvent) obj;
129 if (other.node != null) {
132 } else if (!node.equals(other.node)) {
135 if (tableName == null) {
136 if (other.tableName != null) {
139 } else if (!tableName.equals(other.tableName)) {
143 if (other.type != null) {
146 } else if (!type.equals(other.type)) {
150 if (other.uuid != null) {
153 } else if (!uuid.equals(other.uuid)) {