BUG 2302 : odl-clustering-test-app should not be part of the odl-restconf-all feature set
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / action / Output.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
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
9 package org.opendaylight.controller.sal.action;
10
11 import javax.xml.bind.annotation.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 import org.opendaylight.controller.sal.core.NodeConnector;
17
18 /**
19  * Represents the action of sending the packet out of a physical port
20  */
21 @XmlRootElement
22 @XmlAccessorType(XmlAccessType.NONE)
23 public class Output extends Action {
24     private static final long serialVersionUID = 1L;
25     @XmlElement
26     private NodeConnector port;
27
28     /* Dummy constructor for JAXB */
29     @SuppressWarnings("unused")
30     private Output() {
31     }
32
33     public Output(NodeConnector port) {
34         type = ActionType.OUTPUT;
35         this.port = port;
36         // checkValue(port);
37     }
38
39     public NodeConnector getPort() {
40         return port;
41     }
42
43     @Override
44     public boolean equals(Object obj) {
45         if (this == obj) {
46             return true;
47         }
48         if (!super.equals(obj)) {
49             return false;
50         }
51         if (getClass() != obj.getClass()) {
52             return false;
53         }
54         Output other = (Output) obj;
55         if (port == null) {
56             if (other.port != null) {
57                 return false;
58             }
59         } else if (!port.equals(other.port)) {
60             return false;
61         }
62         return true;
63     }
64
65     @Override
66     public int hashCode() {
67         final int prime = 31;
68         int result = super.hashCode();
69         result = prime * result + ((port == null) ? 0 : port.hashCode());
70         return result;
71     }
72
73     @Override
74     public String toString() {
75         return type + "[" + port.toString() + "]";
76     }
77 }