X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fapi%2FOFConstants.java;h=37aac3072444d78034c821f4ace7f058b3cb27b0;hb=777c94332871b8c34f56f7f2010de1536cb759ba;hp=e08903b339dcaf44e6903cd82f1f8fb0ab4675d7;hpb=6e1e20dd97e1c7605cb5c8e619ace7dbb80f4781;p=openflowplugin.git diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java index e08903b339..37aac30724 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the @@ -7,70 +7,77 @@ */ package org.opendaylight.openflowplugin.api; -import java.math.BigInteger; +import java.util.List; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; +import org.opendaylight.yangtools.yang.common.ErrorTag; +import org.opendaylight.yangtools.yang.common.Uint16; +import org.opendaylight.yangtools.yang.common.Uint32; +import org.opendaylight.yangtools.yang.common.Uint64; +import org.opendaylight.yangtools.yang.common.Uint8; /** - * OFP related constants + * OFP related constants. */ public final class OFConstants { + /** enum ofp_port_no, reserved port: process with normal L2/L3 switching. */ + public static final short OFPP_NORMAL = (short)0xfffa; + /** enum ofp_port_no, reserved port: all physical ports except input port. */ + public static final short OFPP_ALL = (short)0xfffc; + /** enum ofp_port_no, reserved port: local openflow port. */ + public static final short OFPP_LOCAL = (short)0xfffe; - private OFConstants() { - throw new UnsupportedOperationException("OF plugin Constants holder class"); - } - - /** enum ofp_port_no, reserved port: process with normal L2/L3 switching */ - public static final short OFPP_NORMAL = ((short)0xfffa); - /** enum ofp_port_no, reserved port: all physical ports except input port */ - public static final short OFPP_ALL = ((short)0xfffc); - /** enum ofp_port_no, reserved port: local openflow port */ - public static final short OFPP_LOCAL = ((short)0xfffe); - - /** openflow protocol 1.0 - version identifier */ - public static final short OFP_VERSION_1_0 = 0x01; - /** openflow protocol 1.3 - version identifier */ - public static final short OFP_VERSION_1_3 = 0x04; + /** openflow protocol 1.0 - version identifier. */ + public static final Uint8 OFP_VERSION_1_0 = Uint8.ONE; + /** openflow protocol 1.3 - version identifier. */ + public static final Uint8 OFP_VERSION_1_3 = Uint8.valueOf(0x04); public static final String OF_URI_PREFIX = "openflow:"; /** enum ofp_table: Table numbering, wildcard table used for table config, flow stats and flow deletes. */ - public static final Short OFPTT_ALL = 0xff; - public static final Long ANY = 0xffffffffL; + public static final Uint8 OFPTT_ALL = Uint8.MAX_VALUE; + public static final Uint32 ANY = Uint32.MAX_VALUE; /** Wildcard port used only for flow mod (delete) and flow stats requests. Selects * all flows regardless of output port (including flows with no output port).*/ - public static final Long OFPP_ANY = ANY; + public static final Uint32 OFPP_ANY = ANY; /** enum ofp_group: For OFPFC_DELETE* commands, require matching entries to include this as an * output group. A value of OFPG_ANY indicates no restriction. */ - public static final Long OFPG_ANY = ANY; + public static final Uint32 OFPG_ANY = ANY; /** enum ofp_group: Represents all groups for group delete commands. */ - public static final Long OFPG_ALL = 0xfffffffcL; + public static final Uint32 OFPG_ALL = Uint32.valueOf(0xfffffffcL).intern(); /** Refers to all queues configured at the specified port. */ - public static final Long OFPQ_ALL = ANY; + public static final Uint32 OFPQ_ALL = ANY; /** Represents all meters for stat requests commands. */ - public static final Long OFPM_ALL = ANY; - /** default cookie */ - public static final BigInteger DEFAULT_COOKIE = BigInteger.ZERO; - public static final BigInteger DEFAULT_COOKIE_MASK = BigInteger.ZERO; + public static final Uint32 OFPM_ALL = ANY; + /** Default cookie. */ + public static final Uint64 DEFAULT_COOKIE = Uint64.ZERO; + public static final Uint64 DEFAULT_COOKIE_MASK = Uint64.ZERO; public static final FlowCookie DEFAULT_FLOW_COOKIE = new FlowCookie(DEFAULT_COOKIE); - public static final Integer DEFAULT_FLOW_PRIORITY = 0x8000; - /** Empty flow match */ + public static final Uint16 DEFAULT_FLOW_PRIORITY = Uint16.valueOf(0x8000).intern(); + /** Empty flow match. */ public static final Match EMPTY_MATCH = new MatchBuilder().build(); /** indicates that no buffering should be applied and the whole packet is to be * sent to the controller. */ - public static final Long OFP_NO_BUFFER = 0xffffffffL; + public static final Uint32 OFP_NO_BUFFER = Uint32.valueOf(0xffffffffL).intern(); /** enum ofp_controller_max_len: indicates that no buffering should be applied and the whole packet is to be * sent to the controller. */ - public static final Integer OFPCML_NO_BUFFER = 0xffff; + public static final Uint16 OFPCML_NO_BUFFER = Uint16.MAX_VALUE; public static final int MAC_ADDRESS_LENGTH = 6; - public static final int SIZE_OF_LONG_IN_BYTES = 8; public static final int SIGNUM_UNSIGNED = 1; - /** RpcError application tag */ - public static final String APPLICATION_TAG = "OPENFLOW_PLUGIN"; - /** RpcError tag - timeout */ - public static final String ERROR_TAG_TIMEOUT = "TIMOUT"; + /** RpcError application tag. */ + public static final ErrorTag APPLICATION_TAG = new ErrorTag("OPENFLOW_PLUGIN"); + + /** Persistent ID of OpenFlowPlugin configuration file. */ + public static final String CONFIG_FILE_ID = "org.opendaylight.openflowplugin"; + + /** supported version ordered by height (highest version is at the beginning). */ + public static final List VERSION_ORDER = List.of(OFP_VERSION_1_3, OFP_VERSION_1_0); + + private OFConstants() { + // Hidden on purpose + } }