Skip to content

Add Conditional Routes - #1533

Open
rolandphung wants to merge 1 commit into
openconfig:masterfrom
rolandphung:conditional-routes
Open

Add Conditional Routes#1533
rolandphung wants to merge 1 commit into
openconfig:masterfrom
rolandphung:conditional-routes

Conversation

@rolandphung

Copy link
Copy Markdown
Contributor

Change Scope

  • (M) release/models/local-routing/openconfig-local-routing.yang
  • (M) release/models/network-instance/openconfig-network-instance.yang
  • (A) release/models/policy/openconfig-policy-network-instance.yang
  • (M) release/models/policy/openconfig-policy-types.yang
  • (M) release/models/policy/openconfig-routing-policy.yang

This proposal introduces OpenConfig support for conditional routes and conditional prefix-sets, enabling more granular, policy-driven route management. In some ways, this is a more descriptive configuration model for local-aggregates.

This implementation decouples the condition definition from its application for better reusability:

  • Defining the Conditional Set:
    • conditional-prefix-sets (located under /routing-policy/defined-sets/) serve as the definition layer. It is a combination of a defined prefix-set and policy-definition. The attached policy-definition is matched against the whole RIB or protocol table specified by match-source-protocol under a specific match-policy-network-instance.
  • Apply the Conditional Set:
    • conditional-routes (located under /network-instances/.../protocols/) serve as an application layer. These conditional prefix sets are applied to the network-instance with the configured action. Currently this proposal only supports INSTALL_DROP_NEXTHOP which would install these prefixes as local routes with a drop next-hop to discard all traffic.
    • The name conditional-prefix-set-refs is following the precedence of community-set-refs and ext-community-set-refs.
  • Redistribute the routes:
    • table-connections (located under /network-instances/network-instances/) can be used to redistribute and advertise these routes.

These changes are backwards compatible.

Platform Implementations

Tree View

/routing-policy/defined-sets/conditional-prefix-sets/

module: openconfig-routing-policy
  +--rw routing-policy
     +--rw defined-sets
        +--rw conditional-prefix-sets
           +--rw conditional-prefix-set* [name]
              +--rw name      -> ../config/name
              +--rw config
              |  +--rw name?                                            string
              |  +--rw match-policy?                                    -> /routing-policy/policy-definitions/policy-definition/name
              |  +--rw match-source-protocol?                           union
              |  +--rw target-prefix-set?                               -> /routing-policy/defined-sets/prefix-sets/prefix-set/name
              |  +--rw oc-rpol-netinst:match-policy-network-instance?   -> /oc-ni:network-instances/network-instance/name
              +--ro state
                 +--ro name?                                            string
                 +--ro match-policy?                                    -> /routing-policy/policy-definitions/policy-definition/name
                 +--ro match-source-protocol?                           union
                 +--ro target-prefix-set?                               -> /routing-policy/defined-sets/prefix-sets/prefix-set/name
                 +--ro oc-rpol-netinst:match-policy-network-instance?   -> /oc-ni:network-instances/network-instance/name

/network-instances/network-instance/protocols/protocol/conditional-routes

module: openconfig-network-instance
  +--rw network-instances
     +--rw network-instance* [name]
        +--rw protocols
           +--rw protocol* [identifier name]
              +--rw conditional-routes
                 +--rw config
                 +--rw state
                 +--rw conditional-prefix-set-refs
                    +--rw conditional-prefix-set-ref* [name]
                       +--rw name      -> ../config/name
                       +--rw config
                       |  +--rw name?         -> /oc-rpol:routing-policy/defined-sets/conditional-prefix-sets/conditional-prefix-set/name
                       |  +--rw action?       identityref
                       |  +--rw preference?   uint32
                       +--ro state
                          +--ro name?                -> /oc-rpol:routing-policy/defined-sets/conditional-prefix-sets/conditional-prefix-set/name
                          +--ro action?              identityref
                          +--ro preference?          uint32
                          +--ro condition-matched?   boolean

@rolandphung

Copy link
Copy Markdown
Contributor Author

Example

As an example, here's the rough configuration tree that would be for RT-10.1 https://github.com/openconfig/featureprofiles/tree/HEAD/feature/networkinstance/local\_aggregates/tests/policy\_advertise\_aggregate\_test

/routing-policy/
  defined-sets/
    bgp-defined-sets/
      community-sets/
        community-set[name=NON_LOCAL_RR]
          config/
            community-member = [ 994130582 ]
    prefix-sets/
      prefix-set[name=ADV_V4_DEFAULT]/
        config/
          mode = IPV4
        prefixes/
          prefix[ip-prefix=0.0.0.0/0][masklength-range=exact]
      prefix-set[name=ADV_V6_DEFAULT]/
        config/
          mode = IPV6
        prefixes/
          prefix[ip-prefix=::/0][masklength-range=exact]
      prefix-set[name=BGP_V4_MATCH]/
        config/
          mode = IPV4
        prefixes/
          prefix[ip-prefix=10.0.0.0/0][masklength-range=15..16]
      prefix-set[name=BGP_V6_MATCH]/
        config/
          mode = IPV6
        prefixes/
          prefix[ip-prefix=2607:f8b0::/32][masklength-range=64..64]
          prefix[ip-prefix=2a00:1450::/32][masklength-range=64..64]
          prefix[ip-prefix=2002:a00::/32][masklength-range=64..64]
    conditional-prefix-sets/
      conditional-prefix-set[name=ipv4_generate_default]/
        config/
          match-policy = ipv4_generate_default_conditionally
          match-source-protocol = BGP
          target-prefix-set = ADV_V4_DEFAULT
      conditional-prefix-set[name=ipv6_generate_default]/
        config/
          match-policy = ipv6_generate_default_conditionally
          match-source-protocol = BGP
          target-prefix-set = ADV_V6_DEFAULT
  policy-definitions/
    policy-definition[name=ipv4_generate_default_conditionally]/
      statements/
        statement[name=match_bgp_community_and_prefix_list]/
          actions/
            config/
              policy-result = ACCEPT_ROUTE
          conditions/
            bgp-conditions/
              match-community-set/
                config/
                  community-set = NON_LOCAL_RR
            match-prefix-set/
              config/
                prefix-set = BGP_V4_MATCH
    policy-definition[name=ipv6_generate_default_conditionally]/
      statements/
        statement[name=match_bgp_community_and_prefix_list]/
          actions/
            config/
              policy-result = ACCEPT_ROUTE
          conditions/
            bgp-conditions/
              match-community-set/
                config/
                  community-set = NON_LOCAL_RR
            match-prefix-set/
              config/
                prefix-set = BGP_V6_MATCH
/network-instances/network-instance[name=default]/
  protocols/
    protocol[name=DYNAMIC_LOCAL_ROUTES][identifier=DYNAMIC_LOCAL_ROUTES]/
      conditional-routes/
        conditional-prefix-set-refs/
          conditional-prefix-set-ref[name=ipv4_generate_default]/
            config/
              action = INSTALL_DROP_NEXTHOP
          conditional-prefix-set-ref[name=ipv6_generate_default]/
            config/
              action = INSTALL_DROP_NEXTHOP
    protocol[name=BGP][identifier=BGP]/
      bgp/
        config/
          as = 15169
  table-connections/
    table-connection[src-protocol=DYNAMIC_LOCAL_ROUTES][dst-protocol=BGP][address-family=IPV4]
      config/
        src-protocol = DYNAMIC_LOCAL_ROUTES
        dst-protocol = BGP
        address-family = IPV4
    table-connection[src-protocol=DYNAMIC_LOCAL_ROUTES][dst-protocol=BGP][address-family=IPV6]
      config/
        src-protocol = DYNAMIC_LOCAL_ROUTES
        dst-protocol = BGP
        address-family = IPV6

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces conditional routing capabilities to OpenConfig by adding conditional prefix sets and routes across local routing, network instance, and routing policy models. The feedback focuses on improving the quality and accuracy of the YANG models, including correcting a mismatch in a revision description, updating description strings to reference correct leaf names, removing redundant empty config/state containers, and fixing several grammatical errors and typos.

Comment thread release/models/policy/openconfig-policy-types.yang Outdated
Comment thread release/models/policy/openconfig-routing-policy.yang Outdated
Comment thread release/models/local-routing/openconfig-local-routing.yang Outdated
Comment thread release/models/policy/openconfig-policy-network-instance.yang Outdated
Comment thread release/models/policy/openconfig-policy-network-instance.yang Outdated
Comment thread release/models/policy/openconfig-policy-network-instance.yang Outdated
Comment thread release/models/local-routing/openconfig-local-routing.yang Outdated
Comment thread release/models/local-routing/openconfig-local-routing.yang Outdated
Comment thread release/models/local-routing/openconfig-local-routing.yang Outdated
Adding conditional-prefix-sets and conditional-routes to inject routes
into the RIB. The conditions are matched against the routes in the RIB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant