hierarchy of apply-groups

m4rtinm4rtin Member Posts: 170
I made a following configuration to my router:
root> show configuration    
## Last commit: 2011-09-24 02:23:18 UTC by root
version 10.1R1.8;
groups {
    TEST2 {
        interfaces {
            <*> {
                unit <*> {
                    description switch;
                }
            }
        }
    }
    MASTER {
        interfaces {
            fxp2 {
                unit 0 {
                    apply-groups TEST2;
                }
            }
        }
    }
    MASTER2 {
        interfaces {
            fxp2 {                      
                unit 0 {
                    description server;
                }
            }
        }
    }
}
system {
    root-authentication {
        encrypted-password jWd03ZOzd8WDz; ## SECRET-DATA
    }
    syslog {
        user * {
            any emergency;
        }
        file messages {
            any notice;
            authorization info;
        }
        file interactive-commands {
            interactive-commands any;
        }
    }                                   
}
interfaces {
    fxp2 {
        apply-groups MASTER;
        unit 0 {
            apply-groups MASTER2;
        }
    }
    fxp6 {
        unit 0 {
            family inet {
                address 192.168.1.199/24;
            }
        }
    }
}                                       

root> 

As you can see, fxp2.0 gets it's description from group MASTER, which gets it's configuration from group TEST2 so finally the fxp2 unit 0 description would be switch. However, there is a duplicate apply-group MASTER2, which configures interface fxp2 unit 0 description to server. Is there some sort of rule, which of those groups will apply description to fxp2.0? In other words both MASTER2 and TEST2 try to set description to fxp2.0, but which one will win and why? icon_rolleyes.gif

Comments

  • AldurAldur Juniper Moderator Member Posts: 1,460
    MASTER2 will win. Keep in mind that with Junos, the most specific configuration always wins. MASTER2 is under the logical unit hierarchy level, which is more specific than the fxp2 physical level, thus it is applied to fxp2.0 and MASTER is never considered for FXP2.0.

    Another example is with export policies. Say you configure a export policy right under the BGP protocol level. Then configure a export policy under a BGP group within the BGP protocol. The export policy within the BGP group will be applied to the BGP group, the export policy that was applied directly under the protocol will not be applied to that BGP group. Now, if there are other BGP groups without an export policy at the group level, then the export policy that is directly under the BGP protocol will be applied to those groups.

    HTH
    "Bribe is such an ugly word. I prefer extortion. The X makes it sound cool."

    -Bender
  • m4rtinm4rtin Member Posts: 170
    Aldur wrote: »
    MASTER2 will win. Keep in mind that with Junos, the most specific configuration always wins. MASTER2 is under the logical unit hierarchy level, which is more specific than the fxp2 physical level, thus it is applied to fxp2.0 and MASTER is never considered for FXP2.0.

    Another example is with export policies. Say you configure a export policy right under the BGP protocol level. Then configure a export policy under a BGP group within the BGP protocol. The export policy within the BGP group will be applied to the BGP group, the export policy that was applied directly under the protocol will not be applied to that BGP group. Now, if there are other BGP groups without an export policy at the group level, then the export policy that is directly under the BGP protocol will be applied to those groups.

    HTH

    Thank you for explaining! However, what happens if I have an interface ae0 with unit 9 which has group TESTGROUP applied:
    set interfaces ae0 unit 9 apply-groups TESTGROUP
    

    In addition, I have group TESTGROUP2 applied directly to interface ae0:
    set interfaces ae0 apply-groups TESTGROUP2
    

    ..and inside this TESTGROUP2 is a following configuration line:
    set groups TESTGROUP2 interfaces ae0 unit 9 apply-groups TESTGROUP
    


    Am I correct, that TESTGROUP is applied directly to ae0.9 not via TESTGROUP2? I mean for example if I change the:
    set groups TESTGROUP2 interfaces ae0 unit 9 apply-groups TESTGROUP
    

    ..line to:
    set groups TESTGROUP2 interfaces ae0 unit 9 apply-groups TESTGROUP3
    

    ..then actually nothing changes for ae0.9 because ae0.9 receives configuration directly from "set interfaces ae0 unit 9 apply-groups TESTGROUP"? icon_rolleyes.gif
  • zoidbergzoidberg Member Posts: 365
    Do a "show configuration interfaces ae0 | display inheritance" and you will see exactly which group configuration is being applied to ae0 and ae0.9.
Sign In or Register to comment.