Junos OS

 View Only

IMPORTANT MODERATION NOTICE

This community is currently under full moderation, meaning  all posts will be reviewed before appearing in the community. Please expect a brief delay—there is no need to post multiple times. If your post is rejected, you'll receive an email outlining the reason(s). We've implemented full moderation to control spam. Thank you for your patience and participation.



Expand all | Collapse all

Are attributes modified in one term of a route policy available to match in subsequent terms?

This thread has been viewed 8 times
  • 1.  Are attributes modified in one term of a route policy available to match in subsequent terms?

    Posted 08-02-2022 10:24

    In a route policy, if a term modifies an attribute of the route (e.g adds community X), and with no policy terminating action, are subsequent terms able to match on the changed attributes of the route (e.g match on the newly added community X)? Or does each term only see the route attributes in its original pre-policy form (i.e IOS-XR behavior)?

    Thanks!



  • 2.  RE: Are attributes modified in one term of a route policy available to match in subsequent terms?

    Posted 08-02-2022 15:44

    Hi!

    I believe you can match on the modified attributes. To test this, I simply connected 2 routers with EBGP connection between them. R1 exports a route 172.16.20.0/24 to R2. Then I applied an import policy on R2 as mentioned below.

    set policy-options policy-statement CHANGE_COMM term 1 from protocol bgp
    set policy-options policy-statement CHANGE_COMM term 1 from route-filter 172.16.20.0/24 exact
    set policy-options policy-statement CHANGE_COMM term 1 then community add COMM1
    set policy-options policy-statement CHANGE_COMM term 1 then next term
    set policy-options policy-statement CHANGE_COMM term 2 from protocol bgp
    set policy-options policy-statement CHANGE_COMM term 2 from community COMM1
    set policy-options policy-statement CHANGE_COMM term 2 then local-preference 200
    set policy-options policy-statement CHANGE_COMM term 2 then accept
    The route on R2 has the local preference as 200.

    Disclaimer: I don't consider myself an expert and it's quite possible that I could be wrong. I would appreciate it if more experienced members of the community can verify this.



    ------------------------------
    SHAHBAZ KHAN
    ------------------------------



  • 3.  RE: Are attributes modified in one term of a route policy available to match in subsequent terms?

    Posted 08-04-2022 09:06
    At that point, there's no need for 2 terms anymore, just stack the 2 actions (or more) in one term
    set policy-options policy-statement CHANGE_COMM term 1 from protocol bgp
    set policy-options policy-statement CHANGE_COMM term 1 from route-filter 172.16.20.0/24 exact
    set policy-options policy-statement CHANGE_COMM term 1 then community add COMM1
    set policy-options policy-statement CHANGE_COMM term 1 then local-preference 200
    set policy-options policy-statement CHANGE_COMM term 1 then accept

    ------------------------------
    Ridha Hamidi
    ------------------------------