$schema: http://json-schema.org/draft-04/schema#
description: Schema describing an OpenFlow flow mod message, version 1.3
id: of13/ofp_flow_mod.json

type: object
required:
  - header
  - cookie
  - cookie_mask
  - table_id
  - command
  - idle_timeout
  - hard_timeout
  - priority
  - buffer_id
  - out_port
  - out_group
  - flags
  - match
properties:
  header:
    allOf:
      - $ref: definitions.json#/ofp_header
      - properties:
          type:
            enum: [OFPT_FLOW_MOD]
            default: OFPT_FLOW_MOD
  cookie:
    type: string
    pattern: ^[a-fA-F0-9]{16}$
    default: '0000000000000000'
  cookie_mask:
    type: string
    pattern: ^[a-fA-F0-9]{16}$
    default: '0000000000000000'
  table_id:
    type: integer
    maximum: 255
    default: 0
  command:
    type: string
    default: OFPFC_ADD
    enum:
      - OFPFC_ADD
      - OFPFC_MODIFY
      - OFPFC_MODIFY_STRICT
      - OFPFC_DELETE
      - OFPFC_DELETE_STRICT
  idle_timeout:
    type: integer
    maximum: 65535
    default: 0
  hard_timeout:
    type: integer
    maximum: 65535
    default: 0
  priority:
    type: integer
    maximum: 65535
    default: 0
  buffer_id:
    type: integer
    maximum: 4294967295
    default: 4294967295
  # TODO: enumerate with ranges?
  out_port:
    type: integer
    maximum: 4294967295
    default: 4294967295
  out_group:
    type: integer
    maximum: 4294967295
    default: 4294967295
  flags:
    type: array
    default: []
    items:
      type: string
      enum:
        - OFPFF_SEND_FLOW_REM
        - OFPFF_CHECK_OVERLAP
        - OFPFF_RESET_COUNTS
        - OFPFF_NO_PKT_COUNTS
        - OFPFF_NO_BYT_COUNTS
  match:
    $ref: definitions.json#/ofp_match
