[Contents] [Prev] [Next] [Index] [Report an Error]

Testing ex-bgp-global-import.xsl

To test the example in this section, perform the following steps:

  1. From Prepending a Global Policy, copy the XSLT script into a text file, and name the file ex-bgp-global-import.xsl. Copy the ex-bgp-global-import.xsl file to the /var/db/scripts/commit directory on your routing platform.
  2. Select the following configuration, and press Ctrl+c to copy it to the clipboard. If you are using the SLAX version of the script, change the filename to filename.slax.
    system {
        scripts {
            commit {
                allow-transients;
                file ex-bgp-global-import.xsl;
            }
        }
    }
    interfaces {
        fe-0/0/0 {
            unit 0 {
                family inet {
                    address 192.168.16.2/24;
                }
                family inet6 {
                    address 2002:18a5:e996:beef::2/64;
                }
            }
        }
    }
    routing-options {
        autonomous-system 65400;
    }
    protocols {
        bgp {
            group fish {
                neighbor 192.168.16.4 {
                    import [ blue green ];
                    peer-as 65401;
                }
                neighbor 192.168.16.6 {
                    peer-as 65402;
                }
            }
        }
    }
    policy-options {
        policy-statement blue {
            from protocol bgp;
            then accept;
        }
        policy-statement green {
            then accept;
        }
        policy-statement bgp_global_import {
            then accept;
        }
    }
  3. Merge the configuration into your routing platform configuration by issuing the load merge terminal configuration mode command:
    [edit]
    user@host# load merge terminal
    [Type ^D at a new line to end input]
    > Paste the contents of the clipboard here<
    1. At the prompt, paste the contents of the clipboard using the mouse and the paste icon.
    2. Press Enter.
    3. Press Ctrl+d.
  4. Issue the commit command:
    [edit]
    user@host# commit

show protocols

When you issue the show protocols configuration mode command, the bgp_global_import import policy is not displayed because it is added as a transient change:

user@host# show protocols

bgp {
    group fish {
        neighbor 192.168.16.4 {
            import [ blue green ];
            peer-as 65401;
        }
        neighbor 192.168.16.6 {
            peer-as 65402;
        }
    }
}

show protocols | display commit-scripts

The commit script adds the import bgp_global_import statement at the [edit protocols bgp] hierarchy level and prepends the bgp_global_import policy to the 192.168.16.4 neighbor policy chain:

user@host# show protocols | display commit-scripts

bgp {
    import bgp_global_import;
    group fish {
        neighbor 192.168.16.4 {
            import [ bgp_global_import blue green ];
            peer-as 65401;
        }
        neighbor 192.168.16.6 {
            peer-as 65402;
        }
    }
}

show protocols | display commit-scripts

After you add a policy to the 192.168.16.6 neighbor, which previously had no policies applied, the bgp_global_import policy is prepended:

user@host# set protocols bgp group fish neighbor 192.168.16.6 import green


user@host# show protocols | display commit-scripts
bgp {
    import bgp_global_import;
    group fish {
        neighbor 192.168.16.4 {
            import [ bgp_global_import blue green ];
            peer-as 65401;
        }
        neighbor 192.168.16.6 {
            import [ bgp_global_import green ];
            peer-as 65402;
        }
    }
}

[Contents] [Prev] [Next] [Index] [Report an Error]