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
8 package org.opendaylight.openflowplugin.api;
10 import com.google.common.collect.ImmutableList;
11 import java.util.List;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
15 import org.opendaylight.yangtools.yang.common.Uint16;
16 import org.opendaylight.yangtools.yang.common.Uint32;
17 import org.opendaylight.yangtools.yang.common.Uint64;
18 import org.opendaylight.yangtools.yang.common.Uint8;
21 * OFP related constants.
23 public final class OFConstants {
25 private OFConstants() {
26 throw new UnsupportedOperationException("OF plugin Constants holder class");
29 /** enum ofp_port_no, reserved port: process with normal L2/L3 switching. */
30 public static final short OFPP_NORMAL = (short)0xfffa;
31 /** enum ofp_port_no, reserved port: all physical ports except input port. */
32 public static final short OFPP_ALL = (short)0xfffc;
33 /** enum ofp_port_no, reserved port: local openflow port. */
34 public static final short OFPP_LOCAL = (short)0xfffe;
36 /** openflow protocol 1.0 - version identifier. */
37 public static final short OFP_VERSION_1_0 = 0x01;
38 /** openflow protocol 1.3 - version identifier. */
39 public static final short OFP_VERSION_1_3 = 0x04;
41 public static final String OF_URI_PREFIX = "openflow:";
43 /** enum ofp_table: Table numbering, wildcard table used for table config, flow stats and flow deletes. */
44 public static final Uint8 OFPTT_ALL = Uint8.MAX_VALUE;
45 public static final Uint32 ANY = Uint32.MAX_VALUE;
46 /** Wildcard port used only for flow mod (delete) and flow stats requests. Selects
47 * all flows regardless of output port (including flows with no output port).*/
48 public static final Uint32 OFPP_ANY = ANY;
49 /** enum ofp_group: For OFPFC_DELETE* commands, require matching entries to include this as an
50 * output group. A value of OFPG_ANY indicates no restriction. */
51 public static final Uint32 OFPG_ANY = ANY;
52 /** enum ofp_group: Represents all groups for group delete commands. */
53 public static final Uint32 OFPG_ALL = Uint32.valueOf(0xfffffffcL).intern();
54 /** Refers to all queues configured at the specified port. */
55 public static final Uint32 OFPQ_ALL = ANY;
56 /** Represents all meters for stat requests commands. */
57 public static final Uint32 OFPM_ALL = ANY;
58 /** Default cookie. */
59 public static final Uint64 DEFAULT_COOKIE = Uint64.ZERO;
60 public static final Uint64 DEFAULT_COOKIE_MASK = Uint64.ZERO;
61 public static final FlowCookie DEFAULT_FLOW_COOKIE = new FlowCookie(DEFAULT_COOKIE);
62 public static final Uint16 DEFAULT_FLOW_PRIORITY = Uint16.valueOf(0x8000).intern();
63 /** Empty flow match. */
64 public static final Match EMPTY_MATCH = new MatchBuilder().build();
66 /** indicates that no buffering should be applied and the whole packet is to be
67 * sent to the controller. */
68 public static final Uint32 OFP_NO_BUFFER = Uint32.valueOf(0xffffffffL).intern();
69 /** enum ofp_controller_max_len: indicates that no buffering should be applied and the whole packet is to be
70 * sent to the controller. */
71 public static final Uint16 OFPCML_NO_BUFFER = Uint16.MAX_VALUE;
73 public static final int MAC_ADDRESS_LENGTH = 6;
74 public static final int SIGNUM_UNSIGNED = 1;
76 /** RpcError application tag. */
77 public static final String APPLICATION_TAG = "OPENFLOW_PLUGIN";
78 /** RpcError tag - timeout. */
79 public static final String ERROR_TAG_TIMEOUT = "TIMOUT";
81 /** Persistent ID of OpenFlowPlugin configuration file. */
82 public static final String CONFIG_FILE_ID = "org.opendaylight.openflowplugin";
84 /** supported version ordered by height (highest version is at the beginning). */
85 public static final List<Short> VERSION_ORDER = ImmutableList
87 .add((short) 0x04, (short) 0x01)