Enabling Scripts on Devices
After you stage scripts on devices, you can use Junos Space Network Management Platform to enable these scripts on one or more devices simultaneously.
When you enable scripts that use Junos Space Platform, depending on the type of script, an appropriate configuration is added on the device. For example, for a file named bgp-active.slax, the configuration added to the device is as follows:
For a commit script:Example:
[edit]
user@host# set system scripts commit file bgp-active.slax
For an op script:Example:
[edit]
user@host# set system scripts op file bgp-active.slax
For an event script:Example:
[edit]
user@host# set system scripts event file bgp-active.slax
If the filename of the selected script matches that of any script present on the device, then the script on the device is enabled regardless of its contents.
To enable scripts on devices:
On the Junos Space Platform UI, select Images and Scripts > Scripts.
The Scripts page displays the scripts that you imported into Junos Space Platform.
Select one or more scripts that you want to enable on devices.
Select Enable Scripts on Devices from the Actions menu.
The Enable Scripts on Device(s) page appears.
If the selected scripts are already enabled on the devices, then instead of the Enable Scripts on Device(s) page, Junos Space displays the following message:
Device(s) having all the selected staged script(s) already have them in enabled state.
Note:This action does not list devices that are not associated with scripts. It also does not list the devices for which the script is in an enabled state already.
If you select multiple scripts, then only those devices that are associated with all the selected scripts are displayed.
Select the devices on which you want the script to be enabled, by using one of the following selection modes—manually, on the basis of tags, or by using the comma-separated values (CSV) file. These options are mutually exclusive. If you select one, the others are disabled.
Note:By default, the Select Device Manually option is selected and the list of devices that can be selected is displayed.
To select devices manually:
Click the Select Device Manually option and select the devices on which you want to enable the device script. The Select Devices status bar shows the total number of devices that you have selected; the status bar is dynamically updated as you select the devices.
To select all the devices, select the check box in the column header next to the Host Name column.
To select devices on the basis of tags:
Click the Select by Tags option. The Select by tags list is activated.
Click the arrow on the Select by Tags list. A list of tags defined on devices in the Junos Space system appears, displaying two categories of tags—Public and Private.
Note:If no tags are displayed, then it means that none of the devices is associated with any tag. You need to tag the devices on the Device Management page before you can use the Select by Tags option.
To select tags, perform one of the following actions :
Select the check boxes next to the tag names to select the desired tags and click OK.
To search for a specific tag, enter the first few letters of the tag name in the Select by Tags field to the left of the OK button. If a match is found, a suggestion is made. Select the suggested match and click OK.
As you select the tags, the total number of devices associated with the selected tags appears just above the device display table. For example, if there are six devices associated with the selected tags, then
6 items selected
is displayed.The selected tags appear next to the Tags Selected label. An [X] icon appears after each tag name. You can click the [X] icon to clear any tag from the list. The device count decrements accordingly.
The device display table displays the devices associated with the selected tags.
To select devices by using a CSV file:
Select the Select by CSV option.
Click Browse to navigate to the file location on your computer and select the CSV file containing the list of devices on which you want to enable the script.
Tip:For a sample CSV file, click the Sample CSV link. You are prompted to save the file. Save the file to your computer and open it by using an application such as Microsoft Excel.
Click Upload to upload the CSV file.
From Release 16.1R2 onward, when you upload a CSV file to select devices from, Junos Space Platform verifies the devices in the CSV file. If the CSV file contains devices to which the changes do not apply, a warning message appears which says "Few devices are not selected due to precondition failure. Please click "View inapplicable devices" for more details.” You can click the View inapplicable devices link to review the list of devices that are excluded from the update.
(Optional) To schedule a time for enabling the script, select the Schedule at a later time check box and use the calendar icon and drop-down list respectively to specify the date and time when you want the script to be enabled.
Click Enable.
The selected scripts are enabled on the devices, and the Enable Scripts Information dialog box displays a link to the job ID.
Perform one of the following actions on the Enable Scripts Information dialog box:
Click the job ID link to view the status of this task on the Job Management page.
The Job Management page appears. Double-click the job pertaining to the enabling operation. The Script Management Job Status page appears and the Description column on this page displays whether or not the script is enabled successfully on the devices and reasons for failure (if enabling of the script had failed). For more information about the error messages, see Common Error Messages in Device-Related Operations.
Click OK to return to the Scripts page.
On the Job Management page, you can export details about enabling of a script as a CSV file to your local file system:
On the left pane of the UI, select Images and Scripts > Scripts to return to the Scripts page.