2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

Add error codes for Open Flow v1.2

* Where Open Flow 1.2 breaks apart error codes defined
  in previous versions, provide all new definitions to
  previous versions and map the numeric error code to
  the first first definition supplied in ofp-errors.h.
  The case handled so far is:
  OFPERR_OFPBIC_BAD_EXP_TYPE -> { OFPERR_OFPBIC_BAD_EXPERIMENTER,
                                  OFPERR_OFPBIC_BAD_EXP_TYPE }

* Where Open Flow 1.2 adds error codes that were previously
  defined as Nicira extension errors define the later in terms
  of the new codes.

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com added better error checking in extract-ofp-errors, added
 unit tests, miscellaneous cleanup]
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
Simon Horman
2012-03-26 13:46:35 -07:00
committed by Ben Pfaff
parent 4435655128
commit 2e0525bcf5
11 changed files with 427 additions and 154 deletions

View File

@@ -44,6 +44,11 @@ struct ofp_header;
#define OFPERR_OFS (1 << 30)
enum ofperr {
/* Expected duplications. */
/* Expected: 3,5 in OF1.1 means both OFPBIC_BAD_EXPERIMENTER and
* OFPBIC_BAD_EXP_TYPE. */
/* ## ------------------ ## */
/* ## OFPET_HELLO_FAILED ## */
/* ## ------------------ ## */
@@ -95,6 +100,15 @@ enum ofperr {
/* OF1.1+(1,9). Specified table-id invalid or does not exist. */
OFPERR_OFPBRC_BAD_TABLE_ID,
/* OF1.2+(1,10). Denied because controller is slave. */
OFPERR_OFPBRC_IS_SLAVE,
/* OF1.2+(1,11). Invalid port. */
OFPERR_OFPBRC_BAD_PORT,
/* OF1.2+(1,12). Invalid packet in packet-out. */
OFPERR_OFPBRC_BAD_PACKET,
/* NX1.0+(1,256). Invalid NXM flow match. */
OFPERR_NXBRC_NXM_INVALID,
@@ -102,24 +116,9 @@ enum ofperr {
* nxm_hasmask or nxm_length or both, is invalid or not implemented. */
OFPERR_NXBRC_NXM_BAD_TYPE,
/* NX1.0+(1,258). Invalid nxm_value. */
OFPERR_NXBRC_NXM_BAD_VALUE,
/* NX1.0+(1,259). Invalid nxm_mask. */
OFPERR_NXBRC_NXM_BAD_MASK,
/* NX1.0+(1,260). A prerequisite was not met. */
OFPERR_NXBRC_NXM_BAD_PREREQ,
/* NX1.0+(1,261). A given nxm_type was specified more than once. */
OFPERR_NXBRC_NXM_DUP_TYPE,
/* NX1.0+(1,512). A request specified a nonexistent table ID. */
OFPERR_NXBRC_BAD_TABLE_ID,
/* NX1.0+(1,513). NXT_ROLE_REQUEST specified an invalid role. */
OFPERR_NXBRC_BAD_ROLE,
/* NX1.0+(1,514). The in_port in an ofp_packet_out request is invalid. */
OFPERR_NXBRC_BAD_IN_PORT,
@@ -177,6 +176,15 @@ enum ofperr {
/* OF1.1+(2,12). Actions uses an unsupported tag/encap. */
OFPERR_OFPBAC_BAD_TAG,
/* OF1.2+(2,13). Unsupported type in SET_FIELD action. */
OFPERR_OFPBAC_SET_TYPE,
/* OF1.2+(2,14). Length problem in SET_FIELD action. */
OFPERR_OFPBAC_SET_LEN,
/* OF1.2+(2,15). Bad argument in SET_FIELD action. */
OFPERR_OFPBAC_ARGUMENT,
/* NX1.0+(2,256). Must-be-zero action argument had nonzero value. */
OFPERR_NXBAC_MUST_BE_ZERO,
@@ -202,8 +210,17 @@ enum ofperr {
/* OF1.1+(3,4). Metadata mask value unsupported by datapath. */
OFPERR_OFPBIC_UNSUP_METADATA_MASK,
/* OF1.1+(3,5). Specific experimenter instruction unsupported. */
OFPERR_OFPBIC_UNSUP_EXP_INST,
/* OF1.1+(3,5). Unknown experimenter id specified. */
OFPERR_OFPBIC_BAD_EXPERIMENTER,
/* OF1.1(3,5), OF1.2+(3,6). Unknown instruction for experimenter id. */
OFPERR_OFPBIC_BAD_EXP_TYPE,
/* OF1.2+(3,7). Length problem in instructions. */
OFPERR_OFPBIC_BAD_LEN,
/* OF1.2+(3,8). Permissions error. */
OFPERR_OFPBIC_EPERM,
/* ## --------------- ## */
/* ## OFPET_BAD_MATCH ## */
@@ -235,9 +252,24 @@ enum ofperr {
/* OF1.1+(4,6). Unsupported field in the match. */
OFPERR_OFPBMC_BAD_FIELD,
/* OF1.1+(4,7). Unsupported value in a match field. */
/* NX1.0(1,258), NX1.1(1,258), OF1.2+(4,7). Unsupported value in a match
* field. */
OFPERR_OFPBMC_BAD_VALUE,
/* NX1.0(1,259), NX1.1(1,259), OF1.2+(4,8). Unsupported mask specified in
* the match, field is not dl-address or nw-address. */
OFPERR_OFPBMC_BAD_MASK,
/* NX1.0(1,260), NX1.1(1,260), OF1.2+(4,9). A prerequisite was not met. */
OFPERR_OFPBMC_BAD_PREREQ,
/* NX1.0(1,261), NX1.1(1,261), OF1.2+(4,10). A field type was
* duplicated. */
OFPERR_OFPBMC_DUP_FIELD,
/* OF1.2+(4,11). Permissions error. */
OFPERR_OFPBMC_EPERM,
/* ## --------------------- ## */
/* ## OFPET_FLOW_MOD_FAILED ## */
/* ## --------------------- ## */
@@ -274,6 +306,9 @@ enum ofperr {
/* OF1.0(3,4), OF1.1+(5,6). Unsupported or unknown command. */
OFPERR_OFPFMFC_BAD_COMMAND,
/* OF1.2+(5,7). Unsupported or unknown flags. */
OFPERR_OFPFMFC_BAD_FLAGS,
/* OF1.0(3,5). Unsupported action list - cannot process in the order
* specified. */
OFPERR_OFPFMFC_UNSUPPORTED,
@@ -325,6 +360,25 @@ enum ofperr {
* modify a non-existent group. */
OFPERR_OFPGMFC_UNKNOWN_GROUP,
/* OF1.2+(6,9). Group not deleted because another
group is forwarding to it. */
OFPERR_OFPGMFC_CHAINED_GROUP,
/* OF1.2+(6,10). Unsupported or unknown group type. */
OFPERR_OFPGMFC_BAD_TYPE,
/* OF1.2+(6,11). Unsupported or unknown command. */
OFPERR_OFPGMFC_BAD_COMMAND,
/* OF1.2+(6,12). Error in bucket. */
OFPERR_OFPGMFC_OFPGMFC_BAD_BUCKET,
/* OF1.2+(6,13). Error in watch port/group. */
OFPERR_OFPGMFC_OFPGMFC_BAD_WATCH,
/* OF1.2+(6,14). Permissions error. */
OFPERR_OFPGMFC_OFPGMFC_EPERM,
/* ## --------------------- ## */
/* ## OFPET_PORT_MOD_FAILED ## */
/* ## --------------------- ## */
@@ -345,6 +399,9 @@ enum ofperr {
/* OF1.1+(7,3). Specified advertise is invalid. */
OFPERR_OFPPMFC_BAD_ADVERTISE,
/* OF1.2+(7,4). Permissions error. */
OFPERR_OFPPMFC_EPERM,
/* ## ---------------------- ## */
/* ## OFPET_TABLE_MOD_FAILED ## */
/* ## ---------------------- ## */
@@ -358,6 +415,9 @@ enum ofperr {
/* OF1.1+(8,1). Specified config is invalid. */
OFPERR_OFPTMFC_BAD_CONFIG,
/* OF1.2+(8,2). Permissions error. */
OFPERR_OFPTMFC_EPERM,
/* ## --------------------- ## */
/* ## OFPET_QUEUE_OP_FAILED ## */
/* ## --------------------- ## */
@@ -386,12 +446,41 @@ enum ofperr {
/* OF1.1+(10,1). Specified len is invalid. */
OFPERR_OFPSCFC_BAD_LEN,
/* OF1.2+(10,2). Permissions error. */
OFPERR_OFPSCFC_EPERM,
/* ## ------------------------- ## */
/* ## OFPET_ROLE_REQUEST_FAILED ## */
/* ## ------------------------- ## */
/* OF1.2+(11). Controller Role request failed. */
OFPERR_OFPET_ROLE_REQUEST_FAILED,
/* OF1.2+(11,0). Stale Message: old generation_id. */
OFPERR_OFPRRFC_STALE,
/* OF1.2+(11,1). Controller role change unsupported. */
OFPERR_OFPRRFC_UNSUP,
/* NX1.0(1,513), NX1.1(1,513), OF1.2+(11,2). Invalid role. */
OFPERR_OFPRRFC_BAD_ROLE,
/* ## ------------------ ## */
/* ## OFPET_EXPERIMENTER ## */
/* ## ------------------ ## */
/* OF1.2+(0xffff). Experimenter error messages. */
OFPERR_OFPET_EXPERIMENTER,
};
extern const struct ofperr_domain ofperr_of10;
extern const struct ofperr_domain ofperr_of11;
extern const struct ofperr_domain ofperr_of12;
const struct ofperr_domain *ofperr_domain_from_version(uint8_t version);
const char *ofperr_domain_get_name(const struct ofperr_domain *);
bool ofperr_is_valid(enum ofperr);
bool ofperr_is_category(enum ofperr);
@@ -401,11 +490,14 @@ bool ofperr_is_encodable(enum ofperr, const struct ofperr_domain *);
enum ofperr ofperr_decode(const struct ofperr_domain *,
uint16_t type, uint16_t code);
enum ofperr ofperr_decode_type(const struct ofperr_domain *, uint16_t type);
enum ofperr ofperr_from_name(const char *);
enum ofperr ofperr_decode_msg(const struct ofp_header *, size_t *payload_ofs);
struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
struct ofpbuf *ofperr_encode_hello(enum ofperr, const struct ofperr_domain *,
const char *);
int ofperr_get_type(enum ofperr, const struct ofperr_domain *);
int ofperr_get_code(enum ofperr, const struct ofperr_domain *);
const char *ofperr_get_name(enum ofperr);
const char *ofperr_get_description(enum ofperr);