Commit script to enable protocol for LAG members on Qfabric

On QFABRIC there is no way to enable SFLOW on LAG interfaces. Therefore, to enable it, you have to add them one by one under SFLOW protocol configuration.

This post will show you how you can write a SLAX commit script that at every commit on Qfabric, all interfaces that are part of any LAG interface will be added under SFLOW protocol configuration.

Our setup has only one LAG interface that has only one physical interface:

[edit]
 root@QFX3008# show interfaces | display set | match 802.3
 set interfaces node2:ge-0/0/10 ether-options 802.3ad RSNG:ae0
[edit]
 root@QFX3008#

To enable commit scripts, this configuration is needed. This is referencing the script that will be run on commit:

[edit]
root@QFX3008# show system scripts 
commit {
    file sflow.slax;
}

[edit]
root@QFX3008#

The commit script is located always on the Director at this location /pbdata/mgd_shared/xxx.xxx.xxx.xxx/var/db/scripts/commit/ where xxx.xxx.xxx.xxx is the VIP of the Qfabric

[edit]
root@QFX3008# run file show /pbdata/mgd_shared/xxx.xxx.xxx.xxx/var/db/scripts/commit/sflow.slax 
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
 
match configuration {
    var $top = .;
 
        for-each ($top/interfaces/interface[contains(name, "ae")]) {
            var $aeif = ./name;
 
            for-each ($top/interfaces/interface) {
                var $bundle = ./ether-options/ieee-802.3ad/bundle;
 
                if ($bundle == $aeif) {
                    var $name = ./name _ ".0";
 
                    var $change =  <protocols> {
                            <sflow> {
                              <interfaces> {
                                   <name> $name;
                                }
                            }
                        }
                     call jcs:emit-change($dot=$top, $content=$change, $message="You added the interfaces " _ $name _ " to SFLOW");
 
                }
            }
        }
}
 

[edit]
root@QFX3008#

Let’s test this:


[edit]
root@QFX3008# show protocols 

[edit]
root@QFX3008# commit 
[edit interfaces interface node2:ge-0/0/10]
  warning: You added the interfaces node2:ge-0/0/10.0 to SFLOW
commit complete

[edit]
root@QFX3008# show protocols 
sflow {
    interfaces node2:ge-0/0/10.0;
}

[edit]
root@QFX3008#

 

Disclaimer: The script was provided to me to test it, therefore I don’t have any intellectual property of it.

The following two tabs change content below.

Paris ARAU

Paris ARAU is a networking professional with strong background on routing and switching technologies. He is a holder of CCIE R&S and dual JNCIE(SP and ENT). The day to day work allows him to dive deeply in networking technologies. Part of the continuously training, he is focusing on Software Defined Network and cloud computing.

Comments

So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

Sidebar



%d bloggers like this: