netconfcentral logo

bgp-policy

HTML

bgp-policy@2015-05-15



  module bgp-policy {

    yang-version 1;

    namespace
      "http://openconfig.net/yang/bgp-policy";

    prefix bgp-pol;

    import ietf-inet-types {
      prefix inet;
    }
    import routing-policy {
      prefix rpol;
    }
    import policy-types {
      prefix pt;
    }
    import bgp-types {
      prefix bgp-types;
    }

    organization "OpenConfig working group";

    contact
      "OpenConfig working group
    netopenconfig@googlegroups.com";

    description
      "This module contains data definitions for BGP routing policy.
    It augments the base routing-policy module with BGP-specific
    options for conditions and actions.";

    revision "2015-05-15" {
      description
        "Updated model to augment base routing-policy module";
      reference
        "TBD";

    }


    typedef bgp-as-path-prepend-repeat {
      type uint8;
      description
        "Option for the BGP as-prepend policy action.  Prepends the
      local AS number repeated n times";
    }

    typedef bgp-set-community-option-type {
      type enumeration {
        enum "ADD" {
          value 0;
          description
            "add the specified communities to the existing
          community attribute";
        }
        enum "REMOVE" {
          value 1;
          description
            "remove the specified communities from the
          existing community attribute";
        }
        enum "REPLACE" {
          value 2;
          description
            "replace the existing community attribute with
          the specified communities. If an empty set is
          specified, this removes the community attribute
          from the route.";
        }
      }
      description
        "Type definition for options when setting the community
      attribute in a policy action";
    }

    typedef bgp-next-hop-type {
      type union {
        type inet:ip-address;
        type enumeration {
          enum "SELF" {
            value 0;
            description
              "special designation for local router's own
          address, i.e., next-hop-self";
          }
        }
      }
      description
        "type definition for specifying next-hop in policy actions";
    }

    typedef bgp-set-med-type {
      type union {
        type uint32;
        type string {
          pattern "^[+-][0-9]+";
        }
        type enumeration {
          enum "IGP" {
            value 0;
            description
              "set the MED value to the IGP cost toward the
          next hop for the route";
          }
        }
      }
      description
        "Type definition for specifying how the BGP MED can
      be set in BGP policy actions. The three choices are to set
      the MED directly, increment/decrement using +/- notation,
      and setting it to the IGP cost (predefined value).";
    }

    grouping bgp-match-conditions {
      description
        "Condition statement definitions for checking membership in a
      defined set";
      container match-community-set {
        presence
          "The presence of this container indicates that the routes
        should match the referenced community-set";
        description
          "Match a referenced community-set according to the logic
        defined in the match-set-options leaf";
        leaf community-set {
          type leafref {
            path "/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:community-sets/bgp-pol:community-set/bgp-pol:community-set-name";
            require-instance true;
          }
          description
            "References a defined community set";
        }

        uses rpol:match-set-options-group;
      }  // container match-community-set

      container match-ext-community-set {
        presence
          "The presence of this container indicates that the routes
        should match the referenced extended community set";
        description
          "Match a referenced extended community-set according to the
        logic defined in the match-set-options leaf";
        leaf ext-community-set {
          type leafref {
            path "/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:ext-community-sets/bgp-pol:ext-community-set/bgp-pol:ext-community-set-name";
            require-instance true;
          }
          description
            "References a defined extended community set";
        }

        uses rpol:match-set-options-group;
      }  // container match-ext-community-set

      container match-as-path-set {
        presence
          "The presence of this container indicates that the route
        should match the referenced as-path set";
        description
          "Match a referenced as-path set according to the logic
        defined in the match-set-options leaf";
        leaf as-path-set {
          type leafref {
            path "/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/bgp-pol:as-path-set-name";
            require-instance true;
          }
          description
            "References a defined AS path set";
        }

        uses rpol:match-set-options-group;
      }  // container match-as-path-set
    }  // grouping bgp-match-conditions

    grouping bgp-attribute-conditions {
      description
        "Condition statement definitions for comparing a BGP route
      attribute to a specified value";
      leaf med-eq {
        type uint32;
        description
          "Condition to check if the received MED value is equal to
        the specified value";
      }

      leaf origin-eq {
        type bgp-types:bgp-origin-attr-type;
        description
          "Condition to check if the route origin is equal to the
        specified value";
      }

      leaf-list next-hop-in {
        type inet:ip-address;
        description
          "List of next hop addresses to check for in the route
        update";
      }

      leaf local-pref-eq {
        type uint32;
        description
          "Condition to check if the local pref attribute is equal to
        the specified value";
      }

      container community-count {
        presence
          "node is present in the config data to indicate a
      community-count condition";
        description
          "Value and comparison operations for conditions based on the
        number of communities in the route update";
        uses pt:attribute-compare-operators;
      }  // container community-count

      container as-path-length {
        presence
          "node is present in the config data to indicate a
      as-path-length condition";
        description
          "Value and comparison operations for conditions based on the
        length of the AS path in the route update";
        uses pt:attribute-compare-operators;
      }  // container as-path-length

      leaf route-type {
        type enumeration {
          enum "INTERNAL" {
            value 0;
            description
              "route type is internal";
          }
          enum "EXTERNAL" {
            value 1;
            description
              "route type is external";
          }
        }
        description
          "Condition to check the route type in the route update";
      }
    }  // grouping bgp-attribute-conditions

    augment /rpol:routing-policy/rpol:defined-sets {
      description
        "adds BGP defined sets container to routing policy
    model";
      container bgp-defined-sets {
        description
          "BGP-related set definitions for policy match conditions";
        container community-sets {
          description
            "Enclosing container for community sets";
          list community-set {
            key "community-set-name";
            description
              "Definitions for community sets";
            leaf community-set-name {
              type string;
              mandatory true;
              description
                "name / label of the community set -- this is used to
              reference the set in match conditions";
            }

            leaf-list community-member {
              type union {
                type bgp-types:bgp-std-community-type;
                type bgp-types:bgp-community-regexp-type;
                type bgp-types:bgp-well-known-community-type;
              }
              description
                "members of the community set";
            }
          }  // list community-set
        }  // container community-sets

        container ext-community-sets {
          description
            "Enclosing container for extended community sets";
          list ext-community-set {
            key "ext-community-set-name";
            description
              "Definitions for extended community sets";
            leaf ext-community-set-name {
              type string;
              description
                "name / label of the extended community set -- this is
              used to reference the set in match conditions";
            }

            leaf-list ext-community-member {
              type union {
                type bgp-types:bgp-ext-community-type;
                type bgp-types:bgp-community-regexp-type;
              }
              description
                "members of the extended community set";
            }
          }  // list ext-community-set
        }  // container ext-community-sets

        container as-path-sets {
          description
            "Enclosing container for AS path sets";
          list as-path-set {
            key "as-path-set-name";
            description
              "Definitions for AS path sets";
            leaf as-path-set-name {
              type string;
              description
                "name of the AS path set -- this is used to reference
              the set in match conditions";
            }

            leaf-list as-path-set-member {
              type string;
              description
                "AS path expression -- list of ASes in the set";
            }
          }  // list as-path-set
        }  // container as-path-sets
      }  // container bgp-defined-sets
    }

    augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:conditions {
      description
        "BGP policy conditions added to routing policy
    module";
      container bgp-conditions {
        description
          "Policy conditions for matching
      BGP-specific defined sets or comparing BGP-specific
      attributes";
        uses bgp-match-conditions;

        uses bgp-attribute-conditions;
      }  // container bgp-conditions
    }

    augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:actions {
      description
        "BGP policy actions added to routing policy
    module";
      container bgp-actions {
        description
          "Definitions for policy action statements that
        change BGP-specific attributes of the route";
        container set-as-path-prepend {
          presence
            "node is present in the config data to use the AS
      prepend action";
          description
            "action to prepend local AS number to the AS-path a
        specified number of times";
          leaf repeat-n {
            type uint8;
            description
              "number of times to prepend the local AS
          number";
          }
        }  // container set-as-path-prepend

        container set-community {
          presence
            "node is present in the config data when
        set-community action is used";
          description
            "action to set the community attributes of the route, along
          with options to modify how the community is modified";
          choice set-community-method {
            description
              "Option to set communities using an inline list or
            reference to an existing defined set.";
            leaf-list communities {
              type union {
                type bgp-types:bgp-std-community-type;
                type bgp-types:bgp-well-known-community-type;
              }
              description
                "Set the community values for the update inline with
                a list.";
            }
            leaf community-set-ref {
              type leafref {
                path "/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:community-sets/bgp-pol:community-set/bgp-pol:community-set-name";
                require-instance true;
              }
              description
                "References a defined community set by name";
            }
          }  // choice set-community-method

          leaf options {
            type bgp-set-community-option-type;
            description
              "Options for modifying the community attribute with
            the specified values.  These options apply to both
            methods of setting the community attribute.";
          }
        }  // container set-community

        container set-ext-community {
          presence
            "node is present in the config data when
        set-community action is used";
          description
            "Action to set the extended community attributes of the
          route, along with options to modify how the community is
          modified";
          choice set-ext-community-method {
            description
              "Option to set communities using an inline list or
            reference to an existing defined set.";
            leaf-list communities {
              type union {
                type bgp-types:bgp-ext-community-type;
                type bgp-types:bgp-well-known-community-type;
              }
              description
                "Set the community values for the update inline with
                a list.";
            }
            leaf ext-community-set-ref {
              type leafref {
                path "/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:ext-community-sets/bgp-pol:ext-community-set/bgp-pol:ext-community-set-name";
                require-instance true;
              }
              description
                "References a defined extended community set by
                name";
            }
          }  // choice set-ext-community-method

          leaf options {
            type bgp-set-community-option-type;
            description
              "options for modifying the extended community
            attribute with the specified values. These options
            apply to both methods of setting the community
            attribute.";
          }
        }  // container set-ext-community

        leaf set-route-origin {
          type bgp-types:bgp-origin-attr-type;
          description
            "set the origin attribute to the specified
        value";
        }

        leaf set-local-pref {
          type uint32;
          description
            "set the local pref attribute on the route
        update";
        }

        leaf set-next-hop {
          type bgp-next-hop-type;
          description
            "set the next-hop attribute in the route update";
        }

        leaf set-med {
          type bgp-set-med-type;
          description
            "set the med metric attribute in the route
        update";
        }
      }  // container bgp-actions
    }
  }  // module bgp-policy

Summary

  
  
Organization OpenConfig working group
  
Module bgp-policy
Version 2015-05-15
File bgp-policy@2015-05-15.yang
  
Prefix bgp-pol
Namespace http://openconfig.net/yang/bgp-policy
  
Cooked /cookedmodules/bgp-policy/2015-05-15
YANG /src/bgp-policy@2015-05-15.yang
XSD /xsd/bgp-policy@2015-05-15.xsd
  
Abstract This module contains data definitions for BGP routing policy. It augments the base routing-policy module with BGP-specific optio...
  
Contact
OpenConfig working group
netopenconfig@googlegroups.com

Description

 
This module contains data definitions for BGP routing policy.
It augments the base routing-policy module with BGP-specific
options for conditions and actions.

Typedefs

Typedef Base type Abstract
bgp-as-path-prepend-repeat uint8 Option for the BGP as-prepend policy action. Prepends the local AS number repeated n times
bgp-next-hop-type union type definition for specifying next-hop in policy actions
bgp-set-community-option-type enumeration Type definition for options when setting the community attribute in a policy action
bgp-set-med-type union Type definition for specifying how the BGP MED can be set in BGP policy actions. The three choices are to set the MED directly, increment/decrement using +/- notation, and setting it to the IGP cost (predefined value).

Groupings

Grouping Objects Abstract
bgp-attribute-conditions med-eq origin-eq next-hop-in local-pref-eq community-count as-path-length route-type Condition statement definitions for comparing a BGP route attribute to a specified value
bgp-match-conditions match-community-set match-ext-community-set match-as-path-set Condition statement definitions for checking membership in a defined set