BUG 2302 : odl-clustering-test-app should not be part of the odl-restconf-all feature set
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / core / Actions.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.sal.core;
11
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 /**
18  * @file   Actions.java
19  *
20  * @brief  Class representing actions
21  *
22  * Describes supported actions
23  * @Deprecated This class is OF 1.0 specific. Use SupportedFlowActions instead.
24  */
25 @Deprecated
26 @XmlRootElement
27 @XmlAccessorType(XmlAccessType.NONE)
28 public class Actions extends Property {
29         private static final long serialVersionUID = 1L;
30     @XmlElement(name="value")
31     private int actionsValue;
32
33     public enum ActionType {
34         OUTPUT_PORT_ACTION(1<<0),
35         VLAN_VID_ACTION(1<<1),
36         VLAN_PCP_ACTION(1<<2),
37         VLAN_STRIP_ACTION(1<<3),
38         DLSRC_ACTION(1<<4),
39         DLDST_ACTION(1<<5),
40         NWSRC_ACTION(1<<6),
41         NWDST_ACTION(1<<7),
42         NWTOS_ACTION(1<<8),
43         TPTSRC_ACTION(1<<9),
44         TPTDST_ACTION(1<<10),
45         ENQUEUE_ACTION(1<<11),
46         VENDOR_ACTION(0xffff);
47         private final int at;
48         ActionType(int val) {
49                 this.at = val;
50         }
51         public int getValue() {
52                 return at;
53         }
54     }
55
56     public static final String ActionsPropName = "actions";
57     /**
58      * Construct a actions property
59      *
60      * @param actions the actions value
61      * @return Constructed object
62      */
63     public Actions(int actions) {
64         super(ActionsPropName);
65         this.actionsValue = actions;
66     }
67
68     /*
69      * Private constructor used for JAXB mapping
70      */
71     private Actions() {
72         super(ActionsPropName);
73         this.actionsValue = 0;
74     }
75
76     @Override
77     public Actions clone() {
78         return new Actions(this.actionsValue);
79     }
80
81     public int getValue() {
82         return this.actionsValue;
83     }
84
85
86     @Override
87     public int hashCode() {
88         final int prime = 31;
89         int result = super.hashCode();
90         result = prime * result + actionsValue;
91         return result;
92     }
93
94     @Override
95     public boolean equals(Object obj) {
96         if (this == obj) {
97             return true;
98         }
99         if (!super.equals(obj)) {
100             return false;
101         }
102         if (getClass() != obj.getClass()) {
103             return false;
104         }
105         Actions other = (Actions) obj;
106         if (actionsValue != other.actionsValue) {
107             return false;
108         }
109         return true;
110     }
111
112     @Override
113     public String toString() {
114         return "Actions[" + actionsValue + "]";
115     }
116
117     @Override
118     public String getStringValue() {
119         return Integer.toHexString(actionsValue);
120     }
121 }