2 * Copyright (c) 2013 Cisco Systems, 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.controller.sal.action;
12 * The enumeration of actions supported by the controller
13 * Each entry has a unique id and the values range for the action element where applicable
15 public enum ActionType {
17 LOOPBACK("loopback", 0, 0),
18 FLOOD("flood", 0, 0), // regular switching flood (obeys to stp port state)
19 FLOOD_ALL("floodAll", 0, 0), // flood to all ports regardless of stp port state
20 CONTROLLER("controller", 0, 0),
21 INTERFACE("interface", 0, 0), // Interface
22 SW_PATH("software path", 0, 0), // OF Local
23 HW_PATH("harware path", 0, 0),
24 OUTPUT("output", 0, 0xffff), // physical port
25 ENQUEUE("enqueue", 0, 0xffff),
26 SET_DL_SRC("setDlSrc", 0, 0),
27 SET_DL_DST("setDlDst", 0, 0),
28 SET_VLAN_ID("setVlan", 1, 0xfff),
29 SET_VLAN_PCP("setVlanPcp", 0, 0x7),
30 SET_VLAN_CFI("setVlanCif", 0, 0x1),
31 POP_VLAN("stripVlan", 0, 0), // Pop
32 PUSH_VLAN("pushVlan", 0, 0xffff), // Push (the max value only takes into account the TCI portion of the 802.1q header)
33 SET_DL_TYPE("setDlType", 0, 0xffff), // Set ethertype/length field
34 SET_NW_SRC("setNwSrc", 0, 0),
35 SET_NW_DST("setNwDst", 0, 0),
36 SET_NW_TOS("setNwTos", 0, 0x3f),
37 SET_TP_SRC("setTpSrc", 1, 0xffff),
38 SET_TP_DST("setTpDst", 1, 0xffff),
39 SET_NEXT_HOP("setNextHop", 0, 0);
45 private ActionType(String id, int minValue, int maxValue) {
47 this.minValue = minValue;
48 this.maxValue = maxValue;
51 public String getId() {
55 public boolean isValidTarget(int value) {
56 return (value >= minValue && value <= maxValue);
59 public String getRange() {
60 return "[0x" + Long.toHexString(minValue) + "-0x" + Long.toHexString(maxValue) + "]";
63 public boolean takesParameter() {
79 public int calculateConsistentHashCode() {
80 if (this.id != null) {
81 return this.id.hashCode();