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