Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add NEXT-STATEMENT to policy-result-type #949

Merged
merged 16 commits into from
Oct 17, 2023
Merged

Conversation

dplore
Copy link
Member

@dplore dplore commented Aug 31, 2023

Change Scope

  • Add NEXT-STATEMENT to the typedef for route-policy-result.
  • Use NEXT-STATEMENT as the default.
  • This does not change the intended functionality of routing policies. It is intended to
    clarify the expected behavior if there is a match for a policy, but no policy-result is
    specified.

This change adds a default where there previously was none. So if an implementation performs some other action than NEXT-STATEMENT by default, it could be a breaking change.

Platform Implementations

This result type corresponds to the the following policy match actions in existing implementations.

  • JunOS implements next term which is equivalent to NEXT-STATEMENT
  • Cisco implements pass which is similar to NEXT-STATEMENT. It differs in that pass means both accept-route and continue. In OC, NEXT-STATEMENT only means move to the next action in the policy.
  • Arista EOS implements continue which is a superset of NEXT-STATEMENT. Arista's continue statement has additional parameters not contemplated in this PR.

@dplore dplore requested a review from a team as a code owner August 31, 2023 17:58
@OpenConfigBot
Copy link

OpenConfigBot commented Aug 31, 2023

Major YANG version changes in commit e0372f6:

@OpenConfigBot
Copy link

OpenConfigBot commented Aug 31, 2023

Compatibility Report for commit e0372f6:
pyangbind@1c28486

Copy link
Contributor

@wenovus wenovus left a comment

Choose a reason for hiding this comment

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

I think continue is a good name for it. If we choose to add "NEXT_POLICY" in the future this still LGTM.

@dplore dplore changed the title add continue to policy-result-type add NEXT-STATEMENT and NEXT-POLICY to policy-result-type Sep 5, 2023
Copy link
Contributor

@oscargdd oscargdd left a comment

Choose a reason for hiding this comment

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

Please find some suggestions to clarify that the all the actions are executed before jumping to the next statement or policy.

release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
release/models/policy/openconfig-routing-policy.yang Outdated Show resolved Hide resolved
@robshakir
Copy link
Contributor

What is the operational use case that we're envisaging for NEXT_POLICY here? I can see that this is potentially supported in multiple vendor implementations (but the multi-vendor justification here seems a bit tenuous, can we put together an example of two vendor language policies that actually allow for NEXT_POLICY-esque behaviour? It seems like you would need to do continue 100 where 100 is a statement that just falls through to the next policy, but this would imply that you have policy chaining -- so a better example to demonstrate that this actually possible is needed.)

In a similar vein, what's the case where there is ambiguity w.r.t NEXT_STATEMENT. Today, if there isn't a "terminating" action i.e., ACCEPT/REJECT this is the default (as we are saying that this is a NOOP) is there some specific reason that we're trying to make it more explicit?

Copy link
Contributor

@robshakir robshakir left a comment

Choose a reason for hiding this comment

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

Blocking for additional background to be described in this PR.

@rszarecki
Copy link
Contributor

What is expected behavior if all matching statement has NEXT_STATEMENT action?

@wenovus
Copy link
Contributor

wenovus commented Oct 11, 2023

What is expected behavior if all matching statement has NEXT_STATEMENT action?

Then the default apply-policy action is applied (default-import-policy default-export-policy leaves). This is either REJECT or ACCEPT.

@rszarecki
Copy link
Contributor

IOS-XR 'pass' is not same as 'NEXT-STATEMENT'. It Carrie's semantics of "conditionally accepted" unless explicitly dropped in subsequent statements.
IOS-XR default depends on other actions taken. If any route attribute is modified, implicit action is to accept route and stop policy evaluation. If there is no modification, route is dropped.

@rszarecki
Copy link
Contributor

Then the default apply-policy action is applied (default-import-policy default-export-policy leaves). This is either REJECT or ACCEPT.

Yes, but...

  1. what if this leaves are omitted/not specified?
  2. the description of this leaves is bit unclear: "explicitly set a default policy if no policy definition in the export policy chain is satisfied." In short "definition is not satisfied". Is it applicable:
  • ONLY when import-policy/export-policy are not present XOR
  • if non of statements in import-policy/export-policy policy chain is matched XOR
  • if on of matched statement have ACCEPT/REJECT action
  • or some combination of above.

@wenovus
Copy link
Contributor

wenovus commented Oct 11, 2023

IOS-XR 'pass' is not same as 'NEXT-STATEMENT'. It Carrie's semantics of "conditionally accepted" unless explicitly dropped in subsequent statements. IOS-XR default depends on other actions taken. If any route attribute is modified, implicit action is to accept route and stop policy evaluation. If there is no modification, route is dropped.

That's interesting. it looks like Cisco's and Arista's policy evaluation may be quite different from Juniper's, which looks the most similar to OpenConfig to me:

Cisco: "If a policy modifies a route, by default the policy accepts the route.", "If a policy does not modify the route, by default the route is dropped."
Arista: "The evaluation of routes whose settings are the same as match command parameters normally ends and the statement's set commands are applied to the route."

I didn't look deeper into Arista, but in Cisco, whether a particular policy matched a route changes the default behaviour of the route. aka. when mapped to OpenConfig, the default-(import/export)-policy changes depending on whether a particular policy matched and had a pass statement. This is not expressible in OpenConfig without a meaningful modification to the policy.

Then the default apply-policy action is applied (default-import-policy default-export-policy leaves). This is either REJECT or ACCEPT.

Yes, but...

  1. what if this leaves are omitted/not specified?
  2. the description of this leaves is bit unclear: "explicitly set a default policy if no policy definition in the export policy chain is satisfied." In short "definition is not satisfied". Is it applicable:
  • ONLY when import-policy/export-policy are not present XOR
  • if non of statements in import-policy/export-policy policy chain is matched XOR
  • if on of matched statement have ACCEPT/REJECT action
  • or some combination of above.

So the default policy type has a YANG default value: https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-network-instance.html#network-instances-network-instance-inter-instance-policies-apply-policy-config-default-import-policy

Per the standard this means even if not configured, it will still have the value of REJECT.

@dplore
Copy link
Member Author

dplore commented Oct 12, 2023

IOS-XR 'pass' is not same as 'NEXT-STATEMENT'. It Carrie's semantics of "conditionally accepted" unless explicitly dropped in subsequent statements. IOS-XR default depends on other actions taken. If any route attribute is modified, implicit action is to accept route and stop policy evaluation. If there is no modification, route is dropped.

NEXT-STATEMENT is similar to (or maybe exactly the same as) Cisco pass and Arista continue. NEXT-STATEMENT also evaluates to: "apply these changes and continue to evaluate." A later statement in the policy could still be reject route or accept route. Please read the updated/clarified description at the beginning of the yang and let me know if this is clear? (Thanks @oscargdd for additional content for clarification)

Cisco: "If a policy modifies a route, by default the policy accepts the route.", "If a policy does not modify the route, by default the route is dropped." Arista: "The evaluation of routes whose settings are the same as match command parameters normally ends and the statement's set commands are applied to the route."

In OC I think one could produce this behavior usingACCEPT-ROUTE as the policy-result-type for every statement. This may be useful as a way to translate from Arista and Cisco into OC.

@dplore
Copy link
Member Author

dplore commented Oct 12, 2023

What is the operational use case that we're envisaging for NEXT_POLICY here? I can see that this is potentially supported in multiple vendor implementations (but the multi-vendor justification here seems a bit tenuous, can we put together an example of two vendor language policies that actually allow for NEXT_POLICY-esque behaviour? It seems like you would need to do continue 100 where 100 is a statement that just falls through to the next policy, but this would imply that you have policy chaining -- so a better example to demonstrate that this actually possible is needed.)

Today in Google, we have policies which make use, in some cases extensively, of both of these policy-result-type semantics. I will refer them to you offline.

Regarding ambiguity in the current model: In the current model, there is only a description at the beginning of the module which says, "If the condition is not satisfied, then evaluation proceeds to the next policy statement."

But what if the condition is satisfied and there is no policy-result-type? The current yang allows this, but doesn't define what should happen.

@wenovus
Copy link
Contributor

wenovus commented Oct 12, 2023

Cisco: "If a policy modifies a route, by default the policy accepts the route.", "If a policy does not modify the route, by default the route is dropped."

In OC I think one could produce this behavior usingACCEPT-ROUTE as the policy-result-type for every statement. This may be useful as a way to translate from Arista and Cisco into OC.

I believe this does not work in all cases,
e.g.

policy A matches on 10/8, modify & pass.
policy B matches on 10.10/16, drop.

In this case, changing pass to accept would alter the behaviour of the policy. The correct translation is to reverse policy B & A, and then change pass to accept.

However as you pointed out Arista has a continue statement, which may satisfy the concern of showing support in two different vendor implementations.

@dplore
Copy link
Member Author

dplore commented Oct 12, 2023

We don't have explicit support of NEXT-POLICY defined by multiple implementations, but we do for NEXT-STATEMENT.

@rszarecki
Copy link
Contributor

IOS-XR 'pass' is not same as 'NEXT-STATEMENT'. It Carrie's semantics of "conditionally accepted" unless explicitly dropped in subsequent statements. IOS-XR default depends on other actions taken. If any route attribute is modified, implicit action is to accept route and stop policy evaluation. If there is no modification, route is dropped.

NEXT-STATEMENT is similar to (or maybe exactly the same as) Cisco pass and Arista continue. NEXT-STATEMENT also evaluates to: "apply these changes and continue to evaluate." A later statement in the policy could still be reject route or accept route. Please read the updated/clarified description at the beginning of the yang and let me know if this is clear? (Thanks @oscargdd for additional content for clarification)

Lets take an example.
We do have RFC8212 compliant implementation.
The we do have EBGP export have policy : {statement 1 {match 10.0.0/24, pass} statement2 {match 11/8, drop}}. Let evaluate route 10.0.0/24.
it matches statement 1 and is marked as "accepted at the end of policy", then we evaluate statement 2 which do not matches. Hence we are at the end of policy and route is accepted.

Wherhas in OpenConfig NEXT_STATEMENT (and juniper next-term):
The we do have EBGP export have policy : {statement 1 {match 10.0.0/24, next_statement } statement2 {match 11/8, drop}}. Let evaluate route 10.0.0/24.
it matches statement 1 but there is no decission to accept or reject, statemet 2 is not matching. Here we have protocol default (rfc8212) that reject 10.0.0/24.

@rszarecki
Copy link
Contributor

Cisco: "If a policy modifies a route, by default the policy accepts the route.", "If a policy does not modify the route, by default the route is dropped."

example:

Cisco:
statement 1 match 10.0.0/24-/32; pass (no modification)
statement 2 match 10.0/16-/32; drop
statement 3 match 10/8-/32 ; pass

the 10.0.0/24 will be dropped.

OpenConfig , JUNIPER
statement 1 match 10.0.0/24-/32 ; ACCEPT_ROUTE (note cisco has no such action)
statement 2 match 10.0/16-/32 ; REJECT_ROUTE
statement 3 match 10/8-/32; ACCEPT_ROUTE

the 10.0.0/24 will be accepted.

@rszarecki
Copy link
Contributor

rszarecki commented Oct 12, 2023

However as you pointed out Arista has a continue statement, which may satisfy the concern of showing support in two different vendor implementations.

In arista continue is an option in addition to mandatory 'permit'or 'deny'.
So Aristas 'permit'+'continue' == cisco's 'pass' or Juniper 'default-action accept'
Aristas 'deny'+'continue' == Juniper 'default-action reject'
obviously next statement can overwrite. This is kind of nice as it prevent ambiguity. Perhaps we should not have NEXT_STATEMENT as enum of policy action. Instead:

  • define REJECT_ROUTE as default action if not specified.
  • define new leafs: bool next_statement with FALSE as default, string next_statement-name if omited next statement of current/local policy will be taken (or 1st statement of next_policy-name)
  • define new leafs: bool next_policy with FALSE as default , string next_policy-name if omited next policy in the chain will be taken
    if OR( next_policy or next_statement) is true, then action is not taken immedietly but carried to the end of policy chain, where executed.

Note: we should prevent jumping backwards.. It become too fragile - forever loops. perhaps next_statement-name/next_policy-name is too much.

@dplore
Copy link
Member Author

dplore commented Oct 12, 2023

Cisco: statement 1 match 10.0.0/24-/32; pass (no modification) statement 2 match 10.0/16-/32; drop statement 3 match 10/8-/32 ; pass

the 10.0.0/24 will be dropped.

I think this is not correct? pass is "accept and continue". This policy would accept 10.0.0/24. Ref: cisco ios xr route policy disposition
"When a policy has finished executing, any route that has been modified in the policy or any route that has received a pass disposition in the policy, successfully passes the policy and completes the execution. "

@rszarecki
Copy link
Contributor

I think this is not correct? pass is "accept and continue". This policy would accept 10.0.0/24. Ref: cisco ios xr route policy disposition
"When a policy has finished executing, any route that has been modified in the policy or any route that has received a pass disposition in the policy, successfully passes the policy and completes the execution. "

The 10.0.0/24 is matching statement 2 (10.0/16-32, so /16 or any more specific, that is also 10.0.0/24) with explicit drop.

Copy link
Contributor

@rszarecki rszarecki left a comment

Choose a reason for hiding this comment

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

Please consider replacement of lines 43-87 by following:

    Route policy evaluation:
    
    Policy definitions are referenced in routing protocol
    configurations using import and export configuration statements.
    The arguments are members of an ordered list of named policy
    definitions which comprise a policy chain, and optionally, an
    default final dispositinn action for policy chain (i.e., reject
    or accept) applied to routes that does not match conditions of 
    any statement of any policy in chain, or none of matching 
    statement has final dispositinn action (acept or reject).
    If default final dispositinn action for policy chain is not
    explicitly specifird, implicit default action is reject.
    Note: This file contains definition of single policy, wherehas 
    definition of policy chain and default final dispositinn action 
    for policy chain are properties of protocol's policy application,
    and are defiend as part of protocols model. The text in this
    paragraph provides context information.

    Evaluation of each policy definition proceeds by evaluating its
    corresponding individual policy statements in order.  When a
    condition statement in a policy statement is satisfied, the
    corresponding action statement is executed.  If the action
    statement has a final disposition configured as policy result, either
    accept-route or reject-route, evaluation of the current policy definition
    stops, and no further policy statements are evaluated. In case there is a
    policy chain, no further policy definitions in the chain are evaluated.

    If the action statement has the NEXT_STATEMENT policy result, all the
    defined actions are exectued and policy evaluation proceeds to the next
    statement. If statement is last in current policy, and current policy is
    not the last policy of the policy chain, policy evaluation proceeds to 
    the first statement of next policy. If statement is last in current policy,
    and current policy is the last policy of the policy chain, default final 
    disposition action for policy chain is applied.

    If the action statement has the NEXT_POLICY policy result, all the
    defined actions in this stetement are exectued, evaluation of statements
    within the current policy stops and evaluation proceeds to the first 
    statement of next policy in the chain. If statement is last in current
    policy, and current policy is the last policy of the policy chain, default
    final disposition action for policy chain is applied.

    Policy 'subroutines' (or nested policies) are supported by
    allowing policy statement conditions to reference another policy
    definition which applies conditions and actions from the
    referenced policy before returning to the calling policy
    statement and resuming evaluation.  If the called policy
    results in an accept-route (either explicit or by default), then
    the subroutine returns an effective true value to the calling
    policy.  Any other policy result action - reject-route, next_statement, 
    next_policy - returns false.  If the subroutine returns true, 
    the calling policy continues to evaluate the remaining conditions of current
    stement (using a modified route if the subroutine performed any changes to
    the route), and if also satisfied executes statement's action. If the 
    subroutine returns true, evaluation proceeds to next statement or policy.
    ";

@dplore
Copy link
Member Author

dplore commented Oct 13, 2023

I am changing the scope of this PR back to be only NEXT-STATEMENT since we are only finding 1 instance of NEXT-POLICY functionality.

@dplore dplore changed the title add NEXT-STATEMENT and NEXT-POLICY to policy-result-type add NEXT-STATEMENT to policy-result-type Oct 13, 2023
Copy link
Contributor

@robshakir robshakir left a comment

Choose a reason for hiding this comment

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

LGTM.

@dplore dplore merged commit 771cd19 into master Oct 17, 2023
5 checks passed
@TANTRAN1
Copy link

TANTRAN1 commented Mar 7, 2024

Hello Darren, hello all. Sorry to react late. Here in Orange group we have our +20 IP backbone networks worldwide, which are built with various vendors routers (mainly: Cisco XR, Juniper, Nokia, Huawei). For more than 20 years, in our engineering guidelines history, the routers configurations templates converged to obtain most generic and most re-usable config as possible. In this spirit, we have a wide usage of NEXT-STATEMENT, and also NEXT-POLICY.
Nokia and Juniper OSs , for example, allow to configure chained policies.

When automating the production using openconfig yang we would like the possibility to keep following behavior:

example:

export route-policy [ policy1 policy2 policy3]

if inside policy1, even statement x1 has result accept, we would
need keep the possibility to continue the evaluation of policy2 , then finally the evaluation of policy 3
so need necessarily to configure "next policy" as policy-result choice inside entry statement.
To justify the need of usage of NEXT-POLICY in Openconfig, the spirit of chained policies for Orange Group rules, is to write them to have most generic ones. Our idea is to "dedicate" one policy to one generic task . Doing this, we ensure the clarity of each policy-map, our engineers of all Orange understand immediately the function of each single policy with its name.
Each policy is seen as a basic brick, so our network engineers can elaborate the policies (made of several chained basic policies) adapted to their current use-case.

policy 1 : task A
policy 2 : task B
policy 3 : task C

These kind of configuration of chained policies are widely used among +50000 backbone routers inside Orange networks.
I provide examples extracted from Operational backbone routers from one Orange Affiliate from Europe :

NOKIA:
group "GRP-IBGP-RR"
description "Groupe iBGP IPv4 vers Route-Reflector"
family ipv4
min-route-advertisement 1
type internal
export "POCY-CONN2BGP" "POCY-STATIC2BGP" "POCY-RR-OUT"

        policy-statement "POCY-CONN2BGP"
            entry 5
                description "ACPT-CONNECTED"
                from
                    protocol direct
                exit
                action next-entry
                    community add "CMNY-CONNECTED"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 35
                description "ACTP-ASBC"
                from
                    protocol direct
                    prefix-list "PRFX-RESEAUX-ASBC"
                exit
                action next-entry
                    community replace "CMNY-CONNECTED-ASBC"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 40
                description "ACTP-PAS-RADIUS_VAL"
                from
                    protocol direct
                    prefix-list "PRFX-PAS-RADIUS"
                exit
                action next-entry
                    community add "CMNY-PAS-RADIUS"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 45
                description "ACTP-PAS-ADMIN_VAL"
                from
                    protocol direct
                    prefix-list "PRFX-PAS-ADMIN"
                exit
                action next-entry
                    community add "CMNY-PAS-ADMIN"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 60
                description "ACTP-PAS-FW"
                from
                    protocol direct
                    prefix-list "PRFX-PAS-FW"
                exit
                action next-entry
                    community add "CMNY-PAS-FW"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 65
                description "ACPT-CDN-AKA"
                from
                    protocol direct
                    prefix-list "PRFX-AKAMAI-CONN"
                exit
                action next-entry
                    community add "CMNY-CDN-AKAMAI-CONN"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 1000
                description "Passage a la policy suivante"
                action next-policy
                exit
            exit
        exit
        policy-statement "POCY-STATIC2BGP"
            entry 65
                description "ACPT-CDN-AKA"
                from
                    protocol static
                    tag 65
                exit
                action next-entry
                    community add "CMNY-CDN-AKAMAI"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 66
                description "ACPT-CDN-AKA-Lo_HAS"
                from
                    protocol static
                    tag 66
                exit
                action next-entry
                    community add "CMNY-CDN-AKAMAI-RBCI"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 70
                description "STATIC-ASBC"
                from
                    protocol static
                    tag 140
                exit
                action next-entry
                    community add "CMNY-STATIC-ASBC"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 100
                description "ACTP-PAS-RADIUS"
                from
                    protocol static
                    tag 421
                exit
                action next-entry
                    community add "CMNY-PAS-RADIUS"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 105
                description "ACTP-PAS-ADMIN"
                from
                    protocol static
                    tag 420
                exit
                action next-entry
                    community add "CMNY-PAS-ADMIN"
                    local-preference 310000
                    tag 1
                exit
            exit
            entry 1000
                description "Passage a la policy suivante"
                action next-policy
                exit
            exit
        exit
        policy-statement "POCY-RR-OUT"
            entry 10
                description "ACPT-NON-BGP : direct, statique, .."
                from
                    tag 1
                exit
                action accept
                    origin igp
                    metric set 0
                    next-hop-self
                exit
            exit
            entry 15
                description "BLACKHOLE-DYNAMIQUE-RBCI"
                from
                    protocol bgp
                    community "CMNY-BLACKHOLE"
                exit
                action accept
                    community add "CMNY-TRANSPARENCE-BGP"
                exit
            exit
            entry 20
                description "TRANSPARENCE-BGP"
                from
                    protocol bgp
                    community "CMNY-TRANSPARENCE-BGP"
                exit
                action accept
                exit
            exit
            entry 1000
                description "ACPT-EBGP"
                from
                    protocol bgp
                exit
                action accept
                    next-hop-self
                exit
            exit
            default-action drop
            exit
        exit

@TANTRAN1
Copy link

TANTRAN1 commented Mar 7, 2024

In these Juniper config extract, we have 3 chained policies, each policy has got a determined scope, "action next-policy" is useful.

ORANGE operational network config extract JUNIPER: same spirit, chained policies used in context of L3VPN routing-instance (-> oc : network-instance )

CUST-VRF-LDAFRA_BVPN {
instance-type vrf;
interface xe-2/2/1.1913;
route-distinguisher 3215:409023530;
vrf-import [ GEN-POL-IN-REJECT-INET6 GEN-POL-IN-RADEQUA CUST-POL-IN-LDAFRA_BVPN GEN-POL-BOTH-REJECT ];
vrf-export [ GEN-POL-OUT-VPN-STATIC-to-MPBGP GEN-POL-OUT-VPN-EXPORT CUST-POL-OUT-LDAFRA_BVPN GEN-POL-BOTH-ACCEPT ];
routing-options {
static { .....................

policy-statement GEN-POL-OUT-VPN-STATIC-to-MPBGP {
    term 10 {
        from {
            protocol [ static access ];
            tag 110;
        }
        then next policy;
    }
    term 20 {
        from {
            protocol [ static access ];
            tag 181;
        }
        then {
            local-preference 200;
            community add GEN-COM-10283-20077;
            community add GEN-COM-10283-120;
            next policy;
        }
    }
    term 30 {
        from {
            protocol [ static access ];
            tag 182;
        }
        then {
            local-preference 100;
            community add GEN-COM-10283-20066;
            community add GEN-COM-10283-110;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 33 {
        from {
            protocol [ static access ];
            tag 800;
        }
        then {
            local-preference 80;
            community add GEN-COM-10283-20080;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 34 {
        from {
            protocol [ static access ];
            tag 180;
        }
        then {
            local-preference 80;
            community add GEN-COM-10283-20080;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 35 {
        from {
            protocol [ static access ];
            tag 183;
        }
        then {
            local-preference 100;
            community add GEN-COM-10283-20066;
            community add GEN-COM-10283-110;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 37 {
        from {
            protocol [ static access ];
            tag 184;
        }
        then {
            local-preference 80;
            community add GEN-COM-10283-20066;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 40 {
        from {
            protocol [ static access ];
            tag 9911;
        }
        then {
            community add GEN-COM-10283-20011;
            next policy;
        }
    }
    term 50 {
        from {
            protocol [ static access ];
            tag 9922;
        }
        then {
            community add GEN-COM-10283-20022;
            next policy;
        }
    }
    term 55 {
        from {
            protocol [ static access ];
            tag 9933;
        }
        then {
            community add GEN-COM-10283-20033;
            next policy;
        }
    }
    term 57 {
        from {
            protocol [ static access ];
            tag 811;
        }
        then {
            local-preference 80;
            community add GEN-COM-10283-20080;
            community add GEN-COM-10283-20011;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 60 {
        from {
            protocol [ static access ];
            tag 261;
        }
        then {
            local-preference 100;
            community add GEN-COM-10283-20066;
            community add GEN-COM-10283-20011;
            community add GEN-COM-10283-110;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 70 {
        from {
            protocol [ static access ];
            tag 262;
        }
        then {
            local-preference 100;
            community add GEN-COM-10283-20066;
            community add GEN-COM-10283-20022;
            community add GEN-COM-10283-110;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 80 {
        from {
            protocol [ static access ];
            tag 271;
        }
        then {
            local-preference 200;
            community add GEN-COM-10283-20077;
            community add GEN-COM-10283-20011;
            community add GEN-COM-10283-120;
            next policy;
        }
    }
    term 90 {
        from {
            protocol [ static access ];
            tag 272;
        }
        then {
            local-preference 200;
            community add GEN-COM-10283-20077;
            community add GEN-COM-10283-20022;
            community add GEN-COM-10283-120;
            next policy;
        }
    }
    term 100 {
        from {
            protocol [ static access ];
            tag 281;
        }
        then {
            community add GEN-COM-10283-20088;
            community add GEN-COM-10283-20011;
            next policy;
        }
    }
    term 110 {
        from {
            protocol [ static access ];
            tag 282;
        }
        then {
            community add GEN-COM-10283-20088;
            community add GEN-COM-10283-20022;
            next policy;
        }
    }
    term 120 {
        from {
            protocol [ static access ];
            tag 291;
        }
        then {
            community add GEN-COM-10283-20099;
            community add GEN-COM-10283-20011;
            next policy;
        }
    }
    term 130 {
        from {
            protocol [ static access ];
            tag 292;
        }
        then {
            community add GEN-COM-10283-20099;
            community add GEN-COM-10283-20022;
            next policy;
        }
    }
    term 140 {
        from {
            protocol [ static access ];
            tag 500;
        }
        then {
            community add GEN-COM-NO-ADVERTISE;
            next policy;
        }
    }
    term 150 {
        from {
            protocol [ static access ];
            tag 2362;
        }
        then {
            community add GEN-COM-10283-2362;
            next policy;
        }
    }
    term 160 {
        from {
            protocol [ static access ];
            tag 50011;
        }
        then {
            community add GEN-COM-10283-50011;
            next policy;
        }
    }
    term 165 {
        from {
            protocol [ static access ];
            tag 50012;
        }
        then {
            community add GEN-COM-10283-50012;
            next policy;
        }
    }
    term 170 {
        from {
            protocol [ static access ];
            tag 50021;
        }
        then {
            community add GEN-COM-10283-50021;
            next policy;
        }
    }
    term 175 {
        from {
            protocol [ static access ];
            tag 50022;
        }
        then {
            community add GEN-COM-10283-50022;
            next policy;
        }
    }
    term 180 {
        from {
            protocol [ static access ];
            tag 50031;
        }
        then {
            community add GEN-COM-10283-50031;
            next policy;
        }
    }
    term 185 {
        from {
            protocol [ static access ];
            tag 50032;
        }
        then {
            community add GEN-COM-10283-50032;
            next policy;
        }
    }
    term 190 {
        from {
            protocol [ static access ];
            tag 50041;
        }
        then {
            community add GEN-COM-10283-50041;
            next policy;
        }
    }
    term 195 {
        from {
            protocol [ static access ];
            tag 50042;
        }
        then {
            community add GEN-COM-10283-50042;
            next policy;
        }
    }
    term 200 {
        from {
            protocol [ static access ];
            tag 50051;
        }
        then {
            community add GEN-COM-10283-50051;
            next policy;
        }
    }
    term 205 {
        from {
            protocol [ static access ];
            tag 50052;
        }
        then {
            community add GEN-COM-10283-50052;
            next policy;
        }
    }
    term 210 {
        from {
            protocol [ static access ];
            tag 50061;
        }
        then {
            community add GEN-COM-10283-50061;
            next policy;
        }
    }
    term 215 {
        from {
            protocol [ static access ];
            tag 50062;
        }
        then {
            community add GEN-COM-10283-50062;
            next policy;
        }
    }
    term 220 {
        from {
            protocol [ static access ];
            tag 251;
        }
        then {
            community add GEN-COM-10283-20055;
            community add GEN-COM-10283-20011;
            next policy;
        }
    }
    term 225 {
        from {
            protocol [ static access ];
            tag 252;
        }
        then {
            community add GEN-COM-10283-20055;
            community add GEN-COM-10283-20022;
            next policy;
        }
    }
    term 10020 {
        from {
            protocol [ static access ];
            tag2 181;
        }
        then {
            local-preference 200;
            community add GEN-COM-10283-20077;
            community add GEN-COM-10283-120;
            next policy;
        }
    }
    term 10030 {
        from {
            protocol [ static access ];
            tag2 182;
        }
        then {
            local-preference 100;
            community add GEN-COM-10283-20066;
            community add GEN-COM-10283-110;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 10040 {
        from {
            protocol [ static access ];
            tag2 9911;
        }
        then {
            community add GEN-COM-10283-20011;
            next policy;
        }
    }
    term 10050 {
        from {
            protocol [ static access ];
            tag2 9922;
        }
        then {
            community add GEN-COM-10283-20022;
            next policy;
        }
    }
    term 10060 {
        from {
            protocol [ static access ];
            tag2 261;
        }
        then {
            local-preference 100;
            community add GEN-COM-10283-20066;
            community add GEN-COM-10283-20011;
            community add GEN-COM-10283-110;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 10070 {
        from {
            protocol [ static access ];
            tag2 262;
        }
        then {
            local-preference 100;
            community add GEN-COM-10283-20066;
            community add GEN-COM-10283-20022;
            community add GEN-COM-10283-110;
            as-path-expand "64544 64544";
            next policy;
        }
    }
    term 10080 {
        from {
            protocol [ static access ];
            tag2 271;
        }
        then {
            local-preference 200;
            community add GEN-COM-10283-20077;
            community add GEN-COM-10283-20011;
            community add GEN-COM-10283-120;
            next policy;
        }
    }
    term 10090 {
        from {
            protocol [ static access ];
            tag2 272;
        }
        then {
            local-preference 200;
            community add GEN-COM-10283-20077;
            community add GEN-COM-10283-20022;
            community add GEN-COM-10283-120;
            next policy;
        }
    }
    term DEFAULT-STATIC {
        from protocol [ static access ];
        then {
            community add GEN-COM-3215-202;
            next policy;
        }
    }
    term NEXT-POLICY {
        then next policy;
    }
}

policy-statement GEN-POL-OUT-VPN-EXPORT {
    term 40 {
        from tag 99983;
        then {
            community add CUST-RT-OPERA_OCNADMIN_CLT_TPC-3215_471094000;
            accept;
        }
    }
    term 50 {
        from tag 9385;
        then {
            community add GEN-COM-10283-20112;
            community add GEN-RT-10283-140000;
            next policy;
        }
    }
    term 60 {
        from tag 9386;
        then {
            community add GEN-COM-10283-20186;
            community add GEN-COM-10283-20593;
            community add GEN-RT-10283-3964000;
            accept;
        }
    }
    term 70 {
        from tag 9387;
        then {
            community add GEN-COM-10283-20187;
            community add GEN-COM-10283-20593;
            community add GEN-RT-10283-3964000;
            community add GEN-RT-10283-4014000;
            accept;
        }
    }
    term 80 {
        from tag 9388;
        then {
            community add GEN-COM-10283-20112;
            community add GEN-RT-3215-160000;
            accept;
        }
    }
    term 90 {
        from tag 99986;
        then {
            community add GEN-COM-10283-20066;
            community add CUST-RT-SG_OCNADMIN_CLT_TPC-10283_78351000;
            accept;
        }
    }
    term 95 {
        from tag 99987;
        then {
            community add GEN-COM-10283-20077;
            community add CUST-RT-SG_OCNADMIN_CLT_TPC-10283_78351000;
            accept;
        }
    }
    term 130 {
        from tag 99405;
        then {
            community add GEN-COM-10283-20405;
            community add GEN-RT-10283-294000;
            next policy;
        }
    }
    term 140 {
        from community GEN-COM-10283-20405;
        then {
            community add GEN-RT-10283-294000;
            next policy;
        }
    }
    term 150 {
        from tag 99404;
        then {
            community add GEN-COM-10283-20404;
            community add GEN-RT-10283-244000;
            accept;
        }
    }
    term 160 {
        from community GEN-COM-10283-20404;
        then {
            community add GEN-RT-10283-244000;
            accept;
        }
    }
    term 170 {
        from tag 99408;
        then {
            community add GEN-COM-10283-20408;
            community add GEN-RT-10283-304000;
            accept;
        }
    }
    term 180 {
        from community GEN-COM-10283-20408;
        then {
            community add GEN-RT-10283-304000;
            accept;
        }
    }
    term 190 {
        from tag 99407;
        then {
            community add GEN-COM-10283-20407;
            community add GEN-RT-10283-314000;
            accept;
        }
    }
    term 200 {
        from community GEN-COM-10283-20414;
        then {
            community add GEN-RT-10283-140000;
            next policy;
        }
    }
    term 210 {
        from tag 99415;
        then {
            community add GEN-COM-10283-20415;
            community add GEN-RT-10283-434000;
            next policy;
        }
    }
    term 220 {
        from tag 99413;
        then {
            community add GEN-COM-10283-20413;
            community add GEN-RT-10283-424000;
            accept;
        }
    }
    term 290 {
        from tag 99425;
        then {
            community add GEN-RT-10283-914000;
            next policy;
        }
    }
    term 300 {
        from tag 99426;
        then {
            community add GEN-COM-10283-20426;
            community add GEN-RT-10283-754000;
            accept;
        }
    }
    term 301 {
        from community GEN-COM-10283-20426;
        then {
            community add GEN-RT-10283-754000;
            accept;
        }
    }
    term 400 {
        from community GEN-COM-10283-20104;
        then {
            community add GEN-RT-10283-30000;
            community add GEN-RT-10283-197814000;
            next policy;
        }
    }
    term 410 {
        from community GEN-COM-10283-20105;
        then {
            community add GEN-RT-10283-30000;
            community add GEN-RT-10283-197814000;
            accept;
        }
    }
    term 460 {
        from tag 99997;
        then {
            community add GEN-RT-10283-214000;
            community add GEN-COM-NO-ADVERTISE;
            accept;
        }
    }
    term 480 {
        from tag [ 99996 99998 ];
        then {
            community add GEN-COM-10283-20103;
            community add GEN-RT-10283-44000;
            community add GEN-RT-10283-197814000;
            accept;
        }
    }
    term 500 {
        from tag [ 99995 99999 ];
        then {
            community add GEN-COM-10283-20103;
            community add GEN-RT-10283-30000;
            community add GEN-RT-10283-197814000;
            accept;
        }
    }
    term 600 {
        from tag 99994;
        then {
            community add GEN-COM-10283-20194;
            community add GEN-RT-3215-261144000;
            accept;
        }
    }
    term 10050 {
        from tag2 9385;
        then {
            community add GEN-COM-10283-20112;
            community add GEN-RT-10283-140000;
            next policy;
        }
    }
    term 10190 {
        from tag2 99407;
        then {
            community add GEN-COM-10283-20407;
            community add GEN-RT-10283-314000;
            accept;
        }
    }
    term 10220 {
        from tag2 99413;
        then {
            community add GEN-COM-10283-20413;
            community add GEN-RT-10283-424000;
            accept;
        }
    }
    term 10290 {
        from tag2 99425;
        then {
            community add GEN-RT-10283-914000;
            next policy;
        }
    }
    term NEXT-POLICY {
        then next policy;
    }
}

@rszarecki
Copy link
Contributor

@TANTRAN1
This PR has been merged half year ago. Please find some explanation and context:

  1. Before this merge, OpenConfig supported only ACCEPT_ROUTE or REJECT_ROUTE as disposition. This merge added NEXT_STATEMENT. There is no regression in functionality.
  2. OpenConfig as it is today supports policy chaininig at attachment point. specificly .../apply-policy/ingress-policy and .../apply-policy/ingress-policy are both of leaf-lists not just leafs.
  3. Example you have provided using NOKIA's - all entries with next-policy are the last entries of policy. The same is achivable in OpenConfig via using NEXT_STATEMENT in last statement in policy. Or even by not having this last unconditional statement at all. Please read all description in yang file. Specificly
  4. Indeed JUNOS example uses next policy in meny terms. Translating this policy to OpenConfig would be very complex without additinal knowlages . E.g is we know that static route has only one tag, probably we can use NEXT_STATEMENT.
  5. You mentioned that Orange is using also XR. Can you provide example how IOS XR RPL provides "next policy" logic? I'm not able to find such - AFAIK XR RPL support only "drop", "dome", "pass" (and implicit "done" if neither is provided and route attributes are modified). Or, prehaps Orange can crate policies with desired logic without "next term" construct?

It is philosofical question if we want OpenConfig to be suprset of all vendors capabilities or rather reduced set. If former, you will have very flexible OpenConfig but then each vendor will support only partially. The net result would be that operator will either generate vendor-aware configuration what defeat purpose of vendor agnosticity of OpenConfig. Or will self limit and use only subset of OpenConfig common to all vendors it uses. And this would make high acceptance barier for new vendor. So other form of vendor lock-in.
You can contribute to OpenConfig by Pull Request and add "NEXT_POLICY" action, if you fill strongly you need it for your project. Just ensure that your vendors are going to implement it. Othwerwise it become only never used noise in OpenConfig model.

@TANTRAN1
Copy link

TANTRAN1 commented Mar 8, 2024

Hello rszarecki
I confirm I read carefully all the contributions inside #949 ...

Juniper & Nokia: have "next-policy" in their implem.
Huawei VRP: no "next-policy". Just "goto" (eq. next-statement)
Cisco: no explicit "next-policy". RPL not chained like Juniper/Nokia can do. Cisco RPL can use "apply" which calls other policy from within other policy. But not exact equivalent of chained policies (Nokia/juniper).

I know, The good example of configuration to discuss , which requires "next-policy" is the ones I provide with JUNIPER (action next-policy written in numerous terms policy-statements, not only the end of policy)

Question "2-cent" : is the "next-statement" put at the last entry of a policy_1, makes start the evaluation of the policy_2 , even prefix matched conditions of policy_1 ? do you see a mean to replace effect of "next-policy" by usage of "next-statement" ?

If not, I maintain the need to re-open the request of having "next-policy" ...... considering the potential impact of rewriting all RPL for some Nokia/Juniper customers

Thanks

@TANTRAN1
Copy link

TANTRAN1 commented Mar 8, 2024

Hello rszarecki
I do perfectly understand / accept your comments, I fully agree they're relevant. On the other side, even the rewriting of our RPL is possible "theoretically", with only available standard oc-routing-policy, it will be impossible in real operational network life, because RPL are - most of time generic and shared by all routers (backbone protocols) and almost all L2/L3 customers (for export/import ) - and follow the logic "1 RPL = 1 basic usage" => "Customized RPL = chained RPL = easy to understand for people of network operations. The impact would be too big.

I do agree some other operators may use simpler RPL (without need of "next-policy") but not our case, we must assume it.
At Orange, we will do the maximum to convince Nokia & Juniper to implement it if request is re-open.

@dplore dplore deleted the dplore/policy-result branch September 18, 2024 01:15
romeyod pushed a commit to romeyod/aftNextHop that referenced this pull request Sep 19, 2024
* Update release/models/policy/openconfig-routing-policy.yang
* add continue to policy-result-type

---------

Co-authored-by: Óscar González de Dios <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants