Skip to main content

A YANG Data Model for Flow Specification
draft-wu-idr-flowspec-yang-cfg-01

The information below is for an old version of the document.
Document Type
This is an older version of an Internet-Draft whose latest revision state is "Expired".
Authors Nan Wu , Shunwan Zhuang , Aseem Choudhary
Last updated 2015-07-19
RFC stream (None)
Formats
Additional resources
Stream Stream state (No stream defined)
Consensus boilerplate Unknown
RFC Editor Note (None)
IESG IESG state I-D Exists
Telechat date (None)
Responsible AD (None)
Send notices to (None)
draft-wu-idr-flowspec-yang-cfg-01
Network Working Group                                              N. Wu
Internet-Draft                                                 S. Zhuang
Intended status: Standards Track                                  Huawei
Expires: January 19, 2016                                   A. Choudhary
                                                           Cisco Systems
                                                           July 18, 2015

                A YANG Data Model for Flow Specification
                   draft-wu-idr-flowspec-yang-cfg-01

Abstract

   This document defines a YANG data model for Flow Specification
   implementations.  The data model includes configuration data and
   state data.

Requirements Language

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in RFC 2119 [RFC2119].

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on January 19, 2016.

Copyright Notice

   Copyright (c) 2015 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of

Wu, et al.              Expires January 19, 2016                [Page 1]

Internet-Draft              YANG for Flowspec                  July 2015

   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Terminology . . . . . . . . . . . . . . . . . . . . . . .   3
     1.2.  Flowspec Model Design . . . . . . . . . . . . . . . . . .   3
     1.3.  Tree Diagrams . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Flow Specification data model . . . . . . . . . . . . . . . .   4
   3.  Flow Specification YANG Module  . . . . . . . . . . . . . . .   9
   4.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  29
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .  29
   6.  Acknowledgments . . . . . . . . . . . . . . . . . . . . . . .  30
   7.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  30
     7.1.  Normative References  . . . . . . . . . . . . . . . . . .  30
     7.2.  Informative References  . . . . . . . . . . . . . . . . .  31
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  31

1.  Introduction

   This document defines a YANG [RFC6020] data model for the
   configuration and state data of Flowspec policies.  Any RPC or
   notification definition is not part of this document.  The model is
   based on Flowspec Policy architecture[RFC5575] and various other
   internet drafts
   [I-D.ietf-idr-flow-spec-v6][I-D.ietf-idr-bgp-flowspec-oid].  The
   configuration data defined in this document is encoded as flow
   specification rules and which can be distributed as BGP NLRI and/or
   applied locally to a network element.  This distribution of traffic
   filtering rules through provider backbone can be used to filter
   Denial of Service attacks (DOS), maintaining some access control
   lists at network boundary [I-D.litkowski-idr-flowspec-interfaceset]
   besides other use-cases.

   IP routers can classify packets based on multiple header fields.
   Such a classification rule may contain matching criteria to match on
   one or more packet header fields.  Packets can be grouped to match on
   such packet rules defining a traffic flow.  These traffic flows can
   be originated based on a manual policy or automatically or a
   combination of both.  These defined traffic flows can be thus
   distributed.

Wu, et al.              Expires January 19, 2016                [Page 2]

Internet-Draft              YANG for Flowspec                  July 2015

   As many vendors have different object constructs to represent the
   same traffic flow data, it has been tried to design this model in a
   very flexible, extensible and generic way to fit into most of the
   vendor requirements.

1.1.  Terminology

   The following terms are defined in [RFC6020]:

   o  configuration data

   o  data model

   o  module

   o  state data

   The terminology for describing YANG data models is found in
   [RFC6020].

1.2.  Flowspec Model Design

   A flowspec policy contains one or more flowspec rules.  Each flowspec
   rule may contain one or more flowspec components.  A traffic flow
   matches a flowspec rule when it matches all the components present in
   the rule.  A flow MAY match one or more flowspec rules.  The order in
   which the flowspec rules are matched in a flowspec policy is defined
   by RFC 5575.

   A flowspec rule contains one or more packet conditioning functions.
   A packet conditioning function MAY drop, limit the traffic flow rate,
   mark or redirect network packets to a specified routing instance.  A
   flowspec policy can be stored as an object and used across different
   network device interfaces.

1.3.  Tree Diagrams

   A simplified graphical representation of the data model is used in
   this document.  The meaning of the symbols in these diagrams is as
   follows:

   o  Brackets "[" and "]" enclose list keys.

   o  Abbreviations before data node names: "rw" means configuration
      data (read-write), and "ro" means state data (read-only).

   o  Symbols after data node names: "?" means an optional node, "!"
      means a presence container, and "*" denotes a list and leaf-list.

Wu, et al.              Expires January 19, 2016                [Page 3]

Internet-Draft              YANG for Flowspec                  July 2015

   o  Parentheses enclose choice and case nodes, and case nodes are also
      marked with a colon (":").

   o  Ellipsis ("...") stands for contents of subtrees that are not
      shown.

2.  Flow Specification data model

   The data model has the following structure for configuration of
   traffic flow specification:

   module: ietf-flowspec
     +--rw flowspec
        +--rw flowspec-cfg
        |  +--rw flowspec-policy* [policy-name]
        |     +--rw policy-name       string
        |     +--rw vrf-name?         string
        |     +--rw address-family?   identityref
        |     +--rw flowspec-rule* [rule-name]
        |        +--rw rule-name             string
        |        +--rw flowspec-component* [component-type]
        |        |  +--rw component-type        component-enum
        |        |  +--rw (component)?
        |        |     +--:(destination-prefix)
        |        |     |  +--rw destination-prefix?   inet:ip-address
        |        |     +--:(source-prefix)
        |        |     |  +--rw source-prefix?        inet:ip-address
        |        |     +--:(ip-protocol)
        |        |     |  +--rw ip-protocol* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    uint16
        |        |     +--:(port)
        |        |     |  +--rw port* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    uint16
        |        |     +--:(destination-port)
        |        |     |  +--rw destination-port* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    uint16
        |        |     +--:(source-port)
        |        |     |  +--rw source-port* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    uint16
        |        |     +--:(icmp-type)
        |        |     |  +--rw icmp-type* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    uint8
        |        |     +--:(icmp-code)

Wu, et al.              Expires January 19, 2016                [Page 4]

Internet-Draft              YANG for Flowspec                  July 2015

        |        |     |  +--rw icmp-code* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    uint8
        |        |     +--:(tcp-flags)
        |        |     |  +--rw tcp-flag* [op value]
        |        |     |     +--rw op       bitmask-operator
        |        |     |     +--rw value    uint16
        |        |     +--:(packet-length)
        |        |     |  +--rw packet-length* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    uint16
        |        |     +--:(dscp)
        |        |     |  +--rw dscp* [op value]
        |        |     |     +--rw op       numeric-operator
        |        |     |     +--rw value    dscp-type
        |        |     +--:(fragment)
        |        |        +--rw fragment* [op value]
        |        |           +--rw op       numeric-operator
        |        |           +--rw value    fragment-type
        |        +--rw flowspec-action* [action-type]
        |           +--rw action-type     action-type
        |           +--rw (action)?
        |              +--:(traffic-rate)
        |              |  +--rw rate?           float
        |              +--:(redirect)
        |              |  +--rw route-target?   string
        |              +--:(traffic-marking)
        |                 +--rw remark-dscp?    dscp-type
        +--ro flowspec-state
           +--ro flowspec-rib
           |  +--ro flowspec-route*
           |     +--ro index?                        uint32
           |     +--ro islocal?                      boolean
           |     +--ro local-name?                   string
           |     +--ro neighbor?                     inet:ip-address
           |     +--ro duration?                     uint32
           |     +--ro flowspec-protocol-specific
           |        +--ro (protocol)?
           |           +--:(bgp)
           |              +--ro neighbor-router-id?   inet:ipv4-address
           |              +--ro as-path?              string
           |              +--ro origin?               enumeration
           |              +--ro med?                  uint32
           |              +--ro local-preference?     uint8
           |              +--ro community?            string
           |              +--ro ext-community?        string
           |              +--ro preference?           uint32
           |              +--ro originator?           inet:ip-address

Wu, et al.              Expires January 19, 2016                [Page 5]

Internet-Draft              YANG for Flowspec                  July 2015

           |              +--ro cluster-list?         string
           |              +--ro flowspec-component* [component-type]
           |              |  +--ro component-type        component-enum
           |              |  +--ro (component)?
           |              |     +--:(destination-prefix)
           |              |     |  +--ro destination-prefix?
                                                         inet:ip-address
           |              |     +--:(source-prefix)
           |              |     |  +--ro source-prefix?  inet:ip-address
           |              |     +--:(ip-protocol)
           |              |     |  +--ro ip-protocol* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    uint16
           |              |     +--:(port)
           |              |     |  +--ro port* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    uint16
           |              |     +--:(destination-port)
           |              |     |  +--ro destination-port* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    uint16
           |              |     +--:(source-port)
           |              |     |  +--ro source-port* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    uint16
           |              |     +--:(icmp-type)
           |              |     |  +--ro icmp-type* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    uint8
           |              |     +--:(icmp-code)
           |              |     |  +--ro icmp-code* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    uint8
           |              |     +--:(tcp-flags)
           |              |     |  +--ro tcp-flag* [op value]
           |              |     |     +--ro op       bitmask-operator
           |              |     |     +--ro value    uint16
           |              |     +--:(packet-length)
           |              |     |  +--ro packet-length* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    uint16
           |              |     +--:(dscp)
           |              |     |  +--ro dscp* [op value]
           |              |     |     +--ro op       numeric-operator
           |              |     |     +--ro value    dscp-type
           |              |     +--:(fragment)
           |              |        +--ro fragment* [op value]
           |              |           +--ro op       numeric-operator

Wu, et al.              Expires January 19, 2016                [Page 6]

Internet-Draft              YANG for Flowspec                  July 2015

           |              |           +--ro value    fragment-type
           |              +--ro flowspec-action* [action-type]
           |                 +--ro action-type     action-type
           |                 +--ro (action)?
           |                    +--:(traffic-rate)
           |                    |  +--ro rate?           float
           |                    +--:(redirect)
           |                    |  +--ro route-target?   string
           |                    +--:(traffic-marking)
           |                       +--ro remark-dscp?    dscp-type
           +--ro flowspec-statistics
              +--ro flowspec-stats*
                 +--ro vrf-name?              string
                 +--ro address-family?        string
                 +--ro flowspec-rule-stats*
                    +--ro flowspec-component* [component-type]
                    |  +--ro component-type        component-enum
                    |  +--ro (component)?
                    |     +--:(destination-prefix)
                    |     |  +--ro destination-prefix?   inet:ip-address
                    |     +--:(source-prefix)
                    |     |  +--ro source-prefix?        inet:ip-address
                    |     +--:(ip-protocol)
                    |     |  +--ro ip-protocol* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    uint16
                    |     +--:(port)
                    |     |  +--ro port* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    uint16
                    |     +--:(destination-port)
                    |     |  +--ro destination-port* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    uint16
                    |     +--:(source-port)
                    |     |  +--ro source-port* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    uint16
                    |     +--:(icmp-type)
                    |     |  +--ro icmp-type* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    uint8
                    |     +--:(icmp-code)
                    |     |  +--ro icmp-code* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    uint8
                    |     +--:(tcp-flags)
                    |     |  +--ro tcp-flag* [op value]

Wu, et al.              Expires January 19, 2016                [Page 7]

Internet-Draft              YANG for Flowspec                  July 2015

                    |     |     +--ro op       bitmask-operator
                    |     |     +--ro value    uint16
                    |     +--:(packet-length)
                    |     |  +--ro packet-length* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    uint16
                    |     +--:(dscp)
                    |     |  +--ro dscp* [op value]
                    |     |     +--ro op       numeric-operator
                    |     |     +--ro value    dscp-type
                    |     +--:(fragment)
                    |        +--ro fragment* [op value]
                    |           +--ro op       numeric-operator
                    |           +--ro value    fragment-type
                    +--ro flowspec-action* [action-type]
                    |  +--ro action-type     action-type
                    |  +--ro (action)?
                    |     +--:(traffic-rate)
                    |     |  +--ro rate?           float
                    |     +--:(redirect)
                    |     |  +--ro route-target?   string
                    |     +--:(traffic-marking)
                    |        +--ro remark-dscp?    dscp-type
                    +--ro classified-pkts?      uint64
                    +--ro classified-bytes?     uint64
                    +--ro drop-pkts?            uint64
                    +--ro drop-bytes?           uint64

   This data model defines the configuration and state containers for
   traffic flow specification.  In flowspec-cfg container, there is a
   list of configuration containers per flow specification route, which
   contains the configuration for filtering rules and corresponding
   actions.

   The data model for state of traffic flow defines two state
   containers.  Container flowspec-rib contains the current state of
   flowspec route, including filtering rules and actions.  In the second
   container, there is statistics information for traffic flow
   specifications.  The flowspec-rules in the flowspec-statistics
   container is listed per routing instance per address family.  The
   list of flowspec-rules is in order of applied rules in the forwarding
   path.

Wu, et al.              Expires January 19, 2016                [Page 8]

Internet-Draft              YANG for Flowspec                  July 2015

3.  Flow Specification YANG Module

   <CODE BEGINS> file "ietf-flowspec@2015-07-15.yang"

   module ietf-flowspec {
     namespace "urn:ietf:params:xml:ns:yang:ietf-flowspec";
     prefix flowspec;

     import ietf-inet-types {
       prefix inet;
     }

     organization "IETF IDR (Inter-Domain Routing) Working Group";
     contact
       "WG Web:   <http://tools.ietf.org/wg/idr/>
        WG List:  <mailto:idr@ietf.org>

        WG Chair: Susan Hares
                  <mailto:shares@ndzh.com>

        WG Chair: John Scudder
                  <mailto:jgs@juniper.net>

        Editor:   Shunwan Zhuang
                  <mailto:zhuangshunwan@huawei.com>

        Editor:   Nan Wu
                  <mailto:eric.wu@huawei.com>

        Editor:   Aseem Choudhary
                  <mailto:asechoud@cisco.com>";
     description
       "This module contains a collection of YANG definitions for
        configuring flow specification implementations.

        Copyright (c) 2014 IETF Trust and the persons identified as
        authors of the code.  All rights reserved.

        Redistribution and use in source and binary forms, with or
        without modification, is permitted pursuant to, and subject
        to the license terms contained in, the Simplified BSD License
        set forth in Section 4.c of the IETF Trust's Legal Provisions
        Relating to IETF Documents
        (http://trustee.ietf.org/license-info).";

     revision 2015-07-15 {
       description
         "Initial revision.";

Wu, et al.              Expires January 19, 2016                [Page 9]

Internet-Draft              YANG for Flowspec                  July 2015

       reference
         "[RFC5575] Dissemination of Flow Specification Rules
          [draft-ietf-netmod-routing-cfg-16]
          A YANG Data Model for Routing Management.
         ";
     }

     typedef component-enum {
       type enumeration {
         enum "destination-prefix" {
           value 1;
           description
             "Type 1 - Destination Prefix";
         }
         enum "source-prefix" {
           value 2;
           description
             "Type 2 - Source Prefix";
         }
         enum "ip-protocol" {
           value 3;
           description
             "Type 3 - IP Protocol";
         }
         enum "port" {
           value 4;
           description
             "Type 4 - Port";
         }
         enum "destination-port" {
           value 5;
           description
             "Type 5 - Destination port";
         }
         enum "source-port" {
           value 6;
           description
             "Type 6 - Source port";
         }
         enum "icmp-type" {
           value 7;
           description
             "Type 7 - ICMP type";
         }
         enum "icmp-code" {
           value 8;
           description
             "Type 8 - ICMP code";

Wu, et al.              Expires January 19, 2016               [Page 10]

Internet-Draft              YANG for Flowspec                  July 2015

         }
         enum "tcp-flags" {
           value 9;
           description
             "Type 9 - TCP flags";
         }
         enum "packet-length" {
           value 10;
           description
             "Type 10 - Packet length";
         }
         enum "dscp" {
           value 11;
           description
             "Type 11 - DSCP (Diffserv Code Point)";
         }
         enum "fragment" {
           value 12;
           description
             "Type 12 - Fragment";
         }
       }
       description
         "Definition for component type.";
     }

     typedef action-type {
       type enumeration {
         enum "traffic-rate" {
           value 32774;
           description
             "Carry the 2-octet id and 4-octet of rate information
              in IEEE floating point [IEEE.754.1985] format.";
         }
         enum "traffic-action" {
           value 32775;
           description
             "Consists of 6 bytes of which only the 2 least significant
              bits of the 6th byte (from left to right)
              are currently defined.";
         }
         enum "redirect" {
           value 32776;
           description
             "Allows the traffic to be redirected to a VRF
              routing instance that lists the specified
              route-target in its import policy.";
         }

Wu, et al.              Expires January 19, 2016               [Page 11]

Internet-Draft              YANG for Flowspec                  July 2015

         enum "traffic-marking" {
           value 32777;
           description
             "Instructs a system to modify the DSCP bits of
              a transiting IP packet to the corresponding value.";
         }
       }
       description
         "Definition for action type.";
     }

     typedef numeric-operator {
       type bits {
         bit end-of-list {
           position 0;
           description
             "end-of-list bit.
              Set in the last {op, value} pair in the list.";
         }
         bit and-bit {
           position 1;
           description
             "AND bit.
              If unset, the previous term is logically ORed with
              the current one.
              If set, the operation is a logical AND.
              It should be unset in the first operator byte of a
              sequence.  The AND operator has higher priority than
              OR for the purposes of evaluating logical expressions.";
         }
         bit lt-bit {
           position 5;
           description
             "Less than comparison between data and value.";
         }
         bit gt-bit {
           position 6;
           description
             "Greater than comparison between data and value.";
         }
         bit eq-bit {
           position 7;
           description
             "end-of-list bit.
              Set in the last {op, value} pair in the list.";
         }
       }
       description

Wu, et al.              Expires January 19, 2016               [Page 12]

Internet-Draft              YANG for Flowspec                  July 2015

         "Definition for numeric operator.";
     }

     typedef bitmask-operator {
       type bits {
         bit end-of-list {
           position 0;
           description
             "end-of-list bit.
              Set in the last {op, value} pair in the list.";
         }
         bit and-bit {
           position 1;
           description
             "AND bit.
              If unset, the previous term is logically ORed with
              the current one.
              If set, the operation is a logical AND.
              It should be unset in the first operator byte of a
              sequence.  The AND operator has higher priority than
              OR for the purposes of evaluating logical expressions.";
         }
         bit not-bit {
           position 6;
           description
             "NOT bit. If set, logical negation of operation.";
         }
         bit match-bit {
           position 7;
           description
             "Match bit.
              If set, this is a bitwise match operation defined
              as '(data & value) == value';
              if unset, (data & value) evaluates to TRUE if any of
              the bits in the value mask are set in the data";
         }
       }
       description
         "Definition for bitmask operator.";
     }

     typedef dscp-remarked {
       type enumeration {
         enum "be" {
           value 0;
           description
             "Default dscp (000000)";
         }

Wu, et al.              Expires January 19, 2016               [Page 13]

Internet-Draft              YANG for Flowspec                  July 2015

         enum "cs1" {
           value 8;
           description
             "CS1(precedence 1) dscp (001000)";
         }
         enum "af11" {
           value 10;
           description
             "AF11 dscp (001010)";
         }
         enum "af12" {
           value 12;
           description
             "AF12 dscp (001100)";
         }
         enum "af13" {
           value 14;
           description
             "AF13 dscp (001110)";
         }
         enum "cs2" {
           value 16;
           description
             "CS2(precedence 2) dscp (010000)";
         }
         enum "af21" {
           value 18;
           description
             "AF21 dscp (010010)";
         }
         enum "af22" {
           value 20;
           description
             "AF22 dscp (010100)";
         }
         enum "af23" {
           value 22;
           description
             "AF23 dscp (010110)";
         }
         enum "cs3" {
           value 24;
           description
             "CS3(precedence 3) dscp (011000)";
         }
         enum "af31" {
           value 26;
           description

Wu, et al.              Expires January 19, 2016               [Page 14]

Internet-Draft              YANG for Flowspec                  July 2015

             "AF31 dscp (011010)";
         }
         enum "af32" {
           value 28;
           description
             "AF32 dscp (011100)";
         }
         enum "af33" {
           value 30;
           description
             "AF33 dscp (011110)";
         }
         enum "cs4" {
           value 32;
           description
             "CS4(precedence 4) dscp (100000)";
         }
         enum "af41" {
           value 34;
           description
             "AF41 dscp (100010)";
         }
         enum "af42" {
           value 36;
           description
             "AF42 dscp (100100)";
         }
         enum "af43" {
           value 38;
           description
             "AF43 dscp (100110)";
         }
         enum "cs5" {
           value 40;
           description
             "CS5(precedence 5) dscp (101000)";
         }
         enum "ef" {
           value 46;
           description
             "EF dscp (101110)";
         }
         enum "cs6" {
           value 48;
           description
             "CS6(precedence 6) dscp (110000)";
         }
         enum "cs7" {

Wu, et al.              Expires January 19, 2016               [Page 15]

Internet-Draft              YANG for Flowspec                  July 2015

           value 56;
           description
             "CS7(precedence 7) dscp (111000)";
         }
       }
       description
         "Definition for dscp type.";
     }

     typedef dscp-type {
       type union {
         type dscp-remarked;
         type uint8;
       }
       description
         "Definition for dscp type.";
     }

     typedef fragment-type {
       type bits {
         bit last-fragment {
           position 4;
           description
             "Last fragment (LF)";
         }
         bit first-fragment {
           position 5;
           description
             "First fragment (FF)";
         }
         bit is-a-fragment {
           position 6;
           description
             "Is a fragment (IsF)";
         }
         bit do-not-fragment {
           position 7;
           description
             "Don't fragment (DF)";
         }
       }
       description
         "Definition for fragment type.";
     }

     typedef float {
       type union {
         type decimal64 {

Wu, et al.              Expires January 19, 2016               [Page 16]

Internet-Draft              YANG for Flowspec                  July 2015

           fraction-digits 14;
           range "-9999.99999999999999 .. 9999.99999999999999";
         }
         type decimal64 {
           fraction-digits 13;
           range "-99999.9999999999999 .. 99999.9999999999999";
         }
         type decimal64 {
           fraction-digits 12;
           range "-999999.999999999999 .. 999999.999999999999";
         }
         type decimal64 {
           fraction-digits 11;
           range "-9999999.99999999999 .. 9999999.99999999999";
         }
         type decimal64 {
           fraction-digits 10;
           range "-99999999.9999999999 .. 99999999.9999999999";
         }
         type decimal64 {
           fraction-digits 9;
           range "-999999999.999999999 .. 999999999.999999999";
         }
         type decimal64 {
           fraction-digits 8;
           range "-9999999999.99999999 .. 9999999999.99999999";
         }
         type decimal64 {
           fraction-digits 7;
           range "-99999999999.9999999 .. 99999999999.9999999";
         }
         type decimal64 {
           fraction-digits 6;
           range "-999999999999.999999 .. 999999999999.999999";
         }
         type decimal64 {
           fraction-digits 5;
           range "-9999999999999.99999 .. 9999999999999.99999";
         }
         type decimal64 {
           fraction-digits 4;
           range "-99999999999999.9999 .. 99999999999999.9999";
         }
         type decimal64 {
           fraction-digits 3;
           range "-999999999999999.999 .. 999999999999999.999";
         }
         type decimal64 {

Wu, et al.              Expires January 19, 2016               [Page 17]

Internet-Draft              YANG for Flowspec                  July 2015

           fraction-digits 2;
           range "-9999999999999999.99 .. 9999999999999999.99";
         }
         type decimal64 {
           fraction-digits 1;
           range "-99999999999999999.9 .. 99999999999999999.9";
         }
       }
       description
         "Definition for float point referenced from maillist.";
     }

     identity address-family {
       description
         "Base identity from which identities describing address
          families are derived.";
     }

     identity ipv4 {
       base address-family;
       description
         "This identity represents IPv4 address family.";
     }

     identity ipv6 {
       base address-family;
       description
         "This identity represents IPv6 address family.";
     }

     grouping numeric-one-byte-value {
       description
         "This group defines the pair of operator and value
          for one-byte type.";
       leaf op {
         type numeric-operator;
         description
           "Define the operator byte from RFC5575.";
       }
       leaf value {
         type uint8;
         description
           "Define the one-byte value byte from RFC5575.";
       }
     }

     grouping numeric-two-byte-value {
       description

Wu, et al.              Expires January 19, 2016               [Page 18]

Internet-Draft              YANG for Flowspec                  July 2015

         "This group defines the pair of operator and value
          for two-bytes type.";
       leaf op {
         type numeric-operator;
         description
           "Define the operator byte from RFC5575.";
       }
       leaf value {
         type uint16;
         description
           "Define the two-bytes value byte from RFC5575.";
       }
     }

     grouping bitmask-two-byte-value {
       description
         "This group defines the pair of operator and value
          for bitmask.";
       leaf op {
         type bitmask-operator;
         description
           "Define the bitmask operand format from RFC5575.";
       }
       leaf value {
         type uint16;
         description
           "Define the bitmask value from RFC5575.";
       }
     }

     grouping dscp-value {
       description
         "This group defines dscp values for
          DSCP component of FlowSpec.";
       leaf op {
         type numeric-operator;
         description
           "Define the operator byte from RFC5575.";
       }
       leaf value {
         type dscp-type;
         description
           "Define the dscp value from RFC5575.";
       }
     }

     grouping fragment-value {
       description

Wu, et al.              Expires January 19, 2016               [Page 19]

Internet-Draft              YANG for Flowspec                  July 2015

         "This group defines fragment values for
          Fragment component of FlowSpec.";
       leaf op {
         type numeric-operator;
         description
           "Define the operator byte from RFC5575.";
       }
       leaf value {
         type fragment-type;
         description
           "Define the fragment value from RFC5575.";
       }
     }

     grouping flowspec-traffic-filter {
       description
         "This group defines the traffic filter rules for FlowSpec.";
       list flowspec-component {
         key "component-type";
         min-elements 1;
         description
           "Define the traffic filter components into a list.";
         leaf component-type {
           type component-enum;
           description
             "Specify the type of component for this list entry.";
         }
         choice component {
           description
             "Define different kinds of flowspec components involved.";
           case destination-prefix {
             leaf destination-prefix {
               type inet:ip-address;
               description
                 "Specifies the destination address of the traffic.";
             }
           }
           case source-prefix {
             leaf source-prefix {
               type inet:ip-address;
               description
                 "Specifies the source address of the traffic.";
             }
           }
           case ip-protocol {
             list ip-protocol {
               key "op value";
               ordered-by user;

Wu, et al.              Expires January 19, 2016               [Page 20]

Internet-Draft              YANG for Flowspec                  July 2015

               uses numeric-two-byte-value;
               description
                 "Define the pair of <operator, protocol> entries
                  into a list.";
             }
           }
           case port {
             list port {
               key "op value";
               ordered-by user;
               uses numeric-two-byte-value;
               description
                 "Define the pair of <operator, port> entries
                  into a list.";
             }
           }
           case destination-port {
             list destination-port {
               key "op value";
               ordered-by user;
               uses numeric-two-byte-value;
               description
                 "Define the pair of <operator, destination-port>
                  entries into a list.";
             }
           }
           case source-port {
             list source-port {
               key "op value";
               ordered-by user;
               uses numeric-two-byte-value;
               description
                 "Define the pair of <operator, source-port> entries
                  into a list.";
             }
           }
           case icmp-type {
             list icmp-type {
               key "op value";
               ordered-by user;
               uses numeric-one-byte-value;
               description
                 "Define the pair of <operator, icmp-type> entries
                  into a list.";
             }
           }
           case icmp-code {
             list icmp-code {

Wu, et al.              Expires January 19, 2016               [Page 21]

Internet-Draft              YANG for Flowspec                  July 2015

               key "op value";
               ordered-by user;
               uses numeric-one-byte-value;
               description
                 "Define the pair of <operator, icmp-code> entries
                  into a list.";
             }
           }
           case tcp-flags {
             list tcp-flag {
               key "op value";
               ordered-by user;
               uses bitmask-two-byte-value;
               description
                 "Define the pair of <operator, tcp-flag> entries
                  into a list.";
             }
           }
           case packet-length {
             list packet-length {
               key "op value";
               ordered-by user;
               uses numeric-two-byte-value;
               description
                 "Define the pair of <operator, packet-length>
                  entries into a list.";
             }
           }
           case dscp {
             list dscp {
               key "op value";
               ordered-by user;
               uses dscp-value;
               description
                 "Define the pair of <operator, dscp> entries
                  into a list.";
             }
           }
           case fragment {
             list fragment {
               key "op value";
               ordered-by user;
               uses fragment-value;
               description
                 "Define the pair of <operator, fragment> entries
                  into a list.";
             }
           }

Wu, et al.              Expires January 19, 2016               [Page 22]

Internet-Draft              YANG for Flowspec                  July 2015

         }
       }
     }

     grouping flowspec-traffic-action {
       description
         "This group defines the traffic actions for FlowSpec.";
       list flowspec-action {
         key "action-type";
         description
           "Define the traffic actions of FlowSpec into a list.";
         leaf action-type {
           type action-type;
           description
             "Specify the type of traffic filter action.";
         }
         choice action {
           description
             "Define different kinds of traffic actions involved.";
           case traffic-rate {
             leaf rate {
               type float;
               description
                 "Specifies the traffic rate in IEEE floating point
                  [IEEE.754.1985] format, units being bytes per
                  second.";
             }
           }
           case redirect {
             leaf route-target {
               type string {
                 length "3..21";
               }
               description
                 "Allows the traffic to be redirected to a VRF
                  routing instance that lists the specified
                  route-target in its import policy";
             }
           }
           case traffic-marking {
             leaf remark-dscp {
               type dscp-type;
               description
                 "Instructs a system to modify the DSCP bits of
                  a transiting IP packet to the corresponding value";
             }
           }
         }

Wu, et al.              Expires January 19, 2016               [Page 23]

Internet-Draft              YANG for Flowspec                  July 2015

       }
     }

     grouping flowspec-bgp-route {
       description
         "This group define extensions of FlowSpec for bgp protocol.";
       leaf neighbor-router-id {
         type inet:ipv4-address;
         description
           "The router-id of the neighbor from whom
            this route received.";
       }
       leaf as-path {
         type string;
         description
           "Number of the AS the BGP FlowSpec route passes.";
       }
       leaf origin {
         type enumeration {
           enum "igp" {
             value 0;
             description
               "Designate this route originated from igp route.";
           }
           enum "egp" {
             value 1;
             description
               "Designate this route originated from egp route.";
           }
           enum "incomplete" {
             value 2;
             description
               "Designate this route originated from other route.";
           }
         }
         description
           "The Origin attribute defines the origin of a route. The
            Origin attribute is classified into the following types:

            Interior Gateway Protocol (IGP): This attribute type has the
            highest priority. IGP is the Origin attribute for routes
            obtained through an IGP in the AS from which the routes
            originate. For example, the Origin attribute of the routes
            imported to the BGP routing table using the network command
            is IGP.

            Exterior Gateway Protocol (EGP): This attribute type has the
            second highest priority. The Origin attribute of the routes

Wu, et al.              Expires January 19, 2016               [Page 24]

Internet-Draft              YANG for Flowspec                  July 2015

            obtained through EGP is EGP.

            Incomplete: This attribute type has the lowest priority.
            Incomplete is the Origin attribute type of all routes that
            do not have the IGP or EGP Origin attribute. For example,
            the Origin attribute of the routes imported is Incomplete.";
       }
       leaf med {
         type uint32;
         description
           "The Multi-Exit-Discriminator (MED) is transmitted only
            between two neighboring ASs.";
       }
       leaf local-preference {
         type uint8;
         description
           "The local preference of the BGP FlowSpec route.";
       }
       leaf community {
         type string;
         description
           "Community attribute of the BGP FlowSpec route.";
       }
       leaf ext-community {
         type string;
         description
           "Extended community attribute of the BGP FlowSpec route.";
       }
       leaf preference {
         type uint32;
         description
           "The preferred value of a protocol.";
       }
       leaf originator {
         type inet:ip-address;
         description
           "The address of the advertiser of the BGP FlowSpec route.";
       }
       leaf cluster-list {
         type string;
         description
           "Cluster list attribute of the BGP FlowSpec route.";
       }
       uses flowspec-traffic-filter;
       uses flowspec-traffic-action;
     }

     grouping flowspec-protocol-specific {

Wu, et al.              Expires January 19, 2016               [Page 25]

Internet-Draft              YANG for Flowspec                  July 2015

       description
         "This group define extensions of FlowSpec per protocols.";
       choice protocol {
         description
           "Define specific part of FlowSpec when carried in
            different protocols.";
         case bgp {
           uses flowspec-bgp-route;
         }
       }
     }

     container flowspec {
       description
         "Container for flowspec configuration and state";
       container flowspec-cfg {
         description
           "Configuration for flow specification.";
         list flowspec-policy {
           key "policy-name";
           description
             "Configuration of a flow route list.";
           leaf policy-name {
             type string;
             description
               "The name of a flow route.";
           }
           leaf vrf-name {
             type string;
             description
               " Vrf-name of the flowspec-rule";
           }
           leaf address-family {
             type identityref {
               base address-family;
             }
             description
               " address-family of the flowspec-rule";
           }
           list flowspec-rule {
             key "rule-name";
             ordered-by system;
             leaf rule-name {
               type string;
               description
                 "The name of a flowspec rule.";
             }
             uses flowspec-traffic-filter;

Wu, et al.              Expires January 19, 2016               [Page 26]

Internet-Draft              YANG for Flowspec                  July 2015

             uses flowspec-traffic-action;
             description
               "Define flow specification filters.";
           }
         }
       }
       container flowspec-state {
         config false;
         description
           "Operational state of flow specification.";
         container flowspec-rib {
           description
             "Define the operational state data for FlowSpec entries.";
           list flowspec-route {
             description
               "FlowSpec entries are organized into list of routes.";
             leaf index {
               type uint32;
               description
                 "Flow Specification route entry index.";
             }
             leaf islocal {
               type boolean;
               description
                 "Locally configured Flow Specification route.";
             }
             leaf local-name {
               type string;
               description
                 "The name of locally configured FlowSpec route.";
             }
             leaf neighbor {
               type inet:ip-address;
               description
                 "IP address of an advertising device";
             }
             leaf duration {
               type uint32;
               description
                 "Route duration in seconds.";
             }
             container flowspec-protocol-specific {
               description
                 "Define the specific extension for each protocol.";
               uses flowspec-protocol-specific;
             }
           }
         }

Wu, et al.              Expires January 19, 2016               [Page 27]

Internet-Draft              YANG for Flowspec                  July 2015

         container flowspec-statistics {
           description
             "Define the statistics of list of flowspec rules.";
           list flowspec-stats {
             description
               "Statistics of list of flowspec rules per VRF &
                Address-family.";
             leaf vrf-name {
               type string;
               description
                 "Vrf-name of the set of flowspec-rules";
             }
             leaf address-family {
               type string;
               description
                 "Address-family of the set of flowspec-rules";
             }
             list flowspec-rule-stats {
               description
                 "
                  This defines the flowspec filter statistics of
                  each flowspec-rules.
                 ";
               uses flowspec-traffic-filter;
               uses flowspec-traffic-action;
               leaf classified-pkts {
                 type uint64;
                 description
                   " Number of total packets which matched
                     to the flowspec-filter";
               }
               leaf classified-bytes {
                 type uint64;
                 description
                   " Number of total bytes which matched
                     to the flowspec-filter";
               }
               leaf drop-pkts {
                 type uint64;
                 description
                   " Number of total packets which got dropped";
               }
               leaf drop-bytes {
                 type uint64;
                 description
                   " Number of total bytes which got dropped";
               }
             }

Wu, et al.              Expires January 19, 2016               [Page 28]

Internet-Draft              YANG for Flowspec                  July 2015

           }
         }
       }
     }
   }

   <CODE ENDS>

4.  IANA Considerations

   This document registers a URI in the "IETF XML Registry" [RFC3688].
   Following the format in RFC 3688, the following registration has been
   made.

   URI: urn:ietf:params:xml:ns:yang:ietf-flowspec

   Registrant Contact: The RTGWG WG of the IETF.

   XML: N/A; the requested URI is an XML namespace.

   This document registers a YANG module in the "YANG Module Names"
   registry [RFC6020].

   Name: ietf-flowspec

   Namespace: urn:ietf:params:xml:ns:yang:ietf-flowspec

   Prefix: flowspec

   Reference: RFC XXXX

5.  Security Considerations

   The YANG module defined in this memo is designed to be accessed via
   the NETCONF protocol [RFC6241].  The lowest NETCONF layer is the
   secure transport layer and the mandatory-to-implement secure
   transport is SSH [RFC6242].  The NETCONF access control model
   [RFC6536] provides the means to restrict access for particular
   NETCONF users to a pre-configured subset of all available NETCONF
   protocol operations and content.

   There are a number of data nodes defined in the YANG module which are
   writable/creatable/deletable (i.e., config true, which is the
   default).  These data nodes may be considered sensitive or vulnerable
   in some network environments.  Write operations (e.g., <edit-config>)
   to these data nodes without proper protection can have a negative
   effect on network operations.

Wu, et al.              Expires January 19, 2016               [Page 29]

Internet-Draft              YANG for Flowspec                  July 2015

6.  Acknowledgments

   The editor of this document wishes to thank Andrew Mao for the
   guidance and support in coming up with this draft.

7.  References

7.1.  Normative References

   [I-D.ietf-idr-bgp-flowspec-oid]
              Uttaro, J., Filsfils, C., Smith, D., Alcaide, J., and P.
              Mohapatra, "Revised Validation Procedure for BGP Flow
              Specifications", draft-ietf-idr-bgp-flowspec-oid-02 (work
              in progress), January 2014.

   [I-D.ietf-idr-flow-spec-v6]
              Raszuk, R., Pithawala, B., McPherson, D., and A. Andy,
              "Dissemination of Flow Specification Rules for IPv6",
              draft-ietf-idr-flow-spec-v6-06 (work in progress),
              November 2014.

   [I-D.litkowski-idr-flowspec-interfaceset]
              Litkowski, S., Simpson, A., Patel, K., and J. Haas,
              "Applying BGP flowspec rules on a specific interface set",
              draft-litkowski-idr-flowspec-interfaceset-02 (work in
              progress), March 2015.

   [RFC3688]  Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
              DOI 10.17487/RFC3688, January 2004,
              <http://www.rfc-editor.org/info/rfc3688>.

   [RFC5575]  Marques, P., Sheth, N., Raszuk, R., Greene, B., Mauch, J.,
              and D. McPherson, "Dissemination of Flow Specification
              Rules", RFC 5575, DOI 10.17487/RFC5575, August 2009,
              <http://www.rfc-editor.org/info/rfc5575>.

   [RFC6020]  Bjorklund, M., Ed., "YANG - A Data Modeling Language for
              the Network Configuration Protocol (NETCONF)", RFC 6020,
              DOI 10.17487/RFC6020, October 2010,
              <http://www.rfc-editor.org/info/rfc6020>.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
              and A. Bierman, Ed., "Network Configuration Protocol
              (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
              <http://www.rfc-editor.org/info/rfc6241>.

Wu, et al.              Expires January 19, 2016               [Page 30]

Internet-Draft              YANG for Flowspec                  July 2015

   [RFC6242]  Wasserman, M., "Using the NETCONF Protocol over Secure
              Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, June 2011,
              <http://www.rfc-editor.org/info/rfc6242>.

   [RFC6536]  Bierman, A. and M. Bjorklund, "Network Configuration
              Protocol (NETCONF) Access Control Model", RFC 6536,
              DOI 10.17487/RFC6536, March 2012,
              <http://www.rfc-editor.org/info/rfc6536>.

7.2.  Informative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <http://www.rfc-editor.org/info/rfc2119>.

Authors' Addresses

   Nan Wu
   Huawei
   Huawei Bld., No.156 Beiqing Rd.
   Beijing  100095
   China

   Email: eric.wu@huawei.com

   Shunwan Zhuang
   Huawei
   Huawei Bld., No.156 Beiqing Rd.
   Beijing  100095
   China

   Email: zhuangshunwan@huawei.com

   Aseem Choudhary
   Cisco Systems
   170 W. Tasman Drive
   San Jose, CA  95134
   USA

   Email: asechoud@cisco.com

Wu, et al.              Expires January 19, 2016               [Page 31]