Executing Script Bundles on Devices
Junos Space Network Management Platform allows you to execute script bundles on devices. When you execute script bundles, Junos Space Platform triggers the execution of op scripts on the selected devices. Commit scripts are executed on commit when events occur on the device and therefore the result of the script bundle execution for commit scripts is always shown as Success in Junos Space Platform.
To execute script bundles on devices:
- On the Junos Space Platform UI, select Images and
Scripts > Script Bundles.
The Script Bundles page appears, displaying all Junos Space Platform script bundles.
- Select the script bundles that you want to execute on devices.
- Right-click your selection or use the Actions menu, and
select Execute Script Bundle on Devices.
The Execute Script Bundle On Device(s) dialog box appears.
To restage the scripts before execution, keep the Stage & Enable Scripts before Execution check box selected (the default). If the scripts within the script bundle are previously staged and enabled in all the necessary devices and you do not want to restage these scripts, clear this check box.
- Select the devices on which you want to execute the scripts.
You can select devices by using one of the following selection modes—manually, on the basis of tags, or by using the CSV file. These options are mutually exclusive. If you select one, the others are disabled.
By default, the Select Device Manually option is selected and the list of devices on which the scripts in the script bundle are staged and enabled is displayed.
To select devices manually:
Click the Select Device Manually option and select the devices on which you want to execute the scripts in the script bundle. 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 Host Name.
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 Junos Space Platform appears, displaying two categories of tags—Public and Private.
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.
- Click the Select by Tags option.
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 execute the script bundle.
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 17.1R1 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) You can modify the script parameters before
executing script bundles on devices. The changes made to script parameters
are saved only on the devices on which the script bundle is executed.
The script parameters in the script bundle in Junos Space Platform
continue to reflect the original values.
To edit the script parameter values before execution:
On the Execute Script Bundle On Device(s) page, click the Update Script Parameters/Rule link.
The Configure Script Bundle Parameters dialog box appears.
Click set value to edit the script parameters and click Save.
You can also set success or failure criteria based on the script output. When you set criteria, the script execution is considered a success or a failure only if the specified criteria (text string) is present in the execution results. By default, no specific strings are searched in the script output and if the script is executed without any errors, then the execution is considered a success.
Click Configure. Your changes are saved and the Enable Script Bundle On Device(s) dialog box displays your previous selections.
- (Optional) To schedule a time for executing the script bundles, select the Schedule 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 bundles to be executed.
- Click Execute.
The script bundle is enabled and executed on the selected devices and a Jobs dialog box displays a job ID link. Perform one of the following actions in the Jobs dialog box:
Click the job ID link to view the status of execution on the Job Management page. If the execution of the script bundles fails, you can identify the reason for failure by double-clicking this job on the Job Management page. The Job Details page appears and displays the reason for failure in the Description column. The Job Details page supports sorting of data in all columns in ascending or descending order.
Click OK to return to the Script Bundles page.
To return to the Script Bundles page from anywhere on the Junos Space Platform UI, select Images and Scripts > Script Bundles on the left pane of the UI.