Blogs

Scripting How-To: Apply the add lag member-grouped configlet for Junos Space

By Erdem posted 08-06-2015 22:14

  

Apply the add lag member-grouped Configlet for Junos Space

 

You can apply the add lag member-grouped configlet to add interfaces to an AE interface for Junos Space.

 

To apply this configlet:

 

  1. Select one or more AE interfaces from within the “View Physical Interfaces” screen. Please note that this configlet also supports selecting multiple AE interfaces across multiple devices.
  2. To select multiple AE interfaces across multiple devices, you first need to select multiple devices in the Device Management View; then right-click and select “Device Inventory \ View Physical Interfaces”. 
  3. Apply a filter of “ae” on the physical interface name column to make it easier to select multiple AEs; this is also useful to increase the display to 100 items.

    NOTE: It is not yet possible to select multiple interfaces across multiple screens of information.

  4. Once you’ve selected multiple AEs, right-click “Apply CLI Configlet” and select the configlet “add lag member – grouped”. You will see a list of the selected AE interfaces in the “entity” column, and  the “value” column will list the ge-, xe-, and er- interfaces that are present on the associated device.
  5. Select an interface that should become a member of the associated AE and select “Next”. You should then see the appropriate configuration that can be validated (commit check), or applied (committed) to the selected device(s).

The configlet performs a few checks before creating the configuration:

 

  • Checks that the same interface hasn’t been selected multiple times for different AE interfaces on the same box.
  • Checks that the selected interface isn’t already part of an AE bundle.

NOTE: If any of the above checks fail, the configuration for that device is not generated. When selecting only a single device, a dialog box appears to state that this is the issue. When multiple devices are selected, the message appears in the configuration windows for those devices that fail the checks.

 

Code Example

 

<?xml version="1.0" encoding="UTF-8"?><cli-configlets>
<cli-configlet>
<!-- mandatory --><name>add lag member - grouped</name>
<!-- mandatory --><category>Examples</category>
<context>/device/interface-information/physical-interface[starts-with(name,&apos;ae&aposSmiley Wink]</context>
<!-- mandatory --><device-family>ACX/J/M/MX/T/TX/PTX/EX92xx</device-family>
<description>What this example doesn&apos;t perform is a check to make sure that the same interface hasn&apos;t been selected multiple times already.
</description>
<!-- mandatory --><execution-type>Grouped</execution-type>
<preview-show-parameters>true</preview-show-parameters>
<preview-show-configuration>true</preview-show-configuration>
<postview-show-parameters>true</postview-show-parameters>
<postview-show-configuration>true</postview-show-configuration>
<cli-configlet-pages><!-- At least one configlet page required -->
<cli-configlet-page>
<page-number>1</page-number>
<!-- mandatory --><cli-text>## Check to see if the same interface has been selected multiple times.
#foreach ( $intf in $interfaces.entrySet() )
#set ( $checker = $intf.value.get(0) )
#set ( $counter = 0 )
#foreach ( $intf in $interfaces.entrySet() )
#if ( $checker == $intf.value.get(0) )
#set ( $counter = $counter + 1 )
#if ( $counter == 2 )
#terminate( &apos;An interface has been selected more than once.&apos; )
#end
#end
#end
#end
interfaces {
#foreach ( $intf in $interfaces.entrySet() )
## Validated selected interface against bundled interfaces.
#if ( $bundles.contains( $intf.value.get(0) ) )
#terminate( &apos;A selected interface has been assigned to a bundle already.&apos; )
#end
    $intf.value.get(0) {
        gigether-options {
#foreach ( $INTF in $INTERFACE )
#if ( $INTF == $intf.key )
            802.3ad $INTF;
#end
#end
        }
    }
#end
}
</cli-text>
</cli-configlet-page>
</cli-configlet-pages>
<cli-configlet-params>
<cli-configlet-param>
    <!-- mandatory --><parameter>bundles</parameter>
    <!-- mandatory --><display-name>bundles</display-name>
    <!-- mandatory --><parameter-type>Invisible Field</parameter-type>
    <description/>
    <parameter-scope>Device Specific</parameter-scope>
    <configured-value-xpath>/device/configuration/interfaces/interface[gigether-options/ieee-802.3ad/bundle]/name/text()</configured-value-xpath>
    <default-value/>
    <!-- mandatory --><parameter-order>1</parameter-order>
</cli-configlet-param>
<cli-configlet-param>
    <!-- mandatory --><parameter>counter</parameter>
    <!-- mandatory --><display-name>counter</display-name>
    <!-- mandatory --><parameter-type>Invisible Field</parameter-type>
    <description/>
    <parameter-scope>Global</parameter-scope>
    <configured-value-xpath/>
    <default-value/>
    <!-- mandatory --><parameter-order>1</parameter-order>
</cli-configlet-param>
<cli-configlet-param>
    <!-- mandatory --><parameter>interfaces</parameter>
    <!-- mandatory --><display-name>interfaces</display-name>
    <!-- mandatory --><parameter-type>Selection Field</parameter-type>
    <description/>
    <parameter-scope>Entity Specific</parameter-scope>
    <configured-value-xpath/>
    <default-value/>
    <selection-values-xpath>/device/interface-information/physical-interface[starts-with(name,&apos;ge-&aposSmiley Wink or starts-    with(name,&apos;xe-&aposSmiley Wink or starts-with(name,&apos;et-&aposSmiley Wink]/name/text()</selection-values-xpath>
    <selection-values/>
    <!-- mandatory --><parameter-order>1</parameter-order>
</cli-configlet-param>
<cli-configlet-param>
    <!-- mandatory --><parameter>intf</parameter>
    <!-- mandatory --><display-name>intf</display-name>
    <!-- mandatory --><parameter-type>Invisible Field</parameter-type>
    <description/>
    <parameter-scope>Global</parameter-scope>
    <configured-value-xpath/>
    <default-value/>
    <!-- mandatory --><parameter-order>1</parameter-order>
</cli-configlet-param>
<cli-configlet-param>
    <!-- mandatory --><parameter>checker</parameter>
    <!-- mandatory --><display-name>checker</display-name>
    <!-- mandatory --><parameter-type>Invisible Field</parameter-type>
    <description/>
    <parameter-scope>Global</parameter-scope>
    <configured-value-xpath/>
    <default-value/>
    <!-- mandatory --><parameter-order>1</parameter-order>
 </cli-configlet-param>
<cli-configlet-param>
    <!-- mandatory --><parameter>INTF</parameter>
    <!-- mandatory --><display-name>INTF</display-name>
    <!-- mandatory --><parameter-type>Invisible Field</parameter-type>
    <description/>
    <parameter-scope>Global</parameter-scope>
    <configured-value-xpath/>
    <default-value/>
    <!-- mandatory --><parameter-order>1</parameter-order>
</cli-configlet-param>
</cli-configlet-params>
</cli-configlet>
</cli-configlets>

 


#JunosSpace
#ScriptingHow-To
#How-To
#configlet