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