Use Python Script to Create New SecureCRT Sessions from Data File

Problem description

Every time I configure a network in my virtual environment I have to manually:

  • create a special folder for the project
  • create each session (copy-paste)
  • rename each session
  • setup the logon actions on session properties

Solution

On SecureCRT website, I have found a useful article named Importing SecureCRT® Sessions from a Data File. This script creates simple sessions. It also gives me the possibility to define a logon script for each session. Therefore, I will create a script that takes the session name and use it as variable to introduce my first cli commands:

root@MX% cli
root@MX> set cli logical-system SessionName
Logical system: SessionName

root@MX:SessionName> 

Next, I will take as an example the network created to Carrier-of-carriers setup created in a recent post.

Continue reading