- Community Home
- >
- Networking
- >
- IMC
- >
- Interactive script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2019 02:51 AM
12-05-2019 02:51 AM
Hello ,
I would like to know if it was possible to create interactive scripts with iMC. For example, when I run the script, it asks me the hostname, the IP address ... of the switch that I have to write.
Is it possible ?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2019 01:37 AM - last edited on 06-24-2021 07:12 AM by Ramya_Heera
12-09-2019 01:37 AM - last edited on 06-24-2021 07:12 AM by Ramya_Heera
SolutionHello,
Indeed, iMC supports interactive CLI Scripts. These will be run via Telnet/SSH on the devices of your choosing, and the commands they run can contain variables, which you would fill out during deployment of the script.
CLI Scripts can be created via Service > Configuration Center > Configuration Templates. Create a new CLI script and replace the parts of the commands where you would like to use variables with ${variable-name} such as the following example for ProCurve/ArubaOS:
configure
vlan ${vlan-id}
ip address ${vlan-ip-address}
name ${vlan-name}
exit
write memory
When you deploy the script, it will prompt you to fill out these variables, which can be filled out with separate or combined values for individual or multiple devices.
Hope that helps. Let me know if you have any further questions.
Justin
Working @ HPE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 04:29 AM
12-11-2019 04:29 AM
Re: Interactive script
Thank you for your reply.
I have another question. Is it possible to make loops (when, for, if)?
Thank you !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2019 03:16 AM - last edited on 06-29-2021 04:50 AM by Ramya_Heera
12-13-2019 03:16 AM - last edited on 06-29-2021 04:50 AM by Ramya_Heera
Re: Interactive script
Hello,
Not exactly - but you can use the feature "Response prompt" feature in the scripts to essentially expect certain output (success or error output), and have the script act differently depending on which success or error output is received.
Here is a description of response prompt from the iMC in-context help:
- The Successful Prompt means the command run successfully and continuing next command only if the device's echo information matches the prompt. The Error Prompt means the command run failed and exit when the device's echo information matches the error prompt. In the Advanced Mode, the default mode is Successful Prompt, the "!" means Error Prompt. For example, the string "dis acl number ^|^ acl" indicates a successful prompt of "acl", whereas the string "dis acl number ^|^ !acl" indicates an error prompt of "acl".
- To specify only a prompt for a line, input the prompt content and ^|^. For example [device]^|^. To specify only command for a line, input the content of the command directly.
There's also a detailed tip when creating a CLI Script:
So response prompt is essentially like creating an "if" statement. The programming equivalent of "while"/"for" shouldn't be needed, as you can simply deploy the CLI script on many devices at once, and either adjust the variables on a per-device basis or run the exact same commands on all devices.
Hope that helps.
Justin
Working @ HPE