The following examples illustrate ways to use configuration groups and inheritance:
When sets of statements exist in configuration groups, all values are inherited. For example:
[edit] user@host#showgroups { basic { snmp { interface so-1/1/1.0; } } } apply-groups basic; snmp { interface so-0/0/0.0; } [edit] user@host#show | display inheritancesnmp { ## ## 'so-1/1/1.0' was inherited from group 'basic' ## interface [ so-0/0/0.0 so-1/1/1.0 ]; }
For sets that are not displayed within brackets, all values are also inherited. For example:
[edit] user@host#showgroups { worldwide { system { name-server { 10.0.0.100; 10.0.0.200; } } } } apply-groups worldwide; system { name-server { 10.0.0.1; 10.0.0.2; } } [edit] user@host#show | display inheritancesystem { name-server { 10.0.0.1; 10.0.0.2; ## ## '10.0.0.100' was inherited from group 'worldwide' ## 10.0.0.100; ## ## '10.0.0.200' was inherited from group 'worldwide' ## 10.0.0.200; } }
You can use configuration groups to separate the common interface media parameters from the interface-specific addressing information. The following example places configuration data for ATM interfaces into a group called atm-options:
[edit] user@host#showgroups { atm-options { interfaces { <at-*> { atm-options { vpi 0 maximum-vcs 1024; } unit <*> { encapsulation atm-snap; point-to-point; family iso; } } } } } apply-groups atm-options; interfaces { at-0/0/0 { unit 100 { vci 0.100; family inet { address 10.0.0.100/30; } } unit 200 { vci 0.200; family inet { address 10.0.0.200/30; } } } } [edit] user@host#show | display inheritanceinterfaces { at-0/0/0 { ## ## 'atm-options' was inherited from group 'atm-options' ## atm-options { ## ## '1024' was inherited from group 'atm-options' ## vpi 0 maximum-vcs 1024; } unit 100 { ## ## 'atm-snap' was inherited from group 'atm-options' ## encapsulation atm-snap; ## ## 'point-to-point' was inherited from group 'atm-options' ## point-to-point; vci 0.100; family inet { address 10.0.0.100/30; } ## ## 'iso' was inherited from group 'atm-options' ## family iso; } unit 200 { ## ## 'atm-snap' was inherited from group 'atm-options' ## encapsulation atm-snap; ## ## 'point-to-point' was inherited from group 'atm-options' ## point-to-point; vci 0.200; family inet { address 10.0.0.200/30; } ## ## 'iso' was inherited from group 'atm-options' ## family iso; } } } [edit] user@host#show | display inheritance | except ##interfaces { at-0/0/0 { atm-options { vpi 0 maximum-vcs 1024; } unit 100 { encapsulation atm-snap; point-to-point; vci 0.100; family inet { address 10.0.0.100/30; } family iso; } unit 200 { encapsulation atm-snap; point-to-point; vci 0.200; family inet { address 10.0.0.200/30; } family iso; } } }
In this example, we create a group some-isp that contains configuration data relating to another ISP. We can then insert apply-group statements at any point to allow any location in the configuration hierarchy to inherit this data.
[edit] user@host#showgroups { some-isp { interfaces { <ge-*> { gigether-options { flow-control; } } } protocols { bgp { group <*> { neighbor <*> { remove-private; } } } pim { interface <*> { version 1; } } } } } interfaces { ge-0/0/0 { apply-groups some-isp; unit 0 { family inet { address 10.0.0.1/24; } } } } protocols { bgp { group main { neighbor 10.254.0.1 { apply-groups some-isp; } } } pim { interface ge-0/0/0.0 { apply-groups some-isp; } } } [edit] user@host#show | display inheritanceinterfaces { ge-0/0/0 { ## ## 'gigether-options' was inherited from group 'some-isp' ## gigether-options { ## ## 'flow-control' was inherited from group 'some-isp' ## flow-control; } unit 0 { family inet { address 10.0.0.1/24; } } } } protocols { bgp { group main { neighbor 10.254.0.1 { ## ## 'remove-private' was inherited from group 'some-isp' ## remove-private; } } } pim { interface ge-0/0/0.0 { ## ## '1' was inherited from group 'some-isp' ## version 1; } } }
In this example, one group is populated with configuration data that is standard throughout the company while another group contains regional deviations from this standard.
[edit] user@host#showgroups { standard { interfaces { <t3-*> { t3-options { compatibility-mode larscom subrate 10; idle-cycle-flag ones; } } } } northwest { interfaces { <t3-*> { t3-options { long-buildout; compatibility-mode kentrox; } } } } } apply-groups standard; interfaces { t3-0/0/0 { apply-groups northwest; } } [edit] user@host#show | display inheritanceinterfaces { t3-0/0/0 { ## ## 't3-options' was inherited from group 'northwest' ## t3-options { ## ## 'long-buildout' was inherited from group 'northwest' ## long-buildout; ## ## 'kentrox' was inherited from group 'northwest' ## compatibility-mode kentrox; ## ## 'ones' was inherited from group 'standard' ## idle-cycle-flag ones; } } }
The combination of wildcarding and thoughtful use of names in statements gives the ability to tailor statement values.
[edit] user@host#showgroups { mpls-conf { protocols { mpls { label-switched-path <*-major> { retry-timer 5; bandwidth 155m; optimize-timer 60; } label-switched-path <*-minor> { retry-timer 15; bandwidth 64k; optimize-timer 120; } } } } } apply-groups mpls-conf; protocols { mpls { label-switched-path metro-major { to 10.0.0.10; } label-switched-path remote-minor { to 10.0.0.20; } } } [edit] user@host#show | display inheritanceprotocols { mpls { label-switched-path metro-major { to 10.0.0.10; ## ## '5' was inherited from group 'mpls-conf' ## retry-timer 5; # ## '155m' was inherited from group 'mpls-conf' ## bandwidth 155m; ## ## '60' was inherited from group 'mpls-conf' ## optimize-timer 60; } label-switched-path remote-minor { to 10.0.0.20; ## ## '15' was inherited from group 'mpls-conf' ## retry-timer 15; ## ## '64k' was inherited from group 'mpls-conf' ## bandwidth 64k; ## ## '120' was inherited from group 'mpls-conf' ## optimize-timer 120; } } }