We would like to automate the configuration of a new vsys, uisng inputs from a file or script with the required information, using either the set commands or the API.
Has anyone attempted to do this, and what is the best way and how to gather the require commands etc for this.
Any suggestions would be helpful.
assuming you already have at least one vsys configured and want to re-use it's properties, you can easily do this through CLI
first you'll want to collect the current vsys's info. the easiest way to collect the info so it can be easily edited later is by setting the config output to 'set' commands
> set cli config-output-format set
this will change the show config output to a list of set commands rather than XML. next collect the current info
> configure Entering configuration mode  # show vsys vsys1
this will output all the vsys1 specific config in the form of re-usable set commands:
set vsys vsys1 import network interface [ ethernet1/1 ethernet1/2 ethernet1/3 ethernet1/9 ethernet1/10 ethernet1/4 ethernet1/7 et hernet1/8 ethernet1/5 ethernet1/6 ae1 ae2 tunnel.1 tunnel vlan loopback loopback.5 tunnel.2 loopback.20 tunnel.230 ] set vsys vsys1 import network virtual-wire [ replay vw3 ] set vsys vsys1 import network vlan set vsys vsys1 import network virtual-router vr_internet set vsys vsys1 application ....
which you can then edit to suit your needs. When you're done editing the vsys config and want to put the config into the device, make sure to temporarily enable 'scripting mode' which will allow better handling of a large copy/paste operation:
> set cli scripting-mode on > configure Entering configuration mode  #
hope this helps!
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!
The Live Community thanks you for your participation!